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