]>
Commit | Line | Data |
---|---|---|
809a4336 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
27de2dfb | 15 | |
16 | /* $Id$ */ | |
17 | ||
50685501 | 18 | // |
19 | // Class for TOF PID | |
20 | // Implements the abstract base class AliHFEpidBase | |
21 | // IsInitialized() does the PID decision | |
22 | // | |
23 | // Authors: | |
24 | // Markus Fasel <M.Fasel@gsi.de> | |
25 | // Matus Kalisky <matus.kalisky@cern.ch> (contact) | |
26 | // | |
809a4336 | 27 | |
809a4336 | 28 | #include <TMath.h> |
29 | ||
3a72645a | 30 | #include "AliAODpidUtil.h" |
722347d8 | 31 | #include "AliAODTrack.h" |
3a72645a | 32 | #include "AliESDpid.h" |
809a4336 | 33 | #include "AliESDtrack.h" |
809a4336 | 34 | #include "AliPID.h" |
35 | ||
3a72645a | 36 | #include "AliHFEdetPIDqa.h" |
809a4336 | 37 | #include "AliHFEpidTOF.h" |
3a72645a | 38 | #include "AliHFEpidQAmanager.h" |
809a4336 | 39 | |
40 | ||
41 | ClassImp(AliHFEpidTOF) | |
3a72645a | 42 | |
43 | //___________________________________________________________________ | |
44 | AliHFEpidTOF::AliHFEpidTOF(): | |
45 | AliHFEpidBase() | |
46 | , fPID(NULL) | |
47 | , fNsigmaTOF(3) | |
48 | { | |
49 | // | |
50 | // Constructor | |
51 | // | |
52 | } | |
53 | ||
809a4336 | 54 | //___________________________________________________________________ |
55 | AliHFEpidTOF::AliHFEpidTOF(const Char_t *name): | |
56 | AliHFEpidBase(name) | |
3a72645a | 57 | , fPID(NULL) |
9bcfd1ab | 58 | , fNsigmaTOF(3) |
809a4336 | 59 | { |
60 | // | |
61 | // Constructor | |
62 | // | |
63 | } | |
3a72645a | 64 | |
809a4336 | 65 | //___________________________________________________________________ |
66 | AliHFEpidTOF::AliHFEpidTOF(const AliHFEpidTOF &c): | |
67 | AliHFEpidBase("") | |
3a72645a | 68 | , fPID(NULL) |
9bcfd1ab | 69 | , fNsigmaTOF(3) |
809a4336 | 70 | { |
71 | // | |
72 | // Copy operator | |
73 | // | |
74 | ||
75 | c.Copy(*this); | |
76 | } | |
77 | //___________________________________________________________________ | |
78 | AliHFEpidTOF &AliHFEpidTOF::operator=(const AliHFEpidTOF &ref){ | |
79 | // | |
80 | // Assignment operator | |
81 | // | |
82 | ||
83 | if(this != &ref){ | |
84 | ref.Copy(*this); | |
85 | } | |
86 | ||
87 | return *this; | |
88 | } | |
89 | //___________________________________________________________________ | |
90 | AliHFEpidTOF::~AliHFEpidTOF(){ | |
91 | // | |
92 | // Destructor | |
93 | // | |
94 | if(fPID) delete fPID; | |
809a4336 | 95 | } |
96 | //___________________________________________________________________ | |
97 | void AliHFEpidTOF::Copy(TObject &ref) const { | |
98 | // | |
99 | // Performs the copying of the object | |
100 | // | |
101 | AliHFEpidTOF &target = dynamic_cast<AliHFEpidTOF &>(ref); | |
102 | ||
103 | target.fPID = fPID; | |
e3fc062d | 104 | target.fNsigmaTOF = fNsigmaTOF; |
809a4336 | 105 | |
106 | AliHFEpidBase::Copy(ref); | |
107 | } | |
108 | //___________________________________________________________________ | |
109 | Bool_t AliHFEpidTOF::InitializePID(){ | |
110 | // | |
111 | // InitializePID: TOF experts have to implement code here | |
112 | // | |
113 | return kTRUE; | |
114 | } | |
115 | ||
116 | //___________________________________________________________________ | |
6555e2ad | 117 | Int_t AliHFEpidTOF::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const |
809a4336 | 118 | { |
faee3b18 | 119 | // |
120 | // TOF PID based on n-Sigma cut | |
121 | // Selects Protons and Kaons via n-sigma cut up to 3 GeV/c | |
122 | // In addition histos for n-sigma before (all species) and after (only closest species) are filled | |
123 | // | |
3a72645a | 124 | if((!fESDpid && track->IsESDanalysis()) || (!fAODpid && track->IsAODanalysis())) return 0; |
125 | AliDebug(2, "PID object available"); | |
e3fc062d | 126 | |
3a72645a | 127 | AliHFEpidObject::AnalysisType_t anaType = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
bf892a6a | 128 | const AliVTrack *vtrack = dynamic_cast<const AliVTrack *>(track->GetRecTrack()); |
ccc37cdc | 129 | if(!(vtrack && (vtrack->GetStatus() & AliESDtrack::kTOFpid))) return 0; |
3a72645a | 130 | AliDebug(2, "Track Has TOF PID"); |
131 | ||
132 | if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kBeforePID); | |
faee3b18 | 133 | |
134 | // Fill before selection | |
3a72645a | 135 | Double_t sigEle = NumberOfSigmas(track->GetRecTrack(), AliPID::kElectron, anaType); |
136 | AliDebug(2, Form("Number of sigmas in TOF: %f", sigEle)); | |
faee3b18 | 137 | Int_t pdg = 0; |
3a72645a | 138 | if(TMath::Abs(sigEle) < fNsigmaTOF){ |
faee3b18 | 139 | pdg = 11; |
3a72645a | 140 | if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kAfterPID); |
faee3b18 | 141 | } |
142 | ||
143 | return pdg; | |
144 | } | |
722347d8 | 145 | |
6555e2ad | 146 | ///////////////////////////////////////////////////////// |
147 | // | |
148 | // Wrappers for functions which are not virtual but | |
149 | // only available for ESD and AOD case separately | |
150 | // | |
151 | ///////////////////////////////////////////////////////// | |
152 | ||
809a4336 | 153 | //___________________________________________________________________ |
6555e2ad | 154 | Double_t AliHFEpidTOF::NumberOfSigmas(const AliVParticle *track, AliPID::EParticleType species, AliHFEpidObject::AnalysisType_t anaType) const { |
3a72645a | 155 | // |
156 | // Get the number of sigmas | |
157 | // | |
158 | Double_t nSigmas = 100; | |
159 | if(anaType == AliHFEpidObject::kESDanalysis){ | |
160 | // ESD analysis | |
161 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track); | |
ccc37cdc | 162 | if(esdtrack && fESDpid) nSigmas = fESDpid->NumberOfSigmasTOF(esdtrack, species, 0.); |
3a72645a | 163 | } else { |
164 | const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track); | |
165 | if(aodtrack && fAODpid) nSigmas = fAODpid->NumberOfSigmasTOF(aodtrack, species); | |
166 | } | |
167 | return nSigmas; | |
809a4336 | 168 | } |
6555e2ad | 169 | |
170 | //___________________________________________________________________ | |
171 | Double_t AliHFEpidTOF::GetTOFsignal(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anatype) const{ | |
172 | // | |
173 | // Get the TOF signal | |
174 | // | |
175 | Double_t tofSignal = 0.; | |
176 | if(anatype == AliHFEpidObject::kESDanalysis){ | |
177 | // ESD analysis | |
178 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track); | |
bf892a6a | 179 | if(esdtrack) tofSignal = esdtrack->GetTOFsignal(); |
6555e2ad | 180 | } else { |
181 | const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track); | |
bf892a6a | 182 | if(aodtrack) tofSignal = aodtrack->GetDetPid() ? aodtrack->GetDetPid()->GetTOFsignal() : 0.; |
6555e2ad | 183 | } |
184 | return tofSignal; | |
185 | } | |
186 | ||
187 | //___________________________________________________________________ | |
188 | Double_t AliHFEpidTOF::GetTime0(AliHFEpidObject::AnalysisType_t anatype) const{ | |
189 | // | |
190 | // Get Time0 | |
191 | // | |
192 | Double_t time0 = 0.; | |
193 | if(anatype == AliHFEpidObject::kESDanalysis){ | |
194 | time0 = fESDpid->GetTOFResponse().GetTimeZero(); | |
195 | }else { | |
196 | time0 = fAODpid->GetTOFResponse().GetTimeZero(); | |
197 | } | |
198 | return time0; | |
199 | } | |
200 | ||
201 | //___________________________________________________________________ | |
202 | void AliHFEpidTOF::GetIntegratedTimes(const AliVParticle *track, Double_t *times, AliHFEpidObject::AnalysisType_t anatype) const{ | |
203 | // | |
204 | // Return integrated times | |
205 | // | |
206 | if(anatype == AliHFEpidObject::kESDanalysis){ | |
207 | // ESD analysis | |
208 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track); | |
bf892a6a | 209 | if(esdtrack) esdtrack->GetIntegratedTimes(times); |
6555e2ad | 210 | } else { |
211 | const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track); | |
bf892a6a | 212 | if(aodtrack) aodtrack->GetDetPid()->GetIntegratedTimes(times); |
6555e2ad | 213 | } |
214 | ||
215 | } | |
216 |