example macros to run on proof
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDTOF.h
CommitLineData
35e49ca5 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"
80e49c8b 16#include "AliVTrack.h"
35e49ca5 17
35e49ca5 18#include "AliRsnCut.h"
19
2a1c7696 20class AliRsnCutPIDTOF : public AliRsnCut {
21public:
22
23 AliRsnCutPIDTOF(const char *name = "cutTOF",
24 EPARTYPE particle = AliPID::kKaon,
25 Double_t nSigmaMin = -3.,
26 Double_t nSigmaMax = 3.,
27 Bool_t rejectUnmatched = kFALSE);
28
29 AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy);
30 AliRsnCutPIDTOF& operator=(const AliRsnCutPIDTOF& copy);
31 virtual ~AliRsnCutPIDTOF() { }
32
c865cb1d 33 AliESDpid* ESDpid() {return fESDpid;}
34 AliAODpidUtil* AODpid() {return fAODpid;}
2a1c7696 35
36 void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;}
37 void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
38 void SetRefType(EPARTYPE type) {fRefType = type; fRefMass = AliPID::ParticleMass(type);}
39
40 Bool_t IsMatched(AliVTrack *vtrack);
41 virtual Bool_t IsSelected(TObject *object);
42 virtual void Print(const Option_t *option = "") const;
43
44private:
45
46 void Initialize();
47
2a1c7696 48 Bool_t fRejectUnmatched; // decide if non TOF matched tracks pass the cut or not
49 EPARTYPE fRefType; // particle type for which PID is checked
50 Double_t fRefMass; // reference mass used for computations
c865cb1d 51 AliESDpid *fESDpid; //! PID utility for ESD
52 AliAODpidUtil *fAODpid; //! PID utility for AOD
2a1c7696 53
54 ClassDef(AliRsnCutPIDTOF, 1)
35e49ca5 55};
56
80e49c8b 57inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack)
58{
59//
60// Checks if the track has the status flags required for an ITS standalone track
61//
62
2a1c7696 63 if (!vtrack) {
64 AliWarning("NULL argument: impossible to check status");
65 return kFALSE;
66 }
80e49c8b 67
2a1c7696 68 Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
69 Bool_t isTIME = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
80e49c8b 70
2a1c7696 71 // if flags are not set, track is not matched
72 if (!isTOFout || !isTIME) return kFALSE;
80e49c8b 73
2a1c7696 74 // do an additional check on integrated length for ESD tracks
75 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(vtrack);
76 if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE;
80e49c8b 77
2a1c7696 78 // if we are here, flags are OK and length also
79 return kTRUE;
80e49c8b 80}
81
35e49ca5 82#endif