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