Base Particle Cuts moved to the separate file. Property eneum defined namespace of...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODParticleBaseCut.cxx
1 #include "AliAODParticleBaseCut.h"
2
3
4
5 #include <Riostream.h>
6
7 ClassImp(AliAODParticleBaseCut)
8 void AliAODParticleBaseCut::Print(void) const
9 {
10   // prints the information anout the base cut to stdout
11   cout<<"fMin="<<fMin <<", fMax=" <<fMax<<"    ";
12   PrintProperty();
13 }
14 /******************************************************************/
15
16 void AliAODParticleBaseCut::PrintProperty(void) const
17 {
18  //prints the property name 
19  switch (fProperty)
20   {
21    case  kAODP: 
22      cout<<"kAODP"; break;
23    case  kAODPt: 
24      cout<<"kAODPt"; break;
25    case  kAODE: 
26      cout<<"kAODE"; break;
27    case  kAODRapidity: 
28      cout<<"kAODRapidity"; break;
29    case  kAODPseudoRapidity: 
30      cout<<"kAODPseudoRapidity"; break;
31    case  kAODPx: 
32      cout<<"kAODPx"; break;
33    case  kAODPy: 
34      cout<<"kAODPy"; break;
35    case  kAODPz: 
36      cout<<"kAODPz"; break;   
37    case  kAODPhi: 
38      cout<<"kAODPhi"; break;
39    case  kAODTheta: 
40      cout<<"kAODTheta"; break;
41    case  kAODVx: 
42      cout<<"kAODVx"; break;
43    case  kAODVy: 
44      cout<<"kAODVy"; break;
45    case  kAODVz: 
46      cout<<"kAODVz"; break;
47    case  kAODPid: 
48      cout<<"kAODPid"; break;
49    case  kAODNone: 
50      cout<<"kAODNone"; break;
51    default: 
52      cout<<"Property Not Found";
53   }
54  cout<<endl;
55 }
56 ClassImp( AliAODMomentumCut )
57
58 ClassImp( AliAODPtCut )
59 ClassImp( AliAODEnergyCut )
60 ClassImp( AliAODRapidityCut )
61 ClassImp( AliAODPseudoRapidityCut )
62 ClassImp( AliAODPxCut )
63 ClassImp( AliAODPyCut )
64 ClassImp( AliAODPzCut )
65 ClassImp( AliAODPhiCut )
66 ClassImp( AliAODThetaCut )
67 ClassImp( AliAODVxCut )
68 ClassImp( AliAODVyCut )
69 ClassImp( AliAODVzCut )
70
71 ClassImp( AliAODPIDCut )
72
73 void AliAODPIDCut::Print(void) const
74 {
75   cout<<"PID "<<fPID<<" ";
76   AliAODParticleBaseCut::Print();
77 }
78
79 ClassImp( AliAODLogicalOperCut )
80
81 AliAODLogicalOperCut::AliAODLogicalOperCut():
82  AliAODParticleBaseCut(-10e10,10e10,kAODNone),
83  fFirst(new AliAODDummyBaseCut),
84  fSecond(new AliAODDummyBaseCut)
85 {
86  //ctor
87 }
88 /******************************************************************/
89
90 AliAODLogicalOperCut::AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):
91  AliAODParticleBaseCut(-10e10,10e10,kAODNone),
92  fFirst((first)?(AliAODParticleBaseCut*)first->Clone():0x0),
93  fSecond((second)?(AliAODParticleBaseCut*)second->Clone():0x0)
94 {
95   //ctor
96   if ( (fFirst && fSecond) == kFALSE) 
97    {
98      Fatal("AliAODLogicalOperCut","One of parameters is NULL!");
99    }
100 }
101 /******************************************************************/
102
103 AliAODLogicalOperCut::~AliAODLogicalOperCut()
104 {
105   //destructor
106   delete fFirst;
107   delete fSecond;
108 }
109 /******************************************************************/
110
111 Bool_t AliAODLogicalOperCut::AliAODDummyBaseCut::Rejected(AliVAODParticle* /*part*/)  const
112 {
113   //checks if particles passes properties defined by this cut
114   Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
115   return kFALSE;//accept
116 }
117 /******************************************************************/
118
119 void AliAODLogicalOperCut::Streamer(TBuffer &b)
120 {
121   // Stream all objects in the array to or from the I/O buffer.
122   UInt_t R__s, R__c;
123   if (b.IsReading()) 
124    {
125      delete fFirst;
126      delete fSecond;
127      fFirst  = 0x0;
128      fSecond = 0x0;
129
130      b.ReadVersion(&R__s, &R__c);
131      TObject::Streamer(b);
132      b >> fFirst;
133      b >> fSecond;
134      b.CheckByteCount(R__s, R__c,AliAODLogicalOperCut::IsA());
135    } 
136   else 
137    {
138      R__c = b.WriteVersion(AliAODLogicalOperCut::IsA(), kTRUE);
139      TObject::Streamer(b);
140      b << fFirst;
141      b << fSecond;
142      b.SetByteCount(R__c, kTRUE);
143   }
144 }
145
146 /******************************************************************/
147 ClassImp(AliAODOrCut)
148
149 Bool_t AliAODOrCut::Rejected(AliVAODParticle * p) const
150 {
151   //returns true when rejected 
152   //AND operation is a little bit misleading but is correct
153   //User wants to build logical cuts with natural (positive) logic
154   //while AODAN use inernally reverse (returns true when rejected)
155   if (fFirst->Rejected(p) && fSecond->Rejected(p)) return kTRUE;//rejected (both rejected, returned kTRUE)
156   return kFALSE;//accepted, at least one accepted (returned kFALSE)
157 }
158 /******************************************************************/
159
160 ClassImp(AliAODAndCut)
161
162 Bool_t AliAODAndCut::Rejected(AliVAODParticle * p)  const
163 {
164   //returns true when rejected 
165   //OR operation is a little bit misleading but is correct
166   //User wants to build logical cuts with natural (positive) logic
167   //while AODAN use inernally reverse (returns true when rejected)
168   if (fFirst->Rejected(p) || fSecond->Rejected(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) )
169   return kFALSE;//accepted (both accepted (returned kFALSE))
170 }
171 /******************************************************************/