]>
Commit | Line | Data |
---|---|---|
a2ad7da1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2012, 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 | /* $Id$ */ | |
17 | ||
18 | ///////////////////////////////////////////////////////////// | |
19 | // | |
20 | // AliAnalysisTaskSE for D0 candidates (2Prongs) | |
21 | // and hadrons correlations | |
22 | // | |
23 | // Authors: Chiara Bianchin, chiara.bianchin@pd.infn.it (invariant mass) | |
24 | // Fabio Colamaria, fabio.colamaria@ba.infn.it (correlations) | |
25 | ///////////////////////////////////////////////////////////// | |
26 | ||
27 | #include <Riostream.h> | |
28 | #include <TClonesArray.h> | |
29 | #include <TCanvas.h> | |
30 | #include <TNtuple.h> | |
31 | #include <TTree.h> | |
32 | #include <TList.h> | |
33 | #include <TH1F.h> | |
34 | #include <TH2F.h> | |
35 | #include <THnSparse.h> | |
36 | #include <TDatabasePDG.h> | |
37 | ||
38 | #include <AliAnalysisDataSlot.h> | |
39 | #include <AliAnalysisDataContainer.h> | |
40 | #include "AliAnalysisManager.h" | |
41 | #include "AliESDtrack.h" | |
42 | #include "AliVertexerTracks.h" | |
43 | #include "AliAODHandler.h" | |
44 | #include "AliAODEvent.h" | |
45 | #include "AliAODVertex.h" | |
46 | #include "AliAODTrack.h" | |
47 | #include "AliAODMCHeader.h" | |
48 | #include "AliAODMCParticle.h" | |
49 | #include "AliAODRecoDecayHF2Prong.h" | |
50 | #include "AliAODRecoCascadeHF.h" | |
51 | #include "AliAnalysisVertexingHF.h" | |
52 | #include "AliAnalysisTaskSE.h" | |
53 | #include "AliAnalysisTaskSED0Correlations.h" | |
54 | #include "AliNormalizationCounter.h" | |
55 | ||
56 | using std::cout; | |
57 | using std::endl; | |
58 | ||
59 | ClassImp(AliAnalysisTaskSED0Correlations) | |
60 | ||
61 | ||
62 | //________________________________________________________________________ | |
63 | AliAnalysisTaskSED0Correlations::AliAnalysisTaskSED0Correlations(): | |
64 | AliAnalysisTaskSE(), | |
65 | fNPtBinsCorr(0), | |
66 | fBinLimsCorr(), | |
67 | fPtThreshLow(), | |
68 | fPtThreshUp(), | |
69 | fEvents(0), | |
70 | fAlreadyFilled(kFALSE), | |
71 | fOutputMass(0), | |
72 | fOutputCorr(0), | |
73 | fOutputStudy(0), | |
74 | fNentries(0), | |
75 | fCutsD0(0), | |
76 | fCutsTracks(0), | |
bce70c96 | 77 | fCorrelatorTr(0), |
78 | fCorrelatorKc(0), | |
79 | fCorrelatorK0(0), | |
a2ad7da1 | 80 | fReadMC(0), |
bce70c96 | 81 | fMixing(kFALSE), |
a2ad7da1 | 82 | fCounter(0), |
83 | fNPtBins(1), | |
84 | fFillOnlyD0D0bar(0), | |
85 | fIsSelectedCandidate(0), | |
86 | fSys(0), | |
8c2d7467 | 87 | fEtaForCorrel(0), |
a2ad7da1 | 88 | fIsRejectSDDClusters(0), |
89 | fFillGlobal(kTRUE) | |
90 | { | |
91 | // Default constructor | |
92 | ||
93 | } | |
94 | ||
95 | //________________________________________________________________________ | |
96 | AliAnalysisTaskSED0Correlations::AliAnalysisTaskSED0Correlations(const char *name,AliRDHFCutsD0toKpi* cutsD0, AliHFAssociatedTrackCuts* cutsTrk): | |
97 | AliAnalysisTaskSE(name), | |
98 | fNPtBinsCorr(0), | |
99 | fBinLimsCorr(), | |
100 | fPtThreshLow(), | |
101 | fPtThreshUp(), | |
102 | fEvents(0), | |
103 | fAlreadyFilled(kFALSE), | |
104 | fOutputMass(0), | |
105 | fOutputCorr(0), | |
106 | fOutputStudy(0), | |
107 | fNentries(0), | |
108 | fCutsD0(0), | |
109 | fCutsTracks(cutsTrk), | |
bce70c96 | 110 | fCorrelatorTr(0), |
111 | fCorrelatorKc(0), | |
112 | fCorrelatorK0(0), | |
a2ad7da1 | 113 | fReadMC(0), |
bce70c96 | 114 | fMixing(kFALSE), |
a2ad7da1 | 115 | fCounter(0), |
116 | fNPtBins(1), | |
117 | fFillOnlyD0D0bar(0), | |
118 | fIsSelectedCandidate(0), | |
119 | fSys(0), | |
8c2d7467 | 120 | fEtaForCorrel(0), |
a2ad7da1 | 121 | fIsRejectSDDClusters(0), |
122 | fFillGlobal(kTRUE) | |
123 | { | |
124 | // Default constructor | |
125 | ||
126 | fNPtBins=cutsD0->GetNPtBins(); | |
127 | ||
128 | fCutsD0=cutsD0; | |
129 | ||
130 | // Output slot #1 writes into a TList container (mass with cuts) | |
131 | DefineOutput(1,TList::Class()); //My private output | |
132 | // Output slot #2 writes into a TH1F container (number of events) | |
133 | DefineOutput(2,TH1F::Class()); //My private output | |
134 | // Output slot #3 writes into a AliRDHFD0toKpi container (cuts) | |
135 | DefineOutput(3,AliRDHFCutsD0toKpi::Class()); //My private output | |
136 | // Output slot #4 writes Normalization Counter | |
137 | DefineOutput(4,AliNormalizationCounter::Class()); | |
138 | // Output slot #5 writes into a TList container (correl output) | |
139 | DefineOutput(5,TList::Class()); //My private output | |
140 | // Output slot #6 writes into a TList container (correl advanced) | |
141 | DefineOutput(6,TList::Class()); //My private output | |
142 | // Output slot #7 writes into a AliHFAssociatedTrackCuts container (cuts) | |
143 | DefineOutput(7,AliHFAssociatedTrackCuts::Class()); //My private output | |
144 | } | |
145 | ||
146 | //________________________________________________________________________ | |
147 | AliAnalysisTaskSED0Correlations::AliAnalysisTaskSED0Correlations(const AliAnalysisTaskSED0Correlations &source): | |
148 | AliAnalysisTaskSE(source), | |
149 | fNPtBinsCorr(source.fNPtBinsCorr), | |
150 | fBinLimsCorr(source.fBinLimsCorr), | |
151 | fPtThreshLow(source.fPtThreshLow), | |
152 | fPtThreshUp(source.fPtThreshUp), | |
153 | fEvents(source.fEvents), | |
154 | fAlreadyFilled(source.fAlreadyFilled), | |
155 | fOutputMass(source.fOutputMass), | |
156 | fOutputCorr(source.fOutputCorr), | |
157 | fOutputStudy(source.fOutputStudy), | |
158 | fNentries(source.fNentries), | |
159 | fCutsD0(source.fCutsD0), | |
160 | fCutsTracks(source.fCutsTracks), | |
bce70c96 | 161 | fCorrelatorTr(source.fCorrelatorTr), |
162 | fCorrelatorKc(source.fCorrelatorKc), | |
163 | fCorrelatorK0(source.fCorrelatorK0), | |
a2ad7da1 | 164 | fReadMC(source.fReadMC), |
bce70c96 | 165 | fMixing(source.fMixing), |
a2ad7da1 | 166 | fCounter(source.fCounter), |
167 | fNPtBins(source.fNPtBins), | |
168 | fFillOnlyD0D0bar(source.fFillOnlyD0D0bar), | |
169 | fIsSelectedCandidate(source.fIsSelectedCandidate), | |
170 | fSys(source.fSys), | |
8c2d7467 | 171 | fEtaForCorrel(source.fEtaForCorrel), |
a2ad7da1 | 172 | fIsRejectSDDClusters(source.fIsRejectSDDClusters), |
173 | fFillGlobal(source.fFillGlobal) | |
174 | { | |
175 | // Copy constructor | |
176 | } | |
177 | ||
178 | //________________________________________________________________________ | |
179 | AliAnalysisTaskSED0Correlations::~AliAnalysisTaskSED0Correlations() | |
180 | { | |
181 | if (fOutputMass) { | |
182 | delete fOutputMass; | |
183 | fOutputMass = 0; | |
184 | } | |
185 | if (fOutputCorr) { | |
186 | delete fOutputCorr; | |
187 | fOutputCorr = 0; | |
188 | } | |
189 | if (fOutputStudy) { | |
190 | delete fOutputStudy; | |
191 | fOutputStudy = 0; | |
192 | } | |
193 | if (fCutsD0) { | |
194 | delete fCutsD0; | |
195 | fCutsD0 = 0; | |
196 | } | |
197 | if (fNentries){ | |
198 | delete fNentries; | |
199 | fNentries = 0; | |
200 | } | |
bce70c96 | 201 | if (fCorrelatorTr) { |
202 | delete fCorrelatorTr; | |
203 | fCorrelatorTr = 0; | |
204 | } | |
205 | if (fCorrelatorKc) { | |
206 | delete fCorrelatorKc; | |
207 | fCorrelatorKc = 0; | |
208 | } | |
209 | if (fCorrelatorK0) { | |
210 | delete fCorrelatorK0; | |
211 | fCorrelatorK0 = 0; | |
212 | } | |
213 | if (fCounter){ | |
a2ad7da1 | 214 | delete fCounter; |
215 | fCounter=0; | |
216 | } | |
217 | } | |
218 | ||
219 | //______________________________________________________________________________ | |
220 | AliAnalysisTaskSED0Correlations& AliAnalysisTaskSED0Correlations::operator=(const AliAnalysisTaskSED0Correlations& orig) | |
221 | { | |
222 | // Assignment | |
223 | if (&orig == this) return *this; //if address is the same (same object), returns itself | |
224 | ||
225 | AliAnalysisTaskSE::operator=(orig); //Uses the AliAnalysisTaskSE operator to assign the inherited part of the class | |
226 | fNPtBinsCorr = orig.fNPtBinsCorr; | |
227 | fBinLimsCorr = orig.fBinLimsCorr; | |
228 | fPtThreshLow = orig.fPtThreshLow; | |
229 | fPtThreshUp = orig.fPtThreshUp; | |
230 | fEvents = orig.fEvents; | |
231 | fAlreadyFilled = orig.fAlreadyFilled; | |
232 | fOutputMass = orig.fOutputMass; | |
233 | fOutputCorr = orig.fOutputCorr; | |
234 | fOutputStudy = orig.fOutputStudy; | |
235 | fNentries = orig.fNentries; | |
236 | fCutsD0 = orig.fCutsD0; | |
237 | fCutsTracks = orig.fCutsTracks; | |
bce70c96 | 238 | fCorrelatorTr = orig.fCorrelatorTr; |
239 | fCorrelatorKc = orig.fCorrelatorKc; | |
240 | fCorrelatorK0 = orig.fCorrelatorK0; | |
a2ad7da1 | 241 | fReadMC = orig.fReadMC; |
bce70c96 | 242 | fMixing = orig.fMixing; |
a2ad7da1 | 243 | fCounter = orig.fCounter; |
244 | fNPtBins = orig.fNPtBins; | |
245 | fFillOnlyD0D0bar = orig.fFillOnlyD0D0bar; | |
246 | fIsSelectedCandidate = orig.fIsSelectedCandidate; | |
247 | fSys = orig.fSys; | |
8c2d7467 | 248 | fEtaForCorrel = orig.fEtaForCorrel; |
a2ad7da1 | 249 | fIsRejectSDDClusters = orig.fIsRejectSDDClusters; |
250 | fFillGlobal = orig.fFillGlobal; | |
251 | ||
252 | return *this; //returns pointer of the class | |
253 | } | |
254 | ||
255 | //________________________________________________________________________ | |
256 | void AliAnalysisTaskSED0Correlations::Init() | |
257 | { | |
258 | // Initialization | |
259 | ||
260 | if(fDebug > 1) printf("AnalysisTaskSED0Correlations::Init() \n"); | |
261 | ||
262 | //Copy of cuts objects | |
263 | AliRDHFCutsD0toKpi* copyfCutsD0 = new AliRDHFCutsD0toKpi(*fCutsD0); | |
264 | const char* nameoutput=GetOutputSlot(3)->GetContainer()->GetName(); | |
265 | copyfCutsD0->SetName(nameoutput); | |
266 | ||
bce70c96 | 267 | //needer to clear completely the objects inside with Clear() method |
a2ad7da1 | 268 | // Post the data |
269 | PostData(3,copyfCutsD0); | |
270 | PostData(7,fCutsTracks); | |
271 | ||
272 | return; | |
273 | } | |
274 | ||
275 | //________________________________________________________________________ | |
276 | void AliAnalysisTaskSED0Correlations::UserCreateOutputObjects() | |
277 | { | |
278 | ||
279 | // Create the output container | |
280 | // | |
281 | if(fDebug > 1) printf("AnalysisTaskSED0Correlations::UserCreateOutputObjects() \n"); | |
282 | ||
bce70c96 | 283 | //HFCorrelator creation and definition |
284 | fCorrelatorTr = new AliHFCorrelator("CorrelatorTr",fCutsTracks,fSys); | |
285 | fCorrelatorKc = new AliHFCorrelator("CorrelatorKc",fCutsTracks,fSys); | |
286 | fCorrelatorK0 = new AliHFCorrelator("CorrelatorK0",fCutsTracks,fSys); | |
287 | fCorrelatorTr->SetDeltaPhiInterval(-1.57,4.71);// set the Delta Phi Interval you want (in this case -0.5Pi to 1.5 Pi) | |
288 | fCorrelatorKc->SetDeltaPhiInterval(-1.57,4.71); | |
289 | fCorrelatorK0->SetDeltaPhiInterval(-1.57,4.71); | |
290 | fCorrelatorTr->SetEventMixing(fMixing);// sets the analysis on a single event (kFALSE) or mixed events (kTRUE) | |
291 | fCorrelatorKc->SetEventMixing(fMixing); | |
292 | fCorrelatorK0->SetEventMixing(fMixing); | |
293 | fCorrelatorTr->SetAssociatedParticleType(1);// set 1 for correlations with hadrons, 2 with kaons, 3 with KZeros | |
294 | fCorrelatorKc->SetAssociatedParticleType(2);// set 1 for correlations with hadrons, 2 with kaons, 3 with KZeros | |
295 | fCorrelatorK0->SetAssociatedParticleType(3);// set 1 for correlations with hadrons, 2 with kaons, 3 with KZeros | |
296 | fCorrelatorTr->SetApplyDisplacementCut(2); //0: don't calculate d0; 1: return d0; 2: return d0/d0err | |
297 | fCorrelatorKc->SetApplyDisplacementCut(2); | |
298 | fCorrelatorK0->SetApplyDisplacementCut(0); | |
299 | fCorrelatorTr->SetUseMC(fReadMC);// sets Montecarlo flag | |
300 | fCorrelatorKc->SetUseMC(fReadMC); | |
301 | fCorrelatorK0->SetUseMC(fReadMC); | |
302 | fCorrelatorKc->SetPIDmode(2); //switch for K+/- PID option | |
303 | Bool_t pooldefTr = fCorrelatorTr->DefineEventPool();// method that defines the properties ot the event mixing (zVtx and Multipl. bins) | |
304 | Bool_t pooldefKc = fCorrelatorKc->DefineEventPool();// method that defines the properties ot the event mixing (zVtx and Multipl. bins) | |
305 | Bool_t pooldefK0 = fCorrelatorK0->DefineEventPool();// method that defines the properties ot the event mixing (zVtx and Multipl. bins) | |
306 | if(!pooldefTr) AliInfo("Warning:: Event pool not defined properly"); | |
307 | if(!pooldefKc) AliInfo("Warning:: Event pool not defined properly"); | |
308 | if(!pooldefK0) AliInfo("Warning:: Event pool not defined properly"); | |
309 | ||
a2ad7da1 | 310 | // Several histograms are more conveniently managed in a TList |
311 | fOutputMass = new TList(); | |
312 | fOutputMass->SetOwner(); | |
313 | fOutputMass->SetName("listMass"); | |
314 | ||
315 | fOutputCorr = new TList(); | |
316 | fOutputCorr->SetOwner(); | |
317 | fOutputCorr->SetName("correlationslist"); | |
318 | ||
319 | fOutputStudy = new TList(); | |
320 | fOutputStudy->SetOwner(); | |
321 | fOutputStudy->SetName("MCstudyplots"); | |
322 | ||
323 | TString nameMass=" ",nameSgn=" ", nameBkg=" ", nameRfl=" "; | |
324 | ||
325 | for(Int_t i=0;i<fCutsD0->GetNPtBins();i++){ | |
326 | ||
327 | nameMass="histMass_"; | |
328 | nameMass+=i; | |
329 | nameSgn="histSgn_"; | |
330 | nameSgn+=i; | |
331 | nameBkg="histBkg_"; | |
332 | nameBkg+=i; | |
333 | nameRfl="histRfl_"; | |
334 | nameRfl+=i; | |
335 | ||
336 | //histograms of invariant mass distributions | |
337 | ||
338 | //MC signal | |
339 | if(fReadMC){ | |
340 | TH1F* tmpSt = new TH1F(nameSgn.Data(), "D^{0} invariant mass - MC; M [GeV]; Entries",120,1.5648,2.1648); | |
341 | tmpSt->Sumw2(); | |
342 | ||
343 | //Reflection: histo filled with D0Mass which pass the cut (also) as D0bar and with D0bar which pass (also) the cut as D0 | |
344 | TH1F* tmpRt = new TH1F(nameRfl.Data(), "Reflected signal invariant mass - MC; M [GeV]; Entries",120,1.5648,2.1648); | |
345 | TH1F* tmpBt = new TH1F(nameBkg.Data(), "Background invariant mass - MC; M [GeV]; Entries",120,1.5648,2.1648); | |
346 | tmpBt->Sumw2(); | |
347 | tmpRt->Sumw2(); | |
348 | fOutputMass->Add(tmpSt); | |
349 | fOutputMass->Add(tmpRt); | |
350 | fOutputMass->Add(tmpBt); | |
351 | } | |
352 | ||
353 | //mass | |
354 | TH1F* tmpMt = new TH1F(nameMass.Data(),"D^{0} invariant mass; M [GeV]; Entries",120,1.5648,2.1648); | |
355 | tmpMt->Sumw2(); | |
356 | fOutputMass->Add(tmpMt); | |
357 | } | |
358 | ||
359 | const char* nameoutput=GetOutputSlot(2)->GetContainer()->GetName(); | |
360 | ||
361 | 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", 18,-0.5,17.5); | |
362 | ||
363 | fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal"); | |
364 | fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)"); | |
365 | fReadMC ? fNentries->GetXaxis()->SetBinLabel(3,"nD0Selected") : fNentries->GetXaxis()->SetBinLabel(3,"Dstar<-D0"); | |
366 | fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS"); | |
367 | fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1"); | |
368 | fNentries->GetXaxis()->SetBinLabel(6,"no daughter"); | |
369 | if(fSys==0) fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)"); | |
370 | if(fReadMC && fSys==0){ | |
371 | fNentries->GetXaxis()->SetBinLabel(12,"K"); | |
372 | fNentries->GetXaxis()->SetBinLabel(13,"Lambda"); | |
373 | } | |
374 | fNentries->GetXaxis()->SetBinLabel(14,"Pile-up Rej"); | |
375 | fNentries->GetXaxis()->SetBinLabel(15,"N. of 0SMH"); | |
376 | if(fSys==1) fNentries->GetXaxis()->SetBinLabel(16,"Nev in centr"); | |
377 | if(fIsRejectSDDClusters) fNentries->GetXaxis()->SetBinLabel(17,"SDD-Cls Rej"); | |
378 | fNentries->GetXaxis()->SetBinLabel(18,"Phys.Sel.Rej"); | |
379 | fNentries->GetXaxis()->SetNdivisions(1,kFALSE); | |
380 | ||
381 | fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(4)->GetContainer()->GetName())); | |
382 | fCounter->Init(); | |
383 | ||
384 | CreateCorrelationsObjs(); //creates histos for correlations analysis | |
385 | ||
386 | // Post the data | |
387 | PostData(1,fOutputMass); | |
388 | PostData(2,fNentries); | |
389 | PostData(4,fCounter); | |
390 | PostData(5,fOutputCorr); | |
391 | PostData(6,fOutputStudy); | |
392 | ||
393 | return; | |
394 | } | |
395 | ||
396 | //________________________________________________________________________ | |
397 | void AliAnalysisTaskSED0Correlations::UserExec(Option_t */*option*/) | |
398 | { | |
399 | // Execute analysis for current event: | |
400 | // heavy flavor candidates association to MC truth | |
401 | //cout<<"I'm in UserExec"<<endl; | |
402 | ||
403 | ||
404 | //cuts order | |
405 | // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]); | |
406 | // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]); | |
407 | // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]); | |
408 | // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]); | |
409 | // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]); | |
410 | // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]); | |
411 | // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]); | |
412 | // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]); | |
413 | // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]); | |
414 | ||
415 | ||
416 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); | |
417 | fEvents++; | |
418 | ||
419 | TString bname="D0toKpi"; | |
420 | ||
421 | TClonesArray *inputArray=0; | |
422 | ||
423 | if(!aod && AODEvent() && IsStandardAOD()) { | |
424 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
425 | // event in memory rather than the input (ESD) event. | |
426 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
427 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) | |
428 | // have to taken from the AOD event hold by the AliAODExtension | |
429 | AliAODHandler* aodHandler = (AliAODHandler*) | |
430 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
431 | ||
432 | if(aodHandler->GetExtensions()) { | |
433 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
434 | AliAODEvent* aodFromExt = ext->GetAOD(); | |
435 | inputArray=(TClonesArray*)aodFromExt->GetList()->FindObject(bname.Data()); | |
436 | } | |
437 | } else if(aod) { | |
438 | inputArray=(TClonesArray*)aod->GetList()->FindObject(bname.Data()); | |
439 | } | |
440 | ||
441 | if(!inputArray || !aod) { | |
442 | printf("AliAnalysisTaskSED0Correlations::UserExec: input branch not found!\n"); | |
443 | return; | |
444 | } | |
445 | ||
446 | // fix for temporary bug in ESDfilter | |
447 | // the AODs with null vertex pointer didn't pass the PhysSel | |
448 | if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return; | |
449 | ||
450 | TClonesArray *mcArray = 0; | |
451 | AliAODMCHeader *mcHeader = 0; | |
452 | ||
453 | if(fReadMC) { | |
454 | // load MC particles | |
455 | mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
456 | if(!mcArray) { | |
457 | printf("AliAnalysisTaskSED0Correlations::UserExec: MC particles branch not found!\n"); | |
458 | return; | |
459 | } | |
460 | ||
461 | // load MC header | |
462 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
463 | if(!mcHeader) { | |
464 | printf("AliAnalysisTaskSED0Correlations::UserExec: MC header branch not found!\n"); | |
465 | return; | |
466 | } | |
467 | } | |
bce70c96 | 468 | |
a2ad7da1 | 469 | //histogram filled with 1 for every AOD |
470 | fNentries->Fill(0); | |
471 | fCounter->StoreEvent(aod,fCutsD0,fReadMC); | |
472 | ||
473 | // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL | |
474 | TString trigclass=aod->GetFiredTriggerClasses(); | |
475 | if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNentries->Fill(14); | |
476 | ||
477 | if(!fCutsD0->IsEventSelected(aod)) { | |
478 | if(fCutsD0->GetWhyRejection()==1) // rejected for pileup | |
479 | fNentries->Fill(13); | |
480 | if(fSys==1 && (fCutsD0->GetWhyRejection()==2 || fCutsD0->GetWhyRejection()==3)) fNentries->Fill(15); | |
481 | if(fCutsD0->GetWhyRejection()==7) fNentries->Fill(17); | |
482 | return; | |
483 | } | |
484 | ||
8c2d7467 | 485 | //Setting PIDResponse for associated tracks |
486 | fCorrelatorTr->SetPidAssociated(); | |
487 | fCorrelatorKc->SetPidAssociated(); | |
488 | fCorrelatorK0->SetPidAssociated(); | |
489 | ||
a2ad7da1 | 490 | // Check the Nb of SDD clusters |
491 | if (fIsRejectSDDClusters) { | |
492 | Bool_t skipEvent = kFALSE; | |
493 | Int_t ntracks = 0; | |
494 | if (aod) ntracks = aod->GetNTracks(); | |
495 | for(Int_t itrack=0; itrack<ntracks; itrack++) { // loop on tacks | |
496 | // ... get the track | |
497 | AliAODTrack * track = aod->GetTrack(itrack); | |
498 | if(TESTBIT(track->GetITSClusterMap(),2) || TESTBIT(track->GetITSClusterMap(),3) ){ | |
499 | skipEvent=kTRUE; | |
500 | fNentries->Fill(16); | |
501 | break; | |
502 | } | |
503 | } | |
504 | if (skipEvent) return; | |
505 | } | |
506 | ||
bce70c96 | 507 | //HFCorrelators initialization (for this event) |
508 | fCorrelatorTr->SetAODEvent(aod); // set the AOD event from which you are processing | |
509 | fCorrelatorKc->SetAODEvent(aod); | |
510 | fCorrelatorK0->SetAODEvent(aod); | |
511 | Bool_t correlatorONTr = fCorrelatorTr->Initialize(); // initialize the pool for event mixing | |
512 | Bool_t correlatorONKc = fCorrelatorKc->Initialize(); | |
513 | Bool_t correlatorONK0 = fCorrelatorK0->Initialize(); | |
514 | if(!correlatorONTr) {AliInfo("AliHFCorrelator (tracks) didn't initialize the pool correctly or processed a bad event"); return;} | |
515 | if(!correlatorONKc) {AliInfo("AliHFCorrelator (charged K) didn't initialize the pool correctly or processed a bad event"); return;} | |
516 | if(!correlatorONK0) {AliInfo("AliHFCorrelator (K0) didn't initialize the pool correctly or processed a bad event"); return;} | |
517 | ||
518 | if(fReadMC) { | |
519 | fCorrelatorTr->SetMCArray(mcArray); // set the TClonesArray *fmcArray for analysis on monte carlo | |
520 | fCorrelatorKc->SetMCArray(mcArray); | |
521 | fCorrelatorK0->SetMCArray(mcArray); | |
522 | } | |
523 | ||
a2ad7da1 | 524 | // AOD primary vertex |
525 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
a2ad7da1 | 526 | Bool_t isGoodVtx=kFALSE; |
527 | ||
528 | //vtx1->Print(); | |
529 | TString primTitle = vtx1->GetTitle(); | |
530 | if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) { | |
531 | isGoodVtx=kTRUE; | |
532 | fNentries->Fill(3); | |
533 | } | |
534 | ||
535 | //Reset flag for tracks distributions fill | |
536 | fAlreadyFilled=kFALSE; | |
537 | ||
bce70c96 | 538 | //***** Loop over D0 candidates ***** |
a2ad7da1 | 539 | Int_t nInD0toKpi = inputArray->GetEntriesFast(); |
540 | if(fDebug>2) printf("Number of D0->Kpi: %d\n",nInD0toKpi); | |
541 | ||
542 | if(fFillGlobal) { //loop on V0 and tracks for each event, to fill Pt distr. and InvMass distr. | |
543 | ||
544 | TClonesArray *v0array = (TClonesArray*)aod->GetList()->FindObject("v0s"); | |
545 | Int_t pdgCodes[2] = {211,211}; | |
546 | Int_t idArrayV0[v0array->GetEntriesFast()][2]; | |
547 | for(int iV0=0; iV0<v0array->GetEntriesFast(); iV0++) { | |
548 | for(int j=0; j<2; j++) {idArrayV0[iV0][j]=-2;} | |
549 | AliAODv0 *v0 = (AliAODv0*)v0array->UncheckedAt(iV0); | |
550 | if(SelectV0(v0,vtx1,2,idArrayV0)) { //option 2 = for mass inv plots only | |
bce70c96 | 551 | if(fReadMC && (v0->MatchToMC(310,mcArray,2,pdgCodes)<0)) continue; //310 = K0s, 311 = K0 generico!! |
a2ad7da1 | 552 | ((TH2F*)fOutputStudy->FindObject("hK0MassInv"))->Fill(v0->MassK0Short(),v0->Pt()); //invariant mass plot |
f80e7bba | 553 | ((TH1F*)fOutputStudy->FindObject("hist_Pt_K0_AllEv"))->Fill(v0->Pt()); //pT distribution (in all events), K0 case |
a2ad7da1 | 554 | } |
555 | } | |
556 | ||
557 | for(Int_t itrack=0; itrack<aod->GetNTracks(); itrack++) { // loop on tacks | |
558 | AliAODTrack * track = aod->GetTrack(itrack); | |
559 | //rejection of tracks | |
560 | if(track->GetID() < 0) continue; //discard negative ID tracks | |
561 | if(track->Pt() < fPtThreshLow.at(0) || track->Pt() > fPtThreshUp.at(0)) continue; //discard tracks outside pt range for hadrons/K | |
bce70c96 | 562 | if(!fCutsTracks->IsHadronSelected(track) || !fCutsTracks->CheckHadronKinematic(track->Pt(),0.1)) continue; //0.1 = dummy (d0 value, no cut on it for me) |
a2ad7da1 | 563 | //pT distribution (in all events), charg and hadr cases |
564 | ((TH1F*)fOutputStudy->FindObject("hist_Pt_Charg_AllEv"))->Fill(track->Pt()); | |
565 | if(fCutsTracks->CheckKaonCompatibility(track,kFALSE,0,2)) ((TH1F*)fOutputStudy->FindObject("hist_Pt_Kcharg_AllEv"))->Fill(track->Pt()); | |
566 | } | |
567 | ||
568 | } //end of loops for global plot fill | |
569 | ||
570 | Int_t nSelectedloose=0,nSelectedtight=0; | |
571 | for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) { | |
572 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArray->UncheckedAt(iD0toKpi); | |
573 | ||
574 | if(d->GetSelectionMap()) if(!d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)){ | |
575 | fNentries->Fill(2); | |
576 | continue; //skip the D0 from Dstar | |
577 | } | |
578 | ||
579 | if (fCutsD0->IsInFiducialAcceptance(d->Pt(),d->Y(421)) ) { | |
580 | nSelectedloose++; | |
581 | nSelectedtight++; | |
582 | if(fSys==0){ | |
583 | if(fCutsD0->IsSelected(d,AliRDHFCuts::kTracks,aod))fNentries->Fill(6); | |
584 | } | |
585 | Int_t ptbin=fCutsD0->PtBin(d->Pt()); | |
586 | if(ptbin==-1) {fNentries->Fill(4); continue;} //out of bounds | |
587 | ||
bce70c96 | 588 | fIsSelectedCandidate=fCutsD0->IsSelected(d,AliRDHFCuts::kAll,aod); //D0 selected |
a2ad7da1 | 589 | if(!fIsSelectedCandidate) continue; |
590 | ||
bce70c96 | 591 | //D0 infos |
592 | Double_t phiD0 = fCorrelatorTr->SetCorrectPhiRange(d->Phi()); | |
593 | phiD0 = fCorrelatorKc->SetCorrectPhiRange(d->Phi()); //bad usage, but returns a Double_t... | |
594 | phiD0 = fCorrelatorK0->SetCorrectPhiRange(d->Phi()); | |
595 | fCorrelatorTr->SetTriggerParticleProperties(d->Pt(),phiD0,d->Eta()); // sets the parameters of the trigger particles that are needed | |
596 | fCorrelatorKc->SetTriggerParticleProperties(d->Pt(),phiD0,d->Eta()); | |
597 | fCorrelatorK0->SetTriggerParticleProperties(d->Pt(),phiD0,d->Eta()); | |
598 | fCorrelatorTr->SetD0Properties(d,fIsSelectedCandidate); //sets special properties for D0 | |
599 | fCorrelatorKc->SetD0Properties(d,fIsSelectedCandidate); | |
600 | fCorrelatorK0->SetD0Properties(d,fIsSelectedCandidate); | |
601 | ||
602 | if(!fReadMC) { | |
8c2d7467 | 603 | if (TMath::Abs(d->Eta())<fEtaForCorrel) CalculateCorrelations(d); //correlations on real data |
bce70c96 | 604 | } else { //correlations on MC -> association of selected D0 to MCinfo with MCtruth |
8c2d7467 | 605 | if (TMath::Abs(d->Eta())<fEtaForCorrel) { |
606 | Int_t pdgDgD0toKpi[2]={321,211}; | |
607 | Int_t labD0 = d->MatchToMC(421,mcArray,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not | |
608 | if (labD0>-1) CalculateCorrelations(d,labD0,mcArray); | |
bce70c96 | 609 | } |
a2ad7da1 | 610 | } |
611 | ||
612 | FillMassHists(d,mcArray,fCutsD0,fOutputMass); | |
613 | } | |
614 | ||
615 | } //end for prongs | |
bce70c96 | 616 | |
617 | if(fMixing /* && fAlreadyFilled*/) { // update the pool for Event Mixing, if: enabled, event is ok, at least a SelD0 found! (fAlreadyFilled's role!) | |
618 | Bool_t updatedTr = fCorrelatorTr->PoolUpdate(); | |
619 | Bool_t updatedKc = fCorrelatorKc->PoolUpdate(); | |
620 | Bool_t updatedK0 = fCorrelatorK0->PoolUpdate(); | |
621 | if(!updatedTr || !updatedKc || !updatedK0) AliInfo("Pool was not updated"); | |
622 | } | |
623 | ||
a2ad7da1 | 624 | fCounter->StoreCandidates(aod,nSelectedloose,kTRUE); |
625 | fCounter->StoreCandidates(aod,nSelectedtight,kFALSE); | |
626 | ||
627 | // Post the data | |
628 | PostData(1,fOutputMass); | |
629 | PostData(2,fNentries); | |
630 | PostData(4,fCounter); | |
631 | PostData(5,fOutputCorr); | |
632 | PostData(6,fOutputStudy); | |
633 | ||
634 | return; | |
635 | } | |
636 | ||
637 | //____________________________________________________________________________ | |
638 | void AliAnalysisTaskSED0Correlations::FillMassHists(AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliRDHFCutsD0toKpi* cuts, TList *listout){ | |
639 | // | |
640 | // function used in UserExec to fill mass histograms: | |
641 | // | |
642 | if (!fIsSelectedCandidate) return; | |
643 | ||
644 | if(fDebug>2) cout<<"Candidate selected"<<endl; | |
645 | ||
646 | Double_t invmassD0 = part->InvMassD0(), invmassD0bar = part->InvMassD0bar(); | |
647 | Int_t ptbin = cuts->PtBin(part->Pt()); | |
648 | ||
649 | TString fillthis=""; | |
650 | Int_t pdgDgD0toKpi[2]={321,211}; | |
651 | Int_t labD0=-1; | |
652 | 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) | |
653 | ||
654 | //count candidates selected by cuts | |
655 | fNentries->Fill(1); | |
656 | //count true D0 selected by cuts | |
657 | if (fReadMC && labD0>=0) fNentries->Fill(2); | |
658 | ||
659 | if ((fIsSelectedCandidate==1 || fIsSelectedCandidate==3) && fFillOnlyD0D0bar<2) { //D0 | |
660 | ||
661 | if(fReadMC){ | |
662 | if(labD0>=0) { | |
663 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
664 | Int_t pdgD0 = partD0->GetPdgCode(); | |
665 | if (pdgD0==421){ //D0 | |
666 | fillthis="histSgn_"; | |
667 | fillthis+=ptbin; | |
668 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
669 | } else{ //it was a D0bar | |
670 | fillthis="histRfl_"; | |
671 | fillthis+=ptbin; | |
672 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
673 | } | |
674 | } else {//background | |
675 | fillthis="histBkg_"; | |
676 | fillthis+=ptbin; | |
677 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
678 | } | |
679 | }else{ | |
680 | fillthis="histMass_"; | |
681 | fillthis+=ptbin; | |
682 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
683 | } | |
684 | ||
685 | } | |
686 | if (fIsSelectedCandidate>1 && (fFillOnlyD0D0bar==0 || fFillOnlyD0D0bar==2)) { //D0bar | |
687 | ||
688 | if(fReadMC){ | |
689 | if(labD0>=0) { | |
690 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
691 | Int_t pdgD0 = partD0->GetPdgCode(); | |
692 | ||
693 | if (pdgD0==-421){ //D0bar | |
694 | fillthis="histSgn_"; | |
695 | fillthis+=ptbin; | |
696 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
697 | } else{ | |
698 | fillthis="histRfl_"; | |
699 | fillthis+=ptbin; | |
700 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
701 | } | |
702 | } else {//background or LS | |
703 | fillthis="histBkg_"; | |
704 | fillthis+=ptbin; | |
705 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
706 | } | |
707 | }else{ | |
708 | fillthis="histMass_"; | |
709 | fillthis+=ptbin; | |
710 | ((TH1F*)listout->FindObject(fillthis))->Fill(invmassD0bar); | |
711 | } | |
712 | } | |
713 | ||
714 | return; | |
715 | } | |
716 | ||
717 | //________________________________________________________________________ | |
718 | void AliAnalysisTaskSED0Correlations::Terminate(Option_t */*option*/) | |
719 | { | |
720 | // Terminate analysis | |
721 | // | |
722 | if(fDebug > 1) printf("AnalysisTaskSED0Correlations: Terminate() \n"); | |
723 | ||
724 | fOutputMass = dynamic_cast<TList*> (GetOutputData(1)); | |
725 | if (!fOutputMass) { | |
726 | printf("ERROR: fOutputMass not available\n"); | |
727 | return; | |
728 | } | |
729 | ||
730 | fNentries = dynamic_cast<TH1F*>(GetOutputData(2)); | |
731 | ||
732 | if(!fNentries){ | |
733 | printf("ERROR: fNEntries not available\n"); | |
734 | return; | |
735 | } | |
736 | ||
737 | fCutsD0 = dynamic_cast<AliRDHFCutsD0toKpi*>(GetOutputData(3)); | |
738 | if(!fCutsD0){ | |
739 | printf("ERROR: fCuts not available\n"); | |
740 | return; | |
741 | } | |
742 | ||
743 | fCounter = dynamic_cast<AliNormalizationCounter*>(GetOutputData(4)); | |
744 | if (!fCounter) { | |
745 | printf("ERROR: fCounter not available\n"); | |
746 | return; | |
747 | } | |
748 | fOutputCorr = dynamic_cast<TList*> (GetOutputData(5)); | |
749 | if (!fOutputCorr) { | |
750 | printf("ERROR: fOutputCorr not available\n"); | |
751 | return; | |
752 | } | |
753 | fOutputStudy = dynamic_cast<TList*> (GetOutputData(6)); | |
754 | if (!fOutputStudy) { | |
755 | printf("ERROR: fOutputStudy not available\n"); | |
756 | return; | |
757 | } | |
758 | fCutsTracks = dynamic_cast<AliHFAssociatedTrackCuts*>(GetOutputData(7)); | |
759 | if(!fCutsTracks){ | |
760 | printf("ERROR: fCutsTracks not available\n"); | |
761 | return; | |
762 | } | |
763 | ||
764 | return; | |
765 | } | |
766 | ||
767 | //_________________________________________________________________________________________________ | |
768 | Int_t AliAnalysisTaskSED0Correlations::CheckD0Origin(TClonesArray* arrayMC, AliAODMCParticle *mcPartCandidate) const { | |
769 | // | |
770 | // checking whether the mother of the particles come from a charm or a bottom quark | |
771 | // | |
bce70c96 | 772 | printf("AliAnalysisTaskSED0Correlations::CheckD0Origin() \n"); |
a2ad7da1 | 773 | |
774 | Int_t pdgGranma = 0; | |
775 | Int_t mother = 0; | |
776 | mother = mcPartCandidate->GetMother(); | |
777 | Int_t abspdgGranma =0; | |
778 | Bool_t isFromB=kFALSE; | |
779 | Bool_t isQuarkFound=kFALSE; | |
780 | ||
781 | while (mother > 0){ | |
782 | AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(arrayMC->At(mother)); | |
783 | if (mcGranma){ | |
784 | pdgGranma = mcGranma->GetPdgCode(); | |
785 | abspdgGranma = TMath::Abs(pdgGranma); | |
786 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){ | |
787 | isFromB=kTRUE; | |
788 | } | |
789 | if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE; | |
790 | mother = mcGranma->GetMother(); | |
791 | }else{ | |
792 | AliError("Failed casting the mother particle!"); | |
793 | break; | |
794 | } | |
795 | } | |
796 | ||
797 | if(isQuarkFound) { | |
798 | if(isFromB) return 5; | |
799 | else return 4; | |
800 | } | |
801 | else return 1; | |
802 | } | |
803 | ||
804 | //________________________________________________________________________ | |
805 | void AliAnalysisTaskSED0Correlations::CreateCorrelationsObjs() { | |
806 | // | |
807 | ||
808 | TString namePlot = ""; | |
809 | ||
810 | //These for limits in THnSparse (one per bin, same limits). | |
bce70c96 | 811 | //Vars: DeltaPhi, InvMass, PtTrack, Displacement, DeltaEta |
bec72d8c | 812 | Int_t nBinsPhi[5] = {32,150,6,3,16}; |
f80e7bba | 813 | Double_t binMinPhi[5] = {-1.6,1.6,0.,0.,-1.6}; //is the minimum for all the bins |
814 | Double_t binMaxPhi[5] = {4.8,2.2,3.0,3.,1.6}; //is the maximum for all the bins | |
a2ad7da1 | 815 | |
bce70c96 | 816 | //Vars: DeltaPhi, InvMass, DeltaEta |
817 | Int_t nBinsMix[3] = {32,150,16}; | |
818 | Double_t binMinMix[3] = {-1.6,1.6,-1.6}; //is the minimum for all the bins | |
819 | Double_t binMaxMix[3] = {4.8,2.2,1.6}; //is the maximum for all the bins | |
a2ad7da1 | 820 | |
bce70c96 | 821 | for(Int_t i=0;i<fNPtBinsCorr;i++){ |
a2ad7da1 | 822 | |
bce70c96 | 823 | if(!fMixing) { |
824 | //THnSparse plots: correlations for various invariant mass (MC and data) | |
825 | namePlot="hPhi_K0_Bin"; | |
a2ad7da1 | 826 | namePlot+=i; |
827 | ||
bce70c96 | 828 | THnSparseI *hPhiK = new THnSparseI(namePlot.Data(), "Azimuthal correlation; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
829 | hPhiK->Sumw2(); | |
830 | fOutputCorr->Add(hPhiK); | |
a2ad7da1 | 831 | |
bce70c96 | 832 | namePlot="hPhi_Kcharg_Bin"; |
a2ad7da1 | 833 | namePlot+=i; |
834 | ||
bce70c96 | 835 | THnSparseI *hPhiH = new THnSparseI(namePlot.Data(), "Azimuthal correlation; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
836 | hPhiH->Sumw2(); | |
837 | fOutputCorr->Add(hPhiH); | |
a2ad7da1 | 838 | |
bce70c96 | 839 | namePlot="hPhi_Charg_Bin"; |
a2ad7da1 | 840 | namePlot+=i; |
841 | ||
bce70c96 | 842 | THnSparseI *hPhiC = new THnSparseI(namePlot.Data(), "Azimuthal correlation; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
843 | hPhiC->Sumw2(); | |
844 | fOutputCorr->Add(hPhiC); | |
a2ad7da1 | 845 | |
bce70c96 | 846 | //histos for c/b origin for D0 (MC only) |
847 | if (fReadMC) { | |
a2ad7da1 | 848 | |
bce70c96 | 849 | //generic origin for tracks |
850 | namePlot="hPhi_K0_From_c_Bin"; | |
851 | namePlot+=i; | |
a2ad7da1 | 852 | |
bce70c96 | 853 | THnSparseI *hPhiK_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
854 | hPhiK_c->Sumw2(); | |
855 | fOutputCorr->Add(hPhiK_c); | |
a2ad7da1 | 856 | |
bce70c96 | 857 | namePlot="hPhi_Kcharg_From_c_Bin"; |
858 | namePlot+=i; | |
a2ad7da1 | 859 | |
bce70c96 | 860 | THnSparseI *hPhiH_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
861 | hPhiH_c->Sumw2(); | |
862 | fOutputCorr->Add(hPhiH_c); | |
a2ad7da1 | 863 | |
bce70c96 | 864 | namePlot="hPhi_Charg_From_c_Bin"; |
865 | namePlot+=i; | |
a2ad7da1 | 866 | |
bce70c96 | 867 | THnSparseI *hPhiC_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
868 | hPhiC_c->Sumw2(); | |
869 | fOutputCorr->Add(hPhiC_c); | |
870 | ||
871 | namePlot="hPhi_K0_From_b_Bin"; | |
872 | namePlot+=i; | |
a2ad7da1 | 873 | |
bce70c96 | 874 | THnSparseI *hPhiK_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
875 | hPhiK_b->Sumw2(); | |
876 | fOutputCorr->Add(hPhiK_b); | |
a2ad7da1 | 877 | |
bce70c96 | 878 | namePlot="hPhi_Kcharg_From_b_Bin"; |
879 | namePlot+=i; | |
a2ad7da1 | 880 | |
bce70c96 | 881 | THnSparseI *hPhiH_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
882 | hPhiH_b->Sumw2(); | |
883 | fOutputCorr->Add(hPhiH_b); | |
a2ad7da1 | 884 | |
bce70c96 | 885 | namePlot="hPhi_Charg_From_b_Bin"; |
886 | namePlot+=i; | |
a2ad7da1 | 887 | |
bce70c96 | 888 | THnSparseI *hPhiC_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
889 | hPhiC_b->Sumw2(); | |
890 | fOutputCorr->Add(hPhiC_b); | |
a2ad7da1 | 891 | |
bce70c96 | 892 | //HF-only tracks (c for c->D0, b for b->D0) |
893 | namePlot="hPhi_K0_HF_From_c_Bin"; | |
894 | namePlot+=i; | |
a2ad7da1 | 895 | |
bce70c96 | 896 | THnSparseI *hPhiK_HF_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
897 | hPhiK_HF_c->Sumw2(); | |
898 | fOutputCorr->Add(hPhiK_HF_c); | |
a2ad7da1 | 899 | |
bce70c96 | 900 | namePlot="hPhi_Kcharg_HF_From_c_Bin"; |
901 | namePlot+=i; | |
a2ad7da1 | 902 | |
bce70c96 | 903 | THnSparseI *hPhiH_HF_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
904 | hPhiH_HF_c->Sumw2(); | |
905 | fOutputCorr->Add(hPhiH_HF_c); | |
a2ad7da1 | 906 | |
bce70c96 | 907 | namePlot="hPhi_Charg_HF_From_c_Bin"; |
908 | namePlot+=i; | |
a2ad7da1 | 909 | |
bce70c96 | 910 | THnSparseI *hPhiC_HF_c = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - c origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
911 | hPhiC_HF_c->Sumw2(); | |
912 | fOutputCorr->Add(hPhiC_HF_c); | |
a2ad7da1 | 913 | |
bce70c96 | 914 | namePlot="hPhi_K0_HF_From_b_Bin"; |
915 | namePlot+=i; | |
a2ad7da1 | 916 | |
bce70c96 | 917 | THnSparseI *hPhiK_HF_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
918 | hPhiK_HF_b->Sumw2(); | |
919 | fOutputCorr->Add(hPhiK_HF_b); | |
a2ad7da1 | 920 | |
bce70c96 | 921 | namePlot="hPhi_Kcharg_HF_From_b_Bin"; |
922 | namePlot+=i; | |
a2ad7da1 | 923 | |
bce70c96 | 924 | THnSparseI *hPhiH_HF_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
925 | hPhiH_HF_b->Sumw2(); | |
926 | fOutputCorr->Add(hPhiH_HF_b); | |
a2ad7da1 | 927 | |
bce70c96 | 928 | namePlot="hPhi_Charg_HF_From_b_Bin"; |
929 | namePlot+=i; | |
a2ad7da1 | 930 | |
bce70c96 | 931 | THnSparseI *hPhiC_HF_b = new THnSparseI(namePlot.Data(), "Azimuthal correlation HF - b origin; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",5,nBinsPhi,binMinPhi,binMaxPhi); |
932 | hPhiC_HF_b->Sumw2(); | |
933 | fOutputCorr->Add(hPhiC_HF_b); | |
934 | } | |
a2ad7da1 | 935 | |
bce70c96 | 936 | //leading hadron correlations |
937 | namePlot="hPhi_Lead_Bin"; | |
a2ad7da1 | 938 | namePlot+=i; |
939 | ||
bce70c96 | 940 | TH2F *hCorrLead = new TH2F(namePlot.Data(), "Leading particle correlation; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); |
941 | hCorrLead->Sumw2(); | |
942 | fOutputCorr->Add(hCorrLead); | |
a2ad7da1 | 943 | |
bce70c96 | 944 | if (fReadMC) { |
945 | namePlot="hPhi_Lead_From_c_Bin"; | |
946 | namePlot+=i; | |
a2ad7da1 | 947 | |
bce70c96 | 948 | TH2F *hCorrLead_c = new TH2F(namePlot.Data(), "Leading particle correlation - c origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); |
949 | hCorrLead_c->Sumw2(); | |
950 | fOutputCorr->Add(hCorrLead_c); | |
951 | ||
952 | namePlot="hPhi_Lead_From_b_Bin"; | |
953 | namePlot+=i; | |
954 | ||
955 | TH2F *hCorrLead_b = new TH2F(namePlot.Data(), "Leading particle correlation - b origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
956 | hCorrLead_b->Sumw2(); | |
957 | fOutputCorr->Add(hCorrLead_b); | |
958 | ||
959 | namePlot="hPhi_Lead_HF_From_c_Bin"; | |
960 | namePlot+=i; | |
961 | ||
962 | TH2F *hCorrLead_HF_c = new TH2F(namePlot.Data(), "Leading particle correlation HF - c origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
963 | hCorrLead_HF_c->Sumw2(); | |
964 | fOutputCorr->Add(hCorrLead_HF_c); | |
965 | ||
966 | namePlot="hPhi_Lead_HF_From_b_Bin"; | |
967 | namePlot+=i; | |
968 | ||
969 | TH2F *hCorrLead_HF_b = new TH2F(namePlot.Data(), "Leading particle correlation HF - b origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
970 | hCorrLead_HF_b->Sumw2(); | |
971 | fOutputCorr->Add(hCorrLead_HF_b); | |
972 | } | |
973 | ||
974 | //pT weighted correlations | |
975 | namePlot="hPhi_Weig_Bin"; | |
a2ad7da1 | 976 | namePlot+=i; |
bce70c96 | 977 | |
978 | TH2F *hCorrWeig = new TH2F(namePlot.Data(), "Charged particle correlation (pT weighted); #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
979 | fOutputCorr->Add(hCorrWeig); | |
980 | ||
981 | if (fReadMC) { | |
982 | namePlot="hPhi_Weig_From_c_Bin"; | |
983 | namePlot+=i; | |
984 | ||
985 | TH2F *hCorrWeig_c = new TH2F(namePlot.Data(), "Charged particle correlation (pT weighted) - c origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
986 | fOutputCorr->Add(hCorrWeig_c); | |
987 | ||
988 | namePlot="hPhi_Weig_From_b_Bin"; | |
989 | namePlot+=i; | |
990 | ||
991 | TH2F *hCorrWeig_b = new TH2F(namePlot.Data(), "Charged particle correlation (pT weighted) - b origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
992 | fOutputCorr->Add(hCorrWeig_b); | |
993 | ||
994 | namePlot="hPhi_Weig_HF_From_c_Bin"; | |
995 | namePlot+=i; | |
996 | ||
997 | TH2F *hCorrWeig_HF_c = new TH2F(namePlot.Data(), "Charged particle correlation (pT weighted) HF - c origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
998 | fOutputCorr->Add(hCorrWeig_HF_c); | |
999 | ||
1000 | namePlot="hPhi_Weig_HF_From_b_Bin"; | |
1001 | namePlot+=i; | |
1002 | ||
1003 | TH2F *hCorrWeig_HF_b = new TH2F(namePlot.Data(), "Charged particle correlation (pT weighted) HF - b origin; #Delta#phi",32,-1.6,4.8,300,1.6,2.2); | |
1004 | fOutputCorr->Add(hCorrWeig_HF_b); | |
1005 | } | |
a2ad7da1 | 1006 | |
1007 | //pT distribution histos | |
1008 | namePlot = "hist_Pt_Charg_Bin"; namePlot+=i; | |
1009 | TH1F *hPtC = new TH1F(namePlot.Data(), "Charged track pT (in D0 evs); p_{T} (GeV/c)",240,0.,12.); | |
1010 | hPtC->SetMinimum(0); | |
1011 | fOutputStudy->Add(hPtC); | |
1012 | ||
1013 | namePlot = "hist_Pt_Kcharg_Bin"; namePlot+=i; | |
1014 | TH1F *hPtH = new TH1F(namePlot.Data(), "Hadrons pT (in D0 evs); p_{T} (GeV/c)",240,0.,12.); | |
1015 | hPtH->SetMinimum(0); | |
1016 | fOutputStudy->Add(hPtH); | |
1017 | ||
f80e7bba | 1018 | namePlot = "hist_Pt_K0_Bin"; namePlot+=i; |
a2ad7da1 | 1019 | TH1F *hPtK = new TH1F(namePlot.Data(), "Kaons pT (in D0 evs); p_{T} (GeV/c)",240,0.,12.); |
1020 | hPtK->SetMinimum(0); | |
1021 | fOutputStudy->Add(hPtK); | |
1022 | ||
1023 | //D* feeddown pions rejection histos | |
1024 | namePlot = "hDstarPions_Bin"; namePlot+=i; | |
f80e7bba | 1025 | TH2F *hDstarPions = new TH2F(namePlot.Data(), "Tracks rejected for D* inv.mass cut; # Tracks",2,0.,2.,300,1.6,2.2); |
a2ad7da1 | 1026 | hDstarPions->GetXaxis()->SetBinLabel(1,"Not rejected"); |
1027 | hDstarPions->GetXaxis()->SetBinLabel(2,"Rejected"); | |
1028 | hDstarPions->SetMinimum(0); | |
bce70c96 | 1029 | fOutputStudy->Add(hDstarPions); |
1030 | ||
1031 | } | |
1032 | ||
1033 | if(fMixing) { | |
1034 | //THnSparse plots for event mixing! | |
1035 | namePlot="hPhi_K0_Bin"; | |
1036 | namePlot+=i;namePlot+="_EvMix"; | |
1037 | ||
1038 | THnSparseI *hPhiK_EvMix = new THnSparseI(namePlot.Data(), "Az. corr. EvMix; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",3,nBinsMix,binMinMix,binMaxMix); | |
1039 | hPhiK_EvMix->Sumw2(); | |
1040 | fOutputCorr->Add(hPhiK_EvMix); | |
1041 | ||
1042 | namePlot="hPhi_Kcharg_Bin"; | |
1043 | namePlot+=i;namePlot+="_EvMix"; | |
1044 | ||
1045 | THnSparseI *hPhiH_EvMix = new THnSparseI(namePlot.Data(), "Az. corr. EvMix; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",3,nBinsMix,binMinMix,binMaxMix); | |
1046 | hPhiH_EvMix->Sumw2(); | |
1047 | fOutputCorr->Add(hPhiH_EvMix); | |
1048 | ||
1049 | namePlot="hPhi_Charg_Bin"; | |
1050 | namePlot+=i;namePlot+="_EvMix"; | |
1051 | ||
1052 | THnSparseI *hPhiC_EvMix = new THnSparseI(namePlot.Data(), "Az. corr. EvMix; #Delta#phi; Inv. Mass (GeV/c^{2}); p_{t} (GeV/c)",3,nBinsMix,binMinMix,binMaxMix); | |
1053 | hPhiC_EvMix->Sumw2(); | |
1054 | fOutputCorr->Add(hPhiC_EvMix); | |
1055 | } | |
a2ad7da1 | 1056 | } |
1057 | ||
1058 | //out of bin loop | |
da975030 | 1059 | if(!fMixing) { |
1060 | TH1F *hCountC = new TH1F("hist_Count_Charg", "Charged track counter; # Tracks",100,0.,100.); | |
1061 | hCountC->SetMinimum(0); | |
1062 | fOutputStudy->Add(hCountC); | |
bce70c96 | 1063 | |
da975030 | 1064 | TH1F *hCountH = new TH1F("hist_Count_Kcharg", "Hadrons counter; # Tracks",20,0.,20.); |
1065 | hCountH->SetMinimum(0); | |
1066 | fOutputStudy->Add(hCountH); | |
bce70c96 | 1067 | |
da975030 | 1068 | TH1F *hCountK = new TH1F("hist_Count_K0", "Kaons counter; # Tracks",20,0.,20.); |
1069 | hCountK->SetMinimum(0); | |
1070 | fOutputStudy->Add(hCountK); | |
1071 | } | |
bce70c96 | 1072 | |
a2ad7da1 | 1073 | if (fFillGlobal) { //all-events plots |
1074 | //pt distributions | |
1075 | TH1F *hPtCAll = new TH1F("hist_Pt_Charg_AllEv", "Charged track pT (All); p_{T} (GeV/c)",240,0.,12.); | |
1076 | hPtCAll->SetMinimum(0); | |
1077 | fOutputStudy->Add(hPtCAll); | |
1078 | ||
1079 | TH1F *hPtHAll = new TH1F("hist_Pt_Kcharg_AllEv", "Hadrons pT (All); p_{T} (GeV/c)",240,0.,12.); | |
1080 | hPtHAll->SetMinimum(0); | |
1081 | fOutputStudy->Add(hPtHAll); | |
1082 | ||
bce70c96 | 1083 | TH1F *hPtKAll = new TH1F("hist_Pt_K0_AllEv", "Kaons pT (All); p_{T} (GeV/c)",240,0.,12.); |
a2ad7da1 | 1084 | hPtKAll->SetMinimum(0); |
1085 | fOutputStudy->Add(hPtKAll); | |
1086 | ||
da975030 | 1087 | if(!fMixing) { |
1088 | //phi distributions | |
bec72d8c | 1089 | TH1F *hPhiDistCAll = new TH1F("hist_PhiDistr_Charg", "Charged track phi distr. (All); p_{T} (GeV/c)",64,0,6.283); |
da975030 | 1090 | hPhiDistCAll->SetMinimum(0); |
1091 | fOutputStudy->Add(hPhiDistCAll); | |
1092 | ||
bec72d8c | 1093 | TH1F *hPhiDistHAll = new TH1F("hist_PhiDistr_Kcharg", "Hadrons phi distr. (All); p_{T} (GeV/c)",64,0,6.283); |
da975030 | 1094 | hPhiDistHAll->SetMinimum(0); |
1095 | fOutputStudy->Add(hPhiDistHAll); | |
1096 | ||
bec72d8c | 1097 | TH1F *hPhiDistKAll = new TH1F("hist_PhiDistr_K0", "Kaons phi distr. (All); p_{T} (GeV/c)",64,0,6.283); |
da975030 | 1098 | hPhiDistKAll->SetMinimum(0); |
1099 | fOutputStudy->Add(hPhiDistKAll); | |
1100 | ||
bec72d8c | 1101 | TH1F *hPhiDistDAll = new TH1F("hist_PhiDistr_D0", "D^{0} phi distr. (All); p_{T} (GeV/c)",64,0,6.283); |
da975030 | 1102 | hPhiDistDAll->SetMinimum(0); |
1103 | fOutputStudy->Add(hPhiDistDAll); | |
1104 | } | |
bce70c96 | 1105 | |
a2ad7da1 | 1106 | //K0 Invariant Mass plots |
1107 | TH2F *hK0MassInv = new TH2F("hK0MassInv", "K0 invariant mass; Invariant mass (MeV/c^{2}); pT (GeV/c)",200,0.4,0.6,100,0.,10.); | |
1108 | hK0MassInv->SetMinimum(0); | |
1109 | fOutputStudy->Add(hK0MassInv); | |
1110 | } | |
1111 | ||
1112 | //for MC analysis only | |
da975030 | 1113 | for(Int_t i=0;i<fNPtBinsCorr;i++) { |
a2ad7da1 | 1114 | |
da975030 | 1115 | if (fReadMC && !fMixing) { |
a2ad7da1 | 1116 | |
1117 | //displacement histos | |
f80e7bba | 1118 | namePlot="histDispl_K0_Bin"; namePlot+=i; |
a2ad7da1 | 1119 | TH1F *hDisplK = new TH1F(namePlot.Data(), "Kaons Displacement; DCA",150,0.,0.15); |
1120 | hDisplK->SetMinimum(0); | |
1121 | fOutputStudy->Add(hDisplK); | |
1122 | ||
f80e7bba | 1123 | namePlot="histDispl_K0_HF_Bin"; namePlot+=i; |
a2ad7da1 | 1124 | TH1F *hDisplK_HF = new TH1F(namePlot.Data(), "Kaons Displacement (from HF decay only); DCA",150,0.,0.15); |
1125 | hDisplK_HF->SetMinimum(0); | |
1126 | fOutputStudy->Add(hDisplK_HF); | |
1127 | ||
1128 | namePlot="histDispl_Kcharg_Bin"; namePlot+=i; | |
1129 | TH1F *hDisplHadr = new TH1F(namePlot.Data(), "Hadrons Displacement; DCA",150,0.,0.15); | |
1130 | hDisplHadr->SetMinimum(0); | |
1131 | fOutputStudy->Add(hDisplHadr); | |
1132 | ||
1133 | namePlot="histDispl_Kcharg_HF_Bin"; namePlot+=i; | |
1134 | TH1F *hDisplHadr_HF = new TH1F(namePlot.Data(), "Hadrons Displacement (from HF decay only); DCA",150,0.,0.15); | |
1135 | hDisplHadr_HF->SetMinimum(0); | |
1136 | fOutputStudy->Add(hDisplHadr_HF); | |
1137 | ||
1138 | namePlot="histDispl_Charg_Bin"; namePlot+=i; | |
1139 | TH1F *hDisplCharg = new TH1F(namePlot.Data(), "Charged tracks Displacement; DCA",150,0.,0.15); | |
1140 | hDisplCharg->SetMinimum(0); | |
1141 | fOutputStudy->Add(hDisplCharg); | |
1142 | ||
1143 | namePlot="histDispl_Charg_HF_Bin"; namePlot+=i; | |
1144 | TH1F *hDisplCharg_HF = new TH1F(namePlot.Data(), "Charged tracks Displacement (from HF decay only); DCA",150,0.,0.15); | |
1145 | hDisplCharg_HF->SetMinimum(0); | |
1146 | fOutputStudy->Add(hDisplCharg_HF); | |
1147 | ||
f80e7bba | 1148 | namePlot="histDispl_K0_From_c_Bin"; namePlot+=i; |
a2ad7da1 | 1149 | TH1F *hDisplK_c = new TH1F(namePlot.Data(), "Kaons Displacement - c origin; DCA",150,0.,0.15); |
1150 | hDisplK_c->SetMinimum(0); | |
1151 | fOutputStudy->Add(hDisplK_c); | |
1152 | ||
f80e7bba | 1153 | namePlot="histDispl_K0_HF_From_c_Bin"; namePlot+=i; |
a2ad7da1 | 1154 | TH1F *hDisplK_HF_c = new TH1F(namePlot.Data(), "Kaons Displacement (from HF decay only) - c origin; DCA",150,0.,0.15); |
1155 | hDisplK_HF_c->SetMinimum(0); | |
1156 | fOutputStudy->Add(hDisplK_HF_c); | |
1157 | ||
1158 | namePlot="histDispl_Kcharg_From_c_Bin"; namePlot+=i; | |
1159 | TH1F *hDisplHadr_c = new TH1F(namePlot.Data(), "Hadrons Displacement - c origin; DCA",150,0.,0.15); | |
1160 | hDisplHadr_c->SetMinimum(0); | |
1161 | fOutputStudy->Add(hDisplHadr_c); | |
1162 | ||
1163 | namePlot="histDispl_Kcharg_HF_From_c_Bin"; namePlot+=i; | |
1164 | TH1F *hDisplHadr_HF_c = new TH1F(namePlot.Data(), "Hadrons Displacement (from HF decay only) - c origin; DCA",150,0.,0.15); | |
1165 | hDisplHadr_HF_c->SetMinimum(0); | |
1166 | fOutputStudy->Add(hDisplHadr_HF_c); | |
1167 | ||
1168 | namePlot="histDispl_Charg_From_c_Bin"; namePlot+=i; | |
1169 | TH1F *hDisplCharg_c = new TH1F(namePlot.Data(), "Charged tracks Displacement - c origin; DCA",150,0.,0.15); | |
1170 | hDisplCharg_c->Sumw2(); | |
1171 | hDisplCharg_c->SetMinimum(0); | |
1172 | fOutputStudy->Add(hDisplCharg_c); | |
1173 | ||
1174 | namePlot="histDispl_Charg_HF_From_c_Bin"; namePlot+=i; | |
1175 | TH1F *hDisplCharg_HF_c = new TH1F(namePlot.Data(), "Charged tracks Displacement (from HF decay only) - c origin; DCA",150,0.,0.15); | |
1176 | hDisplCharg_HF_c->SetMinimum(0); | |
1177 | fOutputStudy->Add(hDisplCharg_HF_c); | |
1178 | ||
f80e7bba | 1179 | namePlot="histDispl_K0_From_b_Bin"; namePlot+=i; |
a2ad7da1 | 1180 | TH1F *hDisplK_b = new TH1F(namePlot.Data(), "Kaons Displacement - b origin; DCA",150,0.,0.15); |
1181 | hDisplK_b->SetMinimum(0); | |
1182 | fOutputStudy->Add(hDisplK_b); | |
1183 | ||
f80e7bba | 1184 | namePlot="histDispl_K0_HF_From_b_Bin"; namePlot+=i; |
a2ad7da1 | 1185 | TH1F *hDisplK_HF_b = new TH1F(namePlot.Data(), "Kaons Displacement (from HF decay only) - b origin; DCA",150,0.,0.15); |
1186 | hDisplK_HF_b->SetMinimum(0); | |
1187 | fOutputStudy->Add(hDisplK_HF_b); | |
1188 | ||
1189 | namePlot="histDispl_Kcharg_From_b_Bin"; namePlot+=i; | |
1190 | TH1F *hDisplHadr_b = new TH1F(namePlot.Data(), "Hadrons Displacement - b origin; DCA",150,0.,0.15); | |
1191 | hDisplHadr_b->SetMinimum(0); | |
1192 | fOutputStudy->Add(hDisplHadr_b); | |
1193 | ||
1194 | namePlot="histDispl_Kcharg_HF_From_b_Bin"; namePlot+=i; | |
1195 | TH1F *hDisplHadr_HF_b = new TH1F(namePlot.Data(), "Hadrons Displacement (from HF decay only) - b origin; DCA",150,0.,0.15); | |
1196 | hDisplHadr_HF_b->SetMinimum(0); | |
1197 | fOutputStudy->Add(hDisplHadr_HF_b); | |
1198 | ||
1199 | namePlot="histDispl_Charg_From_b_Bin"; namePlot+=i; | |
1200 | TH1F *hDisplCharg_b = new TH1F(namePlot.Data(), "Charged tracks Displacement - b origin; DCA",150,0.,0.15); | |
1201 | hDisplCharg_b->SetMinimum(0); | |
1202 | fOutputStudy->Add(hDisplCharg_b); | |
1203 | ||
1204 | namePlot="histDispl_Charg_HF_From_b_Bin"; namePlot+=i; | |
1205 | TH1F *hDisplCharg_HF_b = new TH1F(namePlot.Data(), "Charged tracks Displacement (from HF decay only) - b origin; DCA",150,0.,0.15); | |
1206 | hDisplCharg_HF_b->SetMinimum(0); | |
1207 | fOutputStudy->Add(hDisplCharg_HF_b); | |
1208 | ||
1209 | //origin of tracks histos | |
1210 | namePlot="histOrig_Charg_Bin"; namePlot+=i; | |
1211 | TH1F *hOrigin_Charm = new TH1F(namePlot.Data(), "Origin of charged tracks",9,0.,9.); | |
1212 | hOrigin_Charm->SetMinimum(0); | |
1213 | hOrigin_Charm->GetXaxis()->SetBinLabel(1,"Not HF"); | |
1214 | hOrigin_Charm->GetXaxis()->SetBinLabel(2,"D->#"); | |
1215 | hOrigin_Charm->GetXaxis()->SetBinLabel(3,"D->X->#"); | |
1216 | hOrigin_Charm->GetXaxis()->SetBinLabel(4,"B->#"); | |
1217 | hOrigin_Charm->GetXaxis()->SetBinLabel(5,"B->X-># (X!=D)"); | |
1218 | hOrigin_Charm->GetXaxis()->SetBinLabel(6,"B->D->#"); | |
1219 | hOrigin_Charm->GetXaxis()->SetBinLabel(7,"B->D->X->#"); | |
1220 | hOrigin_Charm->GetXaxis()->SetBinLabel(8,"c hadr."); | |
1221 | hOrigin_Charm->GetXaxis()->SetBinLabel(9,"b hadr."); | |
1222 | fOutputStudy->Add(hOrigin_Charm); | |
1223 | ||
1224 | namePlot="histOrig_Kcharg_Bin"; namePlot+=i; | |
1225 | TH1F *hOrigin_Kcharg = new TH1F(namePlot.Data(), "Origin of hadrons",9,0.,9.); | |
1226 | hOrigin_Kcharg->SetMinimum(0); | |
1227 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(1,"Not HF"); | |
1228 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(2,"D->#"); | |
1229 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(3,"D->X->#"); | |
1230 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(4,"B->#"); | |
1231 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(5,"B->X-># (X!=D)"); | |
1232 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(6,"B->D->#"); | |
1233 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(7,"B->D->X->#"); | |
1234 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(8,"c hadr."); | |
1235 | hOrigin_Kcharg->GetXaxis()->SetBinLabel(9,"b hadr."); | |
1236 | fOutputStudy->Add(hOrigin_Kcharg); | |
1237 | ||
f80e7bba | 1238 | namePlot="histOrig_K0_Bin"; namePlot+=i; |
a2ad7da1 | 1239 | TH1F *hOrigin_K = new TH1F(namePlot.Data(), "Origin of kaons",9,0.,9.); |
1240 | hOrigin_K->SetMinimum(0); | |
1241 | hOrigin_K->GetXaxis()->SetBinLabel(1,"Not HF"); | |
1242 | hOrigin_K->GetXaxis()->SetBinLabel(2,"D->#"); | |
1243 | hOrigin_K->GetXaxis()->SetBinLabel(3,"D->X->#"); | |
1244 | hOrigin_K->GetXaxis()->SetBinLabel(4,"B->#"); | |
1245 | hOrigin_K->GetXaxis()->SetBinLabel(5,"B->X-># (X!=D)"); | |
1246 | hOrigin_K->GetXaxis()->SetBinLabel(6,"B->D->#"); | |
1247 | hOrigin_K->GetXaxis()->SetBinLabel(7,"B->D->X->#"); | |
1248 | hOrigin_K->GetXaxis()->SetBinLabel(8,"c hadr."); | |
1249 | hOrigin_K->GetXaxis()->SetBinLabel(9,"b hadr."); | |
1250 | fOutputStudy->Add(hOrigin_K); | |
da975030 | 1251 | } |
a2ad7da1 | 1252 | |
da975030 | 1253 | if (fReadMC) { |
a2ad7da1 | 1254 | //origin of D0 histos |
1255 | namePlot="histOrig_D0_Bin"; namePlot+=i; | |
1256 | TH1F *hOrigin_D0 = new TH1F(namePlot.Data(), "Origin of D0",2,0.,2.); | |
1257 | hOrigin_D0->SetMinimum(0); | |
1258 | hOrigin_D0->GetXaxis()->SetBinLabel(1,"From c"); | |
1259 | hOrigin_D0->GetXaxis()->SetBinLabel(2,"From b"); | |
1260 | fOutputStudy->Add(hOrigin_D0); | |
1261 | } | |
1262 | } | |
a2ad7da1 | 1263 | } |
1264 | ||
1265 | //________________________________________________________________________ | |
bce70c96 | 1266 | void AliAnalysisTaskSED0Correlations::CalculateCorrelations(AliAODRecoDecayHF2Prong* d, Int_t labD0, TClonesArray* mcArray) { |
a2ad7da1 | 1267 | // |
1268 | // Method for correlations D0-hadrons study | |
1269 | // | |
bce70c96 | 1270 | Int_t N_Charg = 0, N_KCharg = 0, N_Kaons = 0; |
1271 | Double_t mD0, mD0bar; | |
1272 | Int_t origD0 = 0, PDGD0 = 0; | |
a2ad7da1 | 1273 | d->InvMassD0(mD0,mD0bar); |
1274 | Int_t ptbin = PtBinCorr(d->Pt()); | |
1275 | if(ptbin < 0) return; | |
a2ad7da1 | 1276 | |
bec72d8c | 1277 | //Fill of D0 phi distribution |
1278 | if (!fMixing) ((TH1F*)fOutputStudy->FindObject("hist_PhiDistr_D0"))->Fill(d->Phi()); | |
1279 | ||
bce70c96 | 1280 | //Origin of D0 |
1281 | TString orig=""; | |
1282 | if(fReadMC) { | |
1283 | origD0=CheckD0Origin(mcArray,(AliAODMCParticle*)mcArray->At(labD0)); | |
1284 | PDGD0 = ((AliAODMCParticle*)mcArray->At(labD0))->GetPdgCode(); | |
1285 | switch (CheckD0Origin(mcArray,(AliAODMCParticle*)mcArray->At(labD0))) { | |
1286 | case 4: | |
1287 | orig = "_From_c"; | |
1288 | ((TH1F*)fOutputStudy->FindObject(Form("histOrig_D0_Bin%d",ptbin)))->Fill(0.); | |
1289 | break; | |
1290 | case 5: | |
1291 | orig = "_From_b"; | |
1292 | ((TH1F*)fOutputStudy->FindObject(Form("histOrig_D0_Bin%d",ptbin)))->Fill(1.); | |
1293 | break; | |
1294 | default: | |
1295 | return; | |
1296 | } | |
1297 | } | |
1298 | ||
1299 | Double_t highPt = 0; Double_t lead[3] = {0,0,0}; //infos for leading particle (pt,deltaphi) | |
a2ad7da1 | 1300 | |
bce70c96 | 1301 | //loop over the tracks in the pool |
ad8d2dfd | 1302 | Bool_t execPoolTr = fCorrelatorTr->ProcessEventPool(); //pool is ready? (only in ME, in SE returns kFALSE) |
1303 | Bool_t execPoolKc = fCorrelatorKc->ProcessEventPool(); //pool is ready? (only in ME, in SE returns kFALSE) | |
1304 | Bool_t execPoolK0 = fCorrelatorK0->ProcessEventPool(); //pool is ready? (only in ME, in SE returns kFALSE) | |
bce70c96 | 1305 | |
1306 | Int_t NofEventsinPool = 1; | |
ad8d2dfd | 1307 | if(fMixing) { |
1308 | NofEventsinPool = fCorrelatorTr->GetNofEventsInPool(); | |
1309 | if(!execPoolTr) { | |
1310 | AliInfo("Mixed event analysis: track pool is not ready"); | |
1311 | NofEventsinPool = 0; | |
1312 | } | |
1313 | } | |
1314 | ||
1315 | //Charged tracks | |
bce70c96 | 1316 | for (Int_t jMix =0; jMix < NofEventsinPool; jMix++) {// loop on events in the pool; if it is SE analysis, stops at one (index not needed there) |
1317 | Bool_t analyzetracksTr = fCorrelatorTr->ProcessAssociatedTracks(jMix);// process all the tracks in the aodEvent, by applying the selection cuts | |
ad8d2dfd | 1318 | if(!analyzetracksTr) { |
bce70c96 | 1319 | AliInfo("AliHFCorrelator::Cannot process the track array"); |
1320 | continue; | |
1321 | } | |
ad8d2dfd | 1322 | |
bce70c96 | 1323 | for(Int_t iTrack = 0; iTrack<fCorrelatorTr->GetNofTracks(); iTrack++){ // looping on track candidates |
1324 | ||
1325 | Bool_t runcorrelation = fCorrelatorTr->Correlate(iTrack); | |
1326 | if(!runcorrelation) continue; | |
1327 | ||
1328 | AliReducedParticle* track = fCorrelatorTr->GetAssociatedParticle(); | |
1329 | ||
1330 | if(!fMixing) { | |
1331 | if(!track->CheckSoftPi()) { //removal of soft pions | |
1332 | if (fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(1.,mD0); | |
1333 | if (fIsSelectedCandidate >= 2) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(1.,mD0bar); | |
1334 | continue; | |
1335 | } else { //not a soft pion | |
1336 | if (fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(0.,mD0); | |
1337 | if (fIsSelectedCandidate >= 2) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(0.,mD0bar); | |
1338 | } | |
bce70c96 | 1339 | Int_t idDaughs[2] = {((AliVTrack*)d->GetDaughter(0))->GetID(),((AliVTrack*)d->GetDaughter(1))->GetID()}; //IDs of daughters to be skipped |
1340 | if(track->GetID() == idDaughs[0] || track->GetID() == idDaughs[1]) continue; //discards daughters of candidate | |
ad8d2dfd | 1341 | } |
1342 | if(track->Pt() < fPtThreshLow.at(ptbin) || track->Pt() > fPtThreshUp.at(ptbin)) continue; //discard tracks outside pt range for hadrons/K | |
bce70c96 | 1343 | |
1344 | FillSparsePlots(mcArray,d,origD0,PDGD0,track,kTrack); //fills for charged tracks | |
1345 | ||
1346 | if(!fMixing) N_Charg++; | |
1347 | ||
1348 | //retrieving leading info... | |
1349 | if(track->Pt() > highPt) { | |
da975030 | 1350 | if(fReadMC && track->GetLabel()<1) continue; |
8c2d7467 | 1351 | if(fReadMC && !(AliAODMCParticle*)mcArray->At(track->GetLabel())) continue; |
bce70c96 | 1352 | lead[0] = fCorrelatorTr->GetDeltaPhi(); |
1353 | lead[1] = fCorrelatorTr->GetDeltaEta(); | |
1354 | lead[2] = fReadMC ? CheckTrackOrigin(mcArray,(AliAODMCParticle*)mcArray->At(track->GetLabel())) : 0; | |
1355 | highPt = track->Pt(); | |
a2ad7da1 | 1356 | } |
bce70c96 | 1357 | |
1358 | } // end of tracks loop | |
ad8d2dfd | 1359 | } //end of event loop for fCorrelatorTr |
1360 | ||
1361 | if(fMixing) { | |
1362 | NofEventsinPool = fCorrelatorKc->GetNofEventsInPool(); | |
1363 | if(!execPoolKc) { | |
1364 | AliInfo("Mixed event analysis: K+/- pool is not ready"); | |
1365 | NofEventsinPool = 0; | |
1366 | } | |
1367 | } | |
1368 | ||
1369 | //Charged Kaons loop | |
1370 | for (Int_t jMix =0; jMix < NofEventsinPool; jMix++) {// loop on events in the pool; if it is SE analysis, stops at one (index not needed there) | |
1371 | Bool_t analyzetracksKc = fCorrelatorKc->ProcessAssociatedTracks(jMix); | |
1372 | if(!analyzetracksKc) { | |
1373 | AliInfo("AliHFCorrelator::Cannot process the K+/- array"); | |
1374 | continue; | |
1375 | } | |
bce70c96 | 1376 | |
bce70c96 | 1377 | for(Int_t iTrack = 0; iTrack<fCorrelatorKc->GetNofTracks(); iTrack++){ // looping on charged kaons candidates |
1378 | ||
1379 | Bool_t runcorrelation = fCorrelatorKc->Correlate(iTrack); | |
1380 | if(!runcorrelation) continue; | |
1381 | ||
1382 | AliReducedParticle* kCharg = fCorrelatorKc->GetAssociatedParticle(); | |
1383 | ||
1384 | if(!fMixing) { | |
ad8d2dfd | 1385 | if(!kCharg->CheckSoftPi()) { //removal of soft pions |
bce70c96 | 1386 | if (fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(1.,mD0); |
1387 | if (fIsSelectedCandidate >= 2) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(1.,mD0bar); | |
1388 | continue; | |
1389 | } else { | |
1390 | if (fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(0.,mD0); | |
1391 | if (fIsSelectedCandidate >= 2) ((TH2F*)fOutputStudy->FindObject(Form("hDstarPions_Bin%d",ptbin)))->Fill(0.,mD0bar); | |
a2ad7da1 | 1392 | } |
bce70c96 | 1393 | Int_t idDaughs[2] = {((AliVTrack*)d->GetDaughter(0))->GetID(),((AliVTrack*)d->GetDaughter(1))->GetID()}; //IDs of daughters to be skipped |
1394 | if(kCharg->GetID() == idDaughs[0] || kCharg->GetID() == idDaughs[1]) continue; //discards daughters of candidate | |
ad8d2dfd | 1395 | } |
1396 | if(kCharg->Pt() < fPtThreshLow.at(ptbin) || kCharg->Pt() > fPtThreshUp.at(ptbin)) continue; //discard tracks outside pt range for hadrons/K | |
1397 | ||
bce70c96 | 1398 | FillSparsePlots(mcArray,d,origD0,PDGD0,kCharg,kKCharg); //fills for charged tracks |
a2ad7da1 | 1399 | |
bce70c96 | 1400 | if(!fMixing) N_KCharg++; |
a2ad7da1 | 1401 | |
bce70c96 | 1402 | } // end of charged kaons loop |
ad8d2dfd | 1403 | } //end of event loop for fCorrelatorKc |
1404 | ||
1405 | if(fMixing) { | |
1406 | NofEventsinPool = fCorrelatorK0->GetNofEventsInPool(); | |
1407 | if(!execPoolK0) { | |
1408 | AliInfo("Mixed event analysis: K0 pool is not ready"); | |
1409 | NofEventsinPool = 0; | |
1410 | } | |
1411 | } | |
1412 | ||
1413 | //K0 loop | |
1414 | for (Int_t jMix =0; jMix < NofEventsinPool; jMix++) {// loop on events in the pool; if it is SE analysis, stops at one (index not needed there) | |
1415 | Bool_t analyzetracksK0 = fCorrelatorK0->ProcessAssociatedTracks(jMix); | |
1416 | if(!analyzetracksK0) { | |
1417 | AliInfo("AliHFCorrelator::Cannot process the K0 array"); | |
1418 | continue; | |
1419 | } | |
a2ad7da1 | 1420 | |
bce70c96 | 1421 | for(Int_t iTrack = 0; iTrack<fCorrelatorK0->GetNofTracks(); iTrack++){ // looping on k0 candidates |
1422 | ||
1423 | Bool_t runcorrelation = fCorrelatorK0->Correlate(iTrack); | |
1424 | if(!runcorrelation) continue; | |
1425 | ||
1426 | AliReducedParticle* k0 = fCorrelatorK0->GetAssociatedParticle(); | |
a2ad7da1 | 1427 | |
bce70c96 | 1428 | if(k0->Pt() < fPtThreshLow.at(ptbin) || k0->Pt() > fPtThreshUp.at(ptbin)) continue; //discard tracks outside pt range for hadrons/K |
bce70c96 | 1429 | |
1430 | FillSparsePlots(mcArray,d,origD0,PDGD0,k0,kK0); //fills for charged tracks | |
1431 | ||
1432 | if(!fMixing) N_Kaons++; | |
1433 | ||
1434 | } // end of charged kaons loop | |
ad8d2dfd | 1435 | } //end of event loop for fCorrelatorK0 |
bce70c96 | 1436 | |
1437 | //leading track correlations fill | |
ad8d2dfd | 1438 | if(!fMixing) { |
1439 | if(fReadMC) { | |
1440 | if(((AliAODMCParticle*)mcArray->At(labD0))->GetPdgCode()==421) { //D0 | |
1441 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_Bin%d",ptbin)))->Fill(lead[1],mD0); //c and b D0 | |
1442 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0); //c or b D0 | |
1443 | if(origD0==4&&(int)lead[2]>=1&&(int)lead[2]<=2) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0); | |
1444 | if(origD0==5&&(int)lead[2]>=3&&(int)lead[2]<=6) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0); | |
1445 | } | |
1446 | if(((AliAODMCParticle*)mcArray->At(labD0))->GetPdgCode()==-421) { //D0bar | |
1447 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_Bin%d",ptbin)))->Fill(lead[1],mD0bar); | |
1448 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0bar); //c or b D0 | |
1449 | if(origD0==4&&(int)lead[2]>=1&&(int)lead[2]<=2) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0bar); | |
1450 | if(origD0==5&&(int)lead[2]>=3&&(int)lead[2]<=6) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(lead[0],mD0bar); | |
1451 | } | |
1452 | } else { | |
1453 | if(fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_Bin%d",ptbin)))->Fill(lead[0],mD0); //c and b D0 | |
1454 | if(fIsSelectedCandidate == 2 || fIsSelectedCandidate == 3) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Lead_Bin%d",ptbin)))->Fill(lead[0],mD0bar); | |
a2ad7da1 | 1455 | } |
1456 | ||
ad8d2dfd | 1457 | //Fill of count histograms |
1458 | if (!fAlreadyFilled) { | |
1459 | ((TH1F*)fOutputStudy->FindObject("hist_Count_Charg"))->Fill(N_Charg); | |
1460 | ((TH1F*)fOutputStudy->FindObject("hist_Count_Kcharg"))->Fill(N_KCharg); | |
1461 | ((TH1F*)fOutputStudy->FindObject("hist_Count_K0"))->Fill(N_Kaons); | |
1462 | } | |
bce70c96 | 1463 | } |
a2ad7da1 | 1464 | |
bce70c96 | 1465 | fAlreadyFilled=kTRUE; //at least a D0 analyzed in the event; distribution plots already filled |
a2ad7da1 | 1466 | |
bce70c96 | 1467 | } |
1468 | ||
1469 | //________________________________________________________________________ | |
1470 | void AliAnalysisTaskSED0Correlations::FillSparsePlots(TClonesArray* mcArray, AliAODRecoDecayHF2Prong *d, Int_t origD0, Int_t PdgD0, AliReducedParticle* track, Int_t type) { | |
1471 | // | |
1472 | //fills the THnSparse for correlations, calculating the variables | |
1473 | // | |
1474 | ||
1475 | //Initialization of variables | |
1476 | Int_t ptbin = PtBinCorr(d->Pt()); | |
1477 | if(ptbin < 0) return; | |
1478 | Double_t mD0, mD0bar, deltaphi = 0., deltaeta = 0.; | |
1479 | d->InvMassD0(mD0,mD0bar); | |
1480 | ||
da975030 | 1481 | if (fReadMC && track->GetLabel()<1) return; |
1482 | if (fReadMC && !(AliAODMCParticle*)mcArray->At(track->GetLabel())) return; | |
bce70c96 | 1483 | Double_t ptTrack = track->Pt(); |
1484 | Double_t d0Track = type!=kK0 ? track->GetImpPar() : 0.; | |
1485 | Double_t phiTr = track->Phi(); | |
1486 | Double_t origTr = fReadMC ? CheckTrackOrigin(mcArray,(AliAODMCParticle*)mcArray->At(track->GetLabel())) : 0; | |
1487 | ||
1488 | TString part = "", orig = ""; | |
1489 | ||
1490 | switch (type) { | |
1491 | case(kTrack): { | |
1492 | part = "Charg"; | |
1493 | deltaphi = fCorrelatorTr->GetDeltaPhi(); | |
1494 | deltaeta = fCorrelatorTr->GetDeltaEta(); | |
1495 | break; | |
1496 | } | |
1497 | case(kKCharg): { | |
1498 | part = "Kcharg"; | |
1499 | deltaphi = fCorrelatorKc->GetDeltaPhi(); | |
1500 | deltaeta = fCorrelatorKc->GetDeltaEta(); | |
1501 | break; | |
1502 | } | |
1503 | case(kK0): { | |
1504 | part = "K0"; | |
1505 | deltaphi = fCorrelatorK0->GetDeltaPhi(); | |
1506 | deltaeta = fCorrelatorK0->GetDeltaEta(); | |
1507 | break; | |
a2ad7da1 | 1508 | } |
bce70c96 | 1509 | } |
bce70c96 | 1510 | |
1511 | if(fMixing == kSE) { | |
1512 | ||
ad8d2dfd | 1513 | //Fixes limits; needed to include overflow into THnSparse projections! |
1514 | Double_t pTorig = track->Pt(); | |
1515 | Double_t d0orig = track->GetImpPar(); | |
1516 | Double_t ptLim_Sparse = ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_Charg_Bin%d",ptbin)))->GetAxis(2)->GetXmax(); //all plots have same axes... | |
1517 | Double_t displLim_Sparse = ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_Charg_Bin%d",ptbin)))->GetAxis(3)->GetXmax(); | |
1518 | Double_t EtaLim_Sparse = ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_Charg_Bin%d",ptbin)))->GetAxis(4)->GetXmax(); | |
1519 | if(ptTrack > ptLim_Sparse) ptTrack = ptLim_Sparse-0.01; | |
1520 | if(d0Track > displLim_Sparse) d0Track = (displLim_Sparse-0.001); | |
1521 | if(deltaeta > EtaLim_Sparse) deltaeta = EtaLim_Sparse-0.01; | |
1522 | if(deltaeta < -EtaLim_Sparse) deltaeta = -EtaLim_Sparse+0.01; | |
1523 | ||
1524 | //variables for filling histos | |
1525 | Double_t fillSpPhiD0[5] = {deltaphi,mD0,ptTrack,d0Track,deltaeta}; | |
1526 | Double_t fillSpPhiD0bar[5] = {deltaphi,mD0bar,ptTrack,d0Track,deltaeta}; | |
a2ad7da1 | 1527 | |
bce70c96 | 1528 | if(fReadMC == 0) { |
1529 | //sparse fill for data (tracks, K+-, K0) + weighted | |
1530 | if(fIsSelectedCandidate == 1 || fIsSelectedCandidate == 3) { //D0 | |
1531 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d",part.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1532 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_Bin%d",ptbin)))->Fill(deltaphi,mD0,pTorig); | |
a2ad7da1 | 1533 | } |
bce70c96 | 1534 | if(fIsSelectedCandidate == 2 || fIsSelectedCandidate == 3) { //D0bar |
1535 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d",part.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1536 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_Bin%d",ptbin)))->Fill(deltaphi,mD0bar,pTorig); | |
a2ad7da1 | 1537 | } |
1538 | if(!fAlreadyFilled) { | |
bce70c96 | 1539 | ((TH1F*)fOutputStudy->FindObject(Form("hist_Pt_%s_Bin%d",part.Data(),ptbin)))->Fill(pTorig); |
1540 | ((TH1F*)fOutputStudy->FindObject(Form("hist_PhiDistr_%s",part.Data())))->Fill(phiTr); | |
a2ad7da1 | 1541 | } |
bce70c96 | 1542 | } |
a2ad7da1 | 1543 | |
bce70c96 | 1544 | if(fReadMC) { |
a2ad7da1 | 1545 | |
bce70c96 | 1546 | if(origD0==4) {orig = "_From_c";} else {orig = "_From_b";} |
a2ad7da1 | 1547 | |
bce70c96 | 1548 | //sparse fill for data (tracks, K+-, K0) + weighted |
1549 | if(PdgD0==421) { //D0 (from MCTruth) | |
1550 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d",part.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1551 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1552 | if(origD0==4&&origTr>=1&&origTr<=2) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_HF%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1553 | if(origD0==5&&origTr>=3&&origTr<=6) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_HF%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1554 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_Bin%d",ptbin)))->Fill(deltaphi,mD0,pTorig); | |
1555 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0,pTorig); | |
1556 | if(origD0==4&&origTr>=1&&origTr<=2) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0,pTorig); | |
1557 | if(origD0==5&&origTr>=3&&origTr<=6) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0,pTorig); | |
a2ad7da1 | 1558 | } |
bce70c96 | 1559 | if(PdgD0==-421) { //D0bar |
1560 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d",part.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1561 | ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1562 | if(origD0==4&&origTr>=1&&origTr<=2) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_HF%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1563 | if(origD0==5&&origTr>=3&&origTr<=6) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_HF%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1564 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_Bin%d",ptbin)))->Fill(deltaphi,mD0bar,pTorig); | |
1565 | ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0bar,pTorig); | |
1566 | if(origD0==4&&origTr>=1&&origTr<=2) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0bar,pTorig); | |
1567 | if(origD0==5&&origTr>=3&&origTr<=6) ((TH2F*)fOutputCorr->FindObject(Form("hPhi_Weig_HF%s_Bin%d",orig.Data(),ptbin)))->Fill(deltaphi,mD0bar,pTorig); | |
1568 | } | |
a2ad7da1 | 1569 | if(!fAlreadyFilled) { |
bce70c96 | 1570 | ((TH1F*)fOutputStudy->FindObject(Form("histDispl_%s_Bin%d",part.Data(),ptbin)))->Fill(d0orig); //Fills displacement histos |
1571 | if (origTr>=1&&origTr<=6) ((TH1F*)fOutputStudy->FindObject(Form("histDispl_%s_HF_Bin%d",part.Data(),ptbin)))->Fill(d0orig); | |
1572 | if (origTr>=1&&origTr<=6) ((TH1F*)fOutputStudy->FindObject(Form("histDispl_%s_HF%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(d0orig); | |
1573 | ((TH1F*)fOutputStudy->FindObject(Form("histDispl_%s%s_Bin%d",part.Data(),orig.Data(),ptbin)))->Fill(d0orig); //Fills displacement histos | |
1574 | ((TH1F*)fOutputStudy->FindObject(Form("hist_Pt_%s_Bin%d",part.Data(),ptbin)))->Fill(pTorig); | |
1575 | ((TH1F*)fOutputStudy->FindObject(Form("histOrig_%s_Bin%d",part.Data(),ptbin)))->Fill(origTr); | |
1576 | ((TH1F*)fOutputStudy->FindObject(Form("hist_PhiDistr_%s",part.Data())))->Fill(phiTr); | |
a2ad7da1 | 1577 | } |
bce70c96 | 1578 | }//end MC case |
a2ad7da1 | 1579 | |
bce70c96 | 1580 | } //end of SE fill |
a2ad7da1 | 1581 | |
bce70c96 | 1582 | if(fMixing == kME) { |
a2ad7da1 | 1583 | |
ad8d2dfd | 1584 | //Fixes limits; needed to include overflow into THnSparse projections! |
1585 | Double_t EtaLim_Sparse = ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_Charg_Bin%d_EvMix",ptbin)))->GetAxis(2)->GetXmax(); | |
1586 | if(deltaeta > EtaLim_Sparse) deltaeta = EtaLim_Sparse-0.01; | |
1587 | if(deltaeta < -EtaLim_Sparse) deltaeta = -EtaLim_Sparse+0.01; | |
1588 | ||
1589 | //variables for filling histos | |
1590 | Double_t fillSpPhiD0[3] = {deltaphi,mD0,deltaeta}; | |
1591 | Double_t fillSpPhiD0bar[3] = {deltaphi,mD0bar,deltaeta}; | |
a2ad7da1 | 1592 | |
bce70c96 | 1593 | if(fReadMC == 0) { |
1594 | //sparse fill for data (tracks, K+-, K0) | |
1595 | if(fIsSelectedCandidate == 1||fIsSelectedCandidate == 3) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d_EvMix",part.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1596 | if(fIsSelectedCandidate == 2||fIsSelectedCandidate == 3) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d_EvMix",part.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1597 | } | |
1598 | if(fReadMC == 1) { | |
1599 | //sparse fill for data (tracks, K+-, K0) | |
1600 | if(PdgD0==421) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d_EvMix",part.Data(),ptbin)))->Fill(fillSpPhiD0); | |
1601 | if(PdgD0==-421) ((THnSparseI*)fOutputCorr->FindObject(Form("hPhi_%s_Bin%d_EvMix",part.Data(),ptbin)))->Fill(fillSpPhiD0bar); | |
1602 | }//end MC case | |
a2ad7da1 | 1603 | |
bce70c96 | 1604 | } //end of ME fill |
1605 | ||
1606 | return; | |
a2ad7da1 | 1607 | } |
1608 | ||
1609 | //_________________________________________________________________________________________________ | |
1610 | Int_t AliAnalysisTaskSED0Correlations::CheckTrackOrigin(TClonesArray* arrayMC, AliAODMCParticle *mcPartCandidate) const { | |
1611 | // | |
1612 | // checks on particle (#) origin: | |
1613 | // 0) Not HF | |
1614 | // 1) D-># | |
1615 | // 2) D->X-># | |
1616 | // 3) B-># | |
1617 | // 4) B->X-># (X!=D) | |
1618 | // 5) B->D-># | |
1619 | // 6) B->D->X-># | |
1620 | // 7) c hadronization | |
1621 | // 8) b hadronization | |
1622 | // | |
bce70c96 | 1623 | if(fDebug>2) printf("AliAnalysisTaskSED0Correlations::CheckTrkOrigin() \n"); |
a2ad7da1 | 1624 | |
1625 | Int_t pdgGranma = 0; | |
1626 | Int_t mother = 0; | |
1627 | mother = mcPartCandidate->GetMother(); | |
1628 | Int_t istep = 0; | |
1629 | Int_t abspdgGranma =0; | |
1630 | Bool_t isFromB=kFALSE; | |
1631 | Bool_t isDdaugh=kFALSE; | |
1632 | Bool_t isDchaindaugh=kFALSE; | |
1633 | Bool_t isBdaugh=kFALSE; | |
1634 | Bool_t isBchaindaugh=kFALSE; | |
1635 | Bool_t isQuarkFound=kFALSE; | |
1636 | ||
1637 | while (mother > 0){ | |
1638 | istep++; | |
1639 | AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(arrayMC->At(mother)); | |
1640 | if (mcGranma){ | |
1641 | pdgGranma = mcGranma->GetPdgCode(); | |
1642 | abspdgGranma = TMath::Abs(pdgGranma); | |
1643 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){ | |
1644 | isBchaindaugh=kTRUE; | |
1645 | if(istep==1) isBdaugh=kTRUE; | |
1646 | } | |
1647 | if ((abspdgGranma > 400 && abspdgGranma < 500) || (abspdgGranma > 4000 && abspdgGranma < 5000)){ | |
1648 | isDchaindaugh=kTRUE; | |
1649 | if(istep==1) isDdaugh=kTRUE; | |
1650 | } | |
1651 | if(abspdgGranma==4 || abspdgGranma==5) {isQuarkFound=kTRUE; if(abspdgGranma==5) isFromB = kTRUE;} | |
1652 | mother = mcGranma->GetMother(); | |
1653 | }else{ | |
1654 | AliError("Failed casting the mother particle!"); | |
1655 | break; | |
1656 | } | |
1657 | } | |
1658 | ||
1659 | //decides what to return based on the flag status | |
1660 | if(isQuarkFound) { | |
1661 | if(!isFromB) { //charm | |
1662 | if(isDdaugh) return 1; //charm immediate | |
1663 | else if(isDchaindaugh) return 2; //charm chain | |
1664 | else return 7; //charm hadronization | |
1665 | } | |
1666 | else { //beauty | |
1667 | if(isBdaugh) return 3; //b immediate | |
1668 | else if(isBchaindaugh) { //b chain | |
1669 | if(isDchaindaugh) { | |
1670 | if(isDdaugh) return 5; //d immediate | |
1671 | return 6; //d chain | |
1672 | } | |
1673 | else return 4; //b, not d | |
1674 | } | |
1675 | else return 8; //b hadronization | |
1676 | } | |
1677 | } | |
1678 | else return 0; //no HF quark | |
1679 | } | |
1680 | ||
a2ad7da1 | 1681 | //________________________________________________________________________ |
1682 | Int_t AliAnalysisTaskSED0Correlations::PtBinCorr(Double_t pt) const { | |
1683 | // | |
1684 | //give the pt bin where the pt lies. | |
1685 | // | |
1686 | Int_t ptbin=-1; | |
1687 | if(pt<fBinLimsCorr.at(0)) return ptbin; //out of bounds | |
1688 | ||
1689 | Int_t i = 0; | |
1690 | while(pt>fBinLimsCorr.at(i)) {ptbin=i; i++;} | |
1691 | ||
1692 | return ptbin; | |
1693 | } | |
1694 | ||
a2ad7da1 | 1695 | //--------------------------------------------------------------------------- |
1696 | Bool_t AliAnalysisTaskSED0Correlations::SelectV0(AliAODv0* v0, AliAODVertex *vtx, Int_t opt, Int_t idArrayV0[][2]) const | |
1697 | { | |
1698 | // | |
1699 | // Selection for K0 hypotheses | |
1700 | // options: 1 = selects mass invariant about 3 sigma inside the peak + threshold of 0.3 GeV | |
1701 | // 2 = no previous selections | |
1702 | ||
1703 | if(!fCutsTracks->IsKZeroSelected(v0,vtx)) return kFALSE; | |
1704 | ||
1705 | AliAODTrack *v0Daug1 = (AliAODTrack*)v0->GetDaughter(0); | |
1706 | AliAODTrack *v0Daug2 = (AliAODTrack*)v0->GetDaughter(1); | |
1707 | ||
1708 | if(opt==1) { //additional cuts for correlations (V0 has to be closer than 3 sigma from K0 mass) | |
bce70c96 | 1709 | if(TMath::Abs(v0->MassK0Short()-0.4976) > 3*0.004) return kFALSE; |
a2ad7da1 | 1710 | } |
1711 | ||
1712 | //This part removes double counting for swapped tracks! | |
1713 | Int_t i = 0; //while loop (until the last-written entry pair of ID! | |
1714 | while(idArrayV0[i][0]!=-2 && idArrayV0[i][1]!=-2) { | |
1715 | if((v0Daug1->GetID()==idArrayV0[i][0] && v0Daug2->GetID()==idArrayV0[i][1])|| | |
1716 | (v0Daug1->GetID()==idArrayV0[i][1] && v0Daug2->GetID()==idArrayV0[i][0])) return kFALSE; | |
1717 | i++; | |
1718 | } | |
1719 | idArrayV0[i][0]=v0Daug1->GetID(); | |
1720 | idArrayV0[i][1]=v0Daug2->GetID(); | |
1721 | ||
1722 | return kTRUE; | |
1723 | } | |
1724 | ||
1725 | //________________________________________________________________________ | |
1726 | void AliAnalysisTaskSED0Correlations::PrintBinsAndLimits() { | |
1727 | ||
1728 | cout << "--------------------------\n"; | |
1729 | cout << "PtBins = " << fNPtBinsCorr << "\n"; | |
1730 | cout << "PtBin limits--------------\n"; | |
1731 | for (int i=0; i<fNPtBinsCorr; i++) { | |
1732 | cout << "Bin "<<i+1<<" = "<<fBinLimsCorr.at(i)<<" to "<<fBinLimsCorr.at(i+1)<<"\n"; | |
1733 | } | |
1734 | cout << "\n--------------------------\n"; | |
1735 | cout << "PtBin tresh. tracks low---\n"; | |
1736 | for (int i=0; i<fNPtBinsCorr; i++) { | |
1737 | cout << fPtThreshLow.at(i) << "; "; | |
1738 | } | |
1739 | cout << "PtBin tresh. tracks up----\n"; | |
1740 | for (int i=0; i<fNPtBinsCorr; i++) { | |
1741 | cout << fPtThreshUp.at(i) << "; "; | |
1742 | } | |
1743 | cout << "\n--------------------------\n"; | |
8c2d7467 | 1744 | cout << "D0 Eta cut for Correl = "<<fEtaForCorrel<<"\n"; |
1745 | cout << "--------------------------\n"; | |
a2ad7da1 | 1746 | cout << "MC Truth = "<<fReadMC<<"\n"; |
1747 | cout << "--------------------------\n"; | |
bce70c96 | 1748 | cout << "Ev Mixing = "<<fMixing<<"\n"; |
1749 | cout << "--------------------------\n"; | |
a2ad7da1 | 1750 | } |
1751 |