]>
Commit | Line | Data |
---|---|---|
17e8df02 | 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 reading both reconstructed D0->Kpi candidates | |
19 | // and like sign pairs and for drawing corresponding distributions | |
20 | // | |
21 | // Author: C.Di Giglio, carmelo.digiglio@ba.infn.it | |
22 | /////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <TSystem.h> | |
25 | #include <TROOT.h> | |
26 | #include <TClonesArray.h> | |
27 | #include <TList.h> | |
28 | #include <TH1F.h> | |
29 | ||
b557eb43 | 30 | #include "AliAnalysisManager.h" |
31 | #include "AliAODHandler.h" | |
17e8df02 | 32 | #include "AliAODEvent.h" |
33 | #include "AliAODVertex.h" | |
34 | #include "AliAODTrack.h" | |
35 | #include "AliAODRecoDecayHF2Prong.h" | |
36 | #include "AliAnalysisVertexingHF.h" | |
37 | #include "AliAnalysisTaskSE.h" | |
38 | #include "AliAnalysisTaskSEBkgLikeSignD0.h" | |
39 | ||
40 | ClassImp(AliAnalysisTaskSEBkgLikeSignD0) | |
41 | ||
42 | //________________________________________________________________________ | |
43 | AliAnalysisTaskSEBkgLikeSignD0::AliAnalysisTaskSEBkgLikeSignD0(): | |
44 | AliAnalysisTaskSE(), | |
45 | fOutput(0), | |
46 | fHistMassD0(0), | |
47 | fHistMassLS(0), | |
48 | fHistCtsD0(0), | |
49 | fHistCtsLS(0), | |
50 | fHistCtsLSpos(0), | |
51 | fHistCtsLSneg(0), | |
52 | fHistCPtaD0(0), | |
53 | fHistCPtaLS(0), | |
54 | fHistd0d0D0(0), | |
55 | fHistd0d0LS(0), | |
56 | fHistDCAD0(0), | |
57 | fHistDCALS(0), | |
58 | fVHF(0), | |
2cc87fa1 | 59 | fNentries(0), |
17e8df02 | 60 | fTotPosPairs(0), |
61 | fTotNegPairs(0), | |
62 | fLsNormalization(1.) | |
63 | { | |
64 | // | |
65 | // Default constructor | |
66 | // | |
67 | } | |
68 | ||
69 | //________________________________________________________________________ | |
70 | AliAnalysisTaskSEBkgLikeSignD0::AliAnalysisTaskSEBkgLikeSignD0(const char *name): | |
71 | AliAnalysisTaskSE(name), | |
72 | fOutput(0), | |
73 | fHistMassD0(0), | |
74 | fHistMassLS(0), | |
75 | fHistCtsD0(0), | |
76 | fHistCtsLS(0), | |
77 | fHistCtsLSpos(0), | |
78 | fHistCtsLSneg(0), | |
79 | fHistCPtaD0(0), | |
80 | fHistCPtaLS(0), | |
81 | fHistd0d0D0(0), | |
82 | fHistd0d0LS(0), | |
83 | fHistDCAD0(0), | |
84 | fHistDCALS(0), | |
85 | fVHF(0), | |
2cc87fa1 | 86 | fNentries(0), |
17e8df02 | 87 | fTotPosPairs(0), |
88 | fTotNegPairs(0), | |
89 | fLsNormalization(1.) | |
90 | { | |
91 | // | |
92 | // Standard constructor | |
93 | // | |
94 | // Output slot #1 writes into a TList container | |
95 | DefineOutput(1,TList::Class()); //My private output | |
a27a5626 | 96 | // Output slot #2 writes into a TH1F container |
97 | DefineOutput(2,TH1F::Class()); //My private output | |
98 | ||
17e8df02 | 99 | } |
100 | ||
101 | //________________________________________________________________________ | |
102 | AliAnalysisTaskSEBkgLikeSignD0::~AliAnalysisTaskSEBkgLikeSignD0() | |
103 | { | |
104 | // Destructor | |
105 | if (fOutput) { | |
106 | delete fOutput; | |
107 | fOutput = 0; | |
108 | } | |
109 | ||
110 | if (fVHF) { | |
111 | delete fVHF; | |
112 | fVHF = 0; | |
113 | } | |
114 | ||
a27a5626 | 115 | if (fNentries){ |
116 | delete fNentries; | |
117 | fNentries = 0; | |
118 | } | |
119 | ||
17e8df02 | 120 | } |
121 | //________________________________________________________________________ | |
122 | void AliAnalysisTaskSEBkgLikeSignD0::Init() | |
123 | { | |
124 | // Initialization | |
125 | ||
126 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignD0::Init() \n"); | |
127 | ||
128 | gROOT->LoadMacro("ConfigVertexingHF.C"); | |
129 | ||
130 | fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); | |
a27a5626 | 131 | fVHF->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,1,1,-0.00025,0.8); |
17e8df02 | 132 | fVHF->PrintStatus(); |
133 | ||
134 | return; | |
135 | } | |
136 | ||
137 | //________________________________________________________________________ | |
138 | void AliAnalysisTaskSEBkgLikeSignD0::UserCreateOutputObjects() | |
139 | { | |
140 | // Create the output container | |
141 | // | |
142 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignD0::UserCreateOutputObjects() \n"); | |
143 | ||
144 | // Several histograms are more conveniently managed in a TList | |
145 | fOutput = new TList(); | |
146 | fOutput->SetOwner(); | |
147 | ||
a27a5626 | 148 | fHistMassD0 = new TH1F("fHistMassD0", "D0 invariant mass; M [GeV]; Entries",200,1.765,1.965); |
17e8df02 | 149 | fHistMassD0->Sumw2(); |
150 | fHistMassD0->SetMinimum(0); | |
151 | fOutput->Add(fHistMassD0); | |
152 | ||
a27a5626 | 153 | fHistMassLS = new TH1F("fHistMassLS", "Like sign pairs invariant mass; M [GeV]; Entries",200,1.765,1.965); |
17e8df02 | 154 | fHistMassLS->Sumw2(); |
155 | fHistMassLS->SetMinimum(0); | |
156 | fOutput->Add(fHistMassLS); | |
157 | ||
158 | fHistCtsD0 = new TH1F("fHistCtsD0", "D0 cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
159 | fHistCtsD0->Sumw2(); | |
160 | fHistCtsD0->SetMinimum(0); | |
161 | fOutput->Add(fHistCtsD0); | |
162 | ||
163 | fHistCtsLS = new TH1F("fHistCtsLS", "Like sign pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
164 | fHistCtsLS->Sumw2(); | |
165 | fHistCtsLS->SetMinimum(0); | |
166 | fOutput->Add(fHistCtsLS); | |
167 | ||
168 | fHistCtsLSpos = new TH1F("fHistCtsLSpos", "Like sign ++ pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
169 | fHistCtsLSpos->Sumw2(); | |
170 | fHistCtsLSpos->SetMinimum(0); | |
171 | fOutput->Add(fHistCtsLSpos); | |
172 | ||
173 | fHistCtsLSneg = new TH1F("fHistCtsLSneg", "Like sign -- pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
174 | fHistCtsLSneg->Sumw2(); | |
175 | fHistCtsLSneg->SetMinimum(0); | |
176 | fOutput->Add(fHistCtsLSneg); | |
177 | ||
a27a5626 | 178 | fHistCPtaD0 = new TH1F("fHistCPtaD0", "D0 cosine of pointing angle; Cos#Theta_{point}; Entries",200,0,1.); |
17e8df02 | 179 | fHistCPtaD0->Sumw2(); |
180 | fHistCPtaD0->SetMinimum(0); | |
181 | fOutput->Add(fHistCPtaD0); | |
182 | ||
a27a5626 | 183 | fHistCPtaLS = new TH1F("fHistCPtaLS", "Like sign pairs cosine of pointing angle; Cos#Theta_{point}; Entries",200,0,1.); |
17e8df02 | 184 | fHistCPtaLS->Sumw2(); |
185 | fHistCPtaLS->SetMinimum(0); | |
186 | fOutput->Add(fHistCPtaLS); | |
187 | ||
188 | fHistd0d0D0 = new TH1F("fHistd0d0D0", "D0 product of impact parameters; d0xd0 [#mu m^{2}]; Entries",200,-100000.,100000.); | |
189 | fHistd0d0D0->Sumw2(); | |
190 | fHistd0d0D0->SetMinimum(0); | |
191 | fOutput->Add(fHistd0d0D0); | |
192 | ||
193 | fHistd0d0LS = new TH1F("fHistd0d0LS", "Like sign pairs product of impact parameters; d0xd0 [#mu m^{2}]; Entries",200,-100000.,100000.); | |
194 | fHistd0d0LS->Sumw2(); | |
195 | fHistd0d0LS->SetMinimum(0); | |
196 | fOutput->Add(fHistd0d0LS); | |
197 | ||
198 | fHistDCAD0 = new TH1F("fHistDCAD0", "D0 distance of closest approach; dca [10^{2}#mu m]; Entries",100,0.,5.); | |
199 | fHistDCAD0->Sumw2(); | |
200 | fHistDCAD0->SetMinimum(0); | |
201 | fOutput->Add(fHistDCAD0); | |
202 | ||
203 | fHistDCALS = new TH1F("fHistDCALS", "Like sign pairs distance of closest approach; dca [10^{2}#mu m]; Entries",100,0.,5.); | |
204 | fHistDCALS->Sumw2(); | |
205 | fHistDCALS->SetMinimum(0); | |
206 | fOutput->Add(fHistDCALS); | |
207 | ||
a27a5626 | 208 | fNentries=new TH1F("nentriesLS", "Look at the number of entries! it is = to the number of AODs", 2,1.,2.); |
209 | ||
17e8df02 | 210 | return; |
211 | } | |
212 | ||
213 | //________________________________________________________________________ | |
214 | void AliAnalysisTaskSEBkgLikeSignD0::UserExec(Option_t */*option*/) | |
215 | { | |
216 | // Execute analysis for current event: | |
217 | // heavy flavor candidates association to MC truth | |
218 | ||
219 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); | |
220 | ||
b557eb43 | 221 | TClonesArray *arrayD0toKpi = 0; |
222 | TClonesArray *arrayLikeSign = 0; | |
223 | ||
224 | if(!aod && AODEvent() && IsStandardAOD()) { | |
225 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
226 | // event in memory rather than the input (ESD) event. | |
227 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
228 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) | |
229 | // have to taken from the AOD event hold by the AliAODExtension | |
230 | AliAODHandler* aodHandler = (AliAODHandler*) | |
231 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
232 | if(aodHandler->GetExtensions()) { | |
233 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
234 | AliAODEvent *aodFromExt = ext->GetAOD(); | |
235 | // load D0 candidates | |
236 | arrayD0toKpi=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi"); | |
237 | // load like sign candidates | |
238 | arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign2Prong"); | |
239 | } | |
240 | } else { | |
241 | // load D0 candidates | |
242 | arrayD0toKpi=(TClonesArray*)aod->GetList()->FindObject("D0toKpi"); | |
243 | // load like sign candidates | |
244 | arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign2Prong"); | |
17e8df02 | 245 | } |
246 | ||
b557eb43 | 247 | |
17e8df02 | 248 | if(!arrayD0toKpi) { |
249 | printf("AliAnalysisTaskSEBkgLikeSignD0::UserExec: D0toKpi branch not found!\n"); | |
250 | return; | |
251 | } | |
17e8df02 | 252 | if(!arrayLikeSign) { |
253 | printf("AliAnalysisTaskSEBkgLikeSignD0::UserExec: LikeSign2Prong branch not found!\n"); | |
254 | return; | |
255 | } | |
256 | ||
7c23877d | 257 | // fix for temporary bug in ESDfilter |
258 | // the AODs with null vertex pointer didn't pass the PhysSel | |
259 | if(!aod->GetPrimaryVertex()) return; | |
260 | ||
261 | ||
17e8df02 | 262 | // AOD primary vertex |
263 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
264 | ||
265 | // make trkIDtoEntry register (temporary) | |
266 | Int_t trkIDtoEntry[100000]; | |
267 | for(Int_t it=0;it<aod->GetNumberOfTracks();it++) { | |
268 | AliAODTrack *track = aod->GetTrack(it); | |
269 | trkIDtoEntry[track->GetID()]=it; | |
270 | } | |
271 | ||
a27a5626 | 272 | //histogram filled with 1 for every AOD |
273 | fNentries->Fill(1); | |
274 | PostData(2,fNentries); | |
275 | ||
17e8df02 | 276 | // loop over Like sign candidates |
277 | Int_t nPosPairs=0,nNegPairs=0; | |
278 | Int_t nLikeSign = arrayLikeSign->GetEntriesFast(); | |
3b1598da | 279 | if(fDebug>1) printf("+++\n+++Number of like sign pairs ---> %d \n+++\n", nLikeSign); |
17e8df02 | 280 | |
281 | for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) { | |
282 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayLikeSign->UncheckedAt(iLikeSign); | |
283 | Bool_t unsetvtx=kFALSE; | |
284 | if(!d->GetOwnPrimaryVtx()) { | |
285 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
286 | unsetvtx=kTRUE; | |
287 | } | |
288 | Int_t okD0ls=0; Int_t okD0barls=0; | |
289 | if(d->SelectD0(fVHF->GetD0toKpiCuts(),okD0ls,okD0barls)) { | |
17e8df02 | 290 | AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0); |
1fd36d27 | 291 | AliAODTrack *trk1 = (AliAODTrack*)d->GetDaughter(1); |
292 | if(!trk0 || !trk1) { | |
17e8df02 | 293 | trk0=aod->GetTrack(trkIDtoEntry[d->GetProngID(0)]); |
1fd36d27 | 294 | trk1=aod->GetTrack(trkIDtoEntry[d->GetProngID(1)]); |
17e8df02 | 295 | printf("references to standard AOD not available \n"); |
296 | } | |
a27a5626 | 297 | if(okD0ls) fHistMassLS->Fill(d->InvMassD0()); |
298 | if(okD0barls) fHistMassLS->Fill(d->InvMassD0bar()); | |
1fd36d27 | 299 | fHistCPtaLS->Fill(d->CosPointingAngle()); |
300 | fHistd0d0LS->Fill(1e8*d->Prodd0d0()); | |
a27a5626 | 301 | if(okD0ls) fHistCtsLS->Fill(d->CosThetaStarD0()); |
302 | if(okD0barls) fHistCtsLS->Fill(d->CosThetaStarD0bar()); | |
1fd36d27 | 303 | fHistDCALS->Fill(100*d->GetDCA()); |
304 | //PostData(1,fOutput); | |
17e8df02 | 305 | if((trk0->Charge())==1) { |
306 | nPosPairs++; | |
307 | fHistCtsLSpos->Fill(d->CosThetaStarD0()); | |
1fd36d27 | 308 | //PostData(1,fOutput); |
17e8df02 | 309 | } else { |
310 | nNegPairs++; | |
311 | fHistCtsLSneg->Fill(d->CosThetaStarD0()); | |
1fd36d27 | 312 | //PostData(1,fOutput); |
17e8df02 | 313 | } |
314 | PostData(1,fOutput); | |
315 | } | |
316 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
317 | } | |
318 | ||
3b1598da | 319 | if(fDebug>1) printf("------------ N. of positive pairs in Event ----- %d \n", nPosPairs); |
320 | if(fDebug>1) printf("------------ N. of negative pairs in Event ----- %d \n", nNegPairs); | |
17e8df02 | 321 | |
322 | fTotPosPairs += nPosPairs; | |
323 | fTotNegPairs += nNegPairs; | |
324 | ||
325 | // loop over D0 candidates | |
326 | Int_t nD0toKpi = arrayD0toKpi->GetEntriesFast(); | |
3b1598da | 327 | if(fDebug>1) printf("Number of like D0 -> Kpi candidates ---> %d \n", nD0toKpi); |
17e8df02 | 328 | |
329 | for (Int_t iD0toKpi = 0; iD0toKpi < nD0toKpi; iD0toKpi++) { | |
330 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->UncheckedAt(iD0toKpi); | |
331 | Bool_t unsetvtx=kFALSE; | |
332 | if(!d->GetOwnPrimaryVtx()) { | |
333 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
334 | unsetvtx=kTRUE; | |
335 | } | |
336 | Int_t okD0=0; Int_t okD0bar=0; | |
337 | if(d->SelectD0(fVHF->GetD0toKpiCuts(),okD0,okD0bar)) { | |
a27a5626 | 338 | fHistMassD0->Fill(d->InvMassD0()); |
339 | fHistMassD0->Fill(d->InvMassD0bar()); | |
340 | fHistCtsD0->Fill(d->CosThetaStarD0()); | |
341 | fHistCtsD0->Fill(d->CosThetaStarD0bar()); | |
17e8df02 | 342 | fHistd0d0D0->Fill(1e8*d->Prodd0d0()); |
343 | fHistCPtaD0->Fill(d->CosPointingAngle()); | |
344 | fHistDCAD0->Fill(100*d->GetDCA()); | |
345 | PostData(1,fOutput); | |
346 | } | |
347 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
348 | } | |
349 | ||
350 | return; | |
351 | } | |
352 | ||
353 | //________________________________________________________________________ | |
354 | void AliAnalysisTaskSEBkgLikeSignD0::Terminate(Option_t */*option*/) | |
355 | { | |
356 | // Terminate analysis | |
357 | // | |
358 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignD0: Terminate() \n"); | |
359 | ||
360 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); | |
361 | if (!fOutput) { | |
362 | printf("ERROR: fOutput not available\n"); | |
363 | return; | |
364 | } | |
365 | ||
366 | fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs*fTotNegPairs); | |
367 | ||
1fd36d27 | 368 | fHistMassD0 = dynamic_cast<TH1F*>(fOutput->FindObject("fHistMassD0")); |
369 | fHistMassLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistMassLS")); | |
370 | fHistCtsD0 = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsD0")); | |
371 | fHistCtsLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLS")); | |
17e8df02 | 372 | fHistCtsLSpos = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLSpos")); |
373 | fHistCtsLSneg = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLSneg")); | |
1fd36d27 | 374 | fHistCPtaD0 = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCPtaD0")); |
375 | fHistCPtaLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCPtaLS")); | |
376 | fHistd0d0D0 = dynamic_cast<TH1F*>(fOutput->FindObject("fHistd0d0D0")); | |
377 | fHistd0d0LS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistd0d0LS")); | |
378 | fHistDCAD0 = dynamic_cast<TH1F*>(fOutput->FindObject("fHistDCAD0")); | |
379 | fHistDCALS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistDCALS")); | |
17e8df02 | 380 | |
381 | if(fLsNormalization>0) { | |
382 | fHistMassLS->Scale((1/fLsNormalization)*fHistMassLS->GetEntries()); | |
383 | fHistCtsLS->Scale((1/fLsNormalization)*fHistCtsLS->GetEntries()); | |
384 | fHistCtsLSpos->Scale((1/fLsNormalization)*fHistCtsLSpos->GetEntries()); | |
385 | fHistCtsLSneg->Scale((1/fLsNormalization)*fHistCtsLSneg->GetEntries()); | |
386 | fHistCPtaLS->Scale((1/fLsNormalization)*fHistCPtaLS->GetEntries()); | |
387 | fHistd0d0LS->Scale((1/fLsNormalization)*fHistd0d0LS->GetEntries()); | |
388 | fHistDCALS->Scale((1/fLsNormalization)*fHistDCALS->GetEntries()); | |
389 | } | |
390 | ||
391 | return; | |
392 | } |