]>
Commit | Line | Data |
---|---|---|
adef5d4e | 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 JPSI -> ee 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 | ||
28 | #include "AliAODEvent.h" | |
29 | #include "AliAODVertex.h" | |
30 | #include "AliAODTrack.h" | |
31 | #include "AliAODRecoDecayHF2Prong.h" | |
32 | #include "AliAnalysisTaskSE.h" | |
33 | #include "AliAnalysisTaskSEBkgLikeSignJPSI.h" | |
34 | ||
35 | ClassImp(AliAnalysisTaskSEBkgLikeSignJPSI) | |
36 | ||
37 | //________________________________________________________________________ | |
38 | AliAnalysisTaskSEBkgLikeSignJPSI::AliAnalysisTaskSEBkgLikeSignJPSI(): | |
39 | AliAnalysisTaskSE(), | |
40 | fOutput(0), | |
41 | fHistMassJPSI(0), | |
42 | fHistMassLS(0), | |
43 | fHistCtsJPSI(0), | |
44 | fHistCtsLS(0), | |
45 | fHistCtsLSpos(0), | |
46 | fHistCtsLSneg(0), | |
47 | fHistCPtaJPSI(0), | |
48 | fHistCPtaLS(0), | |
49 | fHistd0d0JPSI(0), | |
50 | fHistd0d0LS(0), | |
51 | fHistDCAJPSI(0), | |
52 | fHistDCALS(0), | |
53 | fVHF(0), | |
54 | fTotPosPairs(0), | |
55 | fTotNegPairs(0), | |
56 | fLsNormalization(1.) | |
57 | { | |
58 | // | |
59 | // Default constructor | |
60 | // | |
adef5d4e | 61 | } |
62 | ||
63 | //________________________________________________________________________ | |
64 | AliAnalysisTaskSEBkgLikeSignJPSI::AliAnalysisTaskSEBkgLikeSignJPSI(const char *name): | |
65 | AliAnalysisTaskSE(name), | |
66 | fOutput(0), | |
67 | fHistMassJPSI(0), | |
68 | fHistMassLS(0), | |
69 | fHistCtsJPSI(0), | |
70 | fHistCtsLS(0), | |
71 | fHistCtsLSpos(0), | |
72 | fHistCtsLSneg(0), | |
73 | fHistCPtaJPSI(0), | |
74 | fHistCPtaLS(0), | |
75 | fHistd0d0JPSI(0), | |
76 | fHistd0d0LS(0), | |
77 | fHistDCAJPSI(0), | |
78 | fHistDCALS(0), | |
79 | fVHF(0), | |
80 | fTotPosPairs(0), | |
81 | fTotNegPairs(0), | |
82 | fLsNormalization(1.) | |
83 | { | |
84 | // | |
9d6d35b0 | 85 | // Standard constructor |
adef5d4e | 86 | // |
87 | // Output slot #1 writes into a TList container | |
88 | DefineOutput(1,TList::Class()); //My private output | |
89 | } | |
90 | ||
91 | //________________________________________________________________________ | |
92 | AliAnalysisTaskSEBkgLikeSignJPSI::~AliAnalysisTaskSEBkgLikeSignJPSI() | |
93 | { | |
94 | // Destructor | |
95 | if (fOutput) { | |
96 | delete fOutput; | |
97 | fOutput = 0; | |
98 | } | |
99 | ||
100 | if (fVHF) { | |
101 | delete fVHF; | |
102 | fVHF = 0; | |
103 | } | |
104 | ||
105 | } | |
106 | //________________________________________________________________________ | |
107 | void AliAnalysisTaskSEBkgLikeSignJPSI::Init() | |
108 | { | |
109 | // Initialization | |
110 | ||
111 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignJPSI::Init() \n"); | |
112 | ||
113 | gROOT->LoadMacro("ConfigVertexingHF.C"); | |
114 | ||
115 | fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); | |
116 | fVHF->PrintStatus(); | |
117 | ||
118 | return; | |
119 | ||
120 | return; | |
121 | } | |
122 | ||
123 | //________________________________________________________________________ | |
124 | void AliAnalysisTaskSEBkgLikeSignJPSI::UserCreateOutputObjects() | |
125 | { | |
126 | // Create the output container | |
127 | // | |
128 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignJPSI::UserCreateOutputObjects() \n"); | |
129 | ||
130 | // Several histograms are more conveniently managed in a TList | |
131 | fOutput = new TList(); | |
132 | fOutput->SetOwner(); | |
133 | ||
134 | fHistMassJPSI = new TH1F("fHistMassJPSI", "J/#Psi invariant mass; M [GeV]; Entries",200,2.8,3.25); | |
135 | fHistMassJPSI->Sumw2(); | |
136 | fHistMassJPSI->SetMinimum(0); | |
137 | fOutput->Add(fHistMassJPSI); | |
138 | ||
139 | fHistMassLS = new TH1F("fHistMassLS", "Like sign pairs invariant mass; M [GeV]; Entries",200,2.8,3.25); | |
140 | fHistMassLS->Sumw2(); | |
141 | fHistMassLS->SetMinimum(0); | |
142 | fOutput->Add(fHistMassLS); | |
143 | ||
144 | fHistCtsJPSI = new TH1F("fHistCtsJPSI", "J/#Psi cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
145 | fHistCtsJPSI->Sumw2(); | |
146 | fHistCtsJPSI->SetMinimum(0); | |
147 | fOutput->Add(fHistCtsJPSI); | |
148 | ||
149 | fHistCtsLS = new TH1F("fHistCtsLS", "Like sign pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
150 | fHistCtsLS->Sumw2(); | |
151 | fHistCtsLS->SetMinimum(0); | |
152 | fOutput->Add(fHistCtsLS); | |
153 | ||
154 | fHistCtsLSpos = new TH1F("fHistCtsLSpos", "Like sign ++ pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
155 | fHistCtsLSpos->Sumw2(); | |
156 | fHistCtsLSpos->SetMinimum(0); | |
157 | fOutput->Add(fHistCtsLSpos); | |
158 | ||
159 | fHistCtsLSneg = new TH1F("fHistCtsLSneg", "Like sign -- pairs cosine of decay angle; Cos#Theta*; Entries",200,-1.,1.); | |
160 | fHistCtsLSneg->Sumw2(); | |
161 | fHistCtsLSneg->SetMinimum(0); | |
162 | fOutput->Add(fHistCtsLSneg); | |
163 | ||
164 | fHistCPtaJPSI = new TH1F("fHistCPtaJPSI", "J/#Psi cosine of pointing angle; Cos#Theta_{point}; Entries",200,-1.,1.); | |
165 | fHistCPtaJPSI->Sumw2(); | |
166 | fHistCPtaJPSI->SetMinimum(0); | |
167 | fOutput->Add(fHistCPtaJPSI); | |
168 | ||
169 | fHistCPtaLS = new TH1F("fHistCPtaLS", "Like sign pairs cosine of pointing angle; Cos#Theta_{point}; Entries",200,-1.,1.); | |
170 | fHistCPtaLS->Sumw2(); | |
171 | fHistCPtaLS->SetMinimum(0); | |
172 | fOutput->Add(fHistCPtaLS); | |
173 | ||
174 | fHistd0d0JPSI = new TH1F("fHistd0d0JPSI", "J/#Psi product of impact parameters; d0xd0 [#mu m^{2}]; Entries",200,-100000.,100000.); | |
175 | fHistd0d0JPSI->Sumw2(); | |
176 | fHistd0d0JPSI->SetMinimum(0); | |
177 | fOutput->Add(fHistd0d0JPSI); | |
178 | ||
179 | fHistd0d0LS = new TH1F("fHistd0d0LS", "Like sign pairs product of impact parameters; d0xd0 [#mu m^{2}]; Entries",200,-100000.,100000.); | |
180 | fHistd0d0LS->Sumw2(); | |
181 | fHistd0d0LS->SetMinimum(0); | |
182 | fOutput->Add(fHistd0d0LS); | |
183 | ||
184 | fHistDCAJPSI = new TH1F("fHistDCAJPSI", "J/#Psi distance of closest approach; dca [10^{2}#mu m]; Entries",100,0.,5.); | |
185 | fHistDCAJPSI->Sumw2(); | |
186 | fHistDCAJPSI->SetMinimum(0); | |
187 | fOutput->Add(fHistDCAJPSI); | |
188 | ||
189 | fHistDCALS = new TH1F("fHistDCALS", "Like sign pairs distance of closest approach; dca [10^{2}#mu m]; Entries",100,0.,5.); | |
190 | fHistDCALS->Sumw2(); | |
191 | fHistDCALS->SetMinimum(0); | |
192 | fOutput->Add(fHistDCALS); | |
193 | ||
194 | return; | |
195 | } | |
196 | ||
197 | //________________________________________________________________________ | |
198 | void AliAnalysisTaskSEBkgLikeSignJPSI::UserExec(Option_t */*option*/) | |
199 | { | |
200 | // Execute analysis for current event: | |
201 | // heavy flavor candidates association to MC truth | |
202 | ||
203 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); | |
204 | ||
205 | // load heavy flavour vertices | |
206 | TClonesArray *arrayVerticesHF = | |
207 | (TClonesArray*)aod->GetList()->FindObject("VerticesHF"); | |
208 | if(!arrayVerticesHF) { | |
209 | printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: VerticesHF branch not found!\n"); | |
210 | return; | |
211 | } | |
212 | ||
213 | // load JPSI->ee candidates | |
214 | TClonesArray *arrayJPSItoEle = | |
215 | (TClonesArray*)aod->GetList()->FindObject("JPSItoEle"); | |
216 | if(!arrayJPSItoEle) { | |
217 | printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: JPSItoEle branch not found!\n"); | |
218 | return; | |
219 | } | |
220 | ||
221 | // load like sign candidates | |
222 | TClonesArray *arrayLikeSign = | |
223 | (TClonesArray*)aod->GetList()->FindObject("LikeSign2Prong"); | |
224 | if(!arrayLikeSign) { | |
225 | printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: LikeSign2Prong branch not found!\n"); | |
226 | return; | |
227 | } | |
228 | ||
229 | // AOD primary vertex | |
230 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
231 | ||
232 | // make trkIDtoEntry register (temporary) | |
233 | Int_t trkIDtoEntry[100000]; | |
234 | for(Int_t it=0;it<aod->GetNumberOfTracks();it++) { | |
235 | AliAODTrack *track = aod->GetTrack(it); | |
236 | trkIDtoEntry[track->GetID()]=it; | |
237 | } | |
238 | ||
239 | // loop over Like sign candidates | |
240 | Int_t nPosPairs=0,nNegPairs=0; | |
241 | Int_t nLikeSign = arrayLikeSign->GetEntriesFast(); | |
242 | printf("+++\n+++Number of like sign pairs ---> %d \n+++\n", nLikeSign); | |
243 | ||
244 | for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) { | |
245 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayLikeSign->UncheckedAt(iLikeSign); | |
246 | Bool_t unsetvtx=kFALSE; | |
247 | if(!d->GetOwnPrimaryVtx()) { | |
248 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
249 | unsetvtx=kTRUE; | |
250 | } | |
251 | Int_t okBtoJPSIls=0; | |
252 | if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSIls)) { | |
253 | fHistMassLS->Fill(d->InvMassJPSIee()); | |
254 | fHistCPtaLS->Fill(d->CosPointingAngle()); | |
255 | fHistd0d0LS->Fill(1e8*d->Prodd0d0()); | |
256 | fHistCtsLS->Fill(d->CosThetaStarJPSI()); | |
257 | fHistDCALS->Fill(100*d->GetDCA()); | |
258 | PostData(1,fOutput); | |
259 | AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0); | |
260 | if(!trk0) { | |
261 | trk0=aod->GetTrack(trkIDtoEntry[d->GetProngID(0)]); | |
262 | printf("references to standard AOD not available \n"); | |
263 | } | |
264 | if((trk0->Charge())==1) { | |
265 | nPosPairs++; | |
266 | fHistCtsLSpos->Fill(d->CosThetaStarJPSI()); | |
267 | PostData(1,fOutput); | |
268 | } else { | |
269 | nNegPairs++; | |
270 | fHistCtsLSneg->Fill(d->CosThetaStarJPSI()); | |
271 | PostData(1,fOutput); | |
272 | } | |
273 | PostData(1,fOutput); | |
274 | } | |
275 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
276 | } | |
277 | ||
278 | printf("------------ N. of positive pairs in Event ----- %d \n", nPosPairs); | |
279 | printf("------------ N. of negative pairs in Event ----- %d \n", nNegPairs); | |
280 | ||
281 | fTotPosPairs += nPosPairs; | |
282 | fTotNegPairs += nNegPairs; | |
283 | ||
284 | // loop over JPSI candidates | |
285 | Int_t nBtoJpsiToEle = arrayJPSItoEle->GetEntriesFast(); | |
286 | printf("Number of like JPSI -> ee candidates ---> %d \n", nBtoJpsiToEle); | |
287 | ||
288 | for (Int_t iBtoJpsiToEle = 0; iBtoJpsiToEle < nBtoJpsiToEle; iBtoJpsiToEle++) { | |
289 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayJPSItoEle->UncheckedAt(iBtoJpsiToEle); | |
290 | Bool_t unsetvtx=kFALSE; | |
291 | if(!d->GetOwnPrimaryVtx()) { | |
292 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
293 | unsetvtx=kTRUE; | |
294 | } | |
295 | Int_t okBtoJPSI=0; | |
296 | if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSI)) { | |
297 | fHistMassJPSI->Fill(d->InvMassJPSIee()); | |
298 | fHistCtsJPSI->Fill(d->CosThetaStarJPSI()); | |
299 | fHistd0d0JPSI->Fill(1e8*d->Prodd0d0()); | |
300 | fHistCPtaJPSI->Fill(d->CosPointingAngle()); | |
301 | fHistDCAJPSI->Fill(100*d->GetDCA()); | |
302 | PostData(1,fOutput); | |
303 | } | |
304 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
305 | } | |
306 | ||
307 | return; | |
308 | } | |
309 | ||
310 | //________________________________________________________________________ | |
311 | void AliAnalysisTaskSEBkgLikeSignJPSI::Terminate(Option_t */*option*/) | |
312 | { | |
313 | // Terminate analysis | |
314 | // | |
315 | if(fDebug > 1) printf("AnalysisTaskSEBkgLikeSignJPSI: Terminate() \n"); | |
316 | ||
317 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); | |
318 | if (!fOutput) { | |
319 | printf("ERROR: fOutput not available\n"); | |
320 | return; | |
321 | } | |
322 | ||
323 | fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs*fTotNegPairs); | |
324 | ||
325 | fHistMassJPSI = dynamic_cast<TH1F*>(fOutput->FindObject("fHistMassJPSI")); | |
326 | fHistMassLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistMassLS")); | |
327 | fHistCtsJPSI = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsJPSI")); | |
328 | fHistCtsLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLS")); | |
329 | fHistCtsLSpos = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLSpos")); | |
330 | fHistCtsLSneg = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCtsLSneg")); | |
331 | fHistCPtaJPSI = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCPtaJPSI")); | |
332 | fHistCPtaLS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistCPtaLS")); | |
333 | fHistd0d0JPSI = dynamic_cast<TH1F*>(fOutput->FindObject("fHistd0d0JPSI")); | |
334 | fHistd0d0LS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistd0d0LS")); | |
335 | fHistDCAJPSI = dynamic_cast<TH1F*>(fOutput->FindObject("fHistDCAJPSI")); | |
336 | fHistDCALS = dynamic_cast<TH1F*>(fOutput->FindObject("fHistDCALS")); | |
337 | ||
338 | fHistMassLS->Scale((1/fLsNormalization)*fHistMassLS->GetEntries()); | |
339 | fHistCtsLS->Scale((1/fLsNormalization)*fHistCtsLS->GetEntries()); | |
340 | fHistCtsLSpos->Scale((1/fLsNormalization)*fHistCtsLSpos->GetEntries()); | |
341 | fHistCtsLSneg->Scale((1/fLsNormalization)*fHistCtsLSneg->GetEntries()); | |
342 | fHistCPtaLS->Scale((1/fLsNormalization)*fHistCPtaLS->GetEntries()); | |
343 | fHistd0d0LS->Scale((1/fLsNormalization)*fHistd0d0LS->GetEntries()); | |
344 | fHistDCALS->Scale((1/fLsNormalization)*fHistDCALS->GetEntries()); | |
345 | ||
346 | return; | |
347 | } |