]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAODPairBaseCut.cxx
Obsolete Integrated Beam Test base class. The new one is AliITSBeamTestITS04
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODPairBaseCut.cxx
1 #include "AliAODPairBaseCut.h"
2
3 #include "AliTrackPoints.h"
4 #include "AliClusterMap.h"
5
6
7 ClassImp(AliAODPairBaseCut)
8 ClassImp(AliAODQInvCut)
9 ClassImp(AliAODKtCut)
10 ClassImp(AliAODQSideLCMSCut)
11 ClassImp(AliAODQOutLCMSCut)
12 ClassImp(AliAODQLongLCMSCut)
13 ClassImp(AliAODDeltaECut)
14 ClassImp(AliAODDeltaPCut)
15 ClassImp(AliAODDeltaPvectorCut)
16 ClassImp(AliAODDeltaPhiCut)
17 ClassImp(AliAODDeltaThetaCut)
18
19 /******************************************************************/
20 ClassImp(AliAODAvSeparationCut)
21     
22 Double_t AliAODAvSeparationCut::GetValue(AliAODPair* pair) const 
23 {
24   //chacks if avarage distance of two tracks is in given range
25   AliTrackPoints* tpts1 = pair->Particle1()->GetTPCTrackPoints();
26   if ( tpts1 == 0x0)
27    {//it could be simulated pair
28 //     Warning("GetValue","Track 1 does not have Track Points. Pair NOT Passed.");
29      return -1.0;
30    }
31
32   AliTrackPoints* tpts2 = pair->Particle2()->GetTPCTrackPoints();
33   if ( tpts2 == 0x0)
34    {
35 //     Warning("GetValue","Track 2 does not have Track Points. Pair NOT Passed.");
36      return -1.0;
37    }
38    
39   return tpts1->AvarageDistance(*tpts2);
40 }
41 /******************************************************************/
42 ClassImp(AliAODSeparationCut)
43     
44 Double_t AliAODSeparationCut::GetValue(AliAODPair* pair) const 
45 {
46   //chacks if avarage distance of two tracks is in given range
47   AliTrackPoints* tpts1 = pair->Particle1()->GetTPCTrackPoints();
48   if ( tpts1 == 0x0)
49    {//it could be simulated pair
50 //     Warning("GetValue","Track 1 does not have Track Points. Pair NOT Passed.");
51      return -1.0;
52    }
53
54   AliTrackPoints* tpts2 = pair->Particle2()->GetTPCTrackPoints();
55   if ( tpts2 == 0x0)
56    {
57 //     Warning("GetValue","Track 2 does not have Track Points. Pair NOT Passed.");
58      return -1.0;
59    }
60   Float_t x1=0,y1=0,z1=0; 
61   Float_t x2=0,y2=0,z2=0;
62   
63   tpts1->PositionAt(fPoint,x1,y1,z1);
64   tpts2->PositionAt(fPoint,x2,y2,z2);
65   Double_t dx1 = x1 - x2;
66   Double_t dy1 = y1 - y2;
67   Double_t dz1 = z1 - z2;
68   Double_t d = TMath::Sqrt(dx1*dx1 + dy1*dy1 + dz1*dz1);
69   return d;
70 }
71 /******************************************************************/
72
73 ClassImp(AliAODITSSeparationCut)
74
75 Bool_t AliAODITSSeparationCut::Rejected(AliAODPair* pair) const
76 {
77  //Checks if two tracks do not cross first pixels too close to each other
78  //If two tracks use the same cluster in pixels they are given
79  //the same position what skews theta angles (both are the same)
80  //These guys create artificial correlation in non-id analyses
81  //which is positive for identical polar angles (Qlong=0) 
82  //and negative for a little bit different theta angle (Qlong=epsilon)
83  //Such tracks "attracks" each other.
84  
85   AliTrackPoints* tpts1 = pair->Particle1()->GetITSTrackPoints();
86   if ( tpts1 == 0x0)
87    {//it could be simulated pair
88      Warning("Pass","Track 1 does not have ITS Track Points. Pair NOT Passed.");
89      return kTRUE;//reject 
90    }
91
92   AliTrackPoints* tpts2 = pair->Particle2()->GetITSTrackPoints();
93   if ( tpts2 == 0x0)
94    {
95      Warning("Pass","Track 2 does not have ITS Track Points. Pair NOT Passed.");
96      return kTRUE;//reject 
97    }
98   Float_t  x1=0.0,y1=0.0,z1=0.0,x2=0.0,y2=0.0,z2=0.0;
99   tpts1->PositionAt(fLayer,x1,y1,z1);
100   tpts2->PositionAt(fLayer,x2,y2,z2);
101   
102 //  Info("Pass","rphi %f z %f",fMin,fMax);
103 //  Info("Pass","P1: %f %f %f", x1,y1,z1);
104 //  Info("Pass","P2: %f %f %f", x2,y2,z2);
105   
106   Double_t dz = TMath::Abs(z1-z2);
107   
108   //fMax encodes treshold valaue of distance in Z
109   if (dz > fMax) return kFALSE;//pair accepted
110   
111   Double_t drphi = TMath::Hypot(x1-x2,y1-y2);
112   
113   //fMin encodes treshold valaue of distance in r-phi
114   if (drphi > fMin) return kFALSE;
115   
116   return kTRUE;//they are too close, rejected
117 }
118 /******************************************************************/
119
120 ClassImp(AliAODCluterOverlapCut)
121
122 Double_t  AliAODCluterOverlapCut::GetValue(AliAODPair* pair) const
123 {
124   //Returns Cluter Overlap Factor
125   //It ranges between -0.5 (in all padrows both tracks have cluters) 
126   // and 1 (in all padrows one track has cluter and second has not)
127   // When Overlap Factor is 1 this pair of tracks in highly probable to be
128   // splitted track: one particle that is recontructed twise
129
130   AliClusterMap* cm1 = pair->Particle1()->GetClusterMap();
131   if ( cm1 == 0x0)
132    {
133      Warning("GetValue","Track 1 does not have Cluster Map. Returning -0.5.");
134      return -.5;
135    }
136
137   AliClusterMap* cm2 = pair->Particle2()->GetClusterMap();
138   if ( cm2 == 0x0)
139    {
140      Warning("GetValue","Track 2 does not have Cluster Map. Returning -0.5.");
141      return -.5;
142    }
143   return cm1->GetOverlapFactor(*cm2);
144 }
145 /******************************************************************/
146 ClassImp(AliAODOutSideSameSignCut)
147
148 Bool_t AliAODOutSideSameSignCut::Rejected(AliAODPair *p) const
149 {
150   //returns kTRUE if pair DO NOT meet cut criteria
151   
152   if ( p->GetQOutLCMS()*p->GetQSideLCMS() > 0 ) 
153    {
154      return kFALSE;//accpeted
155    }
156
157   return kTRUE ;//rejected
158 }
159 /******************************************************************/
160 ClassImp(AliAODOutSideDiffSignCut)
161
162 Bool_t AliAODOutSideDiffSignCut::Rejected(AliAODPair *p) const
163 {
164   //returns kTRUE if pair DO NOT meet cut criteria
165   
166   if ( p->GetQOutLCMS()*p->GetQSideLCMS() > 0 ) 
167    {
168      return kTRUE;//rejected
169    }
170   
171   return kFALSE;//accepted
172 }
173 /******************************************************************/
174 ClassImp( AliAODLogicalOperPairCut )
175
176 AliAODLogicalOperPairCut::AliAODLogicalOperPairCut():
177  AliAODPairBaseCut(-10e10,10e10,kHbtPairCutPropNone),
178  fFirst(new AliAODDummyBasePairCut),
179  fSecond(new AliAODDummyBasePairCut)
180 {
181  //ctor
182 }
183 /******************************************************************/
184
185 AliAODLogicalOperPairCut::AliAODLogicalOperPairCut(AliAODPairBaseCut* first, AliAODPairBaseCut* second):
186  AliAODPairBaseCut(-10e10,10e10,kHbtPairCutPropNone),
187  fFirst((first)?(AliAODPairBaseCut*)first->Clone():0x0),
188  fSecond((second)?(AliAODPairBaseCut*)second->Clone():0x0)
189 {
190   //ctor
191   //note that base cuts are copied, not just pointers assigned
192   if ( (fFirst && fSecond) == kFALSE) 
193    {
194      Fatal("AliAODLogicalOperPairCut","One of parameters is NULL!");
195    }
196 }
197 /******************************************************************/
198
199 AliAODLogicalOperPairCut::~AliAODLogicalOperPairCut()
200 {
201   //destructor
202   delete fFirst;
203   delete fSecond;
204 }
205 /******************************************************************/
206
207 Bool_t AliAODLogicalOperPairCut::AliAODDummyBasePairCut::Rejected(AliAODPair* /*pair*/)  const
208 {
209   //checks if particles passes properties defined by this cut
210   Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
211   return kFALSE;//accept
212 }
213 /******************************************************************/
214
215 void AliAODLogicalOperPairCut::Streamer(TBuffer &b)
216 {
217   // Stream all objects in the array to or from the I/O buffer.
218   UInt_t R__s, R__c;
219   if (b.IsReading()) 
220    {
221      delete fFirst;
222      delete fSecond;
223      fFirst  = 0x0;
224      fSecond = 0x0;
225
226      b.ReadVersion(&R__s, &R__c);
227      TObject::Streamer(b);
228      b >> fFirst;
229      b >> fSecond;
230      b.CheckByteCount(R__s, R__c,AliAODLogicalOperPairCut::IsA());
231    } 
232   else 
233    {
234      R__c = b.WriteVersion(AliAODLogicalOperPairCut::IsA(), kTRUE);
235      TObject::Streamer(b);
236      b << fFirst;
237      b << fSecond;
238      b.SetByteCount(R__c, kTRUE);
239   }
240 }
241
242 /******************************************************************/
243 ClassImp(AliAODOrPairCut)
244
245 Bool_t AliAODOrPairCut::Rejected(AliAODPair * p) const
246 {
247   //returns true when rejected 
248   //AND operation is a little bit misleading but is correct
249   //User wants to build logical cuts with natural (positive) logic
250   //while ALIAN use inernally reverse (returns true when rejected)
251   if (fFirst->Rejected(p) && fSecond->Rejected(p) ) return kTRUE;//rejected (both rejected, returned kTRUE)
252   return kFALSE;//accepted, at least one accepted (returned kFALSE)
253 }
254 /******************************************************************/
255
256 ClassImp(AliAODAndPairCut)
257
258 Bool_t AliAODAndPairCut::Rejected(AliAODPair * p)  const
259 {
260   //returns true when rejected 
261   //OR operation is a little bit misleading but is correct
262   //User wants to build logical cuts with natural (positive) logic
263   //while ALIAN use inernally reverse (returns true when rejected)
264   if (fFirst->Rejected(p))
265    {//first rejected - we reject
266      return kTRUE;
267    }
268   else
269    {//first accepted
270     if (fSecond->Rejected(p))
271      {//second rejected - we reject
272        return kTRUE;
273      }
274    }  
275 //  if (fFirst->Rejected(p) || fSecond->Rejected(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) )
276   
277   return kFALSE;//accepted (both accepted (returned kFALSE))
278 }
279 /******************************************************************/