1 #include "StHiBaseAnalysis.h"
5 StHiBaseAnalysis::StHiBaseAnalysis(
const char* inDir,
const char* outRootName)
6 : mInputDir(inDir),mOutRootName(outRootName),
8 mDebug(0), mNEventAccepted(0),
20 StHiBaseAnalysis::~StHiBaseAnalysis()
25 delete mBenchmark; mBenchmark=0;
35 StHiBaseAnalysis::Init()
37 mBenchmark =
new TBenchmark();
38 mBenchmark->Start(
"timer");
42 cout <<
"n event : " << mNEvent << endl;
46 cout <<
"init more" << endl;
49 cout <<
"debug : " << mDebug << endl << endl;
55 cout <<
"\nOutput file = " << mOutRootName << endl;
56 mOutRootFile =
new TFile(mOutRootName.Data(),
"RECREATE");
58 cout <<
"Cannot open output root file " << mOutRootName << endl;
71 Int_t StHiBaseAnalysis::initMore()
80 StHiBaseAnalysis::initChain()
82 cout <<
"StHiBaseAnalysis::initChain()" << endl;
88 mHiMicroChain =
new TChain(
"StHiMicroTree");
94 mHiMicroChain->SetBranchAddress(
"StHiMicroEvent",&mHiMicroEvent);
96 IO io(mInputDir.Data(),
"hipico.root");
98 io.chain(mHiMicroChain);
104 StHiBaseAnalysis::Run()
107 cout <<
"StHiBaseAnalysis::Run()" << endl;
112 Int_t nEvent = (Int_t) mHiMicroChain->GetEntries();
114 if(mNEvent && mNEvent<nEvent) nEvent = mNEvent;
118 cout <<
"Total # of events " << nEvent << endl;
122 if(nEvent>10000) mDebug = 0;
124 Int_t display = 1000;
127 for(Int_t iEvent=0; iEvent<nEvent; iEvent++){
132 mHiMicroChain->GetEvent(iEvent);
135 if(iEvent%display==0){
136 cout <<
"--------------------- event " << iEvent
137 <<
"--------------------- " << endl;
138 cout <<
"\tprimary vertex z : " << mHiMicroEvent->VertexZ() << endl;
139 cout <<
"\tflow centrality : " << mHiMicroEvent->Centrality() << endl;
140 cout <<
"\tL0TriggerWord : " << mHiMicroEvent->L0TriggerWord() << endl;
141 if(mHiMicroEvent->L3UnbiasedTrigger())
142 cout <<
"\tL3UnbiasedTrigger Event " << endl;
143 if (mHiMicroEvent->L3RichTrigger())
144 cout <<
"\tL3RichTrigger Event " << endl;
149 fillEventHistograms();
153 if(acceptEvent(mHiMicroEvent)){
157 if(iEvent%display==0) cout <<
"\tAccepted event" << endl;
163 if(iEvent%display==0) cout <<
"\tNot Accepted " << endl;
167 cout <<
"##Cannot process event." << endl;
169 mHiMicroEvent->Clear();
176 StHiBaseAnalysis::trackLoop()
179 cout <<
"StHiBaseAnalysis::trackLoop()" << endl;
181 Int_t nTrack = mHiMicroEvent->NTrack();
184 for(Int_t i=0; i<nTrack; i++){
190 cout <<
"\ttracks : " << nTrack << endl;
196 StHiBaseAnalysis::fillEventHistograms()
204 StHiBaseAnalysis::initHistograms()
215 cout <<
"No track pointer?" << endl;
224 StHiBaseAnalysis::Finish()
226 cout <<
"###StHiBaseAnalysis::Finish" << endl;
228 cout <<
"\tall : " << mNEvent << endl;
229 cout <<
"\taccepted: " << mNEventAccepted << endl;
233 cout <<
"\tWriting " << mOutRootName << endl;
234 mOutRootFile->Write();
235 mOutRootFile->Close();
236 cout <<
"\tDone" << endl;
238 mBenchmark->Show(
"timer");
244 StHiBaseAnalysis::finishHistograms()
253 return CutRc::Accept(event);