]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/jetan2004/AliJetParticlesReaderKine.h
Changes in the ACORDE libraries to compile on Windows/Cygwin
[u/mrichter/AliRoot.git] / JETAN / jetan2004 / AliJetParticlesReaderKine.h
CommitLineData
d7c6ab14 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"
21class AliRunLoader;
22
23class 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
52inline Bool_t AliJetParticlesReaderKine::IsAcceptedParticle(TParticle *p) const
53{
301a24f1 54 Int_t pcode=TMath::Abs(p->GetPdgCode());
55
f611ea93 56#if _old_
301a24f1 57 if ((pcode==11)||(pcode==22)) {
d7c6ab14 58 if(!fEM) return kFALSE;
f611ea93 59 } else {
60 /*this is slighly misleading, needs fixing*/
301a24f1 61 if(pcode!=211 && pcode!=321 && pcode!=2212 &&
62 pcode!=111 && pcode!=311 && pcode!=2112 &&
63 pcode!=3122 && pcode!=213 && pcode!=113 &&
64 pcode!=130 &&pcode!=310) {
65 //p->Print();
66 return kFALSE;
67 }
d7c6ab14 68 TParticlePDG *pdg=p->GetPDG();
03747640 69 Int_t ch=(Int_t)pdg->Charge();
d7c6ab14 70 if((!fCharged)&&(ch)) return kFALSE;
71 if((!fNeutral)&&(!ch)) return kFALSE;
72 }
f611ea93 73#else
d0cafdba 74 if(pcode==11 && pcode!=22 && pcode <= 110) return kFALSE;
75 if(pcode==990 || pcode > 5224) return kFALSE;
76 //if(pcode!=11 && pcode!=22 && pcode!=211 && pcode!=321 &&
77 // pcode!=2212 && pcode!=111 && pcode!=211 && pcode!=2112)
78 // return kFALSE; /*keep only e-, gammas, pi, ks, p, n*/
f611ea93 79
d0cafdba 80 if(fEM && (pcode==11 || pcode==22 || pcode==111)){
f611ea93 81 // em particles are accepted
82 } else {
83 TParticlePDG *pdg=p->GetPDG();
84 Int_t ch=(Int_t)pdg->Charge();
85 if((!fCharged)&&(ch)) return kFALSE;
86 if((!fNeutral)&&(!ch)) return kFALSE;
87 }
88#endif
d7c6ab14 89
301a24f1 90 //p->Print();
f611ea93 91
92 Float_t eta=0.;
d7073a83 93 Float_t pz=p->Pz();
d7073a83 94 Float_t pabs=p->P();
95 if(pabs-TMath::Abs(pz)>1.e-8) eta=0.5*TMath::Log((pabs+pz)/(pabs-pz));
96 else return kFALSE;
97
d7c6ab14 98 if((eta<fEtaMin)||(eta>fEtaMax)) return kFALSE;
99
100 Float_t phi=p->Phi();
101 if((phi<fPhiMin)||(phi>fPhiMax)) return kFALSE;
102
103 Float_t pt=p->Pt();
104 if((pt<fPtMin)||(pt>fPtMax)) return kFALSE;
105
106 return kTRUE;
107}
108#endif