15 #include "TTreeHelper.h"
17 #include "StarRoot/TUnixTime.h"
19 #include "StMessMgr.h"
20 #include "StPicoEvent/StPicoDst.h"
21 #include "StPicoEvent/StPicoEvent.h"
22 #include "StPicoEvent/StPicoTrack.h"
23 #include "StPicoEvent/StPicoMcTrack.h"
24 #include "StPicoEvent/StPicoMcVertex.h"
25 #include "StPicoEvent/StPicoArrays.h"
26 #include "StPicoEvent/StPicoBTofPidTraits.h"
27 #include "StPicoDstMaker/StPicoDstMaker.h"
28 #include "StBTofHeader.h"
29 #include "StThreeVectorF.hh"
30 #include "StPhysicalHelixD.hh"
33 void makePicoDstQA(TString InputFileList, Int_t nFiles = 1, Int_t nEvents = 0, TString OutputFile =
"test.histo.root" );
35 void makePicoDstQA(TString InputFileList, Int_t nFiles, Int_t nEvents, TString OutputFile )
40 gROOT -> Macro(
"loadMuDst.C");
41 gSystem->Load(
"StPicoEvent");
42 gSystem->Load(
"StPicoDstMaker");
50 if ( nEvents == 0 ) nEvents = 10000000 ;
53 TFile *tags_output =
new TFile( OutputFile,
"recreate" ) ;
57 TH1F *hPhiMc =
new TH1F(
"hPhiMc",
"Phi of Mc tracks",200,-TMath::Pi(),TMath::Pi());
58 TH1F *hPtMc =
new TH1F(
"hPtMc",
"Pt of Mc tracks",200,0,5.0);
59 TH1F *hSelPtMc =
new TH1F(
"hSelPtMc",
"Pt of selected Mc tracks",38,0.2,4.0);
60 TH1F *hEtaMc =
new TH1F(
"hEtaMc",
"Eta of Mc tracks",200,-2.0,2.0);
61 TH1F *hPhi =
new TH1F(
"hPhi",
"Phi of matched RC tracks",200,-TMath::Pi(),TMath::Pi());
62 TH1F *hPt =
new TH1F(
"hPt",
"Pt of matched RC tracks",200,0,5.0);
63 TH1F *hSelPt =
new TH1F(
"hSelPt",
"Pt of selected matched RC tracks",38,0.2,4.0);
64 TH1F *hEffPt =
new TH1F(
"hEffPt",
"Efficiency in pt bins",38,0.2,4.0);
65 TH1F *hEta =
new TH1F(
"hEta",
"Eta of matched RC tracks",200,-2.0,2.0);
73 Int_t iInit = chain -> Init() ;
74 if (iInit) chain->FatalErr(iInit,
"on init");
77 Int_t istat = 0, i = 1;
78 while (i <= nEvents && istat != 2) {
79 if(i%10==0)cout << endl <<
"== Event " << i <<
" start ==" << endl;
81 istat = chain->
Make(i);
84 cout <<
"Last event processed. Status = " << istat << endl;
86 cout <<
"Error event processed. Status = " << istat << endl;
89 if(istat !=
kStOK)
continue;
96 LOG_WARN <<
" No PicoDst " << endm;
continue;
101 LOG_WARN <<
" No PicoEvent " << endm;
continue;
107 if ( fabs(mPicoEvent->
primaryVertex().Z()) > 75.0 ) continue ;
115 LOG_INFO <<
"# of MC tracks = "<< NoMuMcTracks <<
" # of MC vertices = "<< NoMuMcVertices << endm;
116 if (! NoMuMcVertices || ! NoMuMcTracks) {
117 LOG_WARN <<
"Ev. " << i <<
" has no MC information ==> skip it" << endm;
123 for(Int_t itrk=0; itrk<NoMuMcTracks; itrk++){
125 if (! mcTrack)
continue;
129 if (IdVx != 1)
continue;
131 const int Gid = mcTrack->
geantId();
135 hPtMc->Fill(mcTrack->
p().Perp());
136 hPhiMc->Fill(mcTrack->
p().Phi());
137 hEtaMc->Fill(mcTrack->
p().PseudoRapidity());
138 if(fabs(mcTrack->
p().PseudoRapidity())<0.5)hSelPtMc->Fill(mcTrack->
p().Perp());
141 LOG_WARN <<
"Gid: "<<Gid<<
" in Ev. "<<i<<endm;
148 for(Int_t i=0; i<nTracks; i++)
150 ptrack = mPicoDst->
track(i);
159 LOG_WARN <<
"Inconsistency in mcArray(1), ignored" << endm;
162 if (mcTrack->
id() != ptrack->
idTruth()) {
163 LOG_WARN <<
"Mismatched idTruth " << ptrack->
idTruth() <<
" and mcTrack Id " << mcTrack->
id()
164 <<
" this track is ignored" << endm;
167 while (idMcVx != 1) {
170 if (! idMcTrack)
break;
175 if (idMcVx != 1)
continue;
177 if(mcTrack->
geantId() != 11)
continue;
179 LOG_WARN<<
"mc track may not directly originate from PV!"<<endm;
181 if(ptrack->
qaTruth()<50.)
continue;
183 if(ptrack->
nHits()<=15)
continue;
185 if(abs(ptrack->
charge())!=1)
continue;
187 TVector3 p = ptrack->
pMom();
190 hEta->Fill(p.PseudoRapidity());
191 if(fabs(p.PseudoRapidity())<0.5)hSelPt->Fill(p.Perp());
195 hEffPt->Divide(hSelPt,hSelPtMc,1,1,
"B");
197 if (nEvents > 1) chain ->
Finish() ;
199 if(tags_output!=NULL) tags_output ->
Write() ;
200 if(tags_output!=NULL) tags_output -> Close() ;
static StPicoMcTrack * mcTrack(Int_t i)
Return pointer to i-th MC track.
Bool_t isPrimary() const
Return if track is primary.
Class that converts MuDst into PicoDst.
Holds information about Monte Carlo vertex.
Int_t geantId() const
Return particle ID defined by GEANT (accordingly to GPART)
Int_t idOfParentTrack() const
ID of the parent track.
virtual void Clear(Option_t *option="")
User defined functions.
bool isTrigger(unsigned int) const
Int_t id() const
Return MC track ID (GEANT track ID)
static StPicoEvent * event()
Return pointer to current StPicoEvent (class holding the event wise information)
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Holds information about track parameters.
static UInt_t numberOfTracks()
Return number of tracks.
Main class that keeps TClonesArrays with main classes.
StPicoDst * picoDst()
Returns null pointer if no StPicoDst.
Int_t idVtxStart() const
ID of start MC vertex.
TVector3 pMom() const
Return momentum (GeV/c) of the primary track. Return (0,0,0) if not primary track.
Holds information about Monte Carlo track parameters.
static StPicoTrack * track(Int_t i)
Return pointer to i-th track.
static StPicoMcVertex * mcVertex(Int_t i)
Return pointer to i-th MC vertex.
Int_t qaTruth() const
Qualtiy of the MC track.
TVector3 p() const
Return track three-momentum.
Stores global information about the event.
Int_t idTruth() const
Index of the corresponding MC track.
Int_t nHits() const
Return number of hits.
TVector3 primaryVertex() const
Return primary vertex position.
static UInt_t numberOfMcVertices()
Return number of MC vertices.
Short_t charge() const
Return charge of the track (encoded in nHitsFit as: nHitsFit * charge)
static UInt_t numberOfMcTracks()
Return number of MC tracks.