3 //_______________________________________________________________________
4 /////////////////////////////////////////////////////////////////////////
6 // class AliJetParticlesReaderKineGoodTPC
8 // Reader for Good TPC tracks
10 // loizides@ikf.uni-frankfurt.de
12 /////////////////////////////////////////////////////////////////////////
14 #include <Riostream.h>
17 #include <TParticle.h>
18 #include <TLorentzVector.h>
19 #include <AliRunLoader.h>
21 #include <AliHeader.h>
22 #include <AliGenEventHeader.h>
23 #include <AliGenPythiaEventHeader.h>
24 #include <AliGenHijingEventHeader.h>
25 #include "AliJetParticle.h"
26 #include "AliJetEventParticles.h"
27 #include "AliJetParticlesReaderKineGoodTPC.h"
29 ClassImp(AliJetParticlesReaderKineGoodTPC)
31 AliJetParticlesReaderKineGoodTPC::AliJetParticlesReaderKineGoodTPC() :
32 AliJetParticlesReader(),
33 fFileName("good_tracks_tpc"),
39 AliJetParticlesReaderKineGoodTPC::AliJetParticlesReaderKineGoodTPC(TString& fname) :
40 AliJetParticlesReader(),
47 AliJetParticlesReaderKineGoodTPC::AliJetParticlesReaderKineGoodTPC(TObjArray* dirs, const Char_t *filename):
48 AliJetParticlesReader(dirs),
55 AliJetParticlesReaderKineGoodTPC::~AliJetParticlesReaderKineGoodTPC()
58 if(fInput) delete fInput;
61 void AliJetParticlesReaderKineGoodTPC::Rewind()
63 //Rewinds to the beginning
64 if(fInput) delete fInput;
70 Int_t AliJetParticlesReaderKineGoodTPC::ReadNext()
72 //Reads good_tpc_tracks file
73 if((!fOwner) || (fEventParticles == 0))
74 fEventParticles = new AliJetEventParticles();
76 fEventParticles->Reset();
78 while(fCurrentDir < GetNumberOfDirs())
80 if(!OpenFile(fCurrentDir))
82 delete fInput; //close current session
83 fInput = 0; //assure pointer is null
88 Info("ReadNext","Reading Event %d",fCurrentDir*1000+fCurrentEvent);
91 Float_t px,py,pz,x,y,z;
93 while (*fInput>>label>>code>>px>>py>>pz>>x>>y>>z)
95 const Float_t kp2=px*px+py*py+pz*pz;
96 if(kp2<1e-3) continue;
97 const Float_t kpt=TMath::Sqrt(px*px+py*py);
98 const Float_t kp=TMath::Sqrt(kp2);
99 const Float_t keta=0.5*TMath::Log((kp+pz+1e-30)/(kp-pz+1e-30));
100 const Float_t kphi=TMath::Pi()+TMath::ATan2(-py,-px);
101 //cout << i << " " << label << " " << px << " " << py << " " << pz << endl;
102 if(IsAcceptedParticle(kpt,kphi,keta))
103 fEventParticles->AddParticle(px,py,pz,kp,i++,label,code,kpt,kphi,keta);
114 Int_t AliJetParticlesReaderKineGoodTPC::OpenFile(Int_t n)
116 if(fInput){ //change here if you want to
117 //support more than one good file per dir
121 const TString& dirname = GetDirName(n);
124 Error("OpenNextFile","Can't get directory name with index %d",n);
128 TString filename = dirname +"/"+ fFileName;
129 fInput=new ifstream(filename);
130 #if defined(__HP_aCC) || defined(__DECCXX)
131 if ( fInput->rdbuf()->is_open() == 0)
133 if ( fInput->is_open() == 0)
136 Error("OpenNextFile","Can't open session from file %s",filename.Data());