#include "StHiBaseAnalysis.h" #include using namespace std; //__________________ StHiBaseAnalysis::StHiBaseAnalysis(const char* inDir, const char* match, const char* outRootName) : mInputDir(inDir),mMatch(match), mOutRootName(outRootName), mNEvent(0), mNFile(0), mDebug(0), mNEventAccepted(0), mNHiPtTrack(0), mNEventCentRejected(0), mNEventTrgWordRejected(0), mNEventVtxZRejected(0) { } //__________________ StHiBaseAnalysis::~StHiBaseAnalysis() { } //__________________ // // reads in all the files in the directory // by default, looks for files ending in minimc.root // Int_t StHiBaseAnalysis::Init() { mBenchmark = new TBenchmark(); mBenchmark->Start("timer"); Int_t stat=0; cout << "n event : " << mNEvent << endl; Cut::ShowCuts(); cout << "init more" << endl; stat += initMore(); cout << "debug : " << mDebug << endl << endl; initChain(); // create the output file // cout << "\nOutput file = " << mOutRootName << endl; mOutRootFile = new TFile(mOutRootName.Data(),"RECREATE"); if(!mOutRootFile) { cout << "Cannot open output root file " << mOutRootName << endl; stat++; } // init the histograms after the Tfile // initHistograms(); return stat; } //_________________ Int_t StHiBaseAnalysis::initMore() { return 0; } //_________________ void StHiBaseAnalysis::initChain() { cout << "StHiBaseAnalysis::initChain()" << endl; // // create the chain and event // // add the files to the chain // mHiMicroChain = new TChain("StHiMicroTree"); mHiMicroEvent = new StHiMicroEvent; // // set the address where to read the event object // mHiMicroChain->SetBranchAddress("StHiMicroEvent",&mHiMicroEvent); IO io(mInputDir.Data(),mMatch.Data(),"himicro.root"); io.setNFile(mNFile); io.chain(mHiMicroChain); } //______________________ void StHiBaseAnalysis::Run() { if(mDebug) cout << "StHiBaseAnalysis::Run()" << endl; // // loop over all events // Int_t nEvent = (Int_t) mHiMicroChain->GetEntries(); if(mNEvent && mNEvent10000) mDebug = 0; Int_t display = 1000; // Int_t display = 10000; for(Int_t iEvent=0; iEventGetEvent(iEvent); if(mHiMicroEvent){ if(iEvent%display==0){ cout << "--------------------- event " << iEvent << "--------------------- " << endl; cout << "\tprimary vertex z : " << mHiMicroEvent->VertexZ() << endl; cout << "\tNUncorrectedPrimaries : " << mHiMicroEvent->NUncorrectedPrimaries() << endl; cout << "\tflow centrality : " << flowCentrality(mHiMicroEvent->NUncorrectedPrimaries()) << endl; //cout << "\tcentrality : " << mHiMicroEvent->Centrality() << endl; /* cout << "\tL0TriggerWord : " << mHiMicroEvent->L0TriggerWord() << endl; if(mHiMicroEvent->L3UnbiasedTrigger()) cout << "\tL3UnbiasedTrigger Event " << endl; if (mHiMicroEvent->L3RichTrigger()) cout << "\tL3RichTrigger Event " << endl; */ } //cout<<"==== "<L0TriggerWord()<Clear(); } } //_____________________ void StHiBaseAnalysis::trackLoop() { if(mDebug) cout << "StHiBaseAnalysis::trackLoop()" << endl; Int_t nTrack = mHiMicroEvent->NTrack(); StHiMicroTrack* track; for(Int_t i=0; itracks()->At(i); } // tracks if(mDebug) cout << "\ttracks : " << nTrack << endl; } //_____________________ void StHiBaseAnalysis::fillEventHistograms() { } //_______________________ void StHiBaseAnalysis::initHistograms() { } //_______________________ Bool_t StHiBaseAnalysis::trackOk(StHiMicroTrack* track) { if(!track) { cout << "No track pointer?" << endl; return kFALSE; } return kTRUE; } //_______________________ void StHiBaseAnalysis::Finish() { cout << "###StHiBaseAnalysis::Finish" << endl; cout << "\tall : " << mNEvent << endl; cout << "\taccepted: " << mNEventAccepted << endl; cout << "\tCentrality Rejected: " << mNEventCentRejected << endl; cout << "\tTrgWord Rejected: " << mNEventTrgWordRejected << endl; cout << "\tVtx Z Rejected: " << mNEventVtxZRejected << endl; finishHistograms(); cout << "\tWriting " << mOutRootName << endl; mOutRootFile->Write(); mOutRootFile->Close(); cout << "\tDone" << endl; mBenchmark->Show("timer"); } //______________________ void StHiBaseAnalysis::finishHistograms() { } //_______________________ Bool_t StHiBaseAnalysis::acceptEvent(StHiMicroEvent* event) { return CutRc::Accept(event); } //_____________________________________ ClassImp(StHiBaseAnalysis)