]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-2009, 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 | ///////////////////////////////////////////////////////////// | |
17 | // | |
18 | // AliAnalysisTaskSE for D0 candidates invariant mass histogram | |
19 | // and comparison with the MC truth and cut variables distributions. | |
20 | // | |
21 | // Authors: A.Dainese, andrea.dainese@lnl.infn.it | |
22 | // Chiara Bianchin, chiara.bianchin@pd.infn.it (invariant mass) | |
23 | // Carmelo Di Giglio, carmelo.digiglio@ba.infn.it (like sign) | |
24 | ///////////////////////////////////////////////////////////// | |
25 | ||
26 | #include <Riostream.h> | |
27 | #include <TClonesArray.h> | |
28 | #include <TCanvas.h> | |
29 | #include <TNtuple.h> | |
30 | #include <TList.h> | |
31 | #include <TH1F.h> | |
32 | #include <TH2F.h> | |
33 | #include <TDatabasePDG.h> | |
34 | ||
35 | #include <AliAnalysisDataSlot.h> | |
36 | #include <AliAnalysisDataContainer.h> | |
37 | #include "AliAnalysisManager.h" | |
38 | #include "AliESDtrack.h" | |
39 | #include "AliVertexerTracks.h" | |
40 | #include "AliAODHandler.h" | |
41 | #include "AliAODEvent.h" | |
42 | #include "AliAODVertex.h" | |
43 | #include "AliAODTrack.h" | |
44 | #include "AliAODMCHeader.h" | |
45 | #include "AliAODMCParticle.h" | |
46 | #include "AliAODRecoDecayHF2Prong.h" | |
47 | #include "AliAODRecoCascadeHF.h" | |
48 | #include "AliAnalysisVertexingHF.h" | |
49 | #include "AliAnalysisTaskSE.h" | |
50 | #include "AliAnalysisTaskSED0Mass.h" | |
51 | #include "AliNormalizationCounter.h" | |
52 | ||
53 | ClassImp(AliAnalysisTaskSED0Mass) | |
54 | ||
55 | ||
56 | //________________________________________________________________________ | |
57 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(): | |
58 | AliAnalysisTaskSE(), | |
59 | fOutputMass(0), | |
60 | fDistr(0), | |
61 | fNentries(0), | |
62 | fCuts(0), | |
63 | fArray(0), | |
64 | fReadMC(0), | |
65 | fCutOnDistr(0), | |
66 | fUsePid4Distr(0), | |
67 | fCounter(0), | |
68 | fNPtBins(1), | |
69 | fLsNormalization(1.), | |
70 | fFillOnlyD0D0bar(0) | |
71 | ||
72 | ||
73 | { | |
74 | // Default constructor | |
75 | } | |
76 | ||
77 | //________________________________________________________________________ | |
78 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(const char *name,AliRDHFCutsD0toKpi* cuts): | |
79 | AliAnalysisTaskSE(name), | |
80 | fOutputMass(0), | |
81 | fDistr(0), | |
82 | fNentries(0), | |
83 | fCuts(0), | |
84 | fArray(0), | |
85 | fReadMC(0), | |
86 | fCutOnDistr(0), | |
87 | fUsePid4Distr(0), | |
88 | fCounter(0), | |
89 | fNPtBins(1), | |
90 | fLsNormalization(1.), | |
91 | fFillOnlyD0D0bar(0) | |
92 | ||
93 | { | |
94 | // Default constructor | |
95 | ||
96 | fNPtBins=cuts->GetNPtBins(); | |
97 | // fTotPosPairs=new Int_t[fNPtBins]; | |
98 | // fTotNegPairs=new Int_t[fNPtBins]; | |
99 | // for(Int_t i=0;i<fNPtBins;i++) {fTotPosPairs[i]=0; fTotNegPairs[i]=0;} | |
100 | ||
101 | fCuts=cuts; | |
102 | ||
103 | // Output slot #1 writes into a TList container (mass with cuts) | |
104 | DefineOutput(1,TList::Class()); //My private output | |
105 | // Output slot #2 writes into a TList container (distributions) | |
106 | DefineOutput(2,TList::Class()); //My private output | |
107 | // Output slot #3 writes into a TH1F container (number of events) | |
108 | DefineOutput(3,TH1F::Class()); //My private output | |
109 | // Output slot #4 writes into a TList container (cuts) | |
110 | DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output | |
111 | // Output slot #5 writes Normalization Counter | |
112 | DefineOutput(5,AliNormalizationCounter::Class()); | |
113 | } | |
114 | ||
115 | //________________________________________________________________________ | |
116 | AliAnalysisTaskSED0Mass::~AliAnalysisTaskSED0Mass() | |
117 | { | |
118 | if (fOutputMass) { | |
119 | delete fOutputMass; | |
120 | fOutputMass = 0; | |
121 | } | |
122 | if (fDistr) { | |
123 | delete fDistr; | |
124 | fDistr = 0; | |
125 | } | |
126 | if (fCuts) { | |
127 | delete fCuts; | |
128 | fCuts = 0; | |
129 | } | |
130 | if (fNentries){ | |
131 | delete fNentries; | |
132 | fNentries = 0; | |
133 | } | |
134 | if(fCounter){ | |
135 | delete fCounter; | |
136 | fCounter=0; | |
137 | } | |
138 | ||
139 | } | |
140 | ||
141 | //________________________________________________________________________ | |
142 | void AliAnalysisTaskSED0Mass::Init() | |
143 | { | |
144 | // Initialization | |
145 | ||
146 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n"); | |
147 | ||
148 | ||
149 | AliRDHFCutsD0toKpi* copyfCuts=new AliRDHFCutsD0toKpi(*fCuts); | |
150 | const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName(); | |
151 | copyfCuts->SetName(nameoutput); | |
152 | // Post the data | |
153 | PostData(4,copyfCuts); | |
154 | ||
155 | ||
156 | return; | |
157 | } | |
158 | ||
159 | //________________________________________________________________________ | |
160 | void AliAnalysisTaskSED0Mass::UserCreateOutputObjects() | |
161 | { | |
162 | ||
163 | // Create the output container | |
164 | // | |
165 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::UserCreateOutputObjects() \n"); | |
166 | ||
167 | // Several histograms are more conveniently managed in a TList | |
168 | fOutputMass = new TList(); | |
169 | fOutputMass->SetOwner(); | |
170 | fOutputMass->SetName("listMass"); | |
171 | ||
172 | fDistr = new TList(); | |
173 | fDistr->SetOwner(); | |
174 | fDistr->SetName("distributionslist"); | |
175 | ||
176 | TString nameMass=" ",nameSgn27=" ",nameSgn=" ", nameBkg=" ", nameRfl=" ",nameMassNocutsS =" ",nameMassNocutsB =" ", namedistr=" "; | |
177 | ||
178 | for(Int_t i=0;i<fCuts->GetNPtBins();i++){ | |
179 | ||
180 | nameMass="histMass_"; | |
181 | nameMass+=i; | |
182 | nameSgn27="histSgn27_"; | |
183 | nameSgn27+=i; | |
184 | nameSgn="histSgn_"; | |
185 | nameSgn+=i; | |
186 | nameBkg="histBkg_"; | |
187 | nameBkg+=i; | |
188 | nameRfl="histRfl_"; | |
189 | nameRfl+=i; | |
190 | nameMassNocutsS="hMassS_"; | |
191 | nameMassNocutsS+=i; | |
192 | nameMassNocutsB="hMassB_"; | |
193 | nameMassNocutsB+=i; | |
194 | ||
195 | //histograms of cut variable distributions | |
196 | ||
197 | // pT | |
198 | namedistr="hptpiS_"; | |
199 | namedistr+=i; | |
200 | TH1F *hptpiS = new TH1F(namedistr.Data(), "P_{T} distribution (pions);p_{T} [GeV/c]",200,0.,8.); | |
201 | ||
202 | namedistr="hptKS_"; | |
203 | namedistr+=i; | |
204 | TH1F *hptKS = new TH1F(namedistr.Data(), "P_{T} distribution (kaons);p_{T} [GeV/c]",200,0.,8.); | |
205 | ||
206 | namedistr="hptB_"; | |
207 | namedistr+=i; | |
208 | TH1F *hptB = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); | |
209 | ||
210 | // pT no mass cut | |
211 | // namedistr="hptpiSnoMcut_"; | |
212 | // namedistr+=i; | |
213 | // TH1F *hptpiSnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution (pions);p_{T} [GeV/c]",200,0.,8.); | |
214 | ||
215 | // namedistr="hptKSnoMcut_"; | |
216 | // namedistr+=i; | |
217 | // TH1F *hptKSnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution (kaons);p_{T} [GeV/c]",200,0.,8.); | |
218 | ||
219 | // namedistr="hptB1prongnoMcut_"; | |
220 | // namedistr+=i; | |
221 | // TH1F *hptB1pnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); | |
222 | ||
223 | // namedistr="hptB2prongsnoMcut_"; | |
224 | // namedistr+=i; | |
225 | // TH1F *hptB2pnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); | |
226 | ||
227 | // fDistr->Add(hptpiSnoMcut); | |
228 | // fDistr->Add(hptKSnoMcut); | |
229 | // fDistr->Add(hptB1pnoMcut); | |
230 | // fDistr->Add(hptB2pnoMcut); | |
231 | ||
232 | ||
233 | // dca | |
234 | namedistr="hdcaS_"; | |
235 | namedistr+=i; | |
236 | TH1F *hdcaS = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); | |
237 | namedistr="hdcaB_"; | |
238 | namedistr+=i; | |
239 | TH1F *hdcaB = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); | |
240 | ||
241 | // costhetastar | |
242 | namedistr="hcosthetastarS_"; | |
243 | namedistr+=i; | |
244 | TH1F *hcosthetastarS = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); | |
245 | namedistr="hcosthetastarB_"; | |
246 | namedistr+=i; | |
247 | TH1F *hcosthetastarB = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); | |
248 | ||
249 | // impact parameter | |
250 | namedistr="hd0piS_"; | |
251 | namedistr+=i; | |
252 | TH1F *hd0piS = new TH1F(namedistr.Data(), "Impact parameter distribution (pions);d0(#pi) [cm]",200,-0.1,0.1); | |
253 | ||
254 | namedistr="hd0KS_"; | |
255 | namedistr+=i; | |
256 | TH1F *hd0KS = new TH1F(namedistr.Data(), "Impact parameter distribution (kaons);d0(K) [cm]",200,-0.1,0.1); | |
257 | ||
258 | namedistr="hd0B_"; | |
259 | namedistr+=i; | |
260 | TH1F *hd0B = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); | |
261 | ||
262 | namedistr="hd0p0B_"; | |
263 | namedistr+=i; | |
264 | TH1F *hd0p0B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.1,0.1); | |
265 | ||
266 | namedistr="hd0p1B_"; | |
267 | namedistr+=i; | |
268 | TH1F *hd0p1B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong -);d0 [cm]",200,-0.1,0.1); | |
269 | ||
270 | namedistr="hd0moresB_"; | |
271 | namedistr+=i; | |
272 | TH1F *hd0moresB = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); | |
273 | ||
274 | namedistr="hd0d0moresB_"; | |
275 | namedistr+=i; | |
276 | TH1F *hd0d0moresB = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.001,0.001); | |
277 | ||
278 | namedistr="hd0d0S_"; | |
279 | namedistr+=i; | |
280 | TH1F *hd0d0S = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
281 | namedistr="hd0d0B_"; | |
282 | namedistr+=i; | |
283 | TH1F *hd0d0B = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
284 | ||
285 | //decay lenght | |
286 | namedistr="hdeclS_"; | |
287 | namedistr+=i; | |
288 | TH1F *hdeclengthS = new TH1F(namedistr.Data(), "Decay Length distribution;Decay Length [cm]",200,0,0.15); | |
289 | ||
290 | namedistr="hdeclB_"; | |
291 | namedistr+=i; | |
292 | TH1F *hdeclengthB = new TH1F(namedistr.Data(), "Decay Length distribution;Decay Length [cm]",200,0,0.15); | |
293 | ||
294 | namedistr="hnormdeclS_"; | |
295 | namedistr+=i; | |
296 | TH1F *hnormdeclengthS = new TH1F(namedistr.Data(), "Normalized Decay Length distribution;Decay Length/Err ",200,0,6.); | |
297 | ||
298 | namedistr="hnormdeclB_"; | |
299 | namedistr+=i; | |
300 | TH1F *hnormdeclengthB = new TH1F(namedistr.Data(), "Normalized Decay Length distribution;Decay Length/Err ",200,0,6.); | |
301 | ||
302 | // costhetapoint | |
303 | namedistr="hcosthetapointS_"; | |
304 | namedistr+=i; | |
305 | TH1F *hcosthetapointS = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
306 | namedistr="hcosthetapointB_"; | |
307 | namedistr+=i; | |
308 | TH1F *hcosthetapointB = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
309 | ||
310 | namedistr="hcosthetapointmoresB_"; | |
311 | namedistr+=i; | |
312 | TH1F *hcosthetapointmoresB = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
313 | ||
314 | // costhetapoint vs d0 or d0d0 | |
315 | namedistr="hcosthpointd0S_"; | |
316 | namedistr+=i; | |
317 | TH2F *hcosthpointd0S= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0};cos#theta_{Point};d_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
318 | ||
319 | namedistr="hcosthpointd0B_"; | |
320 | namedistr+=i; | |
321 | TH2F *hcosthpointd0B= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0};cos#theta_{Point};d_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
322 | ||
323 | namedistr="hcosthpointd0d0S_"; | |
324 | namedistr+=i; | |
325 | TH2F *hcosthpointd0d0S= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0}#timesd_{0};cos#theta_{Point};d_{0}#timesd_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
326 | namedistr="hcosthpointd0d0B_"; | |
327 | namedistr+=i; | |
328 | TH2F *hcosthpointd0d0B= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0}#timesd_{0};cos#theta_{Point};d_{0}#timesd_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
329 | ||
330 | fDistr->Add(hptpiS); | |
331 | fDistr->Add(hptKS); | |
332 | fDistr->Add(hptB); | |
333 | ||
334 | fDistr->Add(hdcaS); | |
335 | fDistr->Add(hdcaB); | |
336 | ||
337 | fDistr->Add(hd0piS); | |
338 | fDistr->Add(hd0KS); | |
339 | fDistr->Add(hd0B); | |
340 | fDistr->Add(hd0p0B); | |
341 | fDistr->Add(hd0p1B); | |
342 | fDistr->Add(hd0moresB); | |
343 | ||
344 | fDistr->Add(hd0d0S); | |
345 | fDistr->Add(hd0d0B); | |
346 | fDistr->Add(hd0d0moresB); | |
347 | ||
348 | fDistr->Add(hcosthetastarS); | |
349 | fDistr->Add(hcosthetastarB); | |
350 | ||
351 | fDistr->Add(hcosthetapointS); | |
352 | fDistr->Add(hcosthetapointB); | |
353 | fDistr->Add(hcosthetapointmoresB); | |
354 | ||
355 | fDistr->Add(hdeclengthS); | |
356 | fDistr->Add(hdeclengthB); | |
357 | ||
358 | fDistr->Add(hnormdeclengthS); | |
359 | fDistr->Add(hnormdeclengthB); | |
360 | ||
361 | fDistr->Add(hcosthpointd0S); | |
362 | fDistr->Add(hcosthpointd0B); | |
363 | ||
364 | fDistr->Add(hcosthpointd0d0S); | |
365 | fDistr->Add(hcosthpointd0d0B); | |
366 | ||
367 | //histograms filled only when the secondary vertex is recalculated w/o the daughter tracks (as requested in the cut object) | |
368 | ||
369 | if(fCuts->GetIsPrimaryWithoutDaughters()){ | |
370 | namedistr="hd0vmoresB_"; | |
371 | namedistr+=i; | |
372 | TH1F *hd0vmoresB = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); | |
373 | ||
374 | namedistr="hd0d0vmoresB_"; | |
375 | namedistr+=i; | |
376 | TH1F *hd0d0vmoresB = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.001,0.001); | |
377 | ||
378 | ||
379 | namedistr="hd0vpiS_"; | |
380 | namedistr+=i; | |
381 | TH1F *hd0vpiS = new TH1F(namedistr.Data(), "Impact parameter distribution (pions)(vtx w/o these tracks);d0(#pi) [cm]",200,-0.1,0.1); | |
382 | ||
383 | namedistr="hd0vKS_"; | |
384 | namedistr+=i; | |
385 | TH1F *hd0vKS = new TH1F(namedistr.Data(), "Impact parameter distribution (kaons) (vtx w/o these tracks);d0(K) [cm]",200,-0.1,0.1); | |
386 | namedistr="hd0vB_"; | |
387 | namedistr+=i; | |
388 | TH1F *hd0vB = new TH1F(namedistr.Data(), "Impact parameter distribution (vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
389 | ||
390 | namedistr="hd0vp0B_"; | |
391 | namedistr+=i; | |
392 | TH1F *hd0vp0B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong + ** vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
393 | ||
394 | namedistr="hd0vp1B_"; | |
395 | namedistr+=i; | |
396 | TH1F *hd0vp1B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong - ** vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
397 | ||
398 | ||
399 | namedistr="hd0d0vS_"; | |
400 | namedistr+=i; | |
401 | TH1F *hd0d0vS = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution (vtx w/o these tracks);d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
402 | namedistr="hd0d0vB_"; | |
403 | namedistr+=i; | |
404 | TH1F *hd0d0vB = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution (vtx w/o these tracks);d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
405 | ||
406 | ||
407 | namedistr="hdeclvS_"; | |
408 | namedistr+=i; | |
409 | TH1F *hdeclengthvS = new TH1F(namedistr.Data(), "Decay Length distribution (vtx w/o tracks);Decay Length [cm]",200,0,0.6); | |
410 | ||
411 | namedistr="hdeclvB_"; | |
412 | namedistr+=i; | |
413 | TH1F *hdeclengthvB = new TH1F(namedistr.Data(), "Decay Length distribution (vtx w/o tracks);Decay Length [cm]",200,0,0.6); | |
414 | ||
415 | namedistr="hnormdeclvS_"; | |
416 | namedistr+=i; | |
417 | TH1F *hnormdeclengthvS = new TH1F(namedistr.Data(), "Normalized Decay Length distribution (vtx w/o tracks);Decay Length/Err ",200,0,10.); | |
418 | ||
419 | namedistr="hnormdeclvB_"; | |
420 | namedistr+=i; | |
421 | TH1F *hnormdeclengthvB = new TH1F(namedistr.Data(), "Normalized Decay Length distribution (vtx w/o tracks);Decay Length/Err ",200,0,10.); | |
422 | ||
423 | ||
424 | ||
425 | fDistr->Add(hd0vpiS); | |
426 | fDistr->Add(hd0vKS); | |
427 | fDistr->Add(hd0vB); | |
428 | fDistr->Add(hd0vp0B); | |
429 | fDistr->Add(hd0vp1B); | |
430 | fDistr->Add(hd0vmoresB); | |
431 | ||
432 | fDistr->Add(hd0d0vS); | |
433 | fDistr->Add(hd0d0vB); | |
434 | fDistr->Add(hd0d0vmoresB); | |
435 | ||
436 | fDistr->Add(hdeclengthvS); | |
437 | fDistr->Add(hdeclengthvB); | |
438 | ||
439 | fDistr->Add(hnormdeclengthvS); | |
440 | fDistr->Add(hnormdeclengthvB); | |
441 | } | |
442 | ||
443 | //histograms of invariant mass distributions | |
444 | ||
445 | TH1F* tmpMt = new TH1F(nameMass.Data(),"D^{0} invariant mass; M [GeV]; Entries",200,1.5648,2.1648); | |
446 | TH1F *tmpMl=(TH1F*)tmpMt->Clone(); | |
447 | tmpMt->Sumw2(); | |
448 | tmpMl->Sumw2(); | |
449 | ||
450 | //to compare with AliAnalysisTaskCharmFraction | |
451 | // TH1F* tmpS27t = new TH1F(nameSgn27.Data(),"D^{0} invariant mass in M(D^{0}) +/- 27 MeV - MC; M [GeV]; Entries",200,1.5648,2.1648); | |
452 | // TH1F *tmpS27l=(TH1F*)tmpS27t->Clone(); | |
453 | // tmpS27t->Sumw2(); | |
454 | // tmpS27l->Sumw2(); | |
455 | ||
456 | //distribution w/o cuts | |
457 | // TH1F* tmpMS = new TH1F(nameMassNocutsS.Data(),"D^{0} invariant mass; M [GeV]; Entries",300,0.7,3.); | |
458 | TH1F* tmpMS = new TH1F(nameMassNocutsS.Data(),"D^{0} invariant mass; M [GeV]; Entries",300,1.5648,2.1648); //range (MD0-300MeV, mD0 + 300MeV) | |
459 | TH1F *tmpMB=(TH1F*)tmpMS->Clone(); | |
460 | tmpMB->SetName(nameMassNocutsB.Data()); | |
461 | tmpMS->Sumw2(); | |
462 | tmpMB->Sumw2(); | |
463 | ||
464 | //MC signal and background | |
465 | TH1F* tmpSt = new TH1F(nameSgn.Data(), "D^{0} invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); | |
466 | TH1F *tmpSl=(TH1F*)tmpSt->Clone(); | |
467 | tmpSt->Sumw2(); | |
468 | tmpSl->Sumw2(); | |
469 | ||
470 | TH1F* tmpBt = new TH1F(nameBkg.Data(), "Background invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); | |
471 | TH1F *tmpBl=(TH1F*)tmpBt->Clone(); | |
472 | tmpBt->Sumw2(); | |
473 | tmpBl->Sumw2(); | |
474 | ||
475 | //Reflection: histo filled with D0Mass which pass the cut (also) as D0bar and with D0bar which pass (also) the cut as D0 | |
476 | TH1F* tmpRt = new TH1F(nameRfl.Data(), "Reflected signal invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); | |
477 | TH1F *tmpRl=(TH1F*)tmpRt->Clone(); | |
478 | tmpRt->Sumw2(); | |
479 | tmpRl->Sumw2(); | |
480 | // printf("Created histograms %s\t%s\t%s\t%s\n",tmpM->GetName(),tmpS->GetName(),tmpB->GetName(),tmpR->GetName()); | |
481 | ||
482 | fOutputMass->Add(tmpMt); | |
483 | fOutputMass->Add(tmpSt); | |
484 | // fOutputMass->Add(tmpS27t); | |
485 | fOutputMass->Add(tmpBt); | |
486 | fOutputMass->Add(tmpRt); | |
487 | ||
488 | fDistr->Add(tmpMS); | |
489 | fDistr->Add(tmpMB); | |
490 | ||
491 | ||
492 | } | |
493 | ||
494 | if(fArray==1){ | |
495 | namedistr="hpospair"; | |
496 | TH1F* hpospair=new TH1F(namedistr.Data(),"Number of positive pairs",2*fCuts->GetNPtBins(),-0.5,fCuts->GetNPtBins()-0.5); | |
497 | namedistr="hnegpair"; | |
498 | TH1F* hnegpair=new TH1F(namedistr.Data(),"Number of negative pairs",fCuts->GetNPtBins(),-0.5,2*fCuts->GetNPtBins()-0.5); | |
499 | fDistr->Add(hpospair); | |
500 | fDistr->Add(hnegpair); | |
501 | } | |
502 | ||
503 | const char* nameoutput=GetOutputSlot(3)->GetContainer()->GetName(); | |
504 | ||
505 | fNentries=new TH1F(nameoutput, "Integral(1,2) = number of AODs *** Integral(2,3) = number of candidates selected with cuts *** Integral(3,4) = number of D0 selected with cuts *** Integral(4,5) = events with good vertex *** Integral(5,6) = pt out of bounds", 15,-0.5,14.5); | |
506 | ||
507 | fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal"); | |
508 | fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)"); | |
509 | fNentries->GetXaxis()->SetBinLabel(3,"nD0Selected"); | |
510 | fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS"); | |
511 | fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1"); | |
512 | fNentries->GetXaxis()->SetBinLabel(6,"no daughter"); | |
513 | fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)"); | |
514 | fNentries->GetXaxis()->SetBinLabel(8,"PID=0"); | |
515 | fNentries->GetXaxis()->SetBinLabel(9,"PID=1"); | |
516 | fNentries->GetXaxis()->SetBinLabel(10,"PID=2"); | |
517 | fNentries->GetXaxis()->SetBinLabel(11,"PID=3"); | |
518 | fNentries->GetXaxis()->SetBinLabel(12,"K"); | |
519 | fNentries->GetXaxis()->SetBinLabel(13,"Lambda"); | |
520 | fNentries->GetXaxis()->SetBinLabel(14,"Pile-up Rej"); | |
521 | fNentries->GetXaxis()->SetBinLabel(15,"N. of 0SMH"); | |
522 | fNentries->GetXaxis()->SetNdivisions(1,kFALSE); | |
523 | ||
524 | fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(5)->GetContainer()->GetName())); | |
525 | ||
526 | // Post the data | |
527 | PostData(1,fOutputMass); | |
528 | PostData(2,fDistr); | |
529 | PostData(3,fNentries); | |
530 | PostData(5,fCounter); | |
531 | return; | |
532 | } | |
533 | ||
534 | //________________________________________________________________________ | |
535 | void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) | |
536 | { | |
537 | // Execute analysis for current event: | |
538 | // heavy flavor candidates association to MC truth | |
539 | //cout<<"I'm in UserExec"<<endl; | |
540 | ||
541 | ||
542 | //cuts order | |
543 | // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]); | |
544 | // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]); | |
545 | // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]); | |
546 | // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]); | |
547 | // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]); | |
548 | // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]); | |
549 | // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]); | |
550 | // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]); | |
551 | // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]); | |
552 | ||
553 | ||
554 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); | |
555 | ||
556 | TString bname; | |
557 | if(fArray==0){ //D0 candidates | |
558 | // load D0->Kpi candidates | |
559 | //cout<<"D0 candidates"<<endl; | |
560 | bname="D0toKpi"; | |
561 | } else { //LikeSign candidates | |
562 | // load like sign candidates | |
563 | //cout<<"LS candidates"<<endl; | |
564 | bname="LikeSign2Prong"; | |
565 | } | |
566 | ||
567 | TClonesArray *inputArray=0; | |
568 | ||
569 | if(!aod && AODEvent() && IsStandardAOD()) { | |
570 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
571 | // event in memory rather than the input (ESD) event. | |
572 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
573 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) | |
574 | // have to taken from the AOD event hold by the AliAODExtension | |
575 | AliAODHandler* aodHandler = (AliAODHandler*) | |
576 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
577 | ||
578 | if(aodHandler->GetExtensions()) { | |
579 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
580 | AliAODEvent* aodFromExt = ext->GetAOD(); | |
581 | inputArray=(TClonesArray*)aodFromExt->GetList()->FindObject(bname.Data()); | |
582 | } | |
583 | } else { | |
584 | inputArray=(TClonesArray*)aod->GetList()->FindObject(bname.Data()); | |
585 | } | |
586 | ||
587 | ||
588 | if(!inputArray) { | |
589 | printf("AliAnalysisTaskSED0Mass::UserExec: input branch not found!\n"); | |
590 | return; | |
591 | } | |
592 | ||
593 | // fix for temporary bug in ESDfilter | |
594 | // the AODs with null vertex pointer didn't pass the PhysSel | |
595 | if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return; | |
596 | ||
597 | ||
598 | TClonesArray *mcArray = 0; | |
599 | AliAODMCHeader *mcHeader = 0; | |
600 | ||
601 | if(fReadMC) { | |
602 | // load MC particles | |
603 | mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
604 | if(!mcArray) { | |
605 | printf("AliAnalysisTaskSED0Mass::UserExec: MC particles branch not found!\n"); | |
606 | return; | |
607 | } | |
608 | ||
609 | // load MC header | |
610 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
611 | if(!mcHeader) { | |
612 | printf("AliAnalysisTaskSED0Mass::UserExec: MC header branch not found!\n"); | |
613 | return; | |
614 | } | |
615 | } | |
616 | ||
617 | //printf("VERTEX Z %f %f\n",vtx1->GetZ(),mcHeader->GetVtxZ()); | |
618 | ||
619 | //histogram filled with 1 for every AOD | |
620 | fNentries->Fill(0); | |
621 | fCounter->StoreEvent(aod,fReadMC); | |
622 | ||
623 | // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL | |
624 | TString trigclass=aod->GetFiredTriggerClasses(); | |
625 | if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNentries->Fill(14); | |
626 | ||
627 | if(!fCuts->IsEventSelected(aod)) { | |
628 | if(fCuts->GetWhyRejection()==1) // rejected for pileup | |
629 | fNentries->Fill(13); | |
630 | return; | |
631 | } | |
632 | ||
633 | // AOD primary vertex | |
634 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
635 | ||
636 | Bool_t isGoodVtx=kFALSE; | |
637 | ||
638 | //vtx1->Print(); | |
639 | TString primTitle = vtx1->GetTitle(); | |
640 | if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) { | |
641 | isGoodVtx=kTRUE; | |
642 | fNentries->Fill(3); | |
643 | } | |
644 | ||
645 | // loop over candidates | |
646 | Int_t nInD0toKpi = inputArray->GetEntriesFast(); | |
647 | if(fDebug>2) printf("Number of D0->Kpi: %d\n",nInD0toKpi); | |
648 | ||
649 | // FILE *f=fopen("4display.txt","a"); | |
650 | // fprintf(f,"Number of D0->Kpi: %d\n",nInD0toKpi); | |
651 | Int_t nSelectedloose=0,nSelectedtight=0; | |
652 | for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) { | |
653 | //Int_t nPosPairs=0, nNegPairs=0; | |
654 | //cout<<"inside the loop"<<endl; | |
655 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArray->UncheckedAt(iD0toKpi); | |
656 | ||
657 | //check daughters | |
658 | if(!(d->GetDaughter(0) || d->GetDaughter(1))) { | |
659 | AliDebug(1,"at least one daughter not found!"); | |
660 | fNentries->Fill(5); | |
661 | continue; | |
662 | } | |
663 | ||
664 | // Bool_t unsetvtx=kFALSE; | |
665 | // if(!d->GetOwnPrimaryVtx()) { | |
666 | // d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
667 | // unsetvtx=kTRUE; | |
668 | // } | |
669 | ||
670 | ||
671 | //check reco daughter in acceptance | |
672 | /* | |
673 | Double_t eta0=d->EtaProng(0); | |
674 | Double_t eta1=d->EtaProng(1); | |
675 | */ | |
676 | if ( fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(421)) ) { | |
677 | //if( TMath::Abs(eta0)<0.9 && TMath::Abs(eta1)<0.9 ){ | |
678 | //apply cuts on tracks | |
679 | nSelectedloose++; | |
680 | Int_t isSelected = fCuts->IsSelected(d,AliRDHFCuts::kTracks); | |
681 | if(((AliAODTrack*)d->GetDaughter(0))->GetTPCNcls() < 70 || ((AliAODTrack*)d->GetDaughter(1))->GetTPCNcls() < 70) isSelected=kFALSE; | |
682 | if (!isSelected) continue; | |
683 | nSelectedtight++; | |
684 | fNentries->Fill(6); | |
685 | if(fDebug>2) cout<<"tracks selected"<<endl; | |
686 | ||
687 | Int_t ptbin=fCuts->PtBin(d->Pt()); | |
688 | if(ptbin==-1) {fNentries->Fill(4); continue;} //out of bounds | |
689 | FillVarHists(aod,d,mcArray,fCuts,fDistr); | |
690 | FillMassHists(aod,d,mcArray,fCuts,fOutputMass); | |
691 | } | |
692 | ||
693 | //if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
694 | } //end for prongs | |
695 | fCounter->StoreCandidates(aod,nSelectedloose,kTRUE); | |
696 | fCounter->StoreCandidates(aod,nSelectedtight,kFALSE); | |
697 | // Post the data | |
698 | PostData(1,fOutputMass); | |
699 | PostData(2,fDistr); | |
700 | PostData(3,fNentries); | |
701 | PostData(5,fCounter); | |
702 | return; | |
703 | } | |
704 | ||
705 | //____________________________________________________________________________ | |
706 | void AliAnalysisTaskSED0Mass::FillVarHists(AliAODEvent* aod,AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliRDHFCutsD0toKpi *cuts, TList *listout){ | |
707 | // | |
708 | // function used in UserExec to fill variable histograms: | |
709 | // | |
710 | ||
711 | //add distr here | |
712 | UInt_t pdgs[2]; | |
713 | ||
714 | Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
715 | pdgs[0]=211; | |
716 | pdgs[1]=321; | |
717 | Double_t minvD0 = part->InvMassD0(); | |
718 | pdgs[1]=211; | |
719 | pdgs[0]=321; | |
720 | Double_t minvD0bar = part->InvMassD0bar(); | |
721 | //cout<<"inside mass cut"<<endl; | |
722 | ||
723 | Int_t pdgDgD0toKpi[2]={321,211}; | |
724 | Int_t lab=-9999; | |
725 | if(fReadMC) lab=part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
726 | //Double_t pt = d->Pt(); //mother pt | |
727 | Int_t isSelected=3; | |
728 | Int_t isSelectedPID=99; | |
729 | ||
730 | //isSelectedPID = cuts->IsSelected(part,AliRDHFCuts::kPID); //0 rejected,1 D0,2 Dobar, 3 both | |
731 | isSelectedPID = cuts->IsSelectedPID(part); //0 rejected,1 D0,2 Dobar, 3 both | |
732 | if (isSelectedPID==0)fNentries->Fill(7); | |
733 | if (isSelectedPID==1)fNentries->Fill(8); | |
734 | if (isSelectedPID==2)fNentries->Fill(9); | |
735 | if (isSelectedPID==3)fNentries->Fill(10); | |
736 | //fNentries->Fill(8+isSelectedPID); | |
737 | ||
738 | if(fCutOnDistr){ | |
739 | isSelected = cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod); //cuts with variables recalculated with new vertex (w/o daughters) | |
740 | if (!isSelected){ | |
741 | //cout<<"Not Selected"<<endl; | |
742 | return; | |
743 | } | |
744 | } | |
745 | ||
746 | Double_t invmasscut=0.03; | |
747 | ||
748 | TString fillthispi="",fillthisK="",fillthis=""; | |
749 | ||
750 | Int_t ptbin=cuts->PtBin(part->Pt()); | |
751 | ||
752 | Double_t dz1[2],dz2[2],covar1[3],covar2[3];//,d0xd0proper,errd0xd0proper; | |
753 | dz1[0]=-99; dz2[0]=-99; | |
754 | Double_t d0[2]; | |
755 | Double_t decl[2]={-99,-99}; | |
756 | Bool_t recalcvtx=kFALSE; | |
757 | ||
758 | if(fCuts->GetIsPrimaryWithoutDaughters()){ | |
759 | recalcvtx=kTRUE; | |
760 | //recalculate vertex | |
761 | AliAODVertex *vtxProp=0x0; | |
762 | vtxProp=GetPrimaryVtxSkipped(aod,part); | |
763 | if(vtxProp) { | |
764 | part->SetOwnPrimaryVtx(vtxProp); | |
765 | //Bool_t unsetvtx=kTRUE; | |
766 | //Calculate d0 for daughter tracks with Vtx Skipped | |
767 | AliESDtrack *esdtrack1=new AliESDtrack((AliVTrack*)part->GetDaughter(0)); | |
768 | AliESDtrack *esdtrack2=new AliESDtrack((AliVTrack*)part->GetDaughter(1)); | |
769 | esdtrack1->PropagateToDCA(vtxProp,aod->GetMagneticField(),1.,dz1,covar1); | |
770 | esdtrack2->PropagateToDCA(vtxProp,aod->GetMagneticField(),1.,dz2,covar2); | |
771 | delete vtxProp; vtxProp=NULL; | |
772 | delete esdtrack1; | |
773 | delete esdtrack2; | |
774 | } | |
775 | ||
776 | d0[0]=dz1[0]; | |
777 | d0[1]=dz2[0]; | |
778 | ||
779 | decl[0]=part->DecayLength(); | |
780 | decl[1]=part->NormalizedDecayLength(); | |
781 | part->UnsetOwnPrimaryVtx(); | |
782 | ||
783 | } | |
784 | ||
785 | ||
786 | if(!fCutOnDistr || (fCutOnDistr && isSelected)){ //if no cuts or cuts passed | |
787 | //printf("\nif no cuts or cuts passed\n"); | |
788 | ||
789 | //disable the PID | |
790 | if(!fUsePid4Distr) isSelectedPID=0; | |
791 | if((lab>=0 && fReadMC) || (!fReadMC && isSelectedPID)){ //signal (from MC or PID) | |
792 | ||
793 | //check pdg of the prongs | |
794 | AliAODTrack *prong0=(AliAODTrack*)part->GetDaughter(0); | |
795 | AliAODTrack *prong1=(AliAODTrack*)part->GetDaughter(1); | |
796 | if(!prong0 || !prong1) { | |
797 | return; | |
798 | } | |
799 | Int_t labprong[2]; | |
800 | if(fReadMC){ | |
801 | labprong[0]=prong0->GetLabel(); | |
802 | labprong[1]=prong1->GetLabel(); | |
803 | } | |
804 | AliAODMCParticle *mcprong=0; | |
805 | Int_t pdgProng[2]={0,0}; | |
806 | ||
807 | for (Int_t iprong=0;iprong<2;iprong++){ | |
808 | if(fReadMC && labprong[iprong]>=0) { | |
809 | mcprong= (AliAODMCParticle*)arrMC->At(labprong[iprong]); | |
810 | pdgProng[iprong]=mcprong->GetPdgCode(); | |
811 | } | |
812 | } | |
813 | ||
814 | ||
815 | //no mass cut ditributions: ptbis | |
816 | ||
817 | // fillthispi="hptpiSnoMcut_"; | |
818 | // fillthispi+=ptbin; | |
819 | ||
820 | // fillthisK="hptKSnoMcut_"; | |
821 | // fillthisK+=ptbin; | |
822 | ||
823 | // if ((TMath::Abs(pdgProng[0]) == 211 && TMath::Abs(pdgProng[1]) == 321) | |
824 | // || (isSelectedPID==1 || isSelectedPID==3)){ | |
825 | // ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(0)); | |
826 | // ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(1)); | |
827 | // } | |
828 | ||
829 | // if ((TMath::Abs(pdgProng[0]) == 321 && TMath::Abs(pdgProng[1]) == 211) | |
830 | // || (isSelectedPID==2 || isSelectedPID==3)){ | |
831 | // ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(0)); | |
832 | // ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(1)); | |
833 | // } | |
834 | ||
835 | //no mass cut ditributions: mass | |
836 | fillthis="hMassS_"; | |
837 | fillthis+=ptbin; | |
838 | ||
839 | if ((fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 421) | |
840 | || (!fReadMC && (isSelectedPID==1 || isSelectedPID==3))){//D0 | |
841 | ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0); | |
842 | } | |
843 | else { //D0bar | |
844 | if(fReadMC || (!fReadMC && isSelectedPID > 1)) | |
845 | ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0bar); | |
846 | } | |
847 | ||
848 | //apply cut on invariant mass on the pair | |
849 | if(TMath::Abs(minvD0-mPDG)<invmasscut || TMath::Abs(minvD0bar-mPDG)<invmasscut){ | |
850 | ||
851 | if(fArray==1) cout<<"LS signal: ERROR"<<endl; | |
852 | for (Int_t iprong=0; iprong<2; iprong++){ | |
853 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(iprong); | |
854 | if (fReadMC) labprong[iprong]=prong->GetLabel(); | |
855 | ||
856 | //cout<<"prong name = "<<prong->GetName()<<" label = "<<prong->GetLabel()<<endl; | |
857 | Int_t pdgprong=0; | |
858 | if(fReadMC && labprong[iprong]>=0) { | |
859 | mcprong= (AliAODMCParticle*)arrMC->At(labprong[iprong]); | |
860 | pdgprong=mcprong->GetPdgCode(); | |
861 | } | |
862 | ||
863 | Bool_t isPionHere[2]={(isSelectedPID==1 || isSelectedPID==3) ? kTRUE : kFALSE,(isSelectedPID==2 || isSelectedPID==3) ? kTRUE : kFALSE}; | |
864 | ||
865 | if(TMath::Abs(pdgprong)==211 || isPionHere[iprong]) { | |
866 | //cout<<"pi"<<endl; | |
867 | ||
868 | fillthispi="hptpiS_"; | |
869 | fillthispi+=ptbin; | |
870 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(iprong)); | |
871 | fillthispi="hd0piS_"; | |
872 | fillthispi+=ptbin; | |
873 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->Getd0Prong(iprong)); | |
874 | if(recalcvtx) { | |
875 | ||
876 | fillthispi="hd0vpiS_"; | |
877 | fillthispi+=ptbin; | |
878 | ((TH1F*)listout->FindObject(fillthispi))->Fill(d0[iprong]); | |
879 | } | |
880 | ||
881 | } | |
882 | ||
883 | if(TMath::Abs(pdgprong)==321 || !isPionHere[iprong]) { | |
884 | //cout<<"kappa"<<endl; | |
885 | ||
886 | fillthisK="hptKS_"; | |
887 | fillthisK+=ptbin; | |
888 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(iprong)); | |
889 | fillthisK="hd0KS_"; | |
890 | fillthisK+=ptbin; | |
891 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->Getd0Prong(iprong)); | |
892 | if (recalcvtx){ | |
893 | fillthisK="hd0vKS_"; | |
894 | fillthisK+=ptbin; | |
895 | ((TH1F*)listout->FindObject(fillthisK))->Fill(d0[iprong]); | |
896 | } | |
897 | } | |
898 | ||
899 | fillthis="hcosthpointd0S_"; | |
900 | fillthis+=ptbin; | |
901 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(iprong)); | |
902 | ||
903 | } //end loop on prongs | |
904 | ||
905 | fillthis="hdcaS_"; | |
906 | fillthis+=ptbin; | |
907 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->GetDCA()); | |
908 | ||
909 | fillthis="hcosthetapointS_"; | |
910 | fillthis+=ptbin; | |
911 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle()); | |
912 | ||
913 | fillthis="hcosthpointd0d0S_"; | |
914 | fillthis+=ptbin; | |
915 | ((TH2F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Prodd0d0()); | |
916 | ||
917 | fillthis="hcosthetastarS_"; | |
918 | fillthis+=ptbin; | |
919 | if ((fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 421)) ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); | |
920 | else { | |
921 | if (fReadMC || isSelectedPID>1)((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0bar()); | |
922 | if(isSelectedPID==1 || isSelectedPID==3)((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); | |
923 | } | |
924 | fillthis="hd0d0S_"; | |
925 | fillthis+=ptbin; | |
926 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0()); | |
927 | ||
928 | if(recalcvtx){ | |
929 | fillthis="hd0d0vS_"; | |
930 | fillthis+=ptbin; | |
931 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1]); | |
932 | } | |
933 | ||
934 | fillthis="hdeclS_"; | |
935 | fillthis+=ptbin; | |
936 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->DecayLength()); | |
937 | ||
938 | fillthis="hnormdeclS_"; | |
939 | fillthis+=ptbin; | |
940 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->NormalizedDecayLength()); | |
941 | ||
942 | if(recalcvtx) { | |
943 | fillthis="hdeclvS_"; | |
944 | fillthis+=ptbin; | |
945 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[0]); | |
946 | ||
947 | fillthis="hnormdeclvS_"; | |
948 | fillthis+=ptbin; | |
949 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[1]); | |
950 | } | |
951 | } //end mass cut | |
952 | ||
953 | } else{ //Background or LS | |
954 | //if(!fReadMC){ | |
955 | //cout<<"is background"<<endl; | |
956 | ||
957 | //no mass cut distributions: mass, ptbis | |
958 | fillthis="hMassB_"; | |
959 | fillthis+=ptbin; | |
960 | ||
961 | if (!fCutOnDistr || (fCutOnDistr && (isSelected==1 || isSelected==3))) ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0); | |
962 | if (!fCutOnDistr || (fCutOnDistr && isSelected>1)) ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0bar); | |
963 | ||
964 | // fillthis="hptB1prongnoMcut_"; | |
965 | // fillthis+=ptbin; | |
966 | ||
967 | // ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); | |
968 | ||
969 | // fillthis="hptB2prongsnoMcut_"; | |
970 | // fillthis+=ptbin; | |
971 | // ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); | |
972 | // ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(1)); | |
973 | ||
974 | //apply cut on invariant mass on the pair | |
975 | if(TMath::Abs(minvD0-mPDG)<invmasscut || TMath::Abs(minvD0bar-mPDG)<invmasscut){ | |
976 | ||
977 | ||
978 | AliAODTrack *prongg=(AliAODTrack*)part->GetDaughter(0); | |
979 | if(!prongg) { | |
980 | if(fDebug>2) cout<<"No daughter found"; | |
981 | return; | |
982 | } | |
983 | else{ | |
984 | if(fArray==1){ | |
985 | if(prongg->Charge()==1) { | |
986 | //fTotPosPairs[ptbin]++; | |
987 | ((TH1F*)fDistr->FindObject("hpospair"))->Fill(ptbin); | |
988 | } else { | |
989 | //fTotNegPairs[ptbin]++; | |
990 | ((TH1F*)fDistr->FindObject("hnegpair"))->Fill(ptbin); | |
991 | } | |
992 | } | |
993 | } | |
994 | ||
995 | //normalise pt distr to half afterwards | |
996 | fillthis="hptB_"; | |
997 | fillthis+=ptbin; | |
998 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); | |
999 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(1)); | |
1000 | ||
1001 | fillthis="hd0p0B_"; | |
1002 | fillthis+=ptbin; | |
1003 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(0)); | |
1004 | fillthis="hd0p1B_"; | |
1005 | fillthis+=ptbin; | |
1006 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(1)); | |
1007 | fillthis="hd0B_"; | |
1008 | fillthis+=ptbin; | |
1009 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(0)); | |
1010 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(1)); | |
1011 | ||
1012 | if(fReadMC){ | |
1013 | Int_t pdgMother[2]={0,0}; | |
1014 | Double_t factor[2]={1,1}; | |
1015 | ||
1016 | for(Int_t iprong=0;iprong<2;iprong++){ | |
1017 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(iprong); | |
1018 | lab=prong->GetLabel(); | |
1019 | if(lab>=0){ | |
1020 | AliAODMCParticle* mcprong=(AliAODMCParticle*)arrMC->At(lab); | |
1021 | if(mcprong){ | |
1022 | Int_t labmom=mcprong->GetMother(); | |
1023 | if(labmom>=0){ | |
1024 | AliAODMCParticle* mcmother=(AliAODMCParticle*)arrMC->At(labmom); | |
1025 | if(mcmother) pdgMother[iprong]=mcmother->GetPdgCode(); | |
1026 | } | |
1027 | } | |
1028 | } | |
1029 | ||
1030 | fillthis="hd0moresB_"; | |
1031 | fillthis+=ptbin; | |
1032 | ||
1033 | if(TMath::Abs(pdgMother[iprong])==310 || TMath::Abs(pdgMother[iprong])==130 || TMath::Abs(pdgMother[iprong])==321){ //K^0_S, K^0_L, K^+- | |
1034 | if(part->PtProng(iprong)<=1)factor[iprong]=1./.7; | |
1035 | else factor[iprong]=1./.6; | |
1036 | fNentries->Fill(11); | |
1037 | } | |
1038 | ||
1039 | if(TMath::Abs(pdgMother[iprong])==3122) { //Lambda | |
1040 | factor[iprong]=1./0.25; | |
1041 | fNentries->Fill(12); | |
1042 | } | |
1043 | fillthis="hd0moresB_"; | |
1044 | fillthis+=ptbin; | |
1045 | ||
1046 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(iprong),factor[iprong]); | |
1047 | ||
1048 | if(recalcvtx){ | |
1049 | fillthis="hd0vmoresB_"; | |
1050 | fillthis+=ptbin; | |
1051 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[iprong],factor[iprong]); | |
1052 | } | |
1053 | ||
1054 | } | |
1055 | ||
1056 | fillthis="hd0d0moresB_"; | |
1057 | fillthis+=ptbin; | |
1058 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0(),factor[0]*factor[1]); | |
1059 | ||
1060 | if(recalcvtx){ | |
1061 | fillthis="hd0d0vmoresB_"; | |
1062 | fillthis+=ptbin; | |
1063 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1],factor[0]*factor[1]); | |
1064 | } | |
1065 | fillthis="hcosthetapointmoresB_"; | |
1066 | fillthis+=ptbin; | |
1067 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),factor[0]*factor[1]); | |
1068 | } | |
1069 | ||
1070 | if(recalcvtx){ | |
1071 | fillthis="hd0vp0B_"; | |
1072 | fillthis+=ptbin; | |
1073 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]); | |
1074 | fillthis="hd0vp1B_"; | |
1075 | fillthis+=ptbin; | |
1076 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[1]); | |
1077 | ||
1078 | fillthis="hd0vB_"; | |
1079 | fillthis+=ptbin; | |
1080 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]); | |
1081 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[1]); | |
1082 | } | |
1083 | ||
1084 | fillthis="hcosthpointd0B_"; | |
1085 | fillthis+=ptbin; | |
1086 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(0)); | |
1087 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(1)); | |
1088 | ||
1089 | ||
1090 | fillthis="hdcaB_"; | |
1091 | fillthis+=ptbin; | |
1092 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->GetDCA()); | |
1093 | ||
1094 | fillthis="hcosthetastarB_"; | |
1095 | fillthis+=ptbin; | |
1096 | if (!fCutOnDistr || (fCutOnDistr && (isSelected==1 || isSelected==3)))((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); | |
1097 | if (!fCutOnDistr || (fCutOnDistr && isSelected>1))((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0bar()); | |
1098 | ||
1099 | fillthis="hd0d0B_"; | |
1100 | fillthis+=ptbin; | |
1101 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0()); | |
1102 | ||
1103 | if(recalcvtx){ | |
1104 | fillthis="hd0d0vB_"; | |
1105 | fillthis+=ptbin; | |
1106 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1]); | |
1107 | } | |
1108 | ||
1109 | fillthis="hcosthetapointB_"; | |
1110 | fillthis+=ptbin; | |
1111 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle()); | |
1112 | ||
1113 | fillthis="hcosthpointd0d0B_"; | |
1114 | fillthis+=ptbin; | |
1115 | ((TH2F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Prodd0d0()); | |
1116 | ||
1117 | fillthis="hdeclB_"; | |
1118 | fillthis+=ptbin; | |
1119 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->DecayLength()); | |
1120 | ||
1121 | fillthis="hnormdeclB_"; | |
1122 | fillthis+=ptbin; | |
1123 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->NormalizedDecayLength()); | |
1124 | ||
1125 | if(recalcvtx) { | |
1126 | ||
1127 | fillthis="hdeclvB_"; | |
1128 | fillthis+=ptbin; | |
1129 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[0]); | |
1130 | ||
1131 | fillthis="hnormdeclvB_"; | |
1132 | fillthis+=ptbin; | |
1133 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[1]); | |
1134 | ||
1135 | } | |
1136 | }//mass cut | |
1137 | }//else (background) | |
1138 | } | |
1139 | return; | |
1140 | } | |
1141 | //____________________________________________________________________________ | |
1142 | ||
1143 | void AliAnalysisTaskSED0Mass::FillMassHists(AliAODEvent* aod,AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliRDHFCutsD0toKpi* cuts, TList *listout){ | |
1144 | // | |
1145 | // function used in UserExec to fill mass histograms: | |
1146 | // | |
1147 | ||
1148 | ||
1149 | // Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
1150 | ||
1151 | Int_t isSelected=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod); //selected | |
1152 | ||
1153 | //cout<<"is selected = "<<isSelected<<endl; | |
1154 | ||
1155 | //cout<<"check cuts = "<<endl; | |
1156 | //cuts->PrintAll(); | |
1157 | if (!isSelected){ | |
1158 | //cout<<"Not Selected"<<endl; | |
1159 | //cout<<"Rejected because "<<cuts->GetWhy()<<endl; | |
1160 | return; | |
1161 | } | |
1162 | ||
1163 | ||
1164 | if(fDebug>2) cout<<"Candidate selected"<<endl; | |
1165 | ||
1166 | Double_t invmassD0 = part->InvMassD0(), invmassD0bar = part->InvMassD0bar(); | |
1167 | //printf("SELECTED\n"); | |
1168 | Int_t ptbin=cuts->PtBin(part->Pt()); | |
1169 | ||
1170 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(0); | |
1171 | if(!prong) { | |
1172 | AliDebug(2,"No daughter found"); | |
1173 | return; | |
1174 | } | |
1175 | else{ | |
1176 | // if(prong->Charge()==1) { | |
1177 | // ((TH1F*)fDistr->FindObject("hpospair"))->Fill(fCuts->GetNPtBins()+ptbin); | |
1178 | // //fTotPosPairs[ptbin]++; | |
1179 | // } else { | |
1180 | // ((TH1F*)fDistr->FindObject("hnegpair"))->Fill(fCuts->GetNPtBins()+ptbin); | |
1181 | // //fTotNegPairs[ptbin]++; | |
1182 | // } | |
1183 | } | |
1184 | ||
1185 | // for(Int_t it=0;it<2;it++){ | |
1186 | ||
1187 | // //request on spd points to be addes | |
1188 | // if(/*nSPD==2 && */part->Pt() > 5. && (TMath::Abs(invmassD0-mPDG)<0.01 || TMath::Abs(invmassD0bar-mPDG)<0.01)){ | |
1189 | // FILE *f=fopen("4display.txt","a"); | |
1190 | // fprintf(f,"pt: %f \n Rapidity: %f \t Period Number: %x \t Run Number: %d \t BunchCrossNumb: %d \t OrbitNumber: %d\n",part->Pt(),part->Y(421),aod->GetPeriodNumber(),aod->GetRunNumber(),aod->GetBunchCrossNumber(),aod->GetOrbitNumber()); | |
1191 | // fclose(f); | |
1192 | // //printf("PrimVtx NContributors: %d \n Prongs Rel Angle: %f \n \n",ncont,relangle); | |
1193 | // } | |
1194 | // } | |
1195 | ||
1196 | TString fillthis=""; | |
1197 | Int_t pdgDgD0toKpi[2]={321,211}; | |
1198 | Int_t labD0=-1; | |
1199 | if (fReadMC) labD0 = part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
1200 | ||
1201 | //count candidates selected by cuts | |
1202 | fNentries->Fill(1); | |
1203 | //count true D0 selected by cuts | |
1204 | if (fReadMC && labD0>=0) fNentries->Fill(2); | |
1205 | ||
1206 | if ((isSelected==1 || isSelected==3) && fFillOnlyD0D0bar<2) { //D0 | |
1207 | fillthis="histMass_"; | |
1208 | fillthis+=ptbin; | |
1209 | //cout<<"Filling "<<fillthis<<endl; | |
1210 | ||
1211 | //printf("Fill mass with D0"); | |
1212 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1213 | ||
1214 | if(labD0>=0) { | |
1215 | if(fArray==1) cout<<"LS signal ERROR"<<endl; | |
1216 | ||
1217 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
1218 | Int_t pdgD0 = partD0->GetPdgCode(); | |
1219 | //cout<<"pdg = "<<pdgD0<<endl; | |
1220 | if (pdgD0==421){ //D0 | |
1221 | //cout<<"Fill S with D0"<<endl; | |
1222 | fillthis="histSgn_"; | |
1223 | fillthis+=ptbin; | |
1224 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1225 | // if(TMath::Abs(invmassD0 - mPDG) < 0.027){ | |
1226 | // fillthis="histSgn27_"; | |
1227 | // fillthis+=ptbin; | |
1228 | // ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1229 | // } | |
1230 | } else{ //it was a D0bar | |
1231 | fillthis="histRfl_"; | |
1232 | fillthis+=ptbin; | |
1233 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1234 | } | |
1235 | } else {//background | |
1236 | fillthis="histBkg_"; | |
1237 | fillthis+=ptbin; | |
1238 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1239 | } | |
1240 | ||
1241 | } | |
1242 | if (isSelected>1 && (fFillOnlyD0D0bar==0 || fFillOnlyD0D0bar==2)) { //D0bar | |
1243 | fillthis="histMass_"; | |
1244 | fillthis+=ptbin; | |
1245 | //printf("Fill mass with D0bar"); | |
1246 | ((TH1F*)listout->FindObject(fillthis))->Fill(invmassD0bar); | |
1247 | ||
1248 | if(labD0>=0) { | |
1249 | if(fArray==1) cout<<"LS signal ERROR"<<endl; | |
1250 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
1251 | Int_t pdgD0 = partD0->GetPdgCode(); | |
1252 | //cout<<" pdg = "<<pdgD0<<endl; | |
1253 | if (pdgD0==-421){ //D0bar | |
1254 | fillthis="histSgn_"; | |
1255 | fillthis+=ptbin; | |
1256 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1257 | // if (TMath::Abs(invmassD0bar - mPDG) < 0.027){ | |
1258 | // fillthis="histSgn27_"; | |
1259 | // fillthis+=ptbin; | |
1260 | // ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1261 | // } | |
1262 | ||
1263 | ||
1264 | } else{ | |
1265 | fillthis="histRfl_"; | |
1266 | fillthis+=ptbin; | |
1267 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1268 | } | |
1269 | } else {//background or LS | |
1270 | fillthis="histBkg_"; | |
1271 | fillthis+=ptbin; | |
1272 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1273 | } | |
1274 | } | |
1275 | ||
1276 | return; | |
1277 | } | |
1278 | ||
1279 | //__________________________________________________________________________ | |
1280 | AliAODVertex* AliAnalysisTaskSED0Mass::GetPrimaryVtxSkipped(AliAODEvent *aodev,AliAODRecoDecayHF2Prong *d){ | |
1281 | //Calculate the primary vertex w/o the daughter tracks of the candidate | |
1282 | ||
1283 | Int_t skipped[2]; | |
1284 | Int_t nTrksToSkip=2; | |
1285 | AliAODTrack *dgTrack = (AliAODTrack*)d->GetDaughter(0); | |
1286 | if(!dgTrack){ | |
1287 | AliDebug(2,"no daughter found!"); | |
1288 | return 0x0; | |
1289 | } | |
1290 | skipped[0]=dgTrack->GetID(); | |
1291 | dgTrack = (AliAODTrack*)d->GetDaughter(1); | |
1292 | if(!dgTrack){ | |
1293 | AliDebug(2,"no daughter found!"); | |
1294 | return 0x0; | |
1295 | } | |
1296 | skipped[1]=dgTrack->GetID(); | |
1297 | ||
1298 | AliESDVertex *vertexESD=0x0; | |
1299 | AliAODVertex *vertexAOD=0x0; | |
1300 | AliVertexerTracks *vertexer = new AliVertexerTracks(aodev->GetMagneticField()); | |
1301 | ||
1302 | // | |
1303 | vertexer->SetSkipTracks(nTrksToSkip,skipped); | |
1304 | vertexer->SetMinClusters(4); | |
1305 | vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(aodev); | |
1306 | if(!vertexESD) return vertexAOD; | |
1307 | if(vertexESD->GetNContributors()<=0) { | |
1308 | AliDebug(2,"vertexing failed"); | |
1309 | delete vertexESD; vertexESD=NULL; | |
1310 | return vertexAOD; | |
1311 | } | |
1312 | ||
1313 | delete vertexer; vertexer=NULL; | |
1314 | ||
1315 | ||
1316 | // convert to AliAODVertex | |
1317 | Double_t pos[3],cov[6],chi2perNDF; | |
1318 | vertexESD->GetXYZ(pos); // position | |
1319 | vertexESD->GetCovMatrix(cov); //covariance matrix | |
1320 | chi2perNDF = vertexESD->GetChi2toNDF(); | |
1321 | delete vertexESD; vertexESD=NULL; | |
1322 | ||
1323 | vertexAOD = new AliAODVertex(pos,cov,chi2perNDF); | |
1324 | return vertexAOD; | |
1325 | ||
1326 | } | |
1327 | ||
1328 | ||
1329 | //________________________________________________________________________ | |
1330 | void AliAnalysisTaskSED0Mass::Terminate(Option_t */*option*/) | |
1331 | { | |
1332 | // Terminate analysis | |
1333 | // | |
1334 | if(fDebug > 1) printf("AnalysisTaskSED0Mass: Terminate() \n"); | |
1335 | ||
1336 | ||
1337 | fOutputMass = dynamic_cast<TList*> (GetOutputData(1)); | |
1338 | if (!fOutputMass) { | |
1339 | printf("ERROR: fOutputMass not available\n"); | |
1340 | return; | |
1341 | } | |
1342 | fDistr = dynamic_cast<TList*> (GetOutputData(2)); | |
1343 | if (!fDistr) { | |
1344 | printf("ERROR: fDistr not available\n"); | |
1345 | return; | |
1346 | } | |
1347 | ||
1348 | fNentries = dynamic_cast<TH1F*>(GetOutputData(3)); | |
1349 | ||
1350 | if(!fNentries){ | |
1351 | printf("ERROR: fNEntries not available\n"); | |
1352 | return; | |
1353 | } | |
1354 | fCuts = dynamic_cast<AliRDHFCutsD0toKpi*>(GetOutputData(4)); | |
1355 | if(!fCuts){ | |
1356 | printf("ERROR: fCuts not available\n"); | |
1357 | return; | |
1358 | } | |
1359 | fCounter = dynamic_cast<AliNormalizationCounter*>(GetOutputData(5)); | |
1360 | if (!fCounter) { | |
1361 | printf("ERROR: fCounter not available\n"); | |
1362 | return; | |
1363 | } | |
1364 | Int_t nptbins=fCuts->GetNPtBins(); | |
1365 | for(Int_t ipt=0;ipt<nptbins;ipt++){ | |
1366 | ||
1367 | if(fArray==1){ | |
1368 | fLsNormalization = 2.*TMath::Sqrt(((TH1F*)fDistr->FindObject("hpospair"))->Integral(nptbins+ipt+1,nptbins+ipt+2)*((TH1F*)fDistr->FindObject("hnegpair"))->Integral(nptbins+ipt+1,nptbins+ipt+2)); //after cuts | |
1369 | ||
1370 | ||
1371 | if(fLsNormalization>1e-6) { | |
1372 | ||
1373 | TString massName="histMass_"; | |
1374 | massName+=ipt; | |
1375 | ((TH1F*)fOutputMass->FindObject(massName))->Scale((1/fLsNormalization)*((TH1F*)fOutputMass->FindObject(massName))->GetEntries()); | |
1376 | ||
1377 | } | |
1378 | ||
1379 | ||
1380 | fLsNormalization = 2.*TMath::Sqrt(((TH1F*)fDistr->FindObject("hpospair"))->Integral(ipt+1,ipt+2)*((TH1F*)fDistr->FindObject("hnegpair"))->Integral(ipt+1,ipt+2)); | |
1381 | //fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs[4]*fTotNegPairs[4]); | |
1382 | ||
1383 | if(fLsNormalization>1e-6) { | |
1384 | ||
1385 | TString nameDistr="hptB_"; | |
1386 | nameDistr+=ipt; | |
1387 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1388 | nameDistr="hdcaB_"; | |
1389 | nameDistr+=ipt; | |
1390 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1391 | nameDistr="hcosthetastarB_"; | |
1392 | nameDistr+=ipt; | |
1393 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1394 | nameDistr="hd0B_"; | |
1395 | nameDistr+=ipt; | |
1396 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1397 | nameDistr="hd0d0B_"; | |
1398 | nameDistr+=ipt; | |
1399 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1400 | nameDistr="hcosthetapointB_"; | |
1401 | nameDistr+=ipt; | |
1402 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1403 | nameDistr="hcosthpointd0d0B_"; | |
1404 | nameDistr+=ipt; | |
1405 | ((TH2F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH2F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
1406 | ||
1407 | } | |
1408 | } | |
1409 | } | |
1410 | TString cvname,cstname; | |
1411 | ||
1412 | if (fArray==0){ | |
1413 | cvname="D0invmass"; | |
1414 | cstname="cstat0"; | |
1415 | } else { | |
1416 | cvname="LSinvmass"; | |
1417 | cstname="cstat1"; | |
1418 | } | |
1419 | ||
1420 | TCanvas *cMass=new TCanvas(cvname,cvname); | |
1421 | cMass->cd(); | |
1422 | ((TH1F*)fOutputMass->FindObject("histMass_3"))->Draw(); | |
1423 | ||
1424 | TCanvas* cStat=new TCanvas(cstname,Form("Stat%s",fArray ? "LS" : "D0")); | |
1425 | cStat->cd(); | |
1426 | cStat->SetGridy(); | |
1427 | fNentries->Draw("htext0"); | |
1428 | ||
1429 | // TCanvas *ccheck=new TCanvas(Form("cc%d",fArray),Form("cc%d",fArray)); | |
1430 | // ccheck->cd(); | |
1431 | ||
1432 | return; | |
1433 | } | |
1434 |