]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnValueDaughter.cxx
Merge remote-tracking branch 'origin/master' into mergingFlat
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnValueDaughter.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 ////////////////////////////////////////////////////////////////////////////////
17 //
18 //  This class contains all code which is used to compute any of the values
19 //  which can be of interest within a resonance analysis. Besides the obvious
20 //  invariant mass, it allows to compute other utility values on all possible
21 //  targets, in order to allow a wide spectrum of binning and checks.
22 //  When needed, this object can also define a binning in the variable which
23 //  it is required to compute, which is used for initializing axes of output
24 //  histograms (see AliRsnFunction).
25 //  The value computation requires this object to be passed the object whose
26 //  informations will be used. This object can be of any allowed input type
27 //  (track, Daughter, event), then this class must inherit from AliRsnTarget.
28 //  Then, when value computation is attempted, a check on target type is done
29 //  and computation is successful only if expected target matches that of the
30 //  passed object.
31 //  In some cases, the value computation can require a support external object,
32 //  which must then be passed to this class. It can be of any type inheriting
33 //  from TObject.
34 //
35 //  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
36 //           M. Vala (martin.vala@cern.ch)
37 //
38 ////////////////////////////////////////////////////////////////////////////////
39
40 #include <Riostream.h>
41 #include "AliVVertex.h"
42 #include "AliMultiplicity.h"
43 #include "AliESDtrackCuts.h"
44 #include "AliESDpid.h"
45 #include "AliAODPid.h"
46 #include "AliCentrality.h"
47 #include "AliESDUtils.h"
48 #include "AliPIDResponse.h"
49
50 #include "AliRsnEvent.h"
51 #include "AliRsnDaughter.h"
52 #include "AliRsnMother.h"
53 #include "AliRsnDaughterDef.h"
54 #include "AliRsnDaughterDef.h"
55
56 #include "AliRsnValueDaughter.h"
57
58 ClassImp(AliRsnValueDaughter)
59
60 //_____________________________________________________________________________
61 AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) :
62    AliRsnValue(name, AliRsnTarget::kDaughter),
63    fType(type)
64 {
65 //
66 // Constructor
67 //
68 }
69
70 //_____________________________________________________________________________
71 AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter &copy) :
72    AliRsnValue(copy),
73    fType(copy.fType)
74 {
75 //
76 // Copy constructor
77 //
78 }
79
80 //_____________________________________________________________________________
81 AliRsnValueDaughter &AliRsnValueDaughter::operator=(const AliRsnValueDaughter &copy)
82 {
83 //
84 // Assignment operator.
85 // Works like copy constructor.
86 //
87
88    AliRsnValue::operator=(copy);
89    if (this == &copy)
90       return *this;
91    fType = copy.fType;
92
93    return (*this);
94 }
95
96 //_____________________________________________________________________________
97 const char *AliRsnValueDaughter::GetTypeName() const
98 {
99 //
100 // This method returns a string to give a name to each possible
101 // computation value.
102 //
103
104    switch (fType) {
105       case kP:                         return "SingleTrackPtot";
106       case kPt:                        return "SingleTrackPt";
107       case kPtpc:                      return "SingleTrackPtpc";
108       case kEta:                       return "SingleTrackEta";
109       case kY:                         return "SingleTrackY";
110       case kMass:                      return "SingleTrackMass";
111       case kITSsignal:                 return "SingleTrackITSsignal";
112       case kTPCsignal:                  return "SingleTrackTPCsignal";
113       case kTOFsignal:                  return "SingleTrackTOFsignal";
114       case kTPCnsigmaPi:                return "SingleTrackTPCnsigmaPion";
115       case kTPCnsigmaK:                 return "SingleTrackTPCnsigmaKaon";
116       case kTPCnsigmaP:                 return "SingleTrackTPCnsigmaProton";
117       case kTOFnsigmaPi:                return "SingleTrackTOFnsigmaPion";
118       case kTOFnsigmaK:                 return "SingleTrackTOFnsigmaKaon";
119       case kTOFnsigmaP:                 return "SingleTrackTOFnsigmaProton";
120       case kTOFdeltaPi:                 return "SingleTrackTOFdeltaPion";
121       case kTOFdeltaK:                  return "SingleTrackTOFdeltaKaon";
122       case kTOFdeltaP:                  return "SingleTrackTOFdeltaProton";
123       case kNITSclusters:               return "SingleTrackNITSclusters";
124       case kNTPCclusters:               return "SingleTrackNTPCclusters";
125       case kNTPCcrossedRows:            return "SingleTrackNTPCcrossedRows";
126       case kNTPCcrossedRowsFclusters:   return "SingleTrackNTPCcrossedRowsFclusters";  
127       case kITSchi2:                    return "SingleTrackITSchi2"; 
128       case kTPCchi2:                    return "SingleTrackTPCchi2"; 
129       case kDCAXY:                      return "SingleTrackDCAz"; 
130       case kDCAZ:                       return "SingleTrackDCAz";       
131       case kCharge:                     return "SingleTrackCharge";
132       case kPhi:                        return "SingleTrackPhi";
133       case kPhiOuterTPC:                return "SingleTrackPhiOuterTPC";
134       case kV0DCA:                      return "V0DCAToPrimaryVertex";
135       case kV0Radius:                   return "V0Radius";
136       case kV0Mass:                     return "V0Mass";
137       case kV0P:                        return "V0Momentum";
138       case kV0Pt:                       return "V0TransverseMomentum";
139       case kDaughterDCA:                return "V0DaughterDCA";
140       case kCosPointAng:                return "V0CosineOfPointingAngle";
141       case kLambdaProtonPIDCut:         return "V0LambdaProtonNsigma";
142       case kAntiLambdaAntiProtonPIDCut: return "V0AntiLambdaAntiProtonNsigma";
143       case kLambdaPionPIDCut:           return "V0LambdaPionNsigma";
144       case kAntiLambdaAntiPionPIDCut:   return "V0AntiLambdaPionNsigma";
145       default:                          return "Undefined";
146    }
147 }
148
149 //_____________________________________________________________________________
150 Bool_t AliRsnValueDaughter::Eval(TObject *object)
151 {
152 //
153 // Evaluation of the required value.
154 // Checks that the passed object is of the right type
155 // and if this check is successful, computes the required value.
156 // The output of the function tells if computing was successful,
157 // and the values must be taken with GetValue().
158 //
159
160    // coherence check, which also casts object
161    // to AliRsnTarget data members and returns kFALSE
162    // in case the object is NULL
163    if (!TargetOK(object)) return kFALSE;
164
165    // set a reference to the mother momentum
166    AliVParticle   *ref   = fDaughter->GetRef();
167    AliVParticle   *refMC = fDaughter->GetRefMC();
168    AliVTrack      *track = fDaughter->Ref2Vtrack();
169    AliESDv0       *v0esd = fDaughter->Ref2ESDv0();
170    AliAODv0       *v0aod = fDaughter->Ref2AODv0();
171    AliESDEvent    *lESDEvent = fEvent->GetRefESD();
172    
173    Double_t xPrimaryVertex = -999.9;
174    Double_t yPrimaryVertex = -999.9;
175    Double_t zPrimaryVertex = -999.9;
176    
177    if(lESDEvent){
178    
179    xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
180    yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
181    zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
182    
183    }
184    
185    if (fUseMCInfo && !refMC) {
186       AliError("No MC");
187       return kFALSE;
188    }
189    if (!fUseMCInfo && !ref) {
190       AliError("No DATA");
191       return kFALSE;
192    }
193
194    // compute value depending on types in the enumeration
195    // if the type does not match any available choice, or if
196    // the computation is not doable due to any problem
197    // (not initialized support object, wrong values, risk of floating point errors)
198    // the method returng kFALSE and sets the computed value to a meaningless number
199    switch (fType) {
200    case kP:
201      fComputedValue = (fUseMCInfo ? refMC->P() : ref->P());
202      return kTRUE;
203
204    case kPt:
205      fComputedValue = (fUseMCInfo ? refMC->Pt() : ref->Pt());
206      return kTRUE;
207
208    case kEta:
209      fComputedValue = (fUseMCInfo ? refMC->Eta() : ref->Eta());
210      return kTRUE;
211
212    case kY:
213      fComputedValue = (fUseMCInfo ? refMC->Y() : ref->Y());
214      return kTRUE;   
215  
216    case kMass:
217      fComputedValue = (fUseMCInfo ? refMC->M() : ref->M());
218      return kTRUE;
219
220    case kPtpc:
221      if (track) {
222        fComputedValue = track->GetTPCmomentum();
223        return kTRUE;
224      } else {
225        AliWarning("Cannot get TPC momentum for non-track object");
226        fComputedValue = 0.0;
227        return kFALSE;
228      }
229
230    case kITSsignal:
231      if (track) {
232        fComputedValue = track->GetITSsignal();
233        return kTRUE;
234      } else {
235        AliWarning("Cannot get ITS signal for non-track object");
236        fComputedValue = 0.0;
237        return kFALSE;
238      }
239
240    case kTPCsignal:
241      if (track) {
242        fComputedValue = track->GetTPCsignal();
243        return kTRUE;
244      } else {
245        AliWarning("Cannot get TPC signal for non-track object");
246        fComputedValue = 0.0;
247        return kFALSE;
248      }
249
250    case kTOFsignal:
251      if (track) {
252        fComputedValue = track->GetTOFsignal();
253        return kTRUE;
254      } else {
255        AliWarning("Cannot get TOF signal for non-track object");
256        fComputedValue = 0.0;
257        return kFALSE;
258      }
259
260    case kTPCnsigmaPi:
261      if (track) {
262        AliPIDResponse *pid = fEvent->GetPIDResponse();
263        fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kPion);
264        return kTRUE;
265      } else {
266        AliWarning("Cannot get TOF signal for non-track object");
267        fComputedValue = 0.0;
268        return kFALSE;
269      }
270
271    case kTPCnsigmaK:
272      if (track) {
273        AliPIDResponse *pid = fEvent->GetPIDResponse();
274        fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kKaon);
275        return kTRUE;
276      } else {
277        AliWarning("Cannot get TOF signal for non-track object");
278        fComputedValue = 0.0;
279        return kFALSE;
280      }
281
282    case kTPCnsigmaP:
283      if (track) {
284        AliPIDResponse *pid = fEvent->GetPIDResponse();
285        fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kProton);
286        return kTRUE;
287      } else {
288        AliWarning("Cannot get TOF signal for non-track object");
289        fComputedValue = 0.0;
290        return kFALSE;
291      }
292
293    case kTOFnsigmaPi:
294      if (track) {
295        AliPIDResponse *pid = fEvent->GetPIDResponse();
296        fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kPion);
297        return kTRUE;
298      } else {
299        AliWarning("Cannot get TOF signal for non-track object");
300        fComputedValue = 0.0;
301        return kFALSE;
302      }
303
304    case kTOFnsigmaK:
305      if (track) {
306        AliPIDResponse *pid = fEvent->GetPIDResponse();
307        fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kKaon);
308        return kTRUE;
309      } else {
310        AliWarning("Cannot get TOF signal for non-track object");
311        fComputedValue = 0.0;
312        return kFALSE;
313      }
314
315    case kTOFnsigmaP:
316      if (track) {
317        AliPIDResponse *pid = fEvent->GetPIDResponse();
318        fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kProton);
319        return kTRUE;
320      } else {
321        AliWarning("Cannot get TOF signal for non-track object");
322        fComputedValue = 0.0;
323        return kFALSE;
324      }
325
326    case kTOFdeltaPi:
327      if (track) {
328        AliPIDResponse *pid = fEvent->GetPIDResponse();
329        pid->GetSignalDelta(AliPIDResponse::kTOF, track, AliPID::kPion, fComputedValue, kFALSE);//(==AliPIDResponse::kDetPidOk);
330          return kTRUE;
331      } else {
332        AliWarning("Cannot get TOF delta for non-track object");
333        fComputedValue = 0.0;
334        return kFALSE;
335      }
336
337    case kTOFdeltaK:
338      if (track) {
339        AliPIDResponse *pid = fEvent->GetPIDResponse();
340        pid->GetSignalDelta(AliPIDResponse::kTOF, track, AliPID::kKaon, fComputedValue, kFALSE);//(==AliPIDResponse::kDetPidOk);
341        return kTRUE;
342      } else {
343        AliWarning("Cannot get TOF delta for non-track object");
344        fComputedValue = 0.0;
345        return kFALSE;
346      }
347
348    case kTOFdeltaP:
349      if (track) {
350        AliPIDResponse *pid = fEvent->GetPIDResponse();
351        pid->GetSignalDelta(AliPIDResponse::kTOF, track, AliPID::kProton, fComputedValue, kFALSE);//(==AliPIDResponse::kDetPidOk);
352        return kTRUE;
353      } else {
354        AliWarning("Cannot get TOF delta for non-track object");
355        fComputedValue = 0.0;
356        return kFALSE;
357      }
358    
359    case kNITSclusters:
360      if (track) {
361        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
362        if (trackESD) {
363          fComputedValue =  trackESD->GetITSclusters(0);
364        } else {
365          fComputedValue =  ((AliAODTrack *)track)->GetITSNcls();
366        }
367        return kTRUE;
368      } else {
369        AliWarning("Cannot get n ITS clusters for non-track object");
370        fComputedValue = 0.0;
371        return kFALSE;
372      }
373
374    case kNTPCclusters:
375      if (track) {
376        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
377        if (trackESD) {
378          fComputedValue =  trackESD->GetTPCclusters(0);
379        } else {
380          fComputedValue =  ((AliAODTrack *)track)->GetTPCNcls();
381        }
382        return kTRUE;
383      } else {
384        AliWarning("Cannot get n TPC clusters for non-track object");
385        fComputedValue = 0.0;
386        return kFALSE;
387      }
388
389    case kNTPCcrossedRows:
390      if (track) {
391        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
392        if (trackESD) {
393          fComputedValue =  trackESD->GetTPCCrossedRows();
394        } else {
395          fComputedValue =  ((AliAODTrack *)track)->GetTPCNCrossedRows();
396        }
397        return kTRUE;
398      } else {
399        AliWarning("Cannot get n TPC crossed rows for non-track object");
400        fComputedValue = 0.0;
401        return kFALSE;
402      }
403
404    case kNTPCcrossedRowsFclusters:
405      if (track) {
406        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
407        fComputedValue = 1.0;
408        if (trackESD) {
409          if (trackESD->GetTPCNclsF()>0) fComputedValue = trackESD->GetTPCCrossedRows() / trackESD->GetTPCNclsF();   
410        } else {
411          Float_t nCrossedRows = ((AliAODTrack*) track)->GetTPCNCrossedRows();
412          Float_t nFcls = ((AliAODTrack*) track)->GetTPCNclsF();
413          if (nFcls>0) fComputedValue = nCrossedRows / nFcls;
414        }
415        return kTRUE;
416      } else {
417        AliWarning("Cannot get n TPC crossed rows/findable clusters for non-track object");
418        fComputedValue = 0.0;
419        return kFALSE;
420      }
421      
422    case kITSchi2:
423      if (track) {
424        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
425        if (trackESD) {
426          UShort_t nClustersITS = trackESD->GetITSclusters(0);
427          fComputedValue =  trackESD->GetITSchi2()/Float_t(nClustersITS);
428        } else {
429          fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
430        }
431        return kTRUE;
432      } else {
433        AliWarning("Cannot get ITS chi^2 for non-track object");
434        fComputedValue = 0.0;
435        return kFALSE;
436      }
437    case kTPCchi2:
438      if (track) {
439        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
440        if (trackESD) {
441          UShort_t nClustersTPC = trackESD->GetTPCclusters(0);
442          fComputedValue =  trackESD->GetTPCchi2()/Float_t(nClustersTPC);
443        } else {
444          fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
445        }
446        return kTRUE;
447      } else {
448        AliWarning("Cannot get TPC chi^2 for non-track object");
449        fComputedValue = 0.0;
450        return kFALSE;
451      }
452    case kDCAXY:
453      if (track) {
454        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
455        if (trackESD) {
456          Float_t b[2], bCov[3];
457          trackESD->GetImpactParameters(b, bCov);
458          fComputedValue =  b[0];
459        } else {
460          Double_t b[2]= {-999,-999}, cov[3];
461          AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
462          if(vertex) {
463            track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
464            fComputedValue = b[0];
465          } else {
466            fComputedValue = -999;
467          }
468        }
469        return kTRUE;
470      } else {
471        AliWarning("Cannot get TPC chi^2 for non-track object");
472        fComputedValue = 0.0;
473        return kFALSE;
474      }
475    case kDCAZ:
476      if (track) {
477        AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
478        if (trackESD) {
479          Float_t b[2], bCov[3];
480          trackESD->GetImpactParameters(b, bCov);
481          fComputedValue =  b[1];
482        } else {
483          Double_t b[2]= {-999,-999}, cov[3];
484          AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
485          if(vertex) {
486            track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
487            fComputedValue = b[1];
488          } else {
489            fComputedValue = -999;
490          }
491
492        }
493        return kTRUE;
494      } else {
495        AliWarning("Cannot get TPC chi^2 for non-track object");
496        fComputedValue = 0.0;
497        return kFALSE;
498      }
499
500    case kCharge:
501      fComputedValue = (fUseMCInfo ? refMC->Charge() : ref->Charge());
502      return kTRUE;
503    
504    case kPhi:         
505      fComputedValue = (fUseMCInfo ? (refMC->Phi()*TMath::RadToDeg()) : (ref->Phi()*TMath::RadToDeg()));      
506      return kTRUE;
507
508    case kPhiOuterTPC:    
509      if (track) {
510        Double_t pos[3]={0.,0.,0.};
511        Double_t phiOut = -999.0;
512        Double_t radius = 278.;//TPC outer (vessel) = 278 cm, TOF radius (active surf.) = 378 cm;  ref. PPR.1
513        AliExternalTrackParam etp; //thanks to Andrea and Cristina
514        etp.CopyFromVTrack(track);
515        if(etp.GetXYZAt(radius, 5., pos)){
516          phiOut=TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
517          if (phiOut<0) phiOut+= (2*TMath::Pi()*TMath::RadToDeg());
518        }
519        fComputedValue = phiOut;      
520      } else {
521        AliWarning("Cannot get phi at outer TPC radius for non-track object");
522        fComputedValue = -99.0;
523        return kFALSE;
524      }
525      return kTRUE;
526
527    case kV0DCA:
528      if(v0esd) {
529        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
530        fComputedValue = v0ESD->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
531        return kTRUE;
532      }
533      if(v0aod) {
534        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
535        fComputedValue = v0AOD->DcaV0ToPrimVertex();
536        return kTRUE;
537      }
538      else {
539        fComputedValue = -999;
540        return kFALSE;
541      }           
542
543    case kV0Radius:
544      if(v0esd) {
545        Double_t v0Position[3]; // from $ALICE_ROOT/ANALYSIS/AliESDV0Cuts.cxx
546        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
547        v0ESD->GetXYZ(v0Position[0],v0Position[1],v0Position[2]);
548        fComputedValue = TMath::Sqrt(TMath::Power(v0Position[0],2) + TMath::Power(v0Position[1],2));
549        return kTRUE;
550       }
551      if(v0aod) {
552         AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
553         fComputedValue = v0AOD->RadiusV0();
554        return kTRUE;
555      }
556      else {
557        fComputedValue = -999;
558        return kFALSE;
559      }           
560
561    case kV0Mass:
562      if(v0esd) {
563        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
564        fComputedValue = v0ESD->GetEffMass();
565        return kTRUE;
566      }
567      if(v0aod) {
568        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
569        fComputedValue = v0AOD->MassLambda();
570        return kTRUE;
571      }
572      else {
573        fComputedValue = -999;
574        return kFALSE;
575      }   
576          
577    case kV0P:
578      if(v0esd) {
579        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
580        fComputedValue = v0ESD->P();
581        return kTRUE;
582      }
583      if(v0aod) {
584        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
585        fComputedValue = v0AOD->Ptot2V0();
586        return kTRUE;
587      }
588      else {
589        fComputedValue = -999;
590        return kFALSE;
591      }           
592
593    case kV0Pt:
594      if(v0esd) {
595        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
596        fComputedValue = v0ESD->Pt();
597        return kTRUE;
598      }
599      if(v0aod) {
600        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
601        fComputedValue = v0AOD->Pt2V0();
602        return kTRUE;
603      }
604      else {
605        fComputedValue = -999;
606        return kFALSE;
607      }           
608
609    case kDaughterDCA:
610      if(v0esd) {
611        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
612        fComputedValue = v0ESD->GetDcaV0Daughters();
613        return kTRUE;
614      }
615      if(v0aod) {
616        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
617        fComputedValue = v0AOD->DcaV0Daughters();
618        return kTRUE;
619      }
620      else {
621        fComputedValue = -999;
622        return kFALSE;
623      }
624
625    case kCosPointAng:
626      if(v0esd) {
627        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
628        fComputedValue = v0ESD->GetV0CosineOfPointingAngle();
629        return kTRUE;     
630      }
631      if(v0aod) {
632        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
633        AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
634        fComputedValue = v0AOD->CosPointingAngle(vertex);
635        return kTRUE;
636      }
637      else {
638        fComputedValue = -999;
639        return kFALSE;
640      }
641
642    case kLambdaProtonPIDCut:
643      if(v0esd && lESDEvent) {
644        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
645        // retrieve the V0 daughters
646        UInt_t lIdxPos      = (UInt_t) TMath::Abs(v0ESD->GetPindex());
647        AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
648        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
649        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
650        return kTRUE;     
651      }
652      if(v0aod) {
653        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
654        AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
655        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
656        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
657        return kTRUE;
658      }
659      else {
660        fComputedValue = -999;
661        return kFALSE;
662      }
663
664    case kAntiLambdaAntiProtonPIDCut:
665      if(v0esd && lESDEvent) {
666        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
667        // retrieve the V0 daughters
668        UInt_t lIdxNeg      = (UInt_t) TMath::Abs(v0ESD->GetNindex());
669        AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
670        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
671        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
672        return kTRUE;     
673      }
674      if(v0aod) {
675        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
676        AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
677        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
678        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
679        return kTRUE;
680      }
681      else {
682        fComputedValue = -999;
683        return kFALSE;
684      }
685
686    case kLambdaPionPIDCut:
687      if(v0esd && lESDEvent) {
688        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
689        // retrieve the V0 daughters
690        UInt_t lIdxNeg      = (UInt_t) TMath::Abs(v0ESD->GetNindex());
691        AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
692        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
693        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
694        return kTRUE;     
695      }
696      if(v0aod) {
697        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
698        AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
699        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
700        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
701        return kTRUE;
702      }
703      else {
704        fComputedValue = -999;
705        return kFALSE;
706      }
707
708    case kAntiLambdaAntiPionPIDCut:
709      if(v0esd && lESDEvent) {
710        AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
711        // retrieve the V0 daughters
712        UInt_t lIdxPos      = (UInt_t) TMath::Abs(v0ESD->GetPindex());
713        AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
714        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
715        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
716        return kTRUE;     
717      }
718      if(v0aod) {
719        AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
720        AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
721        AliPIDResponse *pid = fEvent->GetPIDResponse(); 
722        fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
723        return kTRUE;
724      }
725      else {
726        fComputedValue = -999;
727        return kFALSE;
728      }
729              
730    default:
731      AliError(Form("[%s] Invalid value type for this computation", GetName()));
732      return kFALSE;
733    }
734 }