88 #include "TClonesArray.h"
95 #include "TObjArray.h"
97 #include "StMessMgr.h"
98 #include "StarRoot/TH1Helper.h"
101 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
102 #include "StMuDSTMaker/COMMON/StMuEvent.h"
103 #include "StMuDSTMaker/COMMON/StMuTrack.h"
104 #include "StParticleDefinition.hh"
106 #include "StEmbeddingQA.h"
107 #include "StEmbeddingQATrack.h"
109 using namespace std ;
115 : mYear(2007), mProduction("P08ic"), mIsSimulation(kTRUE)
125 : mYear(year), mProduction(production), mIsSimulation(isSimulation)
139 void StEmbeddingQA::clear()
142 LOG_DEBUG <<
"StEmbeddingQA::clear()" << endm;
145 if ( mhRef )
delete mhRef ;
146 if ( mhRefAccepted )
delete mhRefAccepted ;
147 if ( mhVz )
delete mhVz ;
148 if ( mhVzAccepted )
delete mhVzAccepted ;
149 if ( mhVyVx )
delete mhVyVx ;
150 if ( mhVxVz )
delete mhVxVz ;
151 if ( mhVyVz )
delete mhVyVz ;
152 if ( mhdVx )
delete mhdVx ;
153 if ( mhdVy )
delete mhdVy ;
154 if ( mhdVz )
delete mhdVz ;
155 if ( mhEventId )
delete mhEventId ;
156 if ( mhRunNumber )
delete mhRunNumber ;
158 mGeantIdCollection.clear();
161 for(UInt_t ic=0; ic<StEmbeddingQAConst::mNCategory; ic++){
162 if ( mhGeantId[ic] )
delete mhGeantId[ic] ;
163 if ( mhNParticles[ic] )
delete mhNParticles[ic] ;
165 mGeantId[ic].clear();
167 mhNCommonHitVsNHit[ic].clear();
169 mhPtVsEta[ic].clear();
171 mhPtVsPhi[ic].clear();
172 mhPtVsMom[ic].clear();
173 mhdPtVsPt[ic].clear();
174 mhdInvPtVsPt[ic].clear();
175 mhMomVsEta[ic].clear();
176 mhdEdxVsMomMc[ic].clear();
177 mhdEdxVsMomMcPidCut[ic].clear();
178 mhdEdxVsMomReco[ic].clear();
179 mhdEdxVsMomRecoPidCut[ic].clear();
180 mhRecoPVsMcP[ic].clear();
181 mhNCommonHitVsNHit[ic].clear();
182 mhEtaVsPhi[ic].clear();
183 mhEtaVsVz[ic].clear();
194 LOG_INFO << Form(
" StEmbeddingQA::init() for year : %10d", mYear) << endm;
195 LOG_INFO << Form(
" StEmbeddingQA::init() for production : %10s", mProduction.Data()) << endm;
217 for(UInt_t ic=0; ic<StEmbeddingQAConst::mNCategory; ic++){
218 mhNParticles[ic] = 0 ;
227 void StEmbeddingQA::setRefMultMinCut(
const Int_t refMultMin)
233 void StEmbeddingQA::setRefMultMaxCut(
const Int_t refMultMax)
260 Bool_t StEmbeddingQA::isRefMultOk(
const StMiniMcEvent& mcevent)
const
267 Bool_t StEmbeddingQA::isZVertexOk(
const StMiniMcEvent& mcevent)
const
274 Bool_t StEmbeddingQA::isTriggerOk(
StMuEvent* event)
const
278 if( triggerId.empty() )
return kTRUE ;
281 for(UInt_t i=0; i<triggerId.size(); i++){
282 if( event->triggerIdCollection().nominal().isTrigger( triggerId[i] ) ){
283 LOG_DEBUG <<
"StEmbeddingQA::isTriggerOk Trigger found: " << triggerId[i] << endm ;
295 LOG_DEBUG <<
"StEmbeddingQA::book()" << endm;
297 TString fileName(outputFileName);
302 if( fileName.IsWhitespace() ){
303 const TString
data = (mIsSimulation) ?
"embedding" :
"real" ;
304 fileName = Form(
"qa_%s_%d_%s.root", data.Data(), mYear, mProduction.Data());
308 mOutput = TFile::Open(fileName,
"recreate");
310 LOG_INFO <<
" OPEN " << mOutput->GetName() << endm;
320 mhRef =
new TH1D(
"hRef",
"refMult", 1000, 0, 1000);
321 mhRefAccepted =
new TH1D(
"hRefAccepted",
"refMult", 1000, 0, 1000);
322 mhVz =
new TH1D(
"hVz",
"z-vertex", 400, -200, 200);
323 mhVzAccepted =
new TH1D(
"hVzAccepted",
"z-vertex with z-vertex cut", 400, -200, 200);
324 mhRef->SetXTitle(
"refMult");
325 mhRefAccepted->SetXTitle(
"refMult");
326 mhVz->SetXTitle(
"v_{z} (cm)");
327 mhVzAccepted->SetXTitle(
"v_{z} (cm)");
335 const Int_t vtxBin = 800 ;
336 const Double_t vtxMin = -2.0 ;
337 const Double_t vtxMax = 2.0 ;
338 const Double_t binSize = (vtxMax-vtxMin)/static_cast<Double_t>(vtxBin);
341 const Double_t vtxMinShift = vtxMin - binSize/2.0 ;
342 const Double_t vtxMaxShift = vtxMax - binSize/2.0 ;
344 mhVyVx =
new TH2D(
"hVyVx",
"v_{y} vs v_{x}", vtxBin, vtxMinShift, vtxMaxShift, vtxBin, vtxMinShift, vtxMaxShift);
345 mhVxVz =
new TH2D(
"hVxVz",
"v_{x} vs v_{z}", 300, -150, 150, vtxBin, vtxMinShift, vtxMaxShift);
346 mhVyVz =
new TH2D(
"hVyVz",
"v_{y} vs v_{z}", 300, -150, 150, vtxBin, vtxMinShift, vtxMaxShift);
347 mhVyVx->SetXTitle(
"v_{x} (cm)"); mhVyVx->SetYTitle(
"v_{y} (cm)");
348 mhVxVz->SetXTitle(
"v_{z} (cm)"); mhVxVz->SetYTitle(
"v_{x} (cm)");
349 mhVyVz->SetXTitle(
"v_{z} (cm)"); mhVyVz->SetYTitle(
"v_{y} (cm)");
355 mhdVx =
new TH1D(
"hdVx",
"#Delta x = v_{x} - v_{x}(MC)", vtxBin, vtxMinShift, vtxMaxShift);
356 mhdVy =
new TH1D(
"hdVy",
"#Delta y = v_{y} - v_{y}(MC)", vtxBin, vtxMinShift, vtxMaxShift);
357 mhdVz =
new TH1D(
"hdVz",
"#Delta z = v_{z} - v_{z}(MC)", vtxBin, vtxMinShift, vtxMaxShift);
358 mhdVx->SetXTitle(
"#Deltav_{x} = v_{x} - v_{x}(MC) (cm)");
359 mhdVy->SetXTitle(
"#Deltav_{y} = v_{y} - v_{y}(MC) (cm)");
360 mhdVz->SetXTitle(
"#Deltav_{z} = v_{z} - v_{z}(MC) (cm)");
366 mhEventId =
new TH1D(
"hEventId",
"Event id", 1000, 0, 1000);
367 mhRunNumber =
new TH1D(
"hRunNumber",
"Run id - (Year - 1999)#times10^{6}", 400000, 0, 400000);
368 mhEventId->SetXTitle(
"Event id");
369 mhRunNumber->SetXTitle(
"Run number");
372 TH1Helper::SetCanRebin(mhEventId);
377 for(UInt_t ic=0; ic<StEmbeddingQAConst::mNCategory; ic++){
378 mhNParticles[ic] =
new TH1D(Form(
"hNParticles_%d", ic),
379 Form(
"Number of particles per event, %s", utility->
getCategoryTitle(ic).Data()), 1000, 0, 1000);
380 mhNParticles[ic]->SetXTitle(
"# of particles / event");
382 utility->
setStyle(mhNParticles[ic]);
385 mhGeantId[ic] =
new TH1D(Form(
"hGeantId_%d", ic), Form(
"Geantid, %s", utility->
getCategoryTitle(ic).Data()), 100000, 0, 100000) ;
386 mhGeantId[ic]->SetXTitle(
"Geantid");
391 mOutput->GetList()->Sort();
392 LOG_INFO << endm << endm << endm;
403 if(!mOutput || !mOutput->IsOpen()){
404 Error(
"StEmbeddingQA::Make",
"Output file is not opened");
410 LOG_INFO <<
"------------------------------------------------------------------------------------" << endm;
411 LOG_INFO <<
" Fill embedding ..." << endm;
412 LOG_INFO <<
"------------------------------------------------------------------------------------" << endm;
413 fillEmbedding(inputFileName);
417 LOG_INFO <<
"------------------------------------------------------------------------------------" << endm;
418 LOG_INFO <<
" Fill real data ..." << endm;
419 LOG_INFO <<
"------------------------------------------------------------------------------------" << endm;
420 fillRealData(inputFileName);
427 Bool_t StEmbeddingQA::fillEmbedding(
const TString inputFileName)
432 TFile* file = TFile::Open(inputFileName);
433 if( !file || !file->IsOpen() ){
434 Error(
"StEmbeddingQA::fillEmbedding",
"can't open %s", inputFileName.Data());
439 const TString treeName(
"StMiniMcTree");
440 TTree* tree = (TTree*) file->Get(treeName);
442 Error(
"StEmbeddingQA::fillEmbedding",
"can't find %s tree", treeName.Data());
448 TBranch* b_MiniMcEvent = tree->GetBranch(
"StMiniMcEvent");
449 b_MiniMcEvent->SetAddress(&mMiniMcEvent);
464 const Long64_t nentries = tree->GetEntries();
465 LOG_INFO << Form(
" OPEN %s, # of event = %10d", inputFileName.Data(), nentries) << endm;
468 for (Int_t ievent=0; ievent<nentries;ievent++) {
469 tree->GetEntry(ievent);
471 const Float_t vx = mMiniMcEvent->vertexX() ;
472 const Float_t vy = mMiniMcEvent->vertexY() ;
473 const Float_t vz = mMiniMcEvent->vertexZ() ;
474 const Float_t vxmc = mMiniMcEvent->mcVertexX() ;
475 const Float_t vymc = mMiniMcEvent->mcVertexY() ;
476 const Float_t vzmc = mMiniMcEvent->mcVertexZ() ;
477 const Int_t nprimaries = mMiniMcEvent->nUncorrectedPrimaries();
479 mhRef->Fill(nprimaries);
485 if( !isZVertexOk(*mMiniMcEvent) ) continue ;
488 if( !isRefMultOk(*mMiniMcEvent) ) continue ;
491 mhRefAccepted->Fill(nprimaries);
492 mhVzAccepted->Fill(vz);
493 mhVyVx->Fill(vx, vy);
494 mhVxVz->Fill(vz, vx);
495 mhVyVz->Fill(vz, vy);
496 mhdVx->Fill( vx - vxmc );
497 mhdVy->Fill( vy - vymc );
498 mhdVz->Fill( vz - vzmc );
501 mhEventId->Fill( mMiniMcEvent->eventId() );
505 for(UInt_t categoryid=0; categoryid<StEmbeddingQAConst::mNEmbedding; categoryid++){
506 const Int_t nTrack = getNtrack(categoryid, *mMiniMcEvent) ;
507 mhNParticles[categoryid]->Fill(nTrack);
509 const Int_t nevents = (Int_t)mhVz->GetEntries();
510 if( nevents % 100 == 0 && nTrack > 0 ){
511 LOG_INFO << Form(
"#### accept/throw=%10d/%10d, category=%10s, ntrack=%10d",
512 (Int_t)mhVzAccepted->GetEntries(), nevents,
518 for(Int_t itrk=0; itrk<nTrack; itrk++){
519 fillEmbeddingTracks(*mMiniMcEvent, categoryid, itrk) ;
526 delete mMiniMcEvent ;
535 Bool_t StEmbeddingQA::fillRealData(
const TString inputFileName)
541 Int_t ieventAccept = 0;
542 while( !mMuDstMaker->
Make() ){
545 if(!muEvent) continue ;
552 const Int_t refMult = muEvent->
refMult() ;
553 mhRef->Fill(refMult);
557 || ( TMath::Abs(vx) < 1.0e-5 && TMath::Abs(vy) < 1.0e-5 && TMath::Abs(vz) < 1.0e-5 )
558 || ( TMath::Abs(vx) > 1000 || TMath::Abs(vy) > 1000 || TMath::Abs(vz) > 1000 )
560 if( isVertexBad ) continue ;
563 if( !isTriggerOk(muEvent) )
continue ;
565 mhRefAccepted->Fill(refMult);
567 mhVyVx->Fill(vx, vy);
572 for(UInt_t ic=0; ic<StEmbeddingQAConst::mNReal; ic++){
573 const Int_t categoryid = ic + StEmbeddingQAConst::mNEmbedding ;
575 if( ieventAccept % 100 == 0 ){
576 LOG_INFO << Form(
"%85s #### accept/throw=%10d/%10d, category=%10s",
581 const TObjArray* tracks = (ic==0)
585 TObjArrayIter trackIterator(tracks);
588 while ( ( track = (
StMuTrack*) trackIterator.Next() ) ){
589 fillRealTracks(*track, categoryid, itrk);
597 LOG_INFO <<
"End of real data" << endm;
598 LOG_INFO <<
"Total # of events = " << ievent << endm;
609 if( mMuDstMaker )
delete mMuDstMaker ;
611 LOG_INFO <<
"### Read " << inputFileList << endm;
612 mMuDstMaker =
new StMuDstMaker(0, 0,
"", inputFileList,
"MuDst", 1000);
615 LOG_INFO <<
"StEmbeddingQA::runRealData()" << endm;
616 LOG_INFO <<
"Add electrons, pions, kaons and protons for the real data QA" << endm;
617 for(UInt_t ic=0; ic<StEmbeddingQAConst::mNReal; ic++){
618 const Int_t categoryid = ic + StEmbeddingQAConst::mNEmbedding ;
620 const Int_t parentid = 0 ;
621 const Int_t parentparentid = 0 ;
622 const Int_t geantprocess = 0 ;
623 expandHistograms(categoryid, 2, parentid, parentparentid, geantprocess);
624 expandHistograms(categoryid, 3, parentid, parentparentid, geantprocess);
625 expandHistograms(categoryid, 8, parentid, parentparentid, geantprocess);
626 expandHistograms(categoryid, 9, parentid, parentparentid, geantprocess);
627 expandHistograms(categoryid, 11, parentid, parentparentid, geantprocess);
628 expandHistograms(categoryid, 12, parentid, parentparentid, geantprocess);
629 expandHistograms(categoryid, 14, parentid, parentparentid, geantprocess);
630 expandHistograms(categoryid, 15, parentid, parentparentid, geantprocess);
633 for(vector<Int_t>::iterator iter = mGeantId[categoryid].begin(); iter != mGeantId[categoryid].end(); iter++){
634 const Int_t geantid = (*iter) ;
635 LOG_DEBUG << Form(
" Input geant id = %10d, name = %10s", geantid,
640 make(inputFileList, kFALSE);
650 ifstream fEmbedding(inputFileList);
652 Error(
"StEmbeddingQA::runEmbedding",
"can't find %s", inputFileList.Data());
655 LOG_INFO <<
"### Read " << inputFileList << endm;
659 while( fEmbedding >> file ){
660 LOG_INFO <<
"#### Read file : " << file << endm;
672 LOG_INFO <<
"StEmbeddingQA::run()" << endm ;
693 LOG_INFO <<
" End of StEmbeddingQA" << endm;
694 LOG_INFO <<
" Write output " << mOutput->GetName() << endm;
695 mOutput->GetList()->Sort();
704 void StEmbeddingQA::fillEmbeddingTracks(
const StMiniMcEvent& mcevent,
const Int_t categoryid,
const Int_t itrk)
712 if(!miniTrack) return ;
715 fillHistograms(*miniTrack, categoryid);
728 const Category category(utility->
getCategory(categoryid));
730 if ( utility->
isMc(name) ){
735 if ( track->isPrimary() != 1 ){
736 LOG_DEBUG << Form(
"StEmbeddingQA::getEmbeddingQATrack",
"MC track with GeantID %3d is not a primary track", track->geantId()) << endm ;
748 LOG_DEBUG << Form(
"StEmbeddingQA::getEmbeddingQATrack",
"No geantid = %3d exists in StParticleTable", track->geantId()) << endm ;
760 LOG_DEBUG << Form(
"StEmbeddingQA::getEmbeddingQATrack",
"No geantid = %3d exists in StParticleTable", track->geantId()) << endm ;
766 const Bool_t isGeantProcessOk = ( track->mGeantProcess == 5 || (track->parentGeantId() == 1 && track->mGeantProcess == 6) );
768 if ( !isGeantProcessOk ){
769 LOG_DEBUG << Form(
"StEmbeddingQA::getEmbeddingTrack() geantprocess = %3d. Skip the track", track->mGeantProcess) << endm;
776 Warning(
"StEmbeddingQA::fillEmbeddingTracks",
"Unknown category id, id=%3d", categoryid);
784 void StEmbeddingQA::fillRealTracks(
const StMuTrack& track,
const Int_t categoryid,
const Int_t itrk)
788 for(vector<Int_t>::iterator iter = mGeantId[categoryid].begin(); iter != mGeantId[categoryid].end(); iter++){
789 const Int_t geantid = (*iter) ;
790 Bool_t btofflag = kFALSE;
791 if( (categoryid - StEmbeddingQAConst::mNEmbedding) == 0 && utility->getBTofPid() ) btofflag = kTRUE;
794 fillHistograms(miniTrack, categoryid);
799 void StEmbeddingQA::fillHistograms(
const StEmbeddingQATrack& track,
const Int_t categoryid)
808 if ( geantid < 0 ) return ;
821 const Double_t momRc = track.
getPRc() ;
830 mhGeantId[categoryid]->Fill(track.
getGeantId());
834 if(!utility->isRapidityOk(y))
return ;
842 mhdEdxVsMomMc[categoryid][idcollection]->Fill(mom, track.
getdEdxkeV());
843 mhdEdxVsMomReco[categoryid][idcollection]->Fill(momRc, track.
getdEdxkeV());
857 mhNHit[categoryid][idcollection]->Fill(pt, eta, track.
getNHit());
861 const Double_t phi = track.
getPhi() ;
869 mhdEdxVsMomMcPidCut[categoryid][idcollection]->Fill(mom, track.
getdEdxkeV());
870 mhdEdxVsMomRecoPidCut[categoryid][idcollection]->Fill(momRc, track.
getdEdxkeV());
873 mhRecoPVsMcP[categoryid][idcollection]->Fill(mom, momRc);
876 mhPtVsEta[categoryid][idcollection]->Fill(eta, pt);
877 mhPtVsY[categoryid][idcollection]->Fill(y, pt);
878 mhPtVsPhi[categoryid][idcollection]->Fill(phi, pt);
879 mhPtVsMom[categoryid][idcollection]->Fill(mom, pt);
880 mhdPtVsPt[categoryid][idcollection]->Fill(pt, track.
getPtRc()-pt);
881 mhdInvPtVsPt[categoryid][idcollection]->Fill(pt, (1.0/track.
getVectorGl().perp()-1.0/pt)*1000.);
882 mhMomVsEta[categoryid][idcollection]->Fill(eta, mom);
884 mhEtaVsPhi[categoryid][idcollection]->Fill(phi, eta);
885 mhEtaVsVz[categoryid][idcollection]->Fill(mVz, eta);
886 mhYVsVz[categoryid][idcollection]->Fill(mVz, y);
893 mhDca[categoryid][idcollection]->Fill(pt, eta, track.
getDcaGl());
896 LOG_DEBUG << Form(
" RC:(nfit, pt, eta, phi) = (%5d, %1.4f, %1.4f, %1.4f) MC:(pt, eta) = (%1.4f, %1.4f)",
902 Bool_t StEmbeddingQA::pushBackGeantId(
const Int_t categoryid,
const Int_t geantid,
const Int_t parentid,
903 const Int_t parentparentid,
const Int_t geantprocess)
910 Bool_t isOk = kFALSE ;
911 if ( mGeantId[categoryid].empty() ){
913 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm ;
914 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() mGeantId[%d] is empty", categoryid) << endm;
915 if( isContaminated ){
916 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Find a new geant id, (geant, parent, parent-parent, process) = (%4d, %4d, %4d, %4d) (%10s)",
917 geantid, parentid, parentparentid, geantprocess, utility->
getCategoryName(categoryid).Data()) << endm;
920 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Find a new geant id, geantid = %5d (%10s)",
923 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm ;
924 mGeantId[categoryid].push_back(geantid);
932 const vector<Int_t>::iterator iter = find(mGeantId[categoryid].begin(), mGeantId[categoryid].
end(), geantid) ;
934 if ( iter != mGeantId[categoryid].
end() ){
940 if( isContaminated ){
941 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Find a new geant id, (geant, parent, parent-parent, process) = (%4d, %4d, %4d, %4d) (%10s)",
942 geantid, parentid, parentparentid, geantprocess, utility->
getCategoryName(categoryid).Data()) << endm;
945 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Find a new geant id, geantid = %5d (%10s)",
948 mGeantId[categoryid].push_back(geantid);
967 const TString idcollection(getIdCollection(geantid, parentid, parentparentid));
969 if( mGeantIdCollection.empty() ){
971 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm ;
972 LOG_INFO <<
"StEmbeddingQA::pushBackGeantId() mGeantIdCollection is empty." << endm;
973 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Push back (geant, parent, parent-parent) = (%4d, %4d, %4d) (process=%4d)",
974 geantid, parentid, parentparentid, geantprocess) << endm;
975 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm ;
977 mGeantIdCollection.push_back( idcollection );
982 const vector<TString>::iterator iterIdCollection = find(mGeantIdCollection.begin(), mGeantIdCollection.end(), idcollection) ;
983 if ( iterIdCollection != mGeantIdCollection.end() ){
989 LOG_INFO << Form(
"StEmbeddingQA::pushBackGeantId() Push back (geant, parent, parent-parent) = (%4d, %4d, %4d) (process=%4d)",
990 geantid, parentid, parentparentid, geantprocess) << endm;
991 mGeantIdCollection.push_back( idcollection );
1002 void StEmbeddingQA::expandHistograms(
const Int_t categoryid,
const Int_t geantid,
const Int_t parentid,
1003 const Int_t parentparentid,
const Int_t geantprocess)
1007 if ( !pushBackGeantId(categoryid, geantid, parentid, parentparentid, geantprocess) ) return ;
1012 const Int_t ptBin = 10 * mPtMax ;
1013 const Float_t ptMin = 0.0 ;
1014 const Float_t ptMax = mPtMax ;
1015 const Int_t etaBin = 100 ;
1016 const Float_t etaMin = -2.5 ;
1017 const Float_t etaMax = 2.5 ;
1024 const TString nameSuffix = (parentid>0) ? Form(
"_%d_%d_%d_%d", categoryid, parentparentid, parentid, geantid)
1025 : Form(
"_%d_%d", categoryid, geantid);
1028 TString CategoryAndGeantId = (parentid>0) ? Form(
"%s (%s #rightarrow %s)", categoryTitle,
1032 if ( parentparentid > 0 ){
1033 CategoryAndGeantId = Form(
"%s (%s #rightarrow %s #rightarrow %s)", categoryTitle,
1040 const Bool_t isMc = utility->
isMc(categoryName);
1041 const Bool_t isEmbedding = utility->
isEmbedding(categoryName);
1043 const TString idcollection(getIdCollection(geantid, parentid, parentparentid));
1046 TString title(Form(
"N_{fit} distribution (|dcaGl|<3cm), %s", CategoryAndGeantId.Data()));
1047 if( isMc ) title = Form(
"N_{fit} distribution, %s", CategoryAndGeantId.Data());
1048 TH3* hNhit =
new TH3D(Form(
"hNHit%s", nameSuffix.Data()), title, 10, 0, 5, 10, -1.0, 1.0, 50, 0, 50) ;
1049 hNhit->SetXTitle(
"MC p_{T} (GeV/c)");
1050 hNhit->SetYTitle(
"#eta");
1051 hNhit->SetZTitle(
"N_{fit}");
1053 mhNHit[categoryid].insert( std::make_pair(idcollection, hNhit) );
1056 title = Form(
"N_{common} hit vs N_{fit} (|dcaGl|<3cm), %s", CategoryAndGeantId.Data());
1057 if( isMc ) title = Form(
"N_{common} hit vs N_{fit}, %s", CategoryAndGeantId.Data());
1058 TH3* hNCommonHitVsNHit =
new TH3D(Form(
"hNCommonHitVsNHit%s", nameSuffix.Data()), title, 10, 0, 5, 50, 0, 50, 50, 0, 50) ;
1059 hNCommonHitVsNHit->SetXTitle(
"p_{T} (GeV/c)");
1060 hNCommonHitVsNHit->SetYTitle(
"N_{fit}");
1061 hNCommonHitVsNHit->SetZTitle(
"N_{common}");
1062 utility->
setStyle(hNCommonHitVsNHit);
1063 mhNCommonHitVsNHit[categoryid].insert( std::make_pair(idcollection, hNCommonHitVsNHit) );
1066 title = Form(
"Dca vs #eta vs MC p_{T} (N_{fit}#geq10), %s", CategoryAndGeantId.Data());
1067 if( isMc ) title = Form(
"Dca vs #eta vs MC p_{T}, %s", CategoryAndGeantId.Data());
1068 else if ( isEmbedding ) title = Form(
"Dca vs #eta vs MC p_{T} (N_{fit}#geq10 & N_{common}#geq10), %s", CategoryAndGeantId.Data());
1070 TH3* hDca =
new TH3D(Form(
"hDca%s", nameSuffix.Data()), title, 10, 0, 5, 10, -1.0, 1.0, 100, 0, 3.0);
1071 hDca->SetXTitle(
"MC p_{T} (GeV/c)");
1072 hDca->SetYTitle(
"#eta");
1073 hDca->SetZTitle(
"Global dca (cm)");
1075 mhDca[categoryid].insert( std::make_pair(idcollection, hDca) );
1093 TString cut(
" (N_{fit}#geq10 & |dcaGl|<3cm)");
1094 if( isMc ) cut =
"";
1095 else if ( isEmbedding ) cut =
"(N_{fit}#geq10 & N_{common}#geq10 & |dcaGl|<3cm)";
1097 const TString titleSuffix(Form(
"%s, %s", cut.Data(), CategoryAndGeantId.Data()));
1100 TH2* hPtVsEta =
new TH2D(Form(
"hPtVsEta%s", nameSuffix.Data()), Form(
"MC p_{T} vs #eta%s", titleSuffix.Data()),
1101 etaBin, etaMin, etaMax, ptBin, ptMin, ptMax);
1102 hPtVsEta->SetXTitle(
"#eta");
1103 hPtVsEta->SetYTitle(
"MC p_{T} (GeV/c)");
1105 mhPtVsEta[categoryid].insert( std::make_pair(idcollection, hPtVsEta) );
1108 TH2* hPtVsY =
new TH2D(Form(
"hPtVsY%s", nameSuffix.Data()), Form(
"MC p_{T} vs y%s", titleSuffix.Data()),
1109 etaBin, etaMin, etaMax, ptBin, ptMin, ptMax);
1110 hPtVsY->SetXTitle(
"rapidity y");
1111 hPtVsY->SetYTitle(
"MC p_{T} (GeV/c)");
1113 mhPtVsY[categoryid].insert( std::make_pair(idcollection, hPtVsY) );
1116 TH2* hPtVsPhi =
new TH2D(Form(
"hPtVsPhi%s", nameSuffix.Data()), Form(
"MC p_{T} vs #phi%s", titleSuffix.Data()),
1117 100, -TMath::Pi(), TMath::Pi(), ptBin, ptMin, ptMax);
1118 hPtVsPhi->SetXTitle(
"#phi (rad)");
1119 hPtVsPhi->SetYTitle(
"MC p_{T} (GeV/c)");
1121 mhPtVsPhi[categoryid].insert( std::make_pair(idcollection, hPtVsPhi) );
1124 TH2* hPtVsMom =
new TH2D(Form(
"hPtVsMom%s", nameSuffix.Data()), Form(
"MC p_{T} vs momentum%s", titleSuffix.Data()),
1125 ptBin, ptMin, ptMax, ptBin, ptMin, ptMax);
1126 hPtVsMom->SetXTitle(
"momentum (GeV/c)");
1127 hPtVsMom->SetYTitle(
"MC p_{T} (GeV/c)");
1129 mhPtVsMom[categoryid].insert( std::make_pair(idcollection, hPtVsMom) );
1132 TH2* hdPtVsPt =
new TH2D(Form(
"hdPtVsPt%s", nameSuffix.Data()), Form(
"p_{T} - p_{T} (MC) vs p_{T}%s", titleSuffix.Data()),
1133 ptBin, ptMin, ptMax, 100, -5, 5);
1134 hdPtVsPt->SetXTitle(
"MC p_{T} (GeV/c)");
1135 hdPtVsPt->SetYTitle(
"reco. p_{T} - MC p_{T} (GeV/c)");
1137 mhdPtVsPt[categoryid].insert( std::make_pair(idcollection, hdPtVsPt) );
1140 TH2* hdInvPtVsPt =
new TH2D(Form(
"hdInvPtVsPt%s", nameSuffix.Data()), Form(
"1/p_{T} (Gl) - 1/p_{T} (MC) vs p_{T}%s", titleSuffix.Data()),
1141 ptBin, ptMin, ptMax, 200, -50, 50);
1142 hdInvPtVsPt->SetXTitle(
"MC p_{T} (GeV/c)");
1143 hdInvPtVsPt->SetYTitle(
"Gl 1/p_{T} - MC 1/p_{T} (c/MeV)");
1145 mhdInvPtVsPt[categoryid].insert( std::make_pair(idcollection, hdInvPtVsPt) );
1148 TH2* hMomVsEta =
new TH2D(Form(
"hMomVsEta%s", nameSuffix.Data()), Form(
"Momentum vs #eta%s", titleSuffix.Data()),
1149 etaBin, etaMin, etaMax, ptBin, ptMin, ptMax);
1150 hMomVsEta->SetXTitle(
"#eta");
1151 hMomVsEta->SetYTitle(
"momentum (GeV/c)");
1153 mhMomVsEta[categoryid].insert( std::make_pair(idcollection, hMomVsEta) );
1156 TH2* hdEdxVsMomMc =
new TH2D(Form(
"hdEdxVsMomMc%s", nameSuffix.Data()), Form(
"dE/dx vs MC p%s", titleSuffix.Data()),
1157 ptBin, ptMin, ptMax, 100, 0, 10.0);
1158 hdEdxVsMomMc->SetXTitle(
"MC p (GeV/c)");
1159 hdEdxVsMomMc->SetYTitle(
"dE/dx (keV/cm)");
1161 mhdEdxVsMomMc[categoryid].insert( std::make_pair(idcollection, hdEdxVsMomMc) );
1164 TH2* hdEdxVsMomReco =
new TH2D(Form(
"hdEdxVsMomReco%s", nameSuffix.Data()), Form(
"dE/dx vs Reconstructed p%s", titleSuffix.Data()),
1165 ptBin, ptMin, ptMax, 100, 0, 10.0);
1166 hdEdxVsMomReco->SetXTitle(
"Reconstructed p (GeV/c)");
1167 hdEdxVsMomReco->SetYTitle(
"dE/dx (keV/cm)");
1169 mhdEdxVsMomReco[categoryid].insert( std::make_pair(idcollection, hdEdxVsMomReco) );
1172 TH2* hRecoPVsMcP =
new TH2D(Form(
"hRecoPVsMcP%s", nameSuffix.Data()), Form(
"Reconstructed p vs MC p%s", titleSuffix.Data()),
1173 ptBin, ptMin, ptMax, ptBin, ptMin, ptMax);
1174 hRecoPVsMcP->SetXTitle(
"MC p (GeV/c)");
1175 hRecoPVsMcP->SetYTitle(
"Reconstructed p (GeV/c)");
1177 mhRecoPVsMcP[categoryid].insert( std::make_pair(idcollection, hRecoPVsMcP) );
1180 TH2* hEtaVsPhi =
new TH2D(Form(
"hEtaVsPhi%s", nameSuffix.Data()), Form(
"#eta vs #phi%s", titleSuffix.Data()),
1181 100, -TMath::Pi(), TMath::Pi(), etaBin, etaMin, etaMax);
1182 hEtaVsPhi->SetXTitle(
"#phi (rad)");
1183 hEtaVsPhi->SetYTitle(
"#eta");
1185 mhRecoPVsMcP[categoryid].insert( std::make_pair(idcollection, hRecoPVsMcP) );
1186 mhEtaVsPhi[categoryid].insert( std::make_pair(idcollection, hEtaVsPhi) );
1189 TH2* hEtaVsVz =
new TH2D(Form(
"hEtaVsVz%s", nameSuffix.Data()), Form(
"#eta vs v_{z}%s", titleSuffix.Data()),
1190 200, -50, 50, 200, etaMin, etaMax);
1191 hEtaVsVz->SetXTitle(
"v_{z} (cm)");
1192 hEtaVsVz->SetYTitle(
"#eta");
1194 mhEtaVsVz[categoryid].insert( std::make_pair(idcollection, hEtaVsVz) );
1197 TH2* hYVsVz =
new TH2D(Form(
"hYVsVz%s", nameSuffix.Data()), Form(
"rapidity y vs v_{z}%s", titleSuffix.Data()),
1198 200, -50, 50, 200, etaMin, etaMax);
1199 hYVsVz->SetXTitle(
"v_{z} (cm)");
1200 hYVsVz->SetYTitle(
"rapidity y");
1202 mhYVsVz[categoryid].insert( std::make_pair(idcollection, hYVsVz) );
1205 TH2* hdEdxVsMomMcPidCut =
new TH2D(Form(
"hdEdxVsMomMcPidCut%s", nameSuffix.Data()), Form(
"dE/dx vs MC p (with 2#sigma pid cut)%s", titleSuffix.Data()),
1206 ptBin, ptMin, ptMax, 100, 0, 10.0);
1207 hdEdxVsMomMcPidCut->SetXTitle(
"MC p (GeV/c)");
1208 hdEdxVsMomMcPidCut->SetYTitle(
"dE/dx (keV/cm)");
1209 utility->
setStyle(hdEdxVsMomMcPidCut);
1210 mhdEdxVsMomMcPidCut[categoryid].insert( std::make_pair(idcollection, hdEdxVsMomMcPidCut) );
1213 TH2* hdEdxVsMomRecoPidCut =
new TH2D(Form(
"hdEdxVsMomRecoPidCut%s", nameSuffix.Data()),
1214 Form(
"dE/dx vs Reconstructed p (with 2#sigma pid cut)%s", titleSuffix.Data()),
1215 ptBin, ptMin, ptMax, 100, 0, 10.0);
1216 hdEdxVsMomRecoPidCut->SetXTitle(
"Reconstructed p (GeV/c)");
1217 hdEdxVsMomRecoPidCut->SetYTitle(
"dE/dx (keV/cm)");
1218 utility->
setStyle(hdEdxVsMomRecoPidCut);
1219 mhdEdxVsMomRecoPidCut[categoryid].insert( std::make_pair(idcollection, hdEdxVsMomRecoPidCut) );
1223 Int_t StEmbeddingQA::getNtrack(
const Int_t categoryid,
const StMiniMcEvent& mcevent)
const
1225 switch ( categoryid ) {
1226 case 0:
return mcevent.nMcTrack() ;
1227 case 1:
return mcevent.nMatchedPair() ;
1228 case 2:
return mcevent.nGhostPair() ;
1229 case 3:
return mcevent.nContamPair() ;
1235 Warning(
"getNtrack",
"Unkown category id, id=%3d", categoryid);
1243 TString StEmbeddingQA::getIdCollection(
const Int_t geantid,
const Int_t parentid,
const Int_t parentparentid)
const
1245 return Form(
"%d_%d_%d", geantid, parentid, parentparentid) ;
1251 LOG_INFO << Form(
"Maximum p_T for histograms set to %f", mPtMax) << endm;
Bool_t isMatchedGlobal(const TString name) const
Check whether the track is Contaminated pair or not.
Float_t getPtMc() const
Get MC particle mass.
void PrintCuts() const
Print all track selections.
Short_t getNCommonHit() const
Get reconstructed 4-momentum (global)
static TObjArray * globalTracks()
returns pointer to the global tracks list
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
void setRapidityCut(const Float_t ycut)
Float_t getRapidityRc() const
Get reconstructed pseudorapidity (primary)
Bool_t isGhost(const TString name) const
Check whether the track is Matched pair or not.
Float_t getPtRc() const
Get reconstructed particle mass (primary)
Bool_t isReal(const TString name) const
Check whether the track is embedding pair or not.
StEmbeddingQA()
Default constructor (default argument is 2007, P08ic)
Bool_t isEmbedding(const TString name) const
Check whether the track is global track or not.
Category getCategory(const UInt_t id) const
Int_t getParentParentGeantId() const
Get number of common hits.
Bool_t run(const TString inputFileList)
Either RunRealData or RunEmbedding according to the kIsSimulation flag.
Float_t getPRc() const
Get reconstructed pz (primary)
Int_t getParentGeantId() const
Get parent geant id.
Bool_t isDcaOk() const
Nhits/NhitsPoss cut.
Float_t getPhi() const
Get reconstructed rapidity (primary)
void setPtMax(Float_t ptmax)
Set Maximum Range of pT histograms; binning = 10*ptmax.
Bool_t runRealData(const TString inputFileList)
Analyzer real data.
Top level class for the MiniMcTree, containing event-wise information and the McTrack, and all TrackPair collections.
TString getCategoryName(const UInt_t id) const
Category from category id.
void setStyle() const
Check the input geantid is gamma.
Short_t getNHit() const
Get geant process.
Bool_t isContaminated(const TString name) const
Check whether the track is Ghost pair or not.
StParticleDefinition * getParticleDefinition(const UInt_t geantid) const
runnumber = runid - (year - 2000 + 1) * 10^6
Int_t getGeantId() const
Get parent geant id.
const TString getName() const
Get track node name.
Bool_t book(const TString outputFileName="")
Initialization.
virtual ~StEmbeddingQA()
Destructor.
Bool_t runEmbedding(const TString inputFileList)
Analyzer embedding data.
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Bool_t make(const TString inputFileName, const Bool_t isSimulation=kTRUE)
Either fillEmbedding or fillRealData according to the isSimulation flag.
unsigned short refMult(int vtx_id=-1)
Reference multiplicity of charged particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
Bool_t isNHitOk() const
Rapidity cut.
Float_t getdEdxkeV() const
Get dE/dx.
Bool_t isGeantIdOk(const UInt_t geantid) const
Check geant id is defined in StParticleTable or not.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Bool_t isNHitToNPossOk() const
Nhits cut.
static StEmbeddingQAUtilities * instance()
Get instance.
Float_t getEtaMc() const
Get MC momentum.
void addTriggerIdCut(const UInt_t id)
Float_t getPMc() const
Get MC pz.
Bool_t isCommonHitOk() const
Dca cut.
Bool_t isNSigmaOk(const Int_t geantid) const
Common hit cut.
Bool_t end() const
Close output file.
StLorentzVectorD getVectorGl() const
Get reconstructed 4-momentum (primary <- return getVectorRc())
Int_t getGeantProcess() const
Get geant id.
Float_t getEtaRc() const
Get reconstructed momentum (primary)
Float_t getDcaGl() const
Get dE/dx in keV unit.
TString getCategoryTitle(const UInt_t id) const
Category name from category id.
Bool_t isPtAndEtaOk() const
Bool_t isMatched(const TString name) const
Check whether the track is MC track or not.
Float_t getRapidityMc() const
Get MC pseudorapidity.
void setZVertexCut(const Float_t vz)
Bool_t isMc(const TString name) const
Category id from category name.
Persistent MC track class.