]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutPIDTOF.h
Update
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDTOF.h
1 //
2 // Class AliRsnCutRange
3 //
4 // General implementation of cuts which check a value inside a range.
5 // This range can be defined by two integers or two doubles.
6 // A user-friendly enumeration allows to define what is checked.
7 //
8 // authors: Martin Vala (martin.vala@cern.ch)
9 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
10 //
11
12 #ifndef ALIRSNCUTPIDTOF_H
13 #define ALIRSNCUTPIDTOF_H
14
15 #include "AliPID.h"
16
17 #include "AliVTrack.h"
18 #include "AliESDtrack.h"
19 #include "AliESDpid.h"
20 #include "AliAODTrack.h"
21 #include "AliAODpidUtil.h"
22
23 #include "AliRsnDaughter.h"
24 #include "AliRsnCut.h"
25
26 class AliRsnCutPIDTOF : public AliRsnCut
27 {
28   public:
29
30     AliRsnCutPIDTOF(const char *name            = "cutTOF",
31                     EPARTYPE    particle        = AliPID::kKaon,
32                     Double_t    nSigmaMin       = -3.,
33                     Double_t    nSigmaMax       =  3.,
34                     Bool_t      rejectUnmatched = kFALSE);
35                     
36     AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy);
37     AliRsnCutPIDTOF& operator=(const AliRsnCutPIDTOF& copy);
38     virtual ~AliRsnCutPIDTOF() { }
39
40     AliESDpid*      ESDpid()  {return &fESDpid;}
41     AliAODpidUtil*  AODpid()  {return &fAODpid;}
42     
43     void            SetRejectUnmatched(Bool_t yn = kTRUE)      {fRejectUnmatched = yn;}
44     void            SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
45     void            SetRefType(EPARTYPE type)                  {fRefType = type; fRefMass = AliPID::ParticleMass(type);}
46
47     Bool_t          IsMatched(AliVTrack *vtrack);
48     virtual Bool_t  IsSelected(TObject *object);
49     virtual void    Print(const Option_t *option = "") const;
50
51   private:
52
53     void Initialize();
54
55     Bool_t            fInitialized;      // a mono-usage flag which initializes the ESD pid object
56     Bool_t            fRejectUnmatched;  //  decide if non TOF matched tracks pass the cut or not
57     EPARTYPE          fRefType;          //  particle type for which PID is checked   
58     Double_t          fRefMass;          //  reference mass used for computations
59     AliESDpid         fESDpid;           //  PID utility for ESD
60     AliAODpidUtil     fAODpid;           //  PID utility for AOD
61
62     ClassDef(AliRsnCutPIDTOF, 1)
63 };
64
65 inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack)
66 {
67 //
68 // Checks if the track has the status flags required for an ITS standalone track
69 //
70
71   if (!vtrack)
72   {
73     AliWarning("NULL argument: impossible to check status");
74     return kFALSE;
75   }
76
77   Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
78   Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
79
80   // if flags are not set, track is not matched
81   if ( !isTOFout || !isTIME ) return kFALSE;
82
83   // do an additional check on integrated length for ESD tracks
84   AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(vtrack);
85   if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE;
86
87   // if we are here, flags are OK and length also
88   return kTRUE;
89 }
90
91 #endif