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