11 void checkStRefMultCorr(
const char *inFileName =
"/star/u/gnigmat/soft/u/prithwish/data/st_physics_adc_16064082_raw_5000007.MuDst.root",
12 const char *oFileName =
"oFileForPrithwish.root") {
14 gROOT->LoadMacro(
"$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
15 loadSharedLibraries();
16 gSystem->Load(
"StPicoEvent");
17 gSystem->Load(
"StRefMultCorr");
19 std::cout <<
"Hi! Lets do some physics, Master!" << std::endl;
27 std::cout <<
"Explicit read status for some branches" << std::endl;
31 std::cout <<
"Status has been set" << std::endl;
33 std::cout <<
"Now I know what to read, Master!" << std::endl;
35 if( !picoReader->
chain() ) {
36 std::cout <<
"No chain has been found." << std::endl;
37 std::cout <<
"Terminating..." << std::endl;
40 Long64_t eventsInTree = picoReader->
tree()->GetEntries();
41 std::cout <<
"eventsInTree: " << eventsInTree << std::endl;
42 Long64_t events2read = picoReader->
chain()->GetEntries();
44 std::cout <<
"Number of events to read: " << events2read << std::endl;
48 TH1F *hRefMult =
new TH1F(
"hRefMult",
"Reference multiplicity;refMult", 500, -0.5, 499.5);
49 TH2F *hTofMatchVsRefMultBeforeCut =
new TH2F(
"hTofMatchVsRefMultBeforeCut",
";bTofMatched;refMult",
50 500, -0.5, 499.5, 500, -0.5, 499.5);
51 TH2F *hTofMatchVsRefMultAfterCut =
new TH2F(
"hTofMatchVsRefMultAfterCut",
";bTofMatched;refMult",
52 500, -0.5, 499.5, 500, -0.5, 499.5);
53 TH2F *hWeightVsRefMultCorr =
new TH2F(
"hWeightVsRefMultCorr",
";refMult;weight",
54 500, -0.5, 499.5, 125, 0.5, 3.);
55 TH1F *hRefMultCorr =
new TH1F(
"hRefMultCorr",
"Corrected reference multiplicity;refMult", 500, -0.5, 499.5);
56 TH1F *hCent16 =
new TH1F(
"hCent16",
"Centrality bins;Centrality bin", 16, -0.5, 15.5);
57 TH2F *hVtxXvsY =
new TH2F(
"hVtxXvsY",
"hVtxXvsY", 200,-10.,10.,200,-10.,10.);
58 TH1F *hVtxZ =
new TH1F(
"hVtxZ",
"hVtxZ", 210, -210., 210.);
66 Int_t loopSize = 1000;
67 Bool_t verbose = kTRUE;
70 for(Long64_t iEvent=0; iEvent<events2read; iEvent++) {
73 if ( counter >= loopSize ) {
74 std::cout <<
"Working on event #[" << (iEvent+1) <<
"/" << events2read <<
"]" << std::endl;
81 std::cout <<
"No input was provided" << std::endl;
91 std::cout <<
"No event was found" << std::endl;
95 Int_t runId =
event->
runId();
96 mRefMultCorrUtilFxt->
init(runId);
99 std::cout <<
"Checking bad run";
102 if ( mRefMultCorrUtilFxt->
isBadRun( runId ) ) {
104 std::cout <<
"\t[failed]" << std::endl;
109 std::cout <<
"\t[passed]" << std::endl;
113 std::cout <<
"Checking MB triggers";
117 if ( !event->isTrigger(680001) ) {
119 std::cout <<
"\t[failed]" << std::endl;
124 std::cout <<
"\t[passed]" << std::endl;
128 Int_t refMult =
event->fxtMult();
129 TVector3 pVtx =
event->primaryVertex();
130 Int_t nBTofMatched =
event->nBTOFMatch();
131 hTofMatchVsRefMultBeforeCut->Fill( nBTofMatched, refMult );
134 if (mRefMultCorrUtilFxt->
isPileUpEvent( refMult, nBTofMatched, pVtx.Z() ) )
continue;
136 mRefMultCorrUtilFxt->initEvent(refMult, pVtx.Z(),
event->ZDCx());
142 std::cout <<
"\tBad centrality < 0" << std::endl;
150 Double_t weight = mRefMultCorrUtilFxt->
getWeight();
153 std::cout <<
"refMult: " << refMult <<
" refMultCorr: " << refMultCorr
154 <<
" cent16: " << cent16 <<
" cent9: " << cent9
155 <<
" Total weight: " << weight <<
" trigger efficiency: "
157 <<
" z: " << pVtx.Z()
162 hRefMult->Fill( refMult );
163 hRefMultCorr->Fill( refMultCorr );
164 hCent16->Fill( cent16 );
165 hVtxXvsY->Fill( pVtx.X(), pVtx.Y() );
166 hVtxZ->Fill( pVtx.Z() );
167 hTofMatchVsRefMultAfterCut->Fill( nBTofMatched, refMult );
168 hWeightVsRefMultCorr->Fill(refMultCorr, weight);
173 TFile *oFile =
new TFile(oFileName,
"recreate");
175 hRefMultCorr->Write();
179 hTofMatchVsRefMultBeforeCut->Write();
180 hTofMatchVsRefMultAfterCut->Write();
181 hWeightVsRefMultCorr->Write();
185 std::cout <<
"Analysis was finished" << std::endl;
Bool_t readPicoEvent(Long64_t iEvent)
Read next event in the chain.
Allows to read picoDst file(s)
Int_t runId() const
Return run ID.
Int_t getCentralityBin9() const
Get 9 centrality bins (10% increment except for 0-5 and 5-10)
Double_t getShapeWeight_SubVz2Center() const
Shape reweighting of refmult: ratio of refMult in each Vz bin to that in the center (|Vz|<10cm) ...
Int_t getCentralityBin16() const
Get 16 centrality bins (5% increment, 0-5, 5-10, ..., 75-80)
TChain * chain()
Return pointer to the chain of .picoDst.root files.
StPicoDst * picoDst()
Return a pointer to picoDst (return NULL if no dst is found)
Double_t getRefMultCorr() const
Get corrected multiplicity, correction as a function of primary z-vertex.
static StPicoEvent * event()
Return pointer to current StPicoEvent (class holding the event wise information)
Double_t getWeight() const
Total weighting factor: incorporates shape and trigger efficiency weights.
void SetStatus(const Char_t *branchNameRegex, Int_t enable)
Set enable/disable branch matching when reading picoDst.
Bool_t isPileUpEvent(Double_t refmult, Double_t ntofmatch, Double_t vz=0.) const
Check if pile-up event.
Double_t triggerWeight() const
Trigger efficiency: fit of the Glauber/Data.
Main class that keeps TClonesArrays with main classes.
Bool_t isBadRun(const Int_t RunId)
Check if run is bad.
void Init()
Calls openRead()
TTree * tree()
Return pointer to the current TTree.
Stores global information about the event.
void Finish()
Close files and finilize.
void setVerbose(const Bool_t &verbose)
Print debug information.
void init(const Int_t RunId)
Initialization of centrality bins etc.