]>
Commit | Line | Data |
---|---|---|
35e49ca5 | 1 | // |
2 | // Class AliRsnCutPIDTOF | |
3 | // | |
80e49c8b | 4 | // Implements the PID check with TOF detector, |
5 | // computed as a compatibility within a given range | |
6 | // expressed in number of sigmas w.r. to expected time. | |
7 | // Uses the default cut checking facilities of AliRsnCut | |
8 | // to check this. | |
35e49ca5 | 9 | // |
10 | // authors: Martin Vala (martin.vala@cern.ch) | |
11 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
12 | // | |
13 | ||
223b8750 | 14 | #include "AliAnalysisManager.h" |
15 | #include "AliESDInputHandler.h" | |
c865cb1d | 16 | #include "AliESDtrack.h" |
17 | #include "AliESDpid.h" | |
18 | #include "AliAODTrack.h" | |
19 | #include "AliAODpidUtil.h" | |
223b8750 | 20 | |
35e49ca5 | 21 | #include "AliRsnCutPIDTOF.h" |
22 | ||
23 | ClassImp(AliRsnCutPIDTOF) | |
24 | ||
35e49ca5 | 25 | //_________________________________________________________________________________________________ |
80e49c8b | 26 | AliRsnCutPIDTOF::AliRsnCutPIDTOF |
27 | (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectUnmatched) : | |
2a1c7696 | 28 | AliRsnCut(name, AliRsnCut::kDaughter, min, max), |
2a1c7696 | 29 | fRejectUnmatched(rejectUnmatched), |
30 | fRefType(AliPID::kUnknown), | |
31 | fRefMass(0.0), | |
c865cb1d | 32 | fESDpid(0x0), |
33 | fAODpid(0x0) | |
35e49ca5 | 34 | { |
35 | // | |
36 | // Default constructor. | |
80e49c8b | 37 | // To set the reference PID type, calls the SetRefType method, |
38 | // which sets the mass accordingly and coherently. | |
35e49ca5 | 39 | // |
80e49c8b | 40 | |
2a1c7696 | 41 | SetRefType(ref); |
35e49ca5 | 42 | } |
43 | ||
44 | //_________________________________________________________________________________________________ | |
45 | AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) : | |
2a1c7696 | 46 | AliRsnCut(copy), |
2a1c7696 | 47 | fRejectUnmatched(copy.fRejectUnmatched), |
48 | fRefType(AliPID::kUnknown), | |
49 | fRefMass(0.0), | |
50 | fESDpid(copy.fESDpid), | |
51 | fAODpid(copy.fAODpid) | |
35e49ca5 | 52 | { |
53 | // | |
80e49c8b | 54 | // Copy constructor. |
55 | // To set the reference PID type, calls the SetRefType method, | |
56 | // which sets the mass accordingly and coherently. | |
35e49ca5 | 57 | // |
80e49c8b | 58 | |
2a1c7696 | 59 | SetRefType(copy.fRefType); |
35e49ca5 | 60 | } |
61 | ||
62 | //_________________________________________________________________________________________________ | |
63 | AliRsnCutPIDTOF& AliRsnCutPIDTOF::operator=(const AliRsnCutPIDTOF& copy) | |
64 | { | |
65 | // | |
80e49c8b | 66 | // Assignment operator. |
67 | // To set the reference PID type, calls the SetRefType method, | |
68 | // which sets the mass accordingly and coherently. | |
35e49ca5 | 69 | // |
70 | ||
2a1c7696 | 71 | fRejectUnmatched = copy.fRejectUnmatched; |
72 | fESDpid = copy.fESDpid; | |
73 | fAODpid = copy.fAODpid; | |
80e49c8b | 74 | |
2a1c7696 | 75 | SetRefType(copy.fRefType); |
76 | ||
77 | return (*this); | |
35e49ca5 | 78 | } |
79 | ||
80 | //_________________________________________________________________________________________________ | |
81 | Bool_t AliRsnCutPIDTOF::IsSelected(TObject *object) | |
82 | { | |
83 | // | |
84 | // Cut checker. | |
85 | // | |
86 | ||
2a1c7696 | 87 | // coherence check |
88 | if (!TargetOK(object)) return kFALSE; | |
89 | ||
90 | // reject always non-track objects | |
f34f960b | 91 | AliVTrack *vtrack = fDaughter->Ref2Vtrack(); |
2a1c7696 | 92 | if (!vtrack) { |
93 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); | |
80e49c8b | 94 | return kFALSE; |
2a1c7696 | 95 | } |
96 | ||
97 | // checks that track is matched in TOF: | |
98 | // if not, the track is accepted or rejected | |
99 | // depending on the 'fRejectUnmatched' data member: | |
100 | // -- kTRUE --> all unmatched tracks are rejected | |
101 | // -- kFALSE --> all unmatched tracks are accepted (it is assumed that other PIDs are done) | |
102 | if (!IsMatched(vtrack)) { | |
103 | AliDebug(AliLog::kDebug + 2, "Track is not matched with TOF"); | |
c865cb1d | 104 | if (fRejectUnmatched) return kFALSE; |
2a1c7696 | 105 | } |
106 | ||
107 | // retrieve real object type and | |
108 | // prepare some useful variables | |
109 | Double_t tof, sigma, times[5]; | |
110 | Double_t &ref = times[(Int_t)fRefType]; | |
f34f960b | 111 | AliESDtrack *esdTrack = fDaughter->Ref2ESDtrack(); |
112 | AliAODTrack *aodTrack = fDaughter->Ref2AODtrack(); | |
2a1c7696 | 113 | |
114 | // cut check depends on the object type | |
115 | if (esdTrack) { | |
116 | // setup the ESD PID object | |
d7712d44 | 117 | AliESDEvent *esd = 0x0; |
c865cb1d | 118 | if (fEvent) esd = fEvent->GetRefESD(); |
119 | if (!esd) { | |
120 | AliError("Processing an ESD track, but target is not an ESD event"); | |
2a1c7696 | 121 | return kFALSE; |
122 | } | |
c865cb1d | 123 | if (!fESDpid) fESDpid = new AliESDpid; |
124 | fESDpid->SetTOFResponse(esd, AliESDpid::kTOF_T0); | |
2a1c7696 | 125 | |
126 | // get time of flight, reference times and sigma | |
127 | esdTrack->GetIntegratedTimes(times); | |
c865cb1d | 128 | tof = (Double_t)(esdTrack->GetTOFsignal() - fESDpid->GetTOFResponse().GetStartTime(esdTrack->P())); |
129 | sigma = (Double_t)fESDpid->GetTOFResponse().GetExpectedSigma(esdTrack->P(), ref, fRefMass); | |
2a1c7696 | 130 | |
131 | // port values to standard AliRsnCut checker | |
132 | fCutValueD = (tof - ref) / sigma; | |
133 | return OkRangeD(); | |
134 | } else if (aodTrack) { | |
135 | // for AOD tracks, all operations are done by the AOD PID utility | |
c865cb1d | 136 | if (!fAODpid) fAODpid = new AliAODpidUtil; |
137 | fCutValueD = (Double_t)fAODpid->NumberOfSigmasTOF(aodTrack, fRefType); | |
2a1c7696 | 138 | return OkRangeD(); |
139 | } else { | |
140 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); | |
141 | return kFALSE; | |
142 | } | |
35e49ca5 | 143 | } |
144 | ||
a909ffad | 145 | //_________________________________________________________________________________________________ |
146 | void AliRsnCutPIDTOF::Print(const Option_t *) const | |
147 | { | |
148 | // | |
149 | // Print information on this cut | |
150 | // | |
151 | ||
2a1c7696 | 152 | AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName())); |
153 | AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD)); | |
154 | AliInfo(Form("Unmatched tracks are : %s", (fRejectUnmatched ? "rejected" : "accepted"))); | |
a909ffad | 155 | } |
223b8750 | 156 |