]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutPIDTOF.h
Removed old ME classes, since the nex event mixing has been introduced and is integra...
[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 public:
28
29    AliRsnCutPIDTOF(const char *name            = "cutTOF",
30                    EPARTYPE    particle        = AliPID::kKaon,
31                    Double_t    nSigmaMin       = -3.,
32                    Double_t    nSigmaMax       =  3.,
33                    Bool_t      rejectUnmatched = kFALSE);
34
35    AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy);
36    AliRsnCutPIDTOF& operator=(const AliRsnCutPIDTOF& copy);
37    virtual ~AliRsnCutPIDTOF() { }
38
39    AliESDpid*      ESDpid()  {return &fESDpid;}
40    AliAODpidUtil*  AODpid()  {return &fAODpid;}
41
42    void            SetRejectUnmatched(Bool_t yn = kTRUE)      {fRejectUnmatched = yn;}
43    void            SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
44    void            SetRefType(EPARTYPE type)                  {fRefType = type; fRefMass = AliPID::ParticleMass(type);}
45
46    Bool_t          IsMatched(AliVTrack *vtrack);
47    virtual Bool_t  IsSelected(TObject *object);
48    virtual void    Print(const Option_t *option = "") const;
49
50 private:
51
52    void Initialize();
53
54    Bool_t            fInitialized;      // a mono-usage flag which initializes the ESD pid object
55    Bool_t            fRejectUnmatched;  //  decide if non TOF matched tracks pass the cut or not
56    EPARTYPE          fRefType;          //  particle type for which PID is checked
57    Double_t          fRefMass;          //  reference mass used for computations
58    AliESDpid         fESDpid;           //  PID utility for ESD
59    AliAODpidUtil     fAODpid;           //  PID utility for AOD
60
61    ClassDef(AliRsnCutPIDTOF, 1)
62 };
63
64 inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack)
65 {
66 //
67 // Checks if the track has the status flags required for an ITS standalone track
68 //
69
70    if (!vtrack) {
71       AliWarning("NULL argument: impossible to check status");
72       return kFALSE;
73    }
74
75    Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
76    Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
77
78    // if flags are not set, track is not matched
79    if (!isTOFout || !isTIME) return kFALSE;
80
81    // do an additional check on integrated length for ESD tracks
82    AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(vtrack);
83    if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE;
84
85    // if we are here, flags are OK and length also
86    return kTRUE;
87 }
88
89 #endif