54 #include "StEmbeddingQAUtilities.h"
55 #include "StMessMgr.h"
56 #include "StParticleDefinition.hh"
57 #include "StParticleTable.hh"
62 StEmbeddingQAUtilities::StEmbeddingQAUtilities()
76 mCategory[0] = MC ; mCategoryName[0] =
"MC"; mCategoryTitle[0] =
"MC tracks";
77 mCategory[1] = MATCHED ; mCategoryName[1] =
"MATCHED"; mCategoryTitle[1] =
"Matched pairs" ;
78 mCategory[2] = GHOST ; mCategoryName[2] =
"GHOST"; mCategoryTitle[2] =
"Ghost pairs" ;
79 mCategory[3] = CONTAM ; mCategoryName[3] =
"CONTAM"; mCategoryTitle[3] =
"Contaminated pairs" ;
80 mCategory[4] = MATGLOB ; mCategoryName[4] =
"MATGLOB"; mCategoryTitle[4] =
"Matched global pairs" ;
81 mCategoryName[5] =
"PRIMARY"; mCategoryTitle[5] =
"Primary tracks (real)";
82 mCategoryName[6] =
"GLOBAL"; mCategoryTitle[6] =
"Global tracks (real)";
84 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[0], 0) );
85 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[1], 1) );
86 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[2], 2) );
87 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[3], 3) );
88 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[4], 4) );
89 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[5], 5) );
90 mCategoryId.insert( pair<const TString, const UInt_t>(mCategoryName[6], 6) );
97 mNHitToNPossCut = 0.51 ;
101 mRapidityCut = 10.0 ;
104 mRefMultMaxCut = 1000 ;
105 mTriggerIdCut.clear() ;
131 if (
id >= StEmbeddingQAConst::mNEmbedding ){
132 Error(
"StEmbeddingQAUtilities::getCategory",
"Unknown category id, id=%3d. Return MC",
id);
133 return mCategory[0] ;
136 return mCategory[id] ;
143 if(
id >= StEmbeddingQAConst::mNCategory ){
144 Error(
"StEmbeddingQAUtilities::getCategoryName",
"Unknown category id, id=%3d. Return MC name",
id);
145 return mCategoryName[0];
148 return mCategoryName[id] ;
155 if(
id >= StEmbeddingQAConst::mNCategory ){
156 Error(
"StEmbeddingQAUtilities::getCategoryTitle",
"Unknown category id, id=%3d. Return MC title",
id);
157 return mCategoryTitle[0] ;
160 return mCategoryTitle[id] ;
168 map<const TString, const UInt_t>::const_iterator iter = mCategoryId.find(name);
170 if( iter != mCategoryId.end() )
return iter->second ;
172 Error(
"StEmbeddingQAUtilities::getCategoryId",
"Unknown category name, name=%s. Return MC id", name.Data());
178 Bool_t StEmbeddingQAUtilities::CompareString(
const TString s0,
const TString s1,
const Bool_t isExact)
const
184 return (isExact) ? s0.CompareTo(s1)==0 : s0.CompareTo(s1, TString::kIgnoreCase)==0 ;
192 return CompareString(name, mCategoryName[0]);
200 return CompareString(name, mCategoryName[1]);
208 return CompareString(name, mCategoryName[2]);
216 return CompareString(name, mCategoryName[3]);
224 return CompareString(name, mCategoryName[4]);
232 return CompareString(name, mCategoryName[5]) ;
240 return CompareString(name, mCategoryName[6]) ;
334 return (geantid == 1) ;
343 const Int_t font = 42;
347 gStyle->SetOptStat(0);
350 gStyle->SetPalette(1);
354 gStyle->SetPadColor(10);
355 gStyle->SetCanvasColor(10);
356 gStyle->SetFrameLineWidth(2);
357 gStyle->SetPadTickX(1);
358 gStyle->SetPadTickY(1);
359 gStyle->SetPadRightMargin(0.15);
360 gStyle->SetPadLeftMargin(0.21);
361 gStyle->SetPadTopMargin(0.10);
362 gStyle->SetPadBottomMargin(0.20);
366 gStyle->SetStatColor(10);
370 gStyle->SetTextSize(0.07);
371 gStyle->SetTextFont(font);
376 gStyle->SetNdivisions(505,
"XYZ");
379 gStyle->SetLabelSize(0.07,
"XYZ");
380 gStyle->SetLabelOffset(0.011,
"XYZ");
381 gStyle->SetLabelFont(font,
"XYZ");
384 gStyle->SetTitleSize(0.085,
"XYZ");
385 gStyle->SetTitleOffset(1.05,
"X");
386 gStyle->SetTitleOffset(1.18,
"Y");
387 gStyle->SetTitleFont(font,
"XYZ");
390 gStyle->SetTitleFont(42,
"t");
393 gStyle->SetTitleH(0.07);
394 gStyle->SetTitleW(0.6);
395 gStyle->SetTitleBorderSize(0);
396 gStyle->SetTitleFillColor(10);
397 gStyle->SetTitleX(0.1);
401 gStyle->SetLegendBorderSize(0);
404 gStyle->SetOptDate(3);
405 gStyle->GetAttDate()->SetTextFont(52);
406 gStyle->GetAttDate()->SetTextColor(10);
407 gStyle->GetAttDate()->SetTextSize(0.03);
415 LOG_DEBUG <<
"setStyle() for " << h->GetName() << endm;
418 const Int_t font = 42 ;
419 h->GetXaxis()->SetTitleFont(font);
420 h->GetYaxis()->SetTitleFont(font);
421 h->GetZaxis()->SetTitleFont(font);
424 h->SetTitleSize(0.085,
"X"); h->SetTitleSize(0.085,
"Y"); h->SetTitleSize(0.085,
"Z");
425 h->SetTitleOffset(1.05,
"X");
426 h->SetTitleOffset(1.18,
"Y");
429 h->SetLabelSize(0.07,
"X"); h->SetLabelSize(0.07,
"Y"); h->SetLabelSize(0.07,
"Z");
430 h->SetLabelOffset(0.011,
"X"); h->SetLabelOffset(0.011,
"Y"); h->SetLabelOffset(0.011,
"Z");
431 h->SetLabelFont(font,
"X"); h->SetLabelFont(font,
"Y"); h->SetLabelFont(font,
"Z");
432 h->SetNdivisions(505,
"X"); h->SetNdivisions(505,
"Y"); h->SetNdivisions(505,
"Z");
443 LOG_ERROR << Form(
"StEmbeddingQAUtilities::getParticleDefinition Cannot find geantid=%d in StParticleTable", geantid) << endm;
444 LOG_ERROR <<
"StEmbeddingQAUtilities::getParticleDefinition You should check out the latest StRoot/StarClassLibrary from CVS" << endm;
448 return StParticleTable::instance()->findParticleByGeantId(geantid);
457 return StParticleTable::instance()->containsGeantId(geantid);
465 return ( geantid > 50000 ) ? geantid%50000 : geantid ;
472 Float_t StEmbeddingQAUtilities::getPtMaxCut()
const {
return mPtMaxCut ; }
475 Float_t StEmbeddingQAUtilities::getEtaCut()
const {
return mEtaCut ; }
478 Short_t StEmbeddingQAUtilities::getNHitCut()
const {
return mNHitCut ; }
481 Float_t StEmbeddingQAUtilities::getNHitToNPossCut()
const {
return mNHitToNPossCut ; }
484 Float_t StEmbeddingQAUtilities::getDcaCut()
const {
return mDcaCut ; }
487 Double_t StEmbeddingQAUtilities::getNSigmaCut()
const {
return mNSigmaCut ; }
490 Bool_t StEmbeddingQAUtilities::getBTofPid()
const {
return mBTofPid ; }
493 Float_t StEmbeddingQAUtilities::getRapidityCut()
const {
return mRapidityCut ; }
496 Int_t StEmbeddingQAUtilities::getRefMultMinCut()
const {
return mRefMultMinCut ; }
499 Int_t StEmbeddingQAUtilities::getRefMultMaxCut()
const {
return mRefMultMaxCut ; }
502 Float_t StEmbeddingQAUtilities::getZVertexCut()
const {
return mZVertexCut ; }
505 vector<UInt_t> StEmbeddingQAUtilities::getTriggerIdCut()
const {
return mTriggerIdCut ; }
511 LOG_INFO <<
"StEmbeddingQAUtilities::setPtMinCut Minimum pt cut off = " << mPtMinCut
517 Float_t StEmbeddingQAUtilities::setPtMaxCut(
const Float_t val)
520 LOG_INFO <<
"StEmbeddingQAUtilities::setPtMaxCut Maximum pt cut off = " << mPtMaxCut
522 return getPtMaxCut() ;
526 Float_t StEmbeddingQAUtilities::setEtaCut(
const Float_t val)
529 LOG_INFO <<
"StEmbeddingQAUtilities::setEtaCut eta cut = " << mEtaCut
535 Short_t StEmbeddingQAUtilities::setNHitCut(
const Short_t val)
538 LOG_INFO <<
"StEmbeddingQAUtilities::setNHitCut nHitsFit cut = " << mNHitCut
540 return getNHitCut() ;
544 Float_t StEmbeddingQAUtilities::setNHitToNPossCut(
const Float_t val)
546 mNHitToNPossCut = val ;
547 LOG_INFO <<
"StEmbeddingQAUtilities::setNHitToNPossCut Ratio of nHitsFit to nHitsPoss cut = " << mNHitToNPossCut
549 return getNHitToNPossCut() ;
553 Float_t StEmbeddingQAUtilities::setDcaCut(
const Float_t val)
556 LOG_INFO <<
"StEmbeddingQAUtilities::setDcaCut Dca cut = " << mDcaCut
562 Double_t StEmbeddingQAUtilities::setNSigmaCut(
const Double_t val)
565 LOG_INFO <<
"StEmbeddingQAUtilities::setNSigmaCut NSigma cut = " << mNSigmaCut
567 return getNSigmaCut() ;
571 Bool_t StEmbeddingQAUtilities::setBTofPid(
const Bool_t val)
574 LOG_INFO <<
"StEmbeddingQAUtilities::setBTofPid NSigma cut using BTof Pid = " << (mBTofPid?
"true":
"false")
576 return getBTofPid() ;
580 Float_t StEmbeddingQAUtilities::setRapidityCut(
const Float_t val)
583 LOG_INFO <<
"StEmbeddingQAUtilities::setRapidityCut Rapidity cut = " << mRapidityCut
585 return getRapidityCut() ;
589 Int_t StEmbeddingQAUtilities::setRefMultMinCut(
const Int_t val)
591 mRefMultMinCut = val ;
592 LOG_INFO <<
"StEmbeddingQAUtilities::setRefMultCut refMult cut >= " << mRefMultMinCut
594 return getRefMultMinCut() ;
598 Int_t StEmbeddingQAUtilities::setRefMultMaxCut(
const Int_t val)
600 mRefMultMaxCut = val ;
601 LOG_INFO <<
"StEmbeddingQAUtilities::setRefMultCut refMult cut < " << mRefMultMaxCut
603 return getRefMultMaxCut() ;
607 Float_t StEmbeddingQAUtilities::setZVertexCut(
const Float_t val)
610 LOG_INFO <<
"StEmbeddingQAUtilities::setZVertexCut z-vertex cut = " << mZVertexCut
612 return getZVertexCut() ;
616 void StEmbeddingQAUtilities::addTriggerIdCut(
const UInt_t val)
618 mTriggerIdCut.push_back(val);
619 LOG_INFO <<
"StEmbeddingQAUtilities::addTriggerIdCut add new trigger id = " << val
626 return (pt > mPtMinCut && pt < mPtMaxCut ) ;
630 Bool_t StEmbeddingQAUtilities::isEtaOk(
const Float_t eta)
const
632 return TMath::Abs(eta) < mEtaCut ;
636 Bool_t StEmbeddingQAUtilities::isNHitsFitOk(
const Float_t nHitsFit)
const
638 return nHitsFit > mNHitCut ;
641 Bool_t StEmbeddingQAUtilities::isNHitToNPossOk(
const Float_t ratio)
const
643 return ratio > mNHitToNPossCut ;
646 Bool_t StEmbeddingQAUtilities::isDcaOk(
const Float_t dca)
const
648 return ( dca > -mDcaCut && dca < mDcaCut ) ;
651 Bool_t StEmbeddingQAUtilities::isNSigmaOk(
const Float_t nsigma)
const
653 return TMath::Abs(nsigma) < mNSigmaCut ;
657 Bool_t StEmbeddingQAUtilities::isRapidityOk(
const Float_t y)
const
659 return TMath::Abs(y) < mRapidityCut ;
663 Bool_t StEmbeddingQAUtilities::isRefMultOk(
const Int_t refMult)
const
665 return ((refMult >= mRefMultMinCut) && (refMult < mRefMultMaxCut)) ;
669 Bool_t StEmbeddingQAUtilities::isZVertexOk(
const Float_t vz)
const
671 return TMath::Abs(vz) < mZVertexCut ;
675 Bool_t StEmbeddingQAUtilities::isTriggerOk(
const UInt_t trigger)
const
678 if ( mTriggerIdCut.empty() )
return kTRUE ;
680 for(UInt_t i=0; i<mTriggerIdCut.size(); i++) {
681 if ( trigger == mTriggerIdCut[i] )
return kTRUE ;
691 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm;
692 LOG_INFO <<
" StEmbeddingQAUtilities::PrintCuts()" << endm;
693 LOG_INFO <<
" Track-wise selections ==================================================" << endm;
694 LOG_INFO << Form(
" pt cut : %1.1f - %1.1f GeV/c",
getPtMinCut(), getPtMaxCut()) << endm;
695 LOG_INFO << Form(
" eta cut : |eta| < %1.1f", getEtaCut()) << endm;
696 LOG_INFO << Form(
" nHitsFit cut : nHitsfit > %2d", getNHitCut()) << endm;
697 LOG_INFO << Form(
" nHits/nHitsMax cut : ratio > %1.2f", getNHitToNPossCut()) << endm;
698 LOG_INFO << Form(
" dca cut : dca < %1.1f cm", getDcaCut()) << endm;
699 LOG_INFO << Form(
" nsigma cut : nsigma < %1.1f", getNSigmaCut()) << endm;
700 LOG_INFO << Form(
" using BTofPid : %s", getBTofPid()?
"true":
"false") << endm;
701 LOG_INFO << Form(
" rapidity cut : |y| < %1.1f", getRapidityCut()) << endm;
702 LOG_INFO <<
" Event-wise selections ==================================================" << endm;
703 LOG_INFO << Form(
" z-vertex cut : |vz| < %1.1f cm", getZVertexCut()) << endm;
704 LOG_INFO << Form(
" refMult cut : %i <= refMult < %i", getRefMultMinCut(), getRefMultMaxCut()) << endm;
705 if ( !mTriggerIdCut.empty() ) {
706 for(UInt_t i=0; i<mTriggerIdCut.size(); i++) {
707 LOG_INFO << Form(
" trigger id cut : id = %10d", mTriggerIdCut[i]) << endm;
710 LOG_INFO <<
"#----------------------------------------------------------------------------------------------------" << endm;
Bool_t isMatchedGlobal(const TString name) const
Check whether the track is Contaminated pair or not.
Bool_t isElectrons(const Int_t geantid) const
Check the input geantid is pbar.
void PrintCuts() const
Print all track selections.
Bool_t isKPlus(const Int_t geantid) const
Check the input geantid is pi-.
Bool_t isGlobal(const TString name) const
Check whether the track is primary track or not.
Bool_t isEPiKP(const Int_t geantid) const
Check the input geantid is protons.
Bool_t isGhost(const TString name) const
Check whether the track is Matched pair or not.
Bool_t isReal(const TString name) const
Check whether the track is embedding pair or not.
Bool_t isPrimary(const TString name) const
Check whether the track is Contaminated pair or not.
Bool_t isEmbedding(const TString name) const
Check whether the track is global track or not.
Float_t setPtMinCut(const Float_t val)
Set track and event selections, return new value.
Category getCategory(const UInt_t id) const
Bool_t isElectron(const Int_t geantid) const
Check whether the track is real track or not.
Bool_t isGamma(const Int_t geantid) const
Check the input geantid is e/pi/K/p.
Bool_t isPBar(const Int_t geantid) const
Check the input geantid is p.
TString getCategoryName(const UInt_t id) const
Category from category id.
void setStyle() const
Check the input geantid is gamma.
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
Bool_t isPiMinus(const Int_t geantid) const
Check the input geantid is pi+.
Bool_t isProton(const Int_t geantid) const
Check the input geantid is K-.
Int_t getGeantId(const UInt_t geantid) const
Return geant id.
Bool_t isPositron(const Int_t geantid) const
Check the input geantid is e-.
Bool_t isProtons(const Int_t geantid) const
Check the input geantid is kaons.
Float_t getPtMinCut() const
Get track and event selections.
Bool_t isGeantIdOk(const UInt_t geantid) const
Check geant id is defined in StParticleTable or not.
static StEmbeddingQAUtilities * instance()
Get instance.
Bool_t isPions(const Int_t geantid) const
Check the input geantid is electrons.
Bool_t isKMinus(const Int_t geantid) const
Check the input geantid is K+.
virtual ~StEmbeddingQAUtilities()
Destructor.
TString getCategoryTitle(const UInt_t id) const
Category name from category id.
Bool_t isKaons(const Int_t geantid) const
Check the input geantid is pions.
Bool_t isMatched(const TString name) const
Check whether the track is MC track or not.
Int_t getCategoryId(const TString name) const
Category title from category id.
Bool_t isPtOk(const Float_t pt) const
Track and event cuts.
Bool_t isMc(const TString name) const
Category id from category name.
Bool_t isPiPlus(const Int_t geantid) const
Check the input geantid is e+.