40 #include "StPicoDstReader.h"
41 #include "StPicoDst.h"
42 #include "StPicoEvent.h"
43 #include "StPicoTrack.h"
44 #include "StPicoBTofHit.h"
45 #include "StPicoBTowHit.h"
46 #include "StPicoEmcTrigger.h"
47 #include "StPicoBTofPidTraits.h"
48 #include "StPicoTrackCovMatrix.h"
49 #include "StPicoFmsHit.h"
50 #include "StPicoETofHit.h"
51 #include "StPicoEpdHit.h"
54 int main(
int argc,
char* argv[]) {
56 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
57 R__LOAD_LIBRARY(libStPicoDst);
59 gSystem->Load(
"../libs/libStPicoDst.so");
62 std::cout <<
"Hi! Lets do some physics, Master!" << std::endl;
65 const char* oFileName;
73 std::cout <<
"Usage: picoAnalyzerStandalone inputFileName outputFileName.root" << std::endl;
76 std::cout <<
" inputFileName : " << fileName << std::endl;
77 std::cout <<
" outputFileName: " << oFileName << std::endl;
83 std::cout <<
"Explicit read status for some branches" << std::endl;
88 picoReader->
SetStatus(
"BTofPidTraits*", 1);
94 std::cout <<
"Status has been set" << std::endl;
96 std::cout <<
"Now I know what to read, Master!" << std::endl;
98 if( !picoReader->
chain() ) {
99 std::cout <<
"No chain has been found." << std::endl;
101 Long64_t eventsInTree = picoReader->
tree()->GetEntries();
102 std::cout <<
"eventsInTree: " << eventsInTree << std::endl;
103 Long64_t events2read = picoReader->
chain()->GetEntries();
105 std::cout <<
"Number of events to read: " << events2read
109 TFile *oFile =
new TFile(oFileName,
"recreate");
113 TH1F *hRefMult =
new TH1F(
"hRefMult",
114 "Reference multiplicity;refMult",
116 TH2F *hVtxXvsY =
new TH2F(
"hVtxXvsY",
118 200,-10.,10.,200,-10.,10.);
119 TH1F *hVtxZ =
new TH1F(
"hVtxZ",
"hVtxZ",
123 TH1F *hGlobalPtot =
new TH1F(
"hGlobalPtot",
124 "Global track momentum;p (GeV/c)",
126 TH1F *hGlobalPtotCut =
new TH1F(
"hGlobalPtotCut",
127 "Global track momentum after cut;p (GeV/c)",
129 TH1F *hPrimaryPtot =
new TH1F(
"hPrimaryPtot",
130 "Primary track momentum;p (GeV/c)",
132 TH1F *hPrimaryPtotCut =
new TH1F(
"hPrimaryPtotCut",
133 "Primary track momentum after cut;p (GeV/c)",
135 TH1F *hTransvMomentum =
new TH1F(
"hTransvMomentum",
136 "Track transverse momentum;p_{T} (GeV/c)",
138 TH2F *hGlobalPhiVsPt[2];
139 for(
int i=0; i<2; i++) {
140 hGlobalPhiVsPt[i] =
new TH2F(Form(
"hGlobalPhiVsPt_%d",i),
141 Form(
"#phi vs. p_{T} for charge: %d;p_{T} (GeV/c);#phi (rad)", (i==0) ? 1 : -1),
145 TH1F *hNSigmaPion =
new TH1F(
"hNSigmaPion",
146 "n#sigma(#pi);n#sigma(#pi)",
148 TH1F *hNSigmaElectron =
new TH1F(
"hNSigmaElectron",
149 "n#sigma(e);n#sigma(e)",
151 TH1F *hNSigmaKaon =
new TH1F(
"hNSigmaKaon",
152 "n#sigma(K);n#sigma(K)",
154 TH1F *hNSigmaProton =
new TH1F(
"hNSigmaProton",
155 "n#sigma(p);n#sigma(p)",
159 TH1F *hTofBeta =
new TH1F(
"hTofBeta",
"BTofPidTraits #beta;#beta",
163 TH1F *hBTofTrayHit =
new TH1F(
"hBTofTrayHit",
"BTof tray number with the hit",
167 TH1F *hBTowAdc =
new TH1F(
"hBTowAdc",
"Barrel tower ADC;ADC",500,0.,500);
170 TH1F *hFmsAdc =
new TH1F(
"hFmsAdc",
"ADC in FMS modules;ADC",1000, 0.,5000);
173 TH1F *hETofToT =
new TH1F(
"hETofToT",
"eTOF TOT;Time over threshold (ns)",300, 0.,150);
176 TH1F *hEpdAdc =
new TH1F(
"hEpdAdc",
"ADC in EPD;ADC",4095, 0., 4095);
180 for(Long64_t iEvent=0; iEvent<events2read; iEvent++) {
182 std::cout <<
"Working on event #[" << (iEvent+1)
183 <<
"/" << events2read <<
"]" << std::endl;
187 std::cout <<
"Something went wrong, Master! Nothing to analyze..."
198 std::cout <<
"Something went wrong, Master! Event is hiding from me..."
202 hRefMult->Fill( event->refMult() );
205 hVtxXvsY->Fill( event->primaryVertex().X(),
event->primaryVertex().Y() );
206 hVtxZ->Fill( event->primaryVertex().Z() );
211 if(nTracks != nMatrices) {
217 for(Int_t iTrk=0; iTrk<nTracks; iTrk++) {
222 if(!picoTrack)
continue;
225 hGlobalPtot->Fill( picoTrack->
gMom().Mag() );
227 hPrimaryPtot->Fill( picoTrack->
pMom().Mag() );
231 if( picoTrack->
gMom().Mag() < 0.1 ||
232 picoTrack->
gDCA(pVtx).Mag()>50. ) {
236 hGlobalPtotCut->Fill( picoTrack->
gMom().Mag() );
238 hPrimaryPtotCut->Fill( picoTrack->
pMom().Mag() );
240 if( picoTrack->
charge() > 0 ) {
241 hGlobalPhiVsPt[0]->Fill( picoTrack->
gMom().Pt(),
242 picoTrack->
gMom().Phi() );
245 hGlobalPhiVsPt[1]->Fill( picoTrack->
gMom().Pt(),
246 picoTrack->
gMom().Phi() );
253 hTransvMomentum->Fill( picoTrack->
gMom().Pt() );
261 <<
" for track # " << iTrk << std::endl;
262 std::cout <<
"Check that you turned on the branch!" << std::endl;
266 hTofBeta->Fill( trait->
btofBeta() );
278 for(Int_t iHit=0; iHit<nBTofHits; iHit++) {
280 if( !btofHit )
continue;
282 hBTofTrayHit->Fill( btofHit->
tray() );
287 for(Int_t iHit=0; iHit<nBTowHits; iHit++) {
289 if( !btowHit )
continue;
291 hBTowAdc->Fill( btowHit->
adc() );
296 for(Int_t iHit=0; iHit<nFmsHits; iHit++) {
298 if( !fmsHit )
continue;
300 hFmsAdc->Fill( fmsHit->
adc() );
305 for(Int_t iHit=0; iHit<nETofHits; iHit++) {
307 if( !etofHit )
continue;
314 for(Int_t iHit=0; iHit<nEpdHits; iHit++) {
316 if( !epdHit )
continue;
318 hEpdAdc->Fill( epdHit->
adc() );
327 std::cout <<
"I'm done with analysis. We'll have a Nobel Prize, Master!"
Bool_t isPrimary() const
Return if track is primary.
static StPicoETofHit * etofHit(Int_t i)
Return pointer to i-th etof hit.
Bool_t readPicoEvent(Long64_t iEvent)
Read next event in the chain.
static UInt_t numberOfFmsHits()
Return number of FMS hits.
Allows to read picoDst file(s)
static UInt_t numberOfBTowHits()
Return number of BTow hits.
Float_t nSigmaKaon() const
Return nSigma(kaon)
Int_t tray() const
Return tray number.
Float_t nSigmaPion() const
Return nSigma(pion)
Holds information about BEMC tower.
static StPicoBTowHit * btowHit(Int_t i)
Return pointer to i-th btow hit.
TChain * chain()
Return pointer to the chain of .picoDst.root files.
Float_t timeOverThreshold() const
Return time over threshold (ns) of eTOF hit.
StPicoDst * picoDst()
Return a pointer to picoDst (return NULL if no dst is found)
Int_t adc() const
Return ADC of the tower.
static StPicoEpdHit * epdHit(Int_t i)
Return pointer to i-th epd hit.
Holds information about FMS hit.
Float_t btofBeta() const
Return beta (compression = beta * 20000)
TVector3 gMom() const
Return momentum (GeV/c) of the global tracks at the point of DCA to the primary vertex.
static StPicoEvent * event()
Return pointer to current StPicoEvent (class holding the event wise information)
void SetStatus(const Char_t *branchNameRegex, Int_t enable)
Set enable/disable branch matching when reading picoDst.
Holds information about track parameters.
static UInt_t numberOfEpdHits()
Return number of EPD hits.
static UInt_t numberOfETofHits()
Return number of ETof hits.
static UInt_t numberOfTracks()
Return number of tracks.
Float_t nSigmaElectron() const
Return nSigma(electron)
Stores BTOF hit information.
Main class that keeps TClonesArrays with main classes.
static StPicoBTofHit * btofHit(Int_t i)
Return pointer to i-th btof hit.
TVector3 pMom() const
Return momentum (GeV/c) of the primary track. Return (0,0,0) if not primary track.
void Init()
Calls openRead()
static StPicoTrack * track(Int_t i)
Return pointer to i-th track.
TTree * tree()
Return pointer to the current TTree.
Int_t adc() const
ADC value [0,4095].
Float_t nSigmaProton() const
Return nSigma(proton)
Stores eTOF hit information.
Float_t gDCA(Float_t pVtxX, Float_t pVtxY, Float_t pVtxZ) const
Return distance in xyz direction (cm) between the (x,y,z) point and the DCA point to primary vertex...
Stores global information about the event.
Bool_t isTofTrack() const
Return if track has TOF hit.
static UInt_t numberOfTrackCovMatrices()
Return number of track covariance matrices.
void Finish()
Close files and finilize.
static StPicoFmsHit * fmsHit(Int_t i)
Return pointer to i-th fms hit.
Int_t bTofPidTraitsIndex() const
Return index to the corresponding BTOF PID trait.
static UInt_t numberOfBTofHits()
Return number of BTof hits.
TVector3 primaryVertex() const
Return primary vertex position.
Int_t adc() const
Return ADC.
static StPicoBTofPidTraits * btofPidTraits(Int_t i)
Return pointer to i-th btof pidTraits.
Short_t charge() const
Return charge of the track (encoded in nHitsFit as: nHitsFit * charge)