17 #define _VANILLA_ROOT_
33 #include "../StPicoDstReader.h"
34 #include "../StPicoDst.h"
35 #include "../StPicoEvent.h"
36 #include "../StPicoTrack.h"
37 #include "../StPicoBTofHit.h"
38 #include "../StPicoBTowHit.h"
39 #include "../StPicoEmcTrigger.h"
40 #include "../StPicoBTofPidTraits.h"
41 #include "../StPicoTrackCovMatrix.h"
44 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
45 R__LOAD_LIBRARY(../libStPicoDst)
53 void PicoDstAnalyzer(
const Char_t *inFile =
"../files/st_physics_12126101_raw_3040006.picoDst.root") {
55 std::cout <<
"Hi! Lets do some physics, Master!" << std::endl;
63 std::cout <<
"Explicit read status for some branches" << std::endl;
72 std::cout <<
"Status has been set" << std::endl;
74 std::cout <<
"Now I know what to read, Master!" << std::endl;
76 if( !picoReader->
chain() ) {
77 std::cout <<
"No chain has been found." << std::endl;
79 Long64_t eventsInTree = picoReader->
tree()->GetEntries();
80 std::cout <<
"eventsInTree: " << eventsInTree << std::endl;
81 Long64_t events2read = picoReader->
chain()->GetEntries();
83 std::cout <<
"Number of events to read: " << events2read
88 TH1F *hRefMult =
new TH1F(
"hRefMult",
89 "Reference multiplicity;refMult",
91 TH2F *hVtxXvsY =
new TH2F(
"hVtxXvsY",
93 200,-10.,10.,200,-10.,10.);
94 TH1F *hVtxZ =
new TH1F(
"hVtxZ",
"hVtxZ",
98 TH1F *hGlobalPtot =
new TH1F(
"hGlobalPtot",
99 "Global track momentum;p (GeV/c)",
101 TH1F *hGlobalPtotCut =
new TH1F(
"hGlobalPtotCut",
102 "Global track momentum after cut;p (GeV/c)",
104 TH1F *hPrimaryPtot =
new TH1F(
"hPrimaryPtot",
105 "Primary track momentum;p (GeV/c)",
107 TH1F *hPrimaryPtotCut =
new TH1F(
"hPrimaryPtotCut",
108 "Primary track momentum after cut;p (GeV/c)",
110 TH1F *hTransvMomentum =
new TH1F(
"hTransvMomentum",
111 "Track transverse momentum;p_{T} (GeV/c)",
113 TH2F *hGlobalPhiVsPt[2];
114 for(
int i=0; i<2; i++) {
115 hGlobalPhiVsPt[i] =
new TH2F(Form(
"hGlobalPhiVsPt_%d",i),
116 Form(
"#phi vs. p_{T} for charge: %d;p_{T} (GeV/c);#phi (rad)", (i==0) ? 1 : -1),
120 TH1F *hNSigmaPion =
new TH1F(
"hNSigmaPion",
121 "n#sigma(#pi);n#sigma(#pi)",
123 TH1F *hNSigmaElectron =
new TH1F(
"hNSigmaElectron",
124 "n#sigma(e);n#sigma(e)",
126 TH1F *hNSigmaKaon =
new TH1F(
"hNSigmaKaon",
127 "n#sigma(K);n#sigma(K)",
129 TH1F *hNSigmaProton =
new TH1F(
"hNSigmaProton",
130 "n#sigma(p);n#sigma(p)",
134 TH1F *hTofBeta =
new TH1F(
"hTofBeta",
135 "BTofPidTraits #beta;#beta",
139 TH1F *hBTofTrayHit =
new TH1F(
"hBTofTrayHit",
"BTof tray number with the hit",
144 for(Long64_t iEvent=0; iEvent<events2read; iEvent++) {
146 std::cout <<
"Working on event #[" << (iEvent+1)
147 <<
"/" << events2read <<
"]" << std::endl;
151 std::cout <<
"Something went wrong, Master! Nothing to analyze..."
162 std::cout <<
"Something went wrong, Master! Event is hiding from me..."
166 hRefMult->Fill( event->refMult() );
169 hVtxXvsY->Fill( event->primaryVertex().X(),
event->primaryVertex().Y() );
170 hVtxZ->Fill( event->primaryVertex().Z() );
175 if(nTracks != nMatrices) {
181 for(Int_t iTrk=0; iTrk<nTracks; iTrk++) {
186 if(!picoTrack)
continue;
189 hGlobalPtot->Fill( picoTrack->
gMom().Mag() );
191 hPrimaryPtot->Fill( picoTrack->
pMom().Mag() );
195 if( picoTrack->
gMom().Mag() < 0.1 ||
196 picoTrack->
gDCA(pVtx).Mag()>50. ) {
200 hGlobalPtotCut->Fill( picoTrack->
gMom().Mag() );
202 hPrimaryPtotCut->Fill( picoTrack->
pMom().Mag() );
204 if( picoTrack->
charge() > 0 ) {
205 hGlobalPhiVsPt[0]->Fill( picoTrack->
gMom().Pt(),
206 picoTrack->
gMom().Phi() );
209 hGlobalPhiVsPt[1]->Fill( picoTrack->
gMom().Pt(),
210 picoTrack->
gMom().Phi() );
217 hTransvMomentum->Fill( picoTrack->
gMom().Pt() );
225 <<
" for track # " << iTrk << std::endl;
226 std::cout <<
"Check that you turned on the branch!" << std::endl;
230 hTofBeta->Fill( trait->
btofBeta() );
240 for(Int_t iHit=0; iHit<nBTofHits; iHit++) {
243 if( !btofHit )
continue;
244 hBTofTrayHit->Fill( btofHit->
tray() );
253 std::cout <<
"I'm done with analysis. We'll have a Nobel Prize, Master!"
Bool_t isPrimary() const
Return if track is primary.
Bool_t readPicoEvent(Long64_t iEvent)
Read next event in the chain.
Allows to read picoDst file(s)
Float_t nSigmaKaon() const
Return nSigma(kaon)
Int_t tray() const
Return tray number.
Float_t nSigmaPion() const
Return nSigma(pion)
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)
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 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.
Float_t nSigmaProton() const
Return nSigma(proton)
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.
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.
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)