]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
15 | // | |
16 | // Class AliHFEtaggedTrackAnalysis | |
17 | // Analyses tracks with an apriori PID information (i.e. using the daugther | |
18 | // tracks from well-identified decays of neutral charged particles). Tracks | |
19 | // are processed in the Process function, where given tracks are filtered | |
20 | // via the track cuts and used for PID later. The plugin fills Correction | |
21 | // Framework containers and additional PID QA containers | |
22 | // | |
23 | // Author: | |
24 | // Markus Fasel <M.Fasel@gsi.de> | |
25 | // | |
26 | #include "AliCFCutBase.h" | |
27 | #include "AliCFContainer.h" | |
28 | #include "AliCFManager.h" | |
29 | #include "AliESDtrack.h" | |
30 | #include "AliLog.h" | |
31 | #include "AliPID.h" | |
32 | #include "AliPIDResponse.h" | |
33 | #include "AliExternalTrackParam.h" | |
34 | ||
35 | #include "AliHFEcollection.h" | |
36 | #include "AliHFEcontainer.h" | |
37 | #include "AliHFEcuts.h" | |
38 | #include "AliHFEpid.h" | |
39 | #include "AliHFEpidTPC.h" | |
40 | #include "AliHFEpidQAmanager.h" | |
41 | #include "AliHFEtaggedTrackAnalysis.h" | |
42 | #include "AliHFEvarManager.h" | |
43 | ||
44 | ClassImp(AliHFEtaggedTrackAnalysis) | |
45 | //____________________________________________________________ | |
46 | AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(): | |
47 | TNamed() | |
48 | , fVarManager(NULL) | |
49 | , fContainer(NULL) | |
50 | , fPID(NULL) | |
51 | , fPIDqa(NULL) | |
52 | , fCuts(NULL) | |
53 | , fCFM(NULL) | |
54 | , fQAhistos(NULL) | |
55 | , fCentralityF(0) | |
56 | , fClean(kFALSE) | |
57 | , fMagneticField(0.0) | |
58 | , fVariablesTRD(kFALSE) | |
59 | , fIsPbPb(kFALSE) | |
60 | { | |
61 | // | |
62 | // Dummy constructor | |
63 | // | |
64 | } | |
65 | ||
66 | //____________________________________________________________ | |
67 | AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const char *name): | |
68 | TNamed(name, "") | |
69 | , fVarManager(NULL) | |
70 | , fContainer(NULL) | |
71 | , fPID(NULL) | |
72 | , fPIDqa(NULL) | |
73 | , fCuts(NULL) | |
74 | , fCFM(NULL) | |
75 | , fQAhistos(NULL) | |
76 | , fCentralityF(0) | |
77 | , fClean(kFALSE) | |
78 | , fMagneticField(0.0) | |
79 | , fVariablesTRD(kFALSE) | |
80 | , fIsPbPb(kFALSE) | |
81 | { | |
82 | // | |
83 | // Default constructor | |
84 | // | |
85 | fVarManager = new AliHFEvarManager("taggedTrackVarManager"); | |
86 | //fVarManager->AddVariable("pt"); | |
87 | //fVarManager->AddVariable("eta"); | |
88 | //fVarManager->AddVariable("phi"); | |
89 | //fVarManager->AddVariable("charge"); | |
90 | //fVarManager->AddVariable("species"); | |
91 | fPIDqa = new AliHFEpidQAmanager; | |
92 | fCFM = new AliCFManager; | |
93 | SetBit(kIsOwner, kTRUE); | |
94 | } | |
95 | ||
96 | //____________________________________________________________ | |
97 | AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const AliHFEtaggedTrackAnalysis &ref): | |
98 | TNamed(ref) | |
99 | , fVarManager(ref.fVarManager) | |
100 | , fContainer(NULL) | |
101 | , fPID(ref.fPID) | |
102 | , fPIDqa(ref.fPIDqa) | |
103 | , fCuts(ref.fCuts) | |
104 | , fCFM(ref.fCFM) | |
105 | , fQAhistos(ref.fQAhistos) | |
106 | , fCentralityF(ref.fCentralityF) | |
107 | , fClean(ref.fClean) | |
108 | , fMagneticField(ref.fMagneticField) | |
109 | , fVariablesTRD(ref.fVariablesTRD) | |
110 | , fIsPbPb(ref.fIsPbPb) | |
111 | { | |
112 | // | |
113 | // Copy constructor | |
114 | // | |
115 | if(ref.fContainer){ | |
116 | InitContainer(); | |
117 | } | |
118 | SetBit(kIsOwner, kFALSE); | |
119 | } | |
120 | ||
121 | //____________________________________________________________ | |
122 | AliHFEtaggedTrackAnalysis &AliHFEtaggedTrackAnalysis::operator=(const AliHFEtaggedTrackAnalysis &ref){ | |
123 | // | |
124 | // Assignment operator | |
125 | // | |
126 | TNamed::operator=(ref); | |
127 | if(&ref != this){ | |
128 | fVarManager = ref.fVarManager; | |
129 | fPID = ref.fPID; | |
130 | fPIDqa = ref.fPIDqa; | |
131 | fCuts = ref.fCuts; | |
132 | fCFM = ref.fCFM; | |
133 | fQAhistos = ref.fQAhistos; | |
134 | fCentralityF = ref.fCentralityF; | |
135 | fClean = ref.fClean; | |
136 | fMagneticField = ref.fMagneticField; | |
137 | fVariablesTRD = ref.fVariablesTRD; | |
138 | fIsPbPb = ref.fIsPbPb; | |
139 | ||
140 | if(ref.fContainer) InitContainer(); | |
141 | ||
142 | SetBit(kIsOwner, kFALSE); | |
143 | SetBit(kIsOwnerCuts, kFALSE); | |
144 | } | |
145 | return *this; | |
146 | } | |
147 | ||
148 | //____________________________________________________________ | |
149 | AliHFEtaggedTrackAnalysis::~AliHFEtaggedTrackAnalysis(){ | |
150 | // | |
151 | // Destructor | |
152 | // | |
153 | if(TestBit(kIsOwner)){ | |
154 | if(fVarManager) delete fVarManager; | |
155 | if(fPIDqa) delete fPIDqa; | |
156 | } | |
157 | if(TestBit(kIsOwnerCuts)) delete fCuts; | |
158 | if(fContainer) delete fContainer; | |
159 | } | |
160 | ||
161 | //____________________________________________________________ | |
162 | void AliHFEtaggedTrackAnalysis::InitContainer(){ | |
163 | // | |
164 | // Initialize output container | |
165 | // | |
166 | if(fContainer) return; | |
167 | Int_t nStepPID = 0; | |
168 | if(!fPID){ | |
169 | AliError("No PID set - defining container without PID steps"); | |
170 | } else { | |
171 | nStepPID = fPID->GetNumberOfPIDdetectors(); | |
172 | } | |
173 | fContainer = new AliHFEcontainer("containerV0"); | |
174 | fVarManager->DefineVariables(fContainer); | |
175 | fContainer->CreateContainer("taggedTrackContainerReco", "Container for Tagged Tracks", AliHFEcuts::kNcutStepsRecTrack + nStepPID); | |
176 | ||
177 | // Set the step titles | |
178 | for(Int_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++) | |
179 | fContainer->SetStepTitle("taggedTrackContainerReco", AliHFEcuts::RecoCutName(istep), istep); | |
180 | for(Int_t ipid = 0; ipid < nStepPID; ipid++){ | |
181 | fContainer->SetStepTitle("taggedTrackContainerReco", fPID->SortedDetectorName(ipid), ipid + AliHFEcuts::kNcutStepsRecTrack); | |
182 | } | |
183 | fCFM->SetParticleContainer(fContainer->GetCFContainer("taggedTrackContainerReco")); | |
184 | ||
185 | // temporarily special QA | |
186 | fQAhistos = new AliHFEcollection("taggedTrackQA", "Special QA for the TaggedTrackAnalysis"); | |
187 | fQAhistos->CreateTH2F("TPCclusters2_1", "TPCclusterInfo for findable clusters for 2 neighbors", 30, 0.1, 10., 162, 0., 161.); | |
188 | fQAhistos->CreateTH2F("TPCclusters2_0", "TPCclusterInfo for the ratio for 2 neighbors", 30, 0.1, 10., 110, 0., 1.1); | |
189 | fQAhistos->CreateTH2F("TPCncls", "TPC number of clusters", 30, 0.1, 10., 162, 0., 161.); | |
190 | fQAhistos->CreateTH2F("TPCclr", "TPC cluster ratio", 30, 0.1, 10., 110, 0., 1.1); | |
191 | fQAhistos->BinLogAxis("TPCclusters2_1", 0); // pt axis in logarithmic binning | |
192 | fQAhistos->BinLogAxis("TPCclusters2_0", 0); // pt axis in logarithmic binning | |
193 | fQAhistos->BinLogAxis("TPCncls", 0); // pt axis in logarithmic binning | |
194 | fQAhistos->BinLogAxis("TPCclr", 0); // pt axis in logarithmic binning | |
195 | } | |
196 | ||
197 | //____________________________________________________________ | |
198 | void AliHFEtaggedTrackAnalysis::ProcessTrack(AliVTrack *track, Int_t abinitioPID){ | |
199 | // | |
200 | // Filter tracks tagged by V0 PID class | |
201 | // | |
202 | // | |
203 | fVarManager->NewTrack(track, NULL, fCentralityF, abinitioPID, kTRUE); | |
204 | ||
205 | ||
206 | ||
207 | // Phi Angle | |
208 | if(fVariablesTRD) { | |
209 | AliESDtrack *esdtrackc = dynamic_cast<AliESDtrack *>(track); | |
210 | if(esdtrackc) { | |
211 | ||
212 | const AliExternalTrackParam *trueparam = NULL; | |
213 | if(esdtrackc->GetOuterParam()) { | |
214 | trueparam = esdtrackc->GetOuterParam(); | |
215 | fVarManager->NewTrack((AliVParticle *)trueparam, NULL, fCentralityF, abinitioPID, kTRUE); | |
216 | } | |
217 | else return; | |
218 | } | |
219 | } | |
220 | ||
221 | ||
222 | // Try a loose cut to reject pion contamination | |
223 | if(fClean) { | |
224 | if(abinitioPID == AliPID::kElectron){ | |
225 | AliHFEpidTPC *pidTPC = (AliHFEpidTPC *) fPID->GetDetPID(AliHFEpid::kTPCpid); | |
226 | if(pidTPC) { | |
227 | Double_t numberOfSigmaTPC = pidTPC->GetPIDResponse()->NumberOfSigmasTPC(track,AliPID::kElectron); | |
228 | if(numberOfSigmaTPC < -5) return; | |
229 | } | |
230 | } | |
231 | } | |
232 | // temporarily monitoring of the number of TPC clusters | |
233 | AliESDtrack *esdtrack = dynamic_cast<AliESDtrack *>(track); | |
234 | if(esdtrack && abinitioPID == AliPID::kElectron){ | |
235 | if((esdtrack->GetITSClusterMap() & (BIT(0) | BIT(1))) && (TMath::Abs(esdtrack->Eta()) < 0.8)){ // Only select quasi-primary tracks | |
236 | fQAhistos->Fill("TPCclusters2_1", track->Pt(), esdtrack->GetTPCClusterInfo(2,1)); | |
237 | fQAhistos->Fill("TPCclusters2_0", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? esdtrack->GetTPCClusterInfo(2,1)/esdtrack->GetTPCNclsF() : 0.); | |
238 | fQAhistos->Fill("TPCncls", track->Pt(), esdtrack->GetTPCNcls()); | |
239 | fQAhistos->Fill("TPCclr", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? static_cast<Double_t>(esdtrack->GetTPCNcls())/static_cast<Double_t>(esdtrack->GetTPCNclsF()) : 0.); | |
240 | } | |
241 | } | |
242 | ||
243 | Int_t offset = AliHFEcuts::kStepRecKineITSTPC; | |
244 | fVarManager->FillContainer(fCFM->GetParticleContainer(), 0); // Fill Container without filtering | |
245 | ||
246 | Bool_t survived = kTRUE; | |
247 | for(Int_t icut = AliHFEcuts::kStepRecKineITSTPC; icut <= AliHFEcuts::kStepHFEcutsTRD; icut++){ | |
248 | AliDebug(2, Form("Checking cut %d for species %s", icut + AliHFEcuts::kNcutStepsMCTrack, AliPID::ParticleName(abinitioPID))); | |
249 | /* | |
250 | TObjArray *cutlist = fCFM->GetParticleCutsList(icut + AliHFEcuts::kNcutStepsMCTrack); | |
251 | if(!cutlist){ | |
252 | AliDebug(2, Form("No cuts for step %d set", icut + AliHFEcuts::kNcutStepsMCTrack)); | |
253 | } else { | |
254 | AliDebug(2, Form("Cut Collection %s", cutlist->GetName())); | |
255 | TIter cutiter(cutlist); | |
256 | AliCFCutBase *cut; | |
257 | while((cut = dynamic_cast<AliCFCutBase *>(cutiter()))){ | |
258 | AliDebug(2, Form("Cut object %s, QA on? %s", cut->GetName(), cut->IsQAOn() ? "yes" : "no")); | |
259 | } | |
260 | } | |
261 | */ | |
262 | //if(!fCFM->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){ | |
263 | if(!fCuts->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){ | |
264 | AliDebug(2, Form("Track didn' survive cut %d", icut + AliHFEcuts::kNcutStepsMCTrack)); | |
265 | survived = kFALSE; | |
266 | break; | |
267 | } | |
268 | AliDebug(2, Form("Cut passed, filling container %d", icut - offset + 1)); | |
269 | fVarManager->FillContainer(fCFM->GetParticleContainer(), icut - offset + 1); | |
270 | } | |
271 | ||
272 | if(survived){ | |
273 | AliDebug(2, "Use track in the PID"); | |
274 | // Apply PID | |
275 | AliHFEpidObject hfetrack; | |
276 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); | |
277 | hfetrack.SetRecTrack(track); | |
278 | hfetrack.SetAbInitioPID(abinitioPID); | |
279 | hfetrack.SetCentrality(fCentralityF); | |
280 | if(fIsPbPb) hfetrack.SetPbPb(); | |
281 | else hfetrack.SetPP(); | |
282 | fPID->SetVarManager(fVarManager); | |
283 | fPID->IsSelected(&hfetrack, fContainer, "taggedTrackContainer", fPIDqa); | |
284 | } | |
285 | } | |
286 | ||
287 | //____________________________________________________________ | |
288 | void AliHFEtaggedTrackAnalysis::SetCuts(AliHFEcuts *cuts){ | |
289 | // | |
290 | // Set HFE cuts to be used to filter the tagged tracks | |
291 | // | |
292 | if(!cuts){ | |
293 | AliWarning("Nob cuts provided - Using standard cuts"); | |
294 | fCuts = new AliHFEcuts("cutsTagged", "HFE Cuts for the V0 tagged tracks"); | |
295 | fCuts->CreateStandardCuts(); | |
296 | fCuts->SetQAOn(); | |
297 | SetBit(kIsOwnerCuts); | |
298 | } else { | |
299 | AliDebug(1, "Setting single track cuts"); | |
300 | fCuts = cuts; | |
301 | } | |
302 | const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack; | |
303 | printf("Setting Number of cut steps %d\n", kNcutSteps); | |
304 | fCFM->SetNStepParticle(kNcutSteps); | |
305 | for(Int_t istep = 0; istep < kNcutSteps; istep++) | |
306 | fCFM->SetParticleCutsList(istep, NULL); | |
307 | ||
308 | fCuts->Initialize(fCFM); | |
309 | } | |
310 | ||
311 | //____________________________________________________________ | |
312 | void AliHFEtaggedTrackAnalysis::SetPID(AliHFEpid *pid){ | |
313 | // | |
314 | // Set the PID and initialize the the QA manager | |
315 | // | |
316 | fPID = pid; | |
317 | fPIDqa->Initialize(fPID); | |
318 | } | |
319 | ||
320 | //____________________________________________________________ | |
321 | TList *AliHFEtaggedTrackAnalysis::GetPIDQA() const { | |
322 | // | |
323 | // return PID QA | |
324 | // | |
325 | return fPIDqa->MakeList("PIDqa_taggedTracks"); | |
326 | } | |
327 | ||
328 | //____________________________________________________________ | |
329 | TList *AliHFEtaggedTrackAnalysis::GetCutQA() const { | |
330 | // | |
331 | // return Cut QA | |
332 | // | |
333 | return fCuts->GetQAhistograms(); | |
334 | } | |
335 | ||
336 |