]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAODParticleBaseCut.cxx
Was wrong file.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODParticleBaseCut.cxx
1 #include "AliAODParticleBaseCut.h"
2 //__________________________________________________________________________
3 ////////////////////////////////////////////////////////////////////////////
4 //                                                                        //
5 // class AliAODParticleBaseCut                                            //
6 //                                                                        //
7 // Set of classes for performing cuts on particle properties of           //
8 // AliAODParticleBaseCut is a base class for "base                        //
9 // particle cuts". Further, there are implemented classes that performs   //
10 // cuts on the most common particle properties like pt, pseudo rapidity,  //
11 // angles, anergy, etc.                                                   //
12 //                                                                        //
13 // There are also implemeted base cuts that perform logical operations    //
14 // on results of base particle cuts: AliAODOrCut and  AliAODAndCut.       //
15 //                                                                        //
16 // Each base cut has a property, thet allows to distinguish them.         //
17 // This functionality is used by the interface methods of Particle Cut    //
18 // that allows easy update ranges.                                        //
19 //                                                                        //
20 // more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html    //
21 // responsible: Piotr Skowronski@cern.ch                                  //
22 //                                                                        //
23 ////////////////////////////////////////////////////////////////////////////
24
25
26 #include <Riostream.h>
27
28 ClassImp(AliAODParticleBaseCut)
29   void AliAODParticleBaseCut::Print(const Option_t * /*opt*/) const
30 {
31   // prints the information anout the base cut to stdout
32   cout<<"fMin="<<fMin <<", fMax=" <<fMax<<"    ";
33   PrintProperty();
34 }
35 /******************************************************************/
36
37 void AliAODParticleBaseCut::PrintProperty(void) const
38 {
39  //prints the property name 
40  switch (fProperty)
41   {
42    case  kAODP: 
43      cout<<"kAODP"; break;
44    case  kAODPt: 
45      cout<<"kAODPt"; break;
46    case  kAODE: 
47      cout<<"kAODE"; break;
48    case  kAODRapidity: 
49      cout<<"kAODRapidity"; break;
50    case  kAODPseudoRapidity: 
51      cout<<"kAODPseudoRapidity"; break;
52    case  kAODPx: 
53      cout<<"kAODPx"; break;
54    case  kAODPy: 
55      cout<<"kAODPy"; break;
56    case  kAODPz: 
57      cout<<"kAODPz"; break;   
58    case  kAODPhi: 
59      cout<<"kAODPhi"; break;
60    case  kAODTheta: 
61      cout<<"kAODTheta"; break;
62    case  kAODVx: 
63      cout<<"kAODVx"; break;
64    case  kAODVy: 
65      cout<<"kAODVy"; break;
66    case  kAODVz: 
67      cout<<"kAODVz"; break;
68    case  kAODPid: 
69      cout<<"kAODPid"; break;
70    case  kAODNone: 
71      cout<<"kAODNone"; break;
72    default: 
73      cout<<"Property Not Found";
74   }
75  cout<<endl;
76 }
77 ClassImp( AliAODMomentumCut )
78
79 ClassImp( AliAODPtCut )
80 ClassImp( AliAODEnergyCut )
81 ClassImp( AliAODRapidityCut )
82 ClassImp( AliAODPseudoRapidityCut )
83 ClassImp( AliAODPxCut )
84 ClassImp( AliAODPyCut )
85 ClassImp( AliAODPzCut )
86 ClassImp( AliAODPhiCut )
87 ClassImp( AliAODThetaCut )
88 ClassImp( AliAODVxCut )
89 ClassImp( AliAODVyCut )
90 ClassImp( AliAODVzCut )
91
92 ClassImp( AliAODPIDCut )
93
94 void AliAODPIDCut::Print(const Option_t * /*opt*/) const
95 {
96   cout<<"PID "<<fPID<<" ";
97   AliAODParticleBaseCut::Print();
98 }
99
100 ClassImp( AliAODLogicalOperCut )
101
102 AliAODLogicalOperCut::AliAODLogicalOperCut():
103  AliAODParticleBaseCut(-10e10,10e10,kAODNone),
104  fFirst(new AliAODDummyBaseCut),
105  fSecond(new AliAODDummyBaseCut)
106 {
107  //ctor
108 }
109 /******************************************************************/
110
111 AliAODLogicalOperCut::AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):
112  AliAODParticleBaseCut(-10e10,10e10,kAODNone),
113  fFirst((first)?(AliAODParticleBaseCut*)first->Clone():0x0),
114  fSecond((second)?(AliAODParticleBaseCut*)second->Clone():0x0)
115 {
116   //ctor
117   if ( (fFirst && fSecond) == kFALSE) 
118    {
119      Fatal("AliAODLogicalOperCut","One of parameters is NULL!");
120    }
121 }
122 /******************************************************************/
123
124 AliAODLogicalOperCut::~AliAODLogicalOperCut()
125 {
126   //destructor
127   delete fFirst;
128   delete fSecond;
129 }
130 /******************************************************************/
131
132 Bool_t AliAODLogicalOperCut::AliAODDummyBaseCut::Rejected(AliVAODParticle* /*part*/)  const
133 {
134   //checks if particles passes properties defined by this cut
135   Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
136   return kFALSE;//accept
137 }
138 /******************************************************************/
139
140 void AliAODLogicalOperCut::Streamer(TBuffer &b)
141 {
142   // Stream all objects in the array to or from the I/O buffer.
143   UInt_t R__s, R__c;
144   if (b.IsReading()) 
145    {
146      delete fFirst;
147      delete fSecond;
148      fFirst  = 0x0;
149      fSecond = 0x0;
150
151      b.ReadVersion(&R__s, &R__c);
152      TObject::Streamer(b);
153      b >> fFirst;
154      b >> fSecond;
155      b.CheckByteCount(R__s, R__c,AliAODLogicalOperCut::IsA());
156    } 
157   else 
158    {
159      R__c = b.WriteVersion(AliAODLogicalOperCut::IsA(), kTRUE);
160      TObject::Streamer(b);
161      b << fFirst;
162      b << fSecond;
163      b.SetByteCount(R__c, kTRUE);
164   }
165 }
166
167 /******************************************************************/
168 ClassImp(AliAODOrCut)
169
170 Bool_t AliAODOrCut::Rejected(AliVAODParticle * p) const
171 {
172   //returns true when rejected 
173   //AND operation is a little bit misleading but is correct
174   //User wants to build logical cuts with natural (positive) logic
175   //while AODAN use inernally reverse (returns true when rejected)
176   if (fFirst->Rejected(p) && fSecond->Rejected(p)) return kTRUE;//rejected (both rejected, returned kTRUE)
177   return kFALSE;//accepted, at least one accepted (returned kFALSE)
178 }
179 /******************************************************************/
180
181 ClassImp(AliAODAndCut)
182
183 Bool_t AliAODAndCut::Rejected(AliVAODParticle * p)  const
184 {
185   //returns true when rejected 
186   //OR operation is a little bit misleading but is correct
187   //User wants to build logical cuts with natural (positive) logic
188   //while AODAN use inernally reverse (returns true when rejected)
189   if (fFirst->Rejected(p) || fSecond->Rejected(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) )
190   return kFALSE;//accepted (both accepted (returned kFALSE))
191 }
192 /******************************************************************/