]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetParticlesReaderKine.h
ba6b06589d17c6084c6353fbcaa41a3485aafed9
[u/mrichter/AliRoot.git] / JETAN / AliJetParticlesReaderKine.h
1 #ifndef ALIJETPARTICLESREADERKINE_H
2 #define ALIJETPARTICLESREADERKINE_H
3
4 /* $Id$ */
5
6 //_______________________________________________________________________
7 /////////////////////////////////////////////////////////////////////////
8 //
9 // class AliJetParticlesReaderKine
10 //
11 // Reader for Kinematics
12 //
13 // loizides@ikf.uni-frankfurt.de
14 //
15 /////////////////////////////////////////////////////////////////////////
16
17 #include <Riostream.h>
18 #include <TString.h>
19 #include <TParticle.h>
20 #include "AliJetParticlesReader.h"
21 class AliRunLoader;
22
23 class AliJetParticlesReaderKine: public AliJetParticlesReader
24 {
25   public:
26   AliJetParticlesReaderKine();
27   AliJetParticlesReaderKine(TString&);
28   AliJetParticlesReaderKine(TObjArray*, const Char_t *filename="galice.root");
29   virtual ~AliJetParticlesReaderKine();
30
31   void Rewind();
32   void SetNeutral(Bool_t b){fNeutral=b;}
33   void SetCharged(Bool_t b){fCharged=b;}
34   void SetEM(Bool_t b){fEM=b;}
35   void SetUseTracks(Bool_t b){fUseTracks=b;}
36
37   protected:
38   Int_t  ReadNext();
39   Int_t  OpenFile(Int_t n);
40   Bool_t IsAcceptedParticle(TParticle *p) const;
41    
42   TString       fFileName;  //file name of galice 
43   AliRunLoader* fRunLoader; //!pointer to loader
44
45   Bool_t  fNeutral; //neutral cut
46   Bool_t  fCharged; //charged cut
47   Bool_t  fEM;      //em (e+,e-,gamma) cut
48   Bool_t  fUseTracks; // use ntracks instead of nprimaries
49   ClassDef(AliJetParticlesReaderKine,1)
50 };
51
52 inline Bool_t AliJetParticlesReaderKine::IsAcceptedParticle(TParticle *p) const
53 {
54   Int_t pcode=p->GetPdgCode();  
55   if ((pcode==11)||(pcode==-11)||(pcode==22)) {
56     if(!fEM) return kFALSE;
57   }  else {
58     TParticlePDG *pdg=p->GetPDG();
59     Int_t ch=(Int_t)pdg->Charge(); 
60     if((!fCharged)&&(ch)) return kFALSE;
61     if((!fNeutral)&&(!ch)) return kFALSE;
62   }
63
64   Float_t eta=p->Eta();
65   if((eta<fEtaMin)||(eta>fEtaMax)) return kFALSE;
66
67   Float_t phi=p->Phi();
68   if((phi<fPhiMin)||(phi>fPhiMax)) return kFALSE;
69
70   Float_t pt=p->Pt();
71   if((pt<fPtMin)||(pt>fPtMax)) return kFALSE;
72
73   return kTRUE;
74 }
75 #endif