]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutPIDTOF.cxx
Added some more scripts to installation
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDTOF.cxx
CommitLineData
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
35e49ca5 14#include "AliRsnEvent.h"
35e49ca5 15#include "AliRsnCutPIDTOF.h"
16
17ClassImp(AliRsnCutPIDTOF)
18
35e49ca5 19//_________________________________________________________________________________________________
80e49c8b 20AliRsnCutPIDTOF::AliRsnCutPIDTOF
21(const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectUnmatched) :
35e49ca5 22 AliRsnCut(name, AliRsnCut::kDaughter, min, max),
80e49c8b 23 fRejectUnmatched(rejectUnmatched),
24 fRefType(AliPID::kUnknown),
25 fRefMass(0.0),
35e49ca5 26 fESDpid(),
27 fAODpid()
28{
29//
30// Default constructor.
80e49c8b 31// To set the reference PID type, calls the SetRefType method,
32// which sets the mass accordingly and coherently.
35e49ca5 33//
80e49c8b 34
35 SetRefType(ref);
35e49ca5 36}
37
38//_________________________________________________________________________________________________
39AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) :
40 AliRsnCut(copy),
80e49c8b 41 fRejectUnmatched(copy.fRejectUnmatched),
42 fRefType(AliPID::kUnknown),
43 fRefMass(0.0),
35e49ca5 44 fESDpid(copy.fESDpid),
45 fAODpid(copy.fAODpid)
46{
47//
80e49c8b 48// Copy constructor.
49// To set the reference PID type, calls the SetRefType method,
50// which sets the mass accordingly and coherently.
35e49ca5 51//
80e49c8b 52
53 SetRefType(copy.fRefType);
35e49ca5 54}
55
56//_________________________________________________________________________________________________
57AliRsnCutPIDTOF& AliRsnCutPIDTOF::operator=(const AliRsnCutPIDTOF& copy)
58{
59//
80e49c8b 60// Assignment operator.
61// To set the reference PID type, calls the SetRefType method,
62// which sets the mass accordingly and coherently.
35e49ca5 63//
64
80e49c8b 65 fRejectUnmatched = copy.fRejectUnmatched;
35e49ca5 66 fESDpid = copy.fESDpid;
67 fAODpid = copy.fAODpid;
80e49c8b 68
69 SetRefType(copy.fRefType);
35e49ca5 70
71 return (*this);
72}
73
74//_________________________________________________________________________________________________
75Bool_t AliRsnCutPIDTOF::IsSelected(TObject *object)
76{
77//
78// Cut checker.
79//
80
81 // coherence check
82 if (!TargetOK(object)) return kFALSE;
83
659ef4f0 84 // reject always non-track objects
35e49ca5 85 AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
86 if (!vtrack)
87 {
80e49c8b 88 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
35e49ca5 89 return kFALSE;
90 }
659ef4f0 91
80e49c8b 92 // checks that track is matched in TOF:
93 // if not, the track is accepted or rejected
94 // depending on the 'fRejectUnmatched' data member:
95 // -- kTRUE --> all unmatched tracks are rejected
96 // -- kFALSE --> all unmatched tracks are accepted (it is assumed that other PIDs are done)
97 if (!IsMatched(vtrack))
35e49ca5 98 {
99 AliDebug(AliLog::kDebug + 2, "Track is not matched with TOF");
80e49c8b 100 return (!fRejectUnmatched);
35e49ca5 101 }
102
80e49c8b 103 // retrieve real object type and
104 // prepare some useful variables
105 Double_t tof, sigma, times[5];
106 Double_t &ref = times[(Int_t)fRefType];
35e49ca5 107 AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
108 AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
80e49c8b 109
110 // cut check depends on the object type
35e49ca5 111 if (esdTrack)
112 {
80e49c8b 113 // setup the ESD PID object
114 AliESDEvent *esd = AliRsnTarget::GetCurrentEvent()->GetRefESD();
115 if (!esd)
116 {
117 AliError("Processing an ESD track, but target is not an ESD event");
118 return kFALSE;
119 }
120 fESDpid.SetTOFResponse(esd, AliESDpid::kTOF_T0);
121
122 // get time of flight, reference times and sigma
123 esdTrack->GetIntegratedTimes(times);
124 tof = (Double_t)(esdTrack->GetTOFsignal() - fESDpid.GetTOFResponse().GetStartTime(esdTrack->P()));
125 sigma = (Double_t)fESDpid.GetTOFResponse().GetExpectedSigma(esdTrack->P(), ref, fRefMass);
126
127 // port values to standard AliRsnCut checker
128 fCutValueD = (tof - ref) / sigma;
129 return OkRangeD();
35e49ca5 130 }
131 else if (aodTrack)
132 {
80e49c8b 133 // for AOD tracks, all operations are done by the AOD PID utility
134 fCutValueD = (Double_t)fAODpid.NumberOfSigmasTOF(aodTrack, fRefType);
135 return OkRangeD();
35e49ca5 136 }
137 else
138 {
80e49c8b 139 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
35e49ca5 140 return kFALSE;
141 }
142}
143
a909ffad 144//_________________________________________________________________________________________________
145void AliRsnCutPIDTOF::Print(const Option_t *) const
146{
147//
148// Print information on this cut
149//
150
151 AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName()));
152 AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD));
80e49c8b 153 AliInfo(Form("Unmatched tracks are : %s", (fRejectUnmatched ? "rejected" : "accepted")));
a909ffad 154}