]>
Commit | Line | Data |
---|---|---|
d486095a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2008, 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 | ||
27de2dfb | 16 | /* $Id$ */ |
17 | ||
993bfba1 | 18 | //************************************************************************* |
19 | // Class AliAnalysisTaskSEDplus | |
20 | // AliAnalysisTaskSE for the D+ candidates Invariant Mass Histogram and | |
21 | //comparison of heavy-flavour decay candidates | |
22 | // to MC truth (kinematics stored in the AOD) | |
4afc48a2 | 23 | // Authors: Renu Bala, bala@to.infn.it |
24 | // F. Prino, prino@to.infn.it | |
25 | // G. Ortona, ortona@to.infn.it | |
d486095a | 26 | ///////////////////////////////////////////////////////////// |
27 | ||
28 | #include <TClonesArray.h> | |
29 | #include <TNtuple.h> | |
13808a30 | 30 | #include <TCanvas.h> |
d486095a | 31 | #include <TList.h> |
1f4e9722 | 32 | #include <TString.h> |
4afc48a2 | 33 | #include <TDatabasePDG.h> |
b557eb43 | 34 | |
35 | #include "AliAnalysisManager.h" | |
4c230f6d | 36 | #include "AliRDHFCutsDplustoKpipi.h" |
b557eb43 | 37 | #include "AliAODHandler.h" |
d486095a | 38 | #include "AliAODEvent.h" |
39 | #include "AliAODVertex.h" | |
40 | #include "AliAODTrack.h" | |
d486095a | 41 | #include "AliAODRecoDecayHF3Prong.h" |
42 | #include "AliAnalysisVertexingHF.h" | |
43 | #include "AliAnalysisTaskSE.h" | |
44 | #include "AliAnalysisTaskSEDplus.h" | |
a96083b9 | 45 | #include "AliNormalizationCounter.h" |
d48d81b5 | 46 | #include "AliVertexingHFUtils.h" |
d486095a | 47 | ClassImp(AliAnalysisTaskSEDplus) |
48 | ||
d486095a | 49 | //________________________________________________________________________ |
50 | AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(): | |
51 | AliAnalysisTaskSE(), | |
595cc7e2 | 52 | fOutput(0), |
53 | fHistNEvents(0), | |
54 | fPtVsMass(0), | |
55 | fPtVsMassTC(0), | |
56 | fYVsPt(0), | |
57 | fYVsPtTC(0), | |
58 | fYVsPtSig(0), | |
59 | fYVsPtSigTC(0), | |
d48d81b5 | 60 | fSPDMult(0), |
595cc7e2 | 61 | fNtupleDplus(0), |
62 | fUpmasslimit(1.965), | |
63 | fLowmasslimit(1.765), | |
64 | fNPtBins(0), | |
65 | fBinWidth(0.002), | |
66 | fListCuts(0), | |
595cc7e2 | 67 | fRDCutsAnalysis(0), |
a96083b9 | 68 | fCounter(0), |
595cc7e2 | 69 | fFillNtuple(kFALSE), |
70 | fReadMC(kFALSE), | |
a96083b9 | 71 | fUseStrangeness(kFALSE), |
5fc4893f | 72 | fUseBit(kTRUE), |
2edd194d | 73 | fCutsDistr(kFALSE), |
7d9ca2b5 | 74 | fDoImpPar(kFALSE), |
3de19caa | 75 | fNImpParBins(400), |
76 | fLowerImpPar(-2000.), | |
77 | fHigherImpPar(2000.), | |
3ec9254b | 78 | fDoLS(0) |
d486095a | 79 | { |
d48d81b5 | 80 | // Default constructor |
5c2b6336 | 81 | |
82 | for(Int_t i=0;i<3;i++){ | |
d48d81b5 | 83 | if(fHistCentrality[i])fHistCentrality[i]=0; |
84 | if(fCorreld0Kd0pi[i])fCorreld0Kd0pi[i]=0; | |
5c2b6336 | 85 | } |
86 | ||
87 | for(Int_t i=0; i<5; i++)fHistMassPtImpParTC[i]=0; | |
88 | ||
89 | ||
6d2e58f0 | 90 | for(Int_t i=0;i<3*kMaxPtBins;i++){ |
5c2b6336 | 91 | if(fMassHist[i])fMassHist[i]=0; |
92 | if(fCosPHist[i])fCosPHist[i]=0; | |
93 | if(fDLenHist[i])fDLenHist[i]=0; | |
94 | if(fSumd02Hist[i])fSumd02Hist[i]=0; | |
95 | if(fSigVertHist[i])fSigVertHist[i]=0; | |
96 | if(fPtMaxHist[i])fPtMaxHist[i]=0; | |
97 | if(fPtKHist[i])fPtKHist[i]=0; | |
98 | if(fPtpi1Hist[i])fPtpi1Hist[i]=0; | |
99 | if(fPtpi2Hist[i])fPtpi2Hist[i]=0; | |
100 | if(fDCAHist[i])fDCAHist[i]=0; | |
101 | if(fMassHistTC[i])fMassHistTC[i]=0; | |
102 | if(fMassHistTCPlus[i])fMassHistTCPlus[i]=0; | |
103 | if(fMassHistTCMinus[i])fMassHistTCMinus[i]=0; | |
104 | ||
105 | if(fDLxy[i])fDLxy[i]=0; | |
106 | if(fDLxyTC[i])fDLxyTC[i]=0; | |
107 | if(fCosxy[i])fCosxy[i]=0; | |
108 | if(fCosxyTC[i])fCosxyTC[i]=0; | |
5c2b6336 | 109 | if(fCosPHistLS[i])fCosPHistLS[i]=0; |
110 | if(fDLenHistLS[i])fDLenHistLS[i]=0; | |
111 | if(fSumd02HistLS[i])fSumd02HistLS[i]=0; | |
112 | if(fSigVertHistLS[i])fSigVertHistLS[i]=0; | |
113 | if(fPtMaxHistLS[i])fPtMaxHistLS[i]=0; | |
114 | if(fDCAHistLS[i])fDCAHistLS[i]=0; | |
6d2e58f0 | 115 | } |
116 | for(Int_t i=0;i<5*kMaxPtBins;i++){ | |
117 | if(fMassHistLS[i])fMassHistLS[i]=0; | |
5c2b6336 | 118 | if(fMassHistLSTC[i])fMassHistLSTC[i]=0; |
119 | } | |
6d2e58f0 | 120 | for(Int_t i=0;i<kMaxPtBins+1;i++){ |
121 | fArrayBinLimits[i]=0; | |
122 | } | |
5c2b6336 | 123 | |
d486095a | 124 | } |
125 | ||
126 | //________________________________________________________________________ | |
d48d81b5 | 127 | AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(const char *name,AliRDHFCutsDplustoKpipi *dpluscutsana,Bool_t fillNtuple): |
3de19caa | 128 | AliAnalysisTaskSE(name), |
129 | fOutput(0), | |
130 | fHistNEvents(0), | |
131 | fPtVsMass(0), | |
132 | fPtVsMassTC(0), | |
133 | fYVsPt(0), | |
134 | fYVsPtTC(0), | |
135 | fYVsPtSig(0), | |
136 | fYVsPtSigTC(0), | |
d48d81b5 | 137 | fSPDMult(0), |
3de19caa | 138 | fNtupleDplus(0), |
139 | fUpmasslimit(1.965), | |
140 | fLowmasslimit(1.765), | |
141 | fNPtBins(0), | |
142 | fBinWidth(0.002), | |
143 | fListCuts(0), | |
3de19caa | 144 | fRDCutsAnalysis(dpluscutsana), |
145 | fCounter(0), | |
146 | fFillNtuple(fillNtuple), | |
147 | fReadMC(kFALSE), | |
148 | fUseStrangeness(kFALSE), | |
149 | fUseBit(kTRUE), | |
2edd194d | 150 | fCutsDistr(kFALSE), |
3de19caa | 151 | fDoImpPar(kFALSE), |
152 | fNImpParBins(400), | |
153 | fLowerImpPar(-2000.), | |
154 | fHigherImpPar(2000.), | |
155 | fDoLS(0) | |
d486095a | 156 | { |
4c230f6d | 157 | // |
158 | // Standrd constructor | |
159 | // | |
a6003e0a | 160 | fNPtBins=fRDCutsAnalysis->GetNPtBins(); |
9877ffb3 | 161 | |
162 | for(Int_t i=0;i<3;i++){ | |
d48d81b5 | 163 | if(fHistCentrality[i])fHistCentrality[i]=0; |
164 | if(fCorreld0Kd0pi[i])fCorreld0Kd0pi[i]=0; | |
9877ffb3 | 165 | } |
166 | ||
167 | for(Int_t i=0; i<5; i++)fHistMassPtImpParTC[i]=0; | |
168 | ||
6d2e58f0 | 169 | for(Int_t i=0;i<3*kMaxPtBins;i++){ |
9877ffb3 | 170 | if(fMassHist[i])fMassHist[i]=0; |
171 | if(fCosPHist[i])fCosPHist[i]=0; | |
172 | if(fDLenHist[i])fDLenHist[i]=0; | |
173 | if(fSumd02Hist[i])fSumd02Hist[i]=0; | |
174 | if(fSigVertHist[i])fSigVertHist[i]=0; | |
175 | if(fPtMaxHist[i])fPtMaxHist[i]=0; | |
176 | if(fPtKHist[i])fPtKHist[i]=0; | |
177 | if(fPtpi1Hist[i])fPtpi1Hist[i]=0; | |
178 | if(fPtpi2Hist[i])fPtpi2Hist[i]=0; | |
179 | if(fDCAHist[i])fDCAHist[i]=0; | |
180 | if(fMassHistTC[i])fMassHistTC[i]=0; | |
181 | if(fMassHistTCPlus[i])fMassHistTCPlus[i]=0; | |
182 | if(fMassHistTCMinus[i])fMassHistTCMinus[i]=0; | |
183 | ||
184 | if(fDLxy[i])fDLxy[i]=0; | |
185 | if(fDLxyTC[i])fDLxyTC[i]=0; | |
186 | if(fCosxy[i])fCosxy[i]=0; | |
187 | if(fCosxyTC[i])fCosxyTC[i]=0; | |
9877ffb3 | 188 | if(fCosPHistLS[i])fCosPHistLS[i]=0; |
189 | if(fDLenHistLS[i])fDLenHistLS[i]=0; | |
190 | if(fSumd02HistLS[i])fSumd02HistLS[i]=0; | |
191 | if(fSigVertHistLS[i])fSigVertHistLS[i]=0; | |
192 | if(fPtMaxHistLS[i])fPtMaxHistLS[i]=0; | |
193 | if(fDCAHistLS[i])fDCAHistLS[i]=0; | |
6d2e58f0 | 194 | } |
195 | for(Int_t i=0;i<5*kMaxPtBins;i++){ | |
196 | if(fMassHistLS[i])fMassHistLS[i]=0; | |
9877ffb3 | 197 | if(fMassHistLSTC[i])fMassHistLSTC[i]=0; |
198 | } | |
6d2e58f0 | 199 | for(Int_t i=0;i<kMaxPtBins+1;i++){ |
200 | fArrayBinLimits[i]=0; | |
201 | } | |
9877ffb3 | 202 | |
203 | ||
d486095a | 204 | // Default constructor |
9877ffb3 | 205 | // Output slot #1 writes into a TList container |
d486095a | 206 | DefineOutput(1,TList::Class()); //My private output |
d48d81b5 | 207 | // Output slot #2 writes cut to private output |
4c230f6d | 208 | // DefineOutput(2,AliRDHFCutsDplustoKpipi::Class()); |
209 | DefineOutput(2,TList::Class()); | |
9877ffb3 | 210 | // Output slot #3 writes cut to private output |
a96083b9 | 211 | DefineOutput(3,AliNormalizationCounter::Class()); |
9877ffb3 | 212 | |
1f4e9722 | 213 | if(fFillNtuple){ |
a96083b9 | 214 | // Output slot #4 writes into a TNtuple container |
215 | DefineOutput(4,TNtuple::Class()); //My private output | |
1f4e9722 | 216 | } |
d486095a | 217 | } |
218 | ||
219 | //________________________________________________________________________ | |
220 | AliAnalysisTaskSEDplus::~AliAnalysisTaskSEDplus() | |
221 | { | |
4c230f6d | 222 | // |
d486095a | 223 | // Destructor |
4c230f6d | 224 | // |
d486095a | 225 | if (fOutput) { |
226 | delete fOutput; | |
227 | fOutput = 0; | |
228 | } | |
137c7bcd | 229 | if(fHistNEvents){ |
230 | delete fHistNEvents; | |
231 | fHistNEvents=0; | |
232 | } | |
d48d81b5 | 233 | |
37fc80e6 | 234 | for(Int_t i=0;i<3;i++){ |
235 | if(fHistCentrality[i]){delete fHistCentrality[i]; fHistCentrality[i]=0;} | |
236 | } | |
d48d81b5 | 237 | |
137c7bcd | 238 | for(Int_t i=0;i<3*fNPtBins;i++){ |
239 | if(fMassHist[i]){ delete fMassHist[i]; fMassHist[i]=0;} | |
240 | if(fCosPHist[i]){ delete fCosPHist[i]; fCosPHist[i]=0;} | |
241 | if(fDLenHist[i]){ delete fDLenHist[i]; fDLenHist[i]=0;} | |
242 | if(fSumd02Hist[i]){ delete fSumd02Hist[i]; fSumd02Hist[i]=0;} | |
243 | if(fSigVertHist[i]){ delete fSigVertHist[i]; fSigVertHist[i]=0;} | |
244 | if(fPtMaxHist[i]){ delete fPtMaxHist[i]; fPtMaxHist[i]=0;} | |
3ec9254b | 245 | if(fPtKHist[i]){ delete fPtKHist[i]; fPtKHist[i]=0;} |
246 | if(fPtpi1Hist[i]){ delete fPtpi1Hist[i]; fPtpi1Hist[i]=0;} | |
247 | if(fPtpi2Hist[i]){ delete fPtpi2Hist[i]; fPtpi2Hist[i]=0;} | |
137c7bcd | 248 | if(fDCAHist[i]){ delete fDCAHist[i]; fDCAHist[i]=0;} |
249 | if(fMassHistTC[i]){ delete fMassHistTC[i]; fMassHistTC[i]=0;} | |
bb69f127 | 250 | if(fMassHistTCPlus[i]){ delete fMassHistTCPlus[i]; fMassHistTCPlus[i]=0;} |
251 | if(fMassHistTCMinus[i]){ delete fMassHistTCMinus[i]; fMassHistTCMinus[i]=0;} | |
4c230f6d | 252 | |
3ec9254b | 253 | if(fDLxy[i]){delete fDLxy[i]; fDLxy[i]=0;} |
254 | if(fDLxyTC[i]){delete fDLxyTC[i]; fDLxyTC[i]=0;} | |
255 | if(fCosxy[i]){delete fCosxy[i]; fCosxy[i]=0;} | |
256 | if(fCosxyTC[i]){delete fCosxyTC[i]; fCosxyTC[i]=0;} | |
137c7bcd | 257 | if(fMassHistLS[i]){ delete fMassHistLS[i]; fMassHistLS[i]=0;} |
258 | if(fCosPHistLS[i]){ delete fCosPHistLS[i]; fCosPHistLS[i]=0;} | |
259 | if(fDLenHistLS[i]){ delete fDLenHistLS[i]; fDLenHistLS[i]=0;} | |
260 | if(fSumd02HistLS[i]){ delete fSumd02HistLS[i]; fSumd02HistLS[i]=0;} | |
261 | if(fSigVertHistLS[i]){ delete fSigVertHistLS[i]; fSigVertHistLS[i]=0;} | |
262 | if(fPtMaxHistLS[i]){ delete fPtMaxHistLS[i]; fPtMaxHistLS[i]=0;} | |
263 | if(fDCAHistLS[i]){ delete fDCAHistLS[i]; fDCAHistLS[i]=0;} | |
264 | if(fMassHistLSTC[i]){ delete fMassHistLSTC[i]; fMassHistLSTC[i]=0;} | |
265 | } | |
cdc197b1 | 266 | |
267 | for(Int_t i=0;i<3;i++){ | |
268 | if(fCorreld0Kd0pi[i]){ delete fCorreld0Kd0pi[i]; fCorreld0Kd0pi[i]=0;} | |
269 | } | |
270 | ||
137c7bcd | 271 | if(fPtVsMass){ |
272 | delete fPtVsMass; | |
273 | fPtVsMass=0; | |
274 | } | |
275 | if(fPtVsMassTC){ | |
276 | delete fPtVsMassTC; | |
277 | fPtVsMassTC=0; | |
278 | } | |
279 | if(fYVsPt){ | |
280 | delete fYVsPt; | |
281 | fYVsPt=0; | |
282 | } | |
283 | if(fYVsPtTC){ | |
284 | delete fYVsPtTC; | |
285 | fYVsPtTC=0; | |
286 | } | |
287 | if(fYVsPtSig){ | |
288 | delete fYVsPtSig; | |
289 | fYVsPtSig=0; | |
290 | } | |
291 | if(fYVsPtSigTC){ | |
292 | delete fYVsPtSigTC; | |
293 | fYVsPtSigTC=0; | |
294 | } | |
d48d81b5 | 295 | if(fSPDMult){ |
296 | delete fSPDMult; | |
297 | fSPDMult=0; | |
298 | } | |
299 | ||
300 | ||
137c7bcd | 301 | if(fNtupleDplus){ |
302 | delete fNtupleDplus; | |
303 | fNtupleDplus=0; | |
304 | } | |
4c230f6d | 305 | if (fListCuts) { |
306 | delete fListCuts; | |
307 | fListCuts = 0; | |
d486095a | 308 | } |
137c7bcd | 309 | if(fRDCutsAnalysis){ |
4c230f6d | 310 | delete fRDCutsAnalysis; |
311 | fRDCutsAnalysis = 0; | |
312 | } | |
7d9ca2b5 | 313 | for(Int_t i=0; i<5; i++){ |
314 | delete fHistMassPtImpParTC[i]; | |
315 | } | |
a96083b9 | 316 | if(fCounter){ |
317 | delete fCounter; | |
318 | fCounter = 0; | |
319 | } | |
137c7bcd | 320 | |
321 | ||
d486095a | 322 | } |
82bb8d4b | 323 | //_________________________________________________________________ |
324 | void AliAnalysisTaskSEDplus::SetMassLimits(Float_t range){ | |
4c230f6d | 325 | // set invariant mass limits |
993bfba1 | 326 | Float_t bw=GetBinWidth(); |
82bb8d4b | 327 | fUpmasslimit = 1.865+range; |
328 | fLowmasslimit = 1.865-range; | |
993bfba1 | 329 | SetBinWidth(bw); |
82bb8d4b | 330 | } |
331 | //_________________________________________________________________ | |
332 | void AliAnalysisTaskSEDplus::SetMassLimits(Float_t lowlimit, Float_t uplimit){ | |
4c230f6d | 333 | // set invariant mass limits |
82bb8d4b | 334 | if(uplimit>lowlimit) |
335 | { | |
993bfba1 | 336 | Float_t bw=GetBinWidth(); |
82bb8d4b | 337 | fUpmasslimit = lowlimit; |
338 | fLowmasslimit = uplimit; | |
993bfba1 | 339 | SetBinWidth(bw); |
82bb8d4b | 340 | } |
341 | } | |
993bfba1 | 342 | //________________________________________________________________ |
343 | void AliAnalysisTaskSEDplus::SetBinWidth(Float_t w){ | |
344 | Float_t width=w; | |
345 | Int_t nbins=(Int_t)((fUpmasslimit-fLowmasslimit)/width+0.5); | |
346 | Int_t missingbins=4-nbins%4; | |
347 | nbins=nbins+missingbins; | |
348 | width=(fUpmasslimit-fLowmasslimit)/nbins; | |
349 | if(missingbins!=0){ | |
350 | printf("AliAnalysisTaskSEDplus::SetBinWidth: W-bin width of %f will produce histograms not rebinnable by 4. New width set to %f\n",w,width); | |
351 | } | |
352 | else{ | |
353 | if(fDebug>1) printf("AliAnalysisTaskSEDplus::SetBinWidth: width set to %f\n",width); | |
354 | } | |
355 | fBinWidth=width; | |
356 | } | |
82bb8d4b | 357 | //_________________________________________________________________ |
993bfba1 | 358 | Int_t AliAnalysisTaskSEDplus::GetNBinsHistos(){ |
359 | return (Int_t)((fUpmasslimit-fLowmasslimit)/fBinWidth+0.5); | |
360 | } | |
82bb8d4b | 361 | //_________________________________________________________________ |
362 | void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesArray *arrayLikeSign,AliAODEvent *aod,AliAODVertex *vtx1, Int_t nDplusOS){ | |
4c230f6d | 363 | // |
364 | // | |
365 | // Fill the Like Sign histograms | |
366 | // | |
3ec9254b | 367 | if(fDebug>1)printf("started LS\n"); |
2edd194d | 368 | |
5fc4893f | 369 | //histograms for like sign |
370 | Int_t nbins=GetNBinsHistos();; | |
371 | TH1F *histLSPlus = new TH1F("LSPlus","LSPlus",nbins,fLowmasslimit,fUpmasslimit); | |
372 | TH1F *histLSMinus = new TH1F("LSMinus","LSMinus",nbins,fLowmasslimit,fUpmasslimit); | |
373 | ||
82bb8d4b | 374 | Int_t nPosTrks=0,nNegTrks=0; |
82bb8d4b | 375 | Int_t nOStriplets = arrayOppositeSign->GetEntriesFast(); |
82bb8d4b | 376 | Int_t nDplusLS=0; |
5fc4893f | 377 | Int_t nDminusLS=0; |
82bb8d4b | 378 | Int_t nLikeSign = arrayLikeSign->GetEntriesFast(); |
5fc4893f | 379 | Int_t index=0; |
380 | ||
381 | // loop over like sign candidates | |
82bb8d4b | 382 | for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) { |
383 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)arrayLikeSign->UncheckedAt(iLikeSign); | |
5fc4893f | 384 | if(fUseBit && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts))continue; |
82bb8d4b | 385 | Bool_t unsetvtx=kFALSE; |
386 | if(!d->GetOwnPrimaryVtx()) { | |
387 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
388 | unsetvtx=kTRUE; | |
389 | } | |
4b99797c | 390 | Double_t ptCand = d->Pt(); |
391 | Int_t iPtBin = fRDCutsAnalysis->PtBin(ptCand); | |
392 | if(iPtBin<0)continue; | |
393 | Int_t sign= d->GetCharge(); | |
394 | if(sign>0){ | |
395 | nPosTrks++; | |
396 | }else{ | |
397 | nNegTrks++; | |
398 | } | |
5fc4893f | 399 | fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate,aod); |
400 | Int_t passTightCuts=fRDCutsAnalysis->GetIsSelectedCuts(); | |
401 | if(passTightCuts>0){ | |
82bb8d4b | 402 | Float_t invMass = d->InvMassDplus(); |
82bb8d4b | 403 | index=GetLSHistoIndex(iPtBin); |
82bb8d4b | 404 | fMassHistLS[index+1]->Fill(invMass); |
5fc4893f | 405 | if(sign>0){ |
406 | histLSPlus->Fill(invMass); | |
407 | nDplusLS++; | |
408 | }else{ | |
409 | histLSMinus->Fill(invMass); | |
410 | nDminusLS++; | |
411 | } | |
2edd194d | 412 | if(fCutsDistr){ |
5fc4893f | 413 | Double_t dlen=d->DecayLength(); |
414 | Double_t cosp=d->CosPointingAngle(); | |
415 | Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2); | |
416 | Double_t dca=d->GetDCA(); | |
417 | Double_t sigvert=d->GetSigmaVert(); | |
418 | Double_t ptmax=0; | |
419 | for(Int_t i=0;i<3;i++){ | |
420 | if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i); | |
421 | } | |
422 | fCosPHistLS[iPtBin]->Fill(cosp); | |
423 | fDLenHistLS[iPtBin]->Fill(dlen); | |
424 | fSumd02HistLS[iPtBin]->Fill(sumD02); | |
425 | fSigVertHistLS[iPtBin]->Fill(sigvert); | |
426 | fPtMaxHistLS[iPtBin]->Fill(ptmax); | |
427 | fDCAHistLS[iPtBin]->Fill(dca); | |
82bb8d4b | 428 | } |
429 | } | |
430 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
431 | } | |
5fc4893f | 432 | //wei:normalized to the number of combinations (production) |
433 | //wei2:normalized to the number of LS/OS (production) | |
434 | //wei3:normalized to the number of LS/OS (analysis) | |
435 | //wei4:normalized to the number of combinations (analysis) | |
436 | Float_t wei2=0; | |
437 | if(nLikeSign!=0)wei2 = (Float_t)nOStriplets/(Float_t)nLikeSign; | |
438 | Float_t wei3=0; | |
3ec9254b | 439 | if(nDplusLS!=0)wei3 = (Float_t)nDplusOS/(Float_t)(nDplusLS+nDminusLS); |
5fc4893f | 440 | Float_t weiplus=1.,weiminus=1.; |
441 | Float_t wei4plus=1.,wei4minus=1.; | |
442 | //wei* should be automatically protected, since to get a triplet there must be at least 3 good tracks in the event | |
443 | if(nPosTrks>2)weiplus=3.*(Float_t)nNegTrks/((Float_t)nPosTrks-2.); | |
444 | if(nDplusLS>2)wei4plus=3.*(Float_t)nDminusLS/((Float_t)nDplusLS-2.); | |
445 | if(nNegTrks>2)weiminus=3.*(Float_t)nPosTrks/((Float_t)nNegTrks-2.); | |
446 | if(nDminusLS>2)wei4minus=3.*(Float_t)nDplusLS/((Float_t)nDminusLS-2.); | |
447 | ||
448 | fMassHistLS[index]->Add(histLSPlus,weiplus); | |
449 | fMassHistLS[index]->Add(histLSMinus,weiminus); | |
450 | fMassHistLS[index+2]->Add(histLSPlus,wei2); | |
451 | fMassHistLS[index+2]->Add(histLSMinus,wei2); | |
452 | fMassHistLS[index+3]->Add(histLSPlus,wei3); | |
453 | fMassHistLS[index+3]->Add(histLSMinus,wei3); | |
454 | fMassHistLS[index+4]->Add(histLSPlus,wei4plus); | |
455 | fMassHistLS[index+4]->Add(histLSMinus,wei4minus); | |
456 | ||
457 | delete histLSPlus;histLSPlus=0; | |
458 | delete histLSMinus;histLSMinus=0; | |
82bb8d4b | 459 | |
5fc4893f | 460 | if(fDebug>1) printf("LS analysis terminated\n"); |
82bb8d4b | 461 | } |
d486095a | 462 | |
4c230f6d | 463 | //__________________________________________ |
464 | void AliAnalysisTaskSEDplus::Init(){ | |
465 | // | |
466 | // Initialization | |
467 | // | |
d486095a | 468 | if(fDebug > 1) printf("AnalysisTaskSEDplus::Init() \n"); |
4c230f6d | 469 | |
470 | //PostData(2,fRDCutsloose);//we should then put those cuts in a tlist if we have more than 1 | |
471 | fListCuts=new TList(); | |
90993728 | 472 | AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi(*fRDCutsAnalysis); |
473 | analysis->SetName("AnalysisCuts"); | |
4c230f6d | 474 | |
4c230f6d | 475 | fListCuts->Add(analysis); |
476 | PostData(2,fListCuts); | |
477 | ||
d486095a | 478 | return; |
479 | } | |
480 | ||
481 | //________________________________________________________________________ | |
482 | void AliAnalysisTaskSEDplus::UserCreateOutputObjects() | |
483 | { | |
484 | // Create the output container | |
485 | // | |
486 | if(fDebug > 1) printf("AnalysisTaskSEDplus::UserCreateOutputObjects() \n"); | |
487 | ||
488 | // Several histograms are more conveniently managed in a TList | |
489 | fOutput = new TList(); | |
490 | fOutput->SetOwner(); | |
1f4e9722 | 491 | fOutput->SetName("OutputHistos"); |
492 | ||
1f4e9722 | 493 | TString hisname; |
82bb8d4b | 494 | Int_t index=0; |
993bfba1 | 495 | Int_t nbins=GetNBinsHistos(); |
37fc80e6 | 496 | fHistCentrality[0]=new TH1F("centrality","centrality",100,0.5,30000.5); |
497 | fHistCentrality[1]=new TH1F("centrality(selectedCent)","centrality(selectedCent)",100,0.5,30000.5); | |
498 | fHistCentrality[2]=new TH1F("centrality(OutofCent)","centrality(OutofCent)",100,0.5,30000.5); | |
499 | for(Int_t i=0;i<3;i++){ | |
500 | fHistCentrality[i]->Sumw2(); | |
501 | fOutput->Add(fHistCentrality[i]); | |
502 | } | |
82bb8d4b | 503 | for(Int_t i=0;i<fNPtBins;i++){ |
1f4e9722 | 504 | |
82bb8d4b | 505 | index=GetHistoIndex(i); |
ba9ae5b2 | 506 | |
82bb8d4b | 507 | hisname.Form("hMassPt%d",i); |
993bfba1 | 508 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 509 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 510 | hisname.Form("hCosPAllPt%d",i); |
993bfba1 | 511 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 512 | fCosPHist[index]->Sumw2(); |
513 | hisname.Form("hDLenAllPt%d",i); | |
993bfba1 | 514 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 515 | fDLenHist[index]->Sumw2(); |
516 | hisname.Form("hSumd02AllPt%d",i); | |
993bfba1 | 517 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 518 | fSumd02Hist[index]->Sumw2(); |
519 | hisname.Form("hSigVertAllPt%d",i); | |
993bfba1 | 520 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 521 | fSigVertHist[index]->Sumw2(); |
522 | hisname.Form("hPtMaxAllPt%d",i); | |
993bfba1 | 523 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 524 | fPtMaxHist[index]->Sumw2(); |
3ec9254b | 525 | hisname.Form("hPtKPt%d",i); |
526 | fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
527 | fPtKHist[index]->Sumw2(); | |
528 | hisname.Form("hPtpi1Pt%d",i); | |
529 | fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
530 | fPtpi1Hist[index]->Sumw2(); | |
531 | hisname.Form("hPtpi2Pt%d",i); | |
532 | fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
533 | fPtpi2Hist[index]->Sumw2(); | |
ba9ae5b2 | 534 | hisname.Form("hDCAAllPt%d",i); |
993bfba1 | 535 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 536 | fDCAHist[index]->Sumw2(); |
537 | ||
3ec9254b | 538 | hisname.Form("hDLxyPt%d",i); |
539 | fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
540 | fDLxy[index]->Sumw2(); | |
541 | hisname.Form("hCosxyPt%d",i); | |
542 | fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
543 | fCosxy[index]->Sumw2(); | |
544 | hisname.Form("hDLxyPt%dTC",i); | |
545 | fDLxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
546 | fDLxyTC[index]->Sumw2(); | |
547 | hisname.Form("hCosxyPt%dTC",i); | |
548 | fCosxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
549 | fCosxyTC[index]->Sumw2(); | |
550 | ||
1f4e9722 | 551 | hisname.Form("hMassPt%dTC",i); |
993bfba1 | 552 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 553 | fMassHistTC[index]->Sumw2(); |
bb69f127 | 554 | hisname.Form("hMassPt%dTCPlus",i); |
555 | fMassHistTCPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
556 | fMassHistTCPlus[index]->Sumw2(); | |
557 | hisname.Form("hMassPt%dTCMinus",i); | |
558 | fMassHistTCMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
559 | fMassHistTCMinus[index]->Sumw2(); | |
ba9ae5b2 | 560 | |
561 | ||
7d9ca2b5 | 562 | |
82bb8d4b | 563 | index=GetSignalHistoIndex(i); |
82bb8d4b | 564 | hisname.Form("hSigPt%d",i); |
993bfba1 | 565 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 566 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 567 | hisname.Form("hCosPSigPt%d",i); |
993bfba1 | 568 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 569 | fCosPHist[index]->Sumw2(); |
570 | hisname.Form("hDLenSigPt%d",i); | |
993bfba1 | 571 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 572 | fDLenHist[index]->Sumw2(); |
573 | hisname.Form("hSumd02SigPt%d",i); | |
993bfba1 | 574 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 575 | fSumd02Hist[index]->Sumw2(); |
576 | hisname.Form("hSigVertSigPt%d",i); | |
993bfba1 | 577 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 578 | fSigVertHist[index]->Sumw2(); |
579 | hisname.Form("hPtMaxSigPt%d",i); | |
993bfba1 | 580 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
3ec9254b | 581 | fPtMaxHist[index]->Sumw2(); |
582 | hisname.Form("hPtKSigPt%d",i); | |
583 | fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
584 | fPtKHist[index]->Sumw2(); | |
585 | hisname.Form("hPtpi1SigPt%d",i); | |
586 | fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
587 | fPtpi1Hist[index]->Sumw2(); | |
588 | hisname.Form("hPtpi2SigPt%d",i); | |
589 | fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
590 | fPtpi2Hist[index]->Sumw2(); | |
ba9ae5b2 | 591 | |
592 | hisname.Form("hDCASigPt%d",i); | |
993bfba1 | 593 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 594 | fDCAHist[index]->Sumw2(); |
595 | ||
3ec9254b | 596 | hisname.Form("hDLxySigPt%d",i); |
597 | fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
598 | fDLxy[index]->Sumw2(); | |
599 | hisname.Form("hCosxySigPt%d",i); | |
600 | fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
601 | fCosxy[index]->Sumw2(); | |
602 | hisname.Form("hDLxySigPt%dTC",i); | |
603 | fDLxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
604 | fDLxyTC[index]->Sumw2(); | |
605 | hisname.Form("hCosxySigPt%dTC",i); | |
606 | fCosxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
607 | fCosxyTC[index]->Sumw2(); | |
1f4e9722 | 608 | hisname.Form("hSigPt%dTC",i); |
993bfba1 | 609 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 610 | fMassHistTC[index]->Sumw2(); |
bb69f127 | 611 | hisname.Form("hSigPt%dTCPlus",i); |
612 | fMassHistTCPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
613 | fMassHistTCPlus[index]->Sumw2(); | |
614 | hisname.Form("hSigPt%dTCMinus",i); | |
615 | fMassHistTCMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
616 | fMassHistTCMinus[index]->Sumw2(); | |
ba9ae5b2 | 617 | |
ba9ae5b2 | 618 | |
82bb8d4b | 619 | index=GetBackgroundHistoIndex(i); |
82bb8d4b | 620 | hisname.Form("hBkgPt%d",i); |
993bfba1 | 621 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 622 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 623 | hisname.Form("hCosPBkgPt%d",i); |
993bfba1 | 624 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 625 | fCosPHist[index]->Sumw2(); |
626 | hisname.Form("hDLenBkgPt%d",i); | |
993bfba1 | 627 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 628 | fDLenHist[index]->Sumw2(); |
629 | hisname.Form("hSumd02BkgPt%d",i); | |
993bfba1 | 630 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 631 | fSumd02Hist[index]->Sumw2(); |
632 | hisname.Form("hSigVertBkgPt%d",i); | |
993bfba1 | 633 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 634 | fSigVertHist[index]->Sumw2(); |
635 | hisname.Form("hPtMaxBkgPt%d",i); | |
993bfba1 | 636 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 637 | fPtMaxHist[index]->Sumw2(); |
3ec9254b | 638 | hisname.Form("hPtKBkgPt%d",i); |
639 | fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
640 | fPtKHist[index]->Sumw2(); | |
641 | hisname.Form("hPtpi1BkgPt%d",i); | |
642 | fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
643 | fPtpi1Hist[index]->Sumw2(); | |
644 | hisname.Form("hPtpi2BkgPt%d",i); | |
645 | fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
646 | fPtpi2Hist[index]->Sumw2(); | |
ba9ae5b2 | 647 | hisname.Form("hDCABkgPt%d",i); |
993bfba1 | 648 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 649 | fDCAHist[index]->Sumw2(); |
650 | ||
3ec9254b | 651 | hisname.Form("hDLxyBkgPt%d",i); |
652 | fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
653 | fDLxy[index]->Sumw2(); | |
654 | hisname.Form("hCosxyBkgPt%d",i); | |
655 | fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
656 | fCosxy[index]->Sumw2(); | |
657 | hisname.Form("hDLxyBkgPt%dTC",i); | |
658 | fDLxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,10.); | |
659 | fDLxyTC[index]->Sumw2(); | |
660 | hisname.Form("hCosxyBkgPt%dTC",i); | |
661 | fCosxyTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.85,1.); | |
662 | fCosxyTC[index]->Sumw2(); | |
663 | ||
ba9ae5b2 | 664 | |
1f4e9722 | 665 | hisname.Form("hBkgPt%dTC",i); |
993bfba1 | 666 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 667 | fMassHistTC[index]->Sumw2(); |
bb69f127 | 668 | hisname.Form("hBkgPt%dTCPlus",i); |
669 | fMassHistTCPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
670 | fMassHistTCPlus[index]->Sumw2(); | |
671 | hisname.Form("hBkgPt%dTCMinus",i); | |
672 | fMassHistTCMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
673 | fMassHistTCMinus[index]->Sumw2(); | |
1f4e9722 | 674 | } |
7d9ca2b5 | 675 | |
3ec9254b | 676 | |
82bb8d4b | 677 | for(Int_t i=0; i<3*fNPtBins; i++){ |
678 | fOutput->Add(fMassHist[i]); | |
2edd194d | 679 | if(fCutsDistr){ |
680 | fOutput->Add(fCosPHist[i]); | |
681 | fOutput->Add(fDLenHist[i]); | |
682 | fOutput->Add(fSumd02Hist[i]); | |
683 | fOutput->Add(fSigVertHist[i]); | |
684 | fOutput->Add(fPtMaxHist[i]); | |
685 | fOutput->Add(fPtKHist[i]); | |
686 | fOutput->Add(fPtpi1Hist[i]); | |
687 | fOutput->Add(fPtpi2Hist[i]); | |
688 | fOutput->Add(fDCAHist[i]); | |
689 | fOutput->Add(fDLxy[i]); | |
690 | fOutput->Add(fDLxyTC[i]); | |
691 | fOutput->Add(fCosxy[i]); | |
692 | fOutput->Add(fCosxyTC[i]); | |
693 | } | |
82bb8d4b | 694 | fOutput->Add(fMassHistTC[i]); |
bb69f127 | 695 | fOutput->Add(fMassHistTCPlus[i]); |
696 | fOutput->Add(fMassHistTCMinus[i]); | |
2edd194d | 697 | |
82bb8d4b | 698 | } |
ba9ae5b2 | 699 | |
cdc197b1 | 700 | if(fCutsDistr){ |
701 | fCorreld0Kd0pi[0]=new TH2F("hCorreld0Kd0piAll","",100,-0.02,0.02,100,-0.02,0.02); | |
702 | fCorreld0Kd0pi[1]=new TH2F("hCorreld0Kd0piSig","",100,-0.02,0.02,100,-0.02,0.02); | |
703 | fCorreld0Kd0pi[2]=new TH2F("hCorreld0Kd0piBkg","",100,-0.02,0.02,100,-0.02,0.02); | |
704 | for(Int_t i=0; i<3; i++){ | |
705 | fCorreld0Kd0pi[i]->Sumw2(); | |
706 | fOutput->Add(fCorreld0Kd0pi[i]); | |
707 | } | |
708 | } | |
26da4c42 | 709 | |
6e62a374 | 710 | fHistNEvents = new TH1F("fHistNEvents", "number of events ",11,-0.5,10.5); |
de1b82ff | 711 | fHistNEvents->GetXaxis()->SetBinLabel(1,"nEventsAnal"); |
04578e36 | 712 | fHistNEvents->GetXaxis()->SetBinLabel(2,"nEvents accepted"); |
713 | fHistNEvents->GetXaxis()->SetBinLabel(3,"Rejected due to trigger"); | |
6e62a374 | 714 | fHistNEvents->GetXaxis()->SetBinLabel(4,"Rejected pileup events"); |
715 | fHistNEvents->GetXaxis()->SetBinLabel(5,"Rejected due to centrality"); | |
716 | fHistNEvents->GetXaxis()->SetBinLabel(6,"Rejected due to vtxz"); | |
04578e36 | 717 | fHistNEvents->GetXaxis()->SetBinLabel(7,"Rejected due to Physics Sel"); |
6e62a374 | 718 | fHistNEvents->GetXaxis()->SetBinLabel(8,"Total no. of candidate"); |
5fc4893f | 719 | fHistNEvents->GetXaxis()->SetBinLabel(9,"no. of cand wo bitmask"); |
6e62a374 | 720 | fHistNEvents->GetXaxis()->SetBinLabel(10,"D+ after loose cuts"); |
721 | fHistNEvents->GetXaxis()->SetBinLabel(11,"D+ after tight cuts"); | |
722 | ||
7d9ca2b5 | 723 | fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE); |
ba9ae5b2 | 724 | fHistNEvents->Sumw2(); |
725 | fHistNEvents->SetMinimum(0); | |
726 | fOutput->Add(fHistNEvents); | |
595cc7e2 | 727 | |
4d797793 | 728 | fPtVsMass=new TH2F("hPtVsMass","PtVsMass (prod. cuts)",nbins,fLowmasslimit,fUpmasslimit,200,0.,20.); |
729 | fPtVsMassTC=new TH2F("hPtVsMassTC","PtVsMass (analysis cuts)",nbins,fLowmasslimit,fUpmasslimit,200,0.,20.); | |
595cc7e2 | 730 | fYVsPt=new TH2F("hYVsPt","YvsPt (prod. cuts)",40,0.,20.,80,-2.,2.); |
731 | fYVsPtTC=new TH2F("hYVsPtTC","YvsPt (analysis cuts)",40,0.,20.,80,-2.,2.); | |
732 | fYVsPtSig=new TH2F("hYVsPtSig","YvsPt (MC, only sig., prod. cuts)",40,0.,20.,80,-2.,2.); | |
733 | fYVsPtSigTC=new TH2F("hYVsPtSigTC","YvsPt (MC, only Sig, analysis cuts)",40,0.,20.,80,-2.,2.); | |
d48d81b5 | 734 | fSPDMult = new TH1F("hSPDMult", "Tracklets multiplicity; Tracklets ; Entries",200,0.,200.); |
595cc7e2 | 735 | fOutput->Add(fPtVsMass); |
736 | fOutput->Add(fPtVsMassTC); | |
737 | fOutput->Add(fYVsPt); | |
738 | fOutput->Add(fYVsPtTC); | |
739 | fOutput->Add(fYVsPtSig); | |
740 | fOutput->Add(fYVsPtSigTC); | |
d48d81b5 | 741 | fOutput->Add(fSPDMult); |
4afc48a2 | 742 | |
a96083b9 | 743 | |
744 | //Counter for Normalization | |
e0fdfa52 | 745 | TString normName="NormalizationCounter"; |
746 | AliAnalysisDataContainer *cont = GetOutputSlot(3)->GetContainer(); | |
747 | if(cont)normName=(TString)cont->GetName(); | |
748 | fCounter = new AliNormalizationCounter(normName.Data()); | |
38802708 | 749 | fCounter->Init(); |
a96083b9 | 750 | |
7d9ca2b5 | 751 | if(fDoLS) CreateLikeSignHistos(); |
752 | if(fDoImpPar) CreateImpactParameterHistos(); | |
753 | ||
1f4e9722 | 754 | if(fFillNtuple){ |
e0fdfa52 | 755 | OpenFile(4); // 4 is the slot number of the ntuple |
ba9ae5b2 | 756 | |
ba9ae5b2 | 757 | |
d48d81b5 | 758 | fNtupleDplus = new TNtuple("fNtupleDplus","D +","pdg:Px:Py:Pz:Pt:pid:Ptpi:PtK:Ptpi2:cosp:cospxy:DecLen:NormDecLen:DecLenXY:NormDecLenXY:InvMass:sigvert:d0Pi:d0K:d0Pi2:maxdca:ntracks:centr:RunNumber"); |
2b09f51c | 759 | |
1f4e9722 | 760 | } |
ba9ae5b2 | 761 | |
d486095a | 762 | return; |
763 | } | |
764 | ||
765 | //________________________________________________________________________ | |
766 | void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/) | |
767 | { | |
768 | // Execute analysis for current event: | |
769 | // heavy flavor candidates association to MC truth | |
770 | ||
4c230f6d | 771 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); |
4afc48a2 | 772 | |
b557eb43 | 773 | TClonesArray *array3Prong = 0; |
4afc48a2 | 774 | TClonesArray *arrayLikeSign =0; |
b557eb43 | 775 | if(!aod && AODEvent() && IsStandardAOD()) { |
776 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
777 | // event in memory rather than the input (ESD) event. | |
778 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
d48d81b5 | 779 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) |
780 | // have to taken from the AOD event hold by the AliAODExtension | |
b557eb43 | 781 | AliAODHandler* aodHandler = (AliAODHandler*) |
782 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
783 | if(aodHandler->GetExtensions()) { | |
784 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
785 | AliAODEvent *aodFromExt = ext->GetAOD(); | |
786 | array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong"); | |
4afc48a2 | 787 | arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong"); |
b557eb43 | 788 | } |
dc222f77 | 789 | } else if(aod) { |
b557eb43 | 790 | array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); |
4afc48a2 | 791 | arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong"); |
b557eb43 | 792 | } |
8931c313 | 793 | |
90993728 | 794 | if(!aod || !array3Prong) { |
d486095a | 795 | printf("AliAnalysisTaskSEDplus::UserExec: Charm3Prong branch not found!\n"); |
796 | return; | |
797 | } | |
3a3c90f4 | 798 | if(!arrayLikeSign && fDoLS) { |
4afc48a2 | 799 | printf("AliAnalysisTaskSEDplus::UserExec: LikeSign3Prong branch not found!\n"); |
82bb8d4b | 800 | return; |
4afc48a2 | 801 | } |
802 | ||
7c23877d | 803 | // fix for temporary bug in ESDfilter |
804 | // the AODs with null vertex pointer didn't pass the PhysSel | |
a96083b9 | 805 | if(!aod->GetPrimaryVertex()||TMath::Abs(aod->GetMagneticField())<0.001) return; |
d48d81b5 | 806 | |
807 | //Store the event in AliNormalizationCounter->To disable for Pb-Pb? Add a flag to disable it? | |
1879baec | 808 | fCounter->StoreEvent(aod,fRDCutsAnalysis,fReadMC); |
d48d81b5 | 809 | |
de1b82ff | 810 | fHistNEvents->Fill(0); // count event |
2b09f51c | 811 | Int_t runNumber=aod->GetRunNumber(); |
97049c4a | 812 | |
d48d81b5 | 813 | //Event selection |
814 | Bool_t isEvSel=fRDCutsAnalysis->IsEventSelected(aod); | |
2b09f51c | 815 | Float_t ntracks=aod->GetNTracks();//fRDCutsAnalysis->GetCentrality(aod); |
816 | fHistCentrality[0]->Fill(ntracks); | |
04578e36 | 817 | if(fRDCutsAnalysis->GetWhyRejection()==5) fHistNEvents->Fill(2); |
818 | if(fRDCutsAnalysis->GetWhyRejection()==1) fHistNEvents->Fill(3); | |
2b09f51c | 819 | if(fRDCutsAnalysis->GetWhyRejection()==2){fHistNEvents->Fill(4);fHistCentrality[2]->Fill(ntracks);} |
6e62a374 | 820 | if(fRDCutsAnalysis->GetWhyRejection()==6)fHistNEvents->Fill(5); |
821 | if(fRDCutsAnalysis->GetWhyRejection()==7)fHistNEvents->Fill(6); | |
d48d81b5 | 822 | |
823 | // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD | |
824 | //TString trigclass=aod->GetFiredTriggerClasses(); | |
37fc80e6 | 825 | // Post the data already here |
de1b82ff | 826 | PostData(1,fOutput); |
37fc80e6 | 827 | if(!isEvSel)return; |
d48d81b5 | 828 | Int_t tracklets=AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aod,-1.,1.); |
829 | // printf("ntracklet===%d\n",tracklets); | |
830 | fSPDMult->Fill(tracklets); | |
37fc80e6 | 831 | |
2b09f51c | 832 | fHistCentrality[1]->Fill(ntracks); |
37fc80e6 | 833 | fHistNEvents->Fill(1); |
834 | ||
4afc48a2 | 835 | TClonesArray *arrayMC=0; |
836 | AliAODMCHeader *mcHeader=0; | |
d486095a | 837 | |
838 | // AOD primary vertex | |
1f4e9722 | 839 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); |
840 | // vtx1->Print(); | |
d48d81b5 | 841 | // TString primTitle = vtx1->GetTitle(); |
842 | //if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0)fHistNEvents->Fill(2); | |
26da4c42 | 843 | |
d486095a | 844 | // load MC particles |
4afc48a2 | 845 | if(fReadMC){ |
4afc48a2 | 846 | arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); |
847 | if(!arrayMC) { | |
848 | printf("AliAnalysisTaskSEDplus::UserExec: MC particles branch not found!\n"); | |
90993728 | 849 | return; |
4afc48a2 | 850 | } |
1f4e9722 | 851 | |
d48d81b5 | 852 | // load MC header |
4afc48a2 | 853 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); |
854 | if(!mcHeader) { | |
d48d81b5 | 855 | printf("AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n"); |
856 | return; | |
4afc48a2 | 857 | } |
d486095a | 858 | } |
4afc48a2 | 859 | |
1f4e9722 | 860 | Int_t n3Prong = array3Prong->GetEntriesFast(); |
7d9ca2b5 | 861 | // printf("Number of D+->Kpipi: %d and of tracks: %d\n",n3Prong,aod->GetNumberOfTracks()); |
4afc48a2 | 862 | |
4afc48a2 | 863 | Int_t nOS=0; |
82bb8d4b | 864 | Int_t index; |
1f4e9722 | 865 | Int_t pdgDgDplustoKpipi[3]={321,211,211}; |
3ec9254b | 866 | |
d48d81b5 | 867 | if(fDoLS>1){//Normalizations for LS |
3ec9254b | 868 | for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) { |
869 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong); | |
870 | if(fUseBit && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)){ | |
871 | if(fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate,aod))nOS++; | |
872 | } | |
873 | } | |
d48d81b5 | 874 | }else{//Standard analysis |
875 | // Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};//TO REMOVE | |
876 | //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts(); | |
877 | Int_t nSelectedloose=0,nSelectedtight=0; | |
878 | for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) { | |
879 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong); | |
880 | fHistNEvents->Fill(7); | |
881 | if(fUseBit && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)){ | |
882 | fHistNEvents->Fill(8); | |
883 | continue; | |
884 | } | |
885 | Bool_t unsetvtx=kFALSE; | |
886 | if(!d->GetOwnPrimaryVtx()){ | |
887 | d->SetOwnPrimaryVtx(vtx1); | |
888 | unsetvtx=kTRUE; | |
889 | } | |
890 | ||
891 | Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate,aod); | |
892 | if(!fRDCutsAnalysis->GetIsSelectedCuts())continue;//filling loose cuts histos with no-pid informations | |
a96083b9 | 893 | |
1f4e9722 | 894 | Double_t ptCand = d->Pt(); |
d48d81b5 | 895 | Int_t iPtBin = fRDCutsAnalysis->PtBin(ptCand); |
896 | ||
a6003e0a | 897 | Bool_t recVtx=kFALSE; |
898 | AliAODVertex *origownvtx=0x0; | |
d48d81b5 | 899 | if(fRDCutsAnalysis->GetIsPrimaryWithoutDaughters()){ |
a6003e0a | 900 | if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx()); |
d48d81b5 | 901 | if(fRDCutsAnalysis->RecalcOwnPrimaryVtx(d,aod))recVtx=kTRUE; |
902 | else fRDCutsAnalysis->CleanOwnPrimaryVtx(d,aod,origownvtx); | |
a6003e0a | 903 | } |
d48d81b5 | 904 | |
4afc48a2 | 905 | Int_t labDp=-1; |
7d9ca2b5 | 906 | Bool_t isPrimary=kTRUE; |
4afc48a2 | 907 | Float_t pdgCode=-2; |
af636507 | 908 | Float_t trueImpParXY=0.; |
4afc48a2 | 909 | if(fReadMC){ |
910 | labDp = d->MatchToMC(411,arrayMC,3,pdgDgDplustoKpipi); | |
911 | if(labDp>=0){ | |
912 | AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp); | |
7d9ca2b5 | 913 | if(CheckOrigin(arrayMC,partDp)==5) isPrimary=kFALSE; |
4afc48a2 | 914 | pdgCode=TMath::Abs(partDp->GetPdgCode()); |
af636507 | 915 | if(!isPrimary){ |
94da94c4 | 916 | trueImpParXY=GetTrueImpactParameter(mcHeader,arrayMC,partDp)*10000.; |
af636507 | 917 | } |
4afc48a2 | 918 | }else{ |
919 | pdgCode=-1; | |
920 | } | |
921 | } | |
a6003e0a | 922 | |
1f4e9722 | 923 | Double_t invMass=d->InvMassDplus(); |
595cc7e2 | 924 | Double_t rapid=d->YDplus(); |
925 | fYVsPt->Fill(ptCand,rapid); | |
3ec9254b | 926 | if(passTightCuts) {fYVsPtTC->Fill(ptCand,rapid);nOS++;} |
595cc7e2 | 927 | Bool_t isFidAcc=fRDCutsAnalysis->IsInFiducialAcceptance(ptCand,rapid); |
928 | if(isFidAcc){ | |
929 | fPtVsMass->Fill(invMass,ptCand); | |
930 | if(passTightCuts) fPtVsMassTC->Fill(invMass,ptCand); | |
931 | } | |
d48d81b5 | 932 | |
933 | ||
934 | Double_t dlen=0,cosp=0,maxdca=0,sigvert=0,sumD02=0,ptmax=0,dlxy=0,cxy=0; | |
f362e074 | 935 | if(fCutsDistr||fFillNtuple||fDoImpPar){ |
d48d81b5 | 936 | dlen=d->DecayLength(); |
937 | cosp=d->CosPointingAngle(); | |
938 | sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2); | |
939 | maxdca=-9999.; | |
940 | for(Int_t idau=0;idau<3;idau++) if(d->GetDCA(idau)>maxdca) maxdca=d->GetDCA(idau); | |
941 | sigvert=d->GetSigmaVert(); | |
942 | ptmax=0; | |
943 | for(Int_t i=0;i<3;i++){ | |
944 | if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i); | |
945 | } | |
946 | dlxy=d->NormalizedDecayLengthXY(); | |
947 | cxy=d->CosPointingAngleXY(); | |
a6003e0a | 948 | } |
7d9ca2b5 | 949 | Double_t impparXY=d->ImpParXY()*10000.; |
d48d81b5 | 950 | Double_t arrayForSparse[6]={invMass,ptCand,impparXY,cosp,dlen,tracklets}; |
951 | Double_t arrayForSparseTrue[6]={invMass,ptCand,trueImpParXY,cosp,dlen,tracklets}; | |
952 | ||
953 | //Ntuple | |
954 | Float_t tmp[24]; | |
7d9ca2b5 | 955 | if(fFillNtuple){ |
4afc48a2 | 956 | tmp[0]=pdgCode; |
2b09f51c | 957 | tmp[1]=d->Px(); |
958 | tmp[2]=d->Py(); | |
959 | tmp[3]=d->Pz(); | |
960 | tmp[4]=d->Pt(); | |
4214a55d | 961 | tmp[5]=fRDCutsAnalysis->GetPIDBitMask(d); |
2b09f51c | 962 | tmp[6]=d->PtProng(0); |
963 | tmp[7]=d->PtProng(1); | |
70675e50 | 964 | tmp[8]=d->PtProng(2); |
d48d81b5 | 965 | tmp[9]=cosp; |
966 | tmp[10]=cxy; | |
967 | tmp[11]=dlen; | |
968 | tmp[12]=d->NormalizedDecayLength(); | |
969 | tmp[13]=d->DecayLengthXY(); | |
970 | tmp[14]=dlxy; | |
971 | tmp[15]=d->InvMassDplus(); | |
972 | tmp[16]=sigvert; | |
973 | tmp[17]=d->Getd0Prong(0); | |
974 | tmp[18]=d->Getd0Prong(1); | |
975 | tmp[19]=d->Getd0Prong(2); | |
976 | tmp[20]=maxdca; | |
977 | tmp[21]=ntracks; | |
978 | tmp[22]=fRDCutsAnalysis->GetCentrality(aod); | |
979 | tmp[23]=runNumber; | |
4afc48a2 | 980 | fNtupleDplus->Fill(tmp); |
de1b82ff | 981 | PostData(4,fNtupleDplus); |
4afc48a2 | 982 | } |
d48d81b5 | 983 | |
984 | //Fill histos | |
985 | index=GetHistoIndex(iPtBin); | |
986 | if(isFidAcc){ | |
987 | fHistNEvents->Fill(9); | |
988 | nSelectedloose++; | |
989 | fMassHist[index]->Fill(invMass); | |
990 | if(fCutsDistr){ | |
991 | fCosPHist[index]->Fill(cosp); | |
992 | fDLenHist[index]->Fill(dlen); | |
993 | fSumd02Hist[index]->Fill(sumD02); | |
994 | fSigVertHist[index]->Fill(sigvert); | |
995 | fPtMaxHist[index]->Fill(ptmax); | |
996 | fPtKHist[index]->Fill(d->PtProng(1)); | |
997 | fPtpi1Hist[index]->Fill(d->PtProng(0)); | |
998 | fPtpi2Hist[index]->Fill(d->PtProng(2)); | |
999 | fDCAHist[index]->Fill(maxdca); | |
1000 | fDLxy[index]->Fill(dlxy); | |
1001 | fCosxy[index]->Fill(cxy); | |
1002 | fCorreld0Kd0pi[0]->Fill(d->Getd0Prong(0)*d->Getd0Prong(1), | |
1003 | d->Getd0Prong(2)*d->Getd0Prong(1)); | |
1004 | } | |
1005 | if(passTightCuts){ | |
1006 | fHistNEvents->Fill(10); | |
1007 | nSelectedtight++; | |
1008 | fMassHistTC[index]->Fill(invMass); | |
1009 | if(fCutsDistr){ | |
1010 | fDLxyTC[index]->Fill(dlxy); | |
1011 | fCosxyTC[index]->Fill(cxy); | |
1012 | } | |
1013 | if(d->GetCharge()>0) fMassHistTCPlus[index]->Fill(invMass); | |
1014 | else if(d->GetCharge()<0) fMassHistTCMinus[index]->Fill(invMass); | |
1015 | if(fDoImpPar){ | |
1016 | fHistMassPtImpParTC[0]->Fill(arrayForSparse); | |
1017 | } | |
1018 | } | |
1019 | } | |
1020 | ||
1021 | if(fReadMC){ | |
595cc7e2 | 1022 | if(isFidAcc){ |
d48d81b5 | 1023 | Int_t correlIndex=0; |
1024 | if(labDp>=0) { | |
1025 | index=GetSignalHistoIndex(iPtBin); | |
1026 | correlIndex=1; | |
1027 | if(passTightCuts&&fDoImpPar){ | |
1028 | if(isPrimary) fHistMassPtImpParTC[1]->Fill(arrayForSparse); | |
1029 | else{ | |
1030 | fHistMassPtImpParTC[2]->Fill(arrayForSparse); | |
1031 | fHistMassPtImpParTC[3]->Fill(arrayForSparseTrue); | |
1032 | } | |
1033 | } | |
1034 | }else{ | |
1035 | index=GetBackgroundHistoIndex(iPtBin); | |
1036 | correlIndex=2; | |
1037 | if(passTightCuts&&fDoImpPar)fHistMassPtImpParTC[4]->Fill(arrayForSparse); | |
1038 | } | |
1039 | ||
595cc7e2 | 1040 | fMassHist[index]->Fill(invMass); |
d48d81b5 | 1041 | if(fCutsDistr){ |
1042 | Float_t fact=1.; | |
1043 | Float_t factor[3]; | |
1044 | if(fUseStrangeness) fact=GetStrangenessWeights(d,arrayMC,factor); | |
1045 | fCosPHist[index]->Fill(cosp,fact); | |
1046 | fDLenHist[index]->Fill(dlen,fact); | |
2edd194d | 1047 | fDLxy[index]->Fill(dlxy); |
1048 | fCosxy[index]->Fill(cxy); | |
d48d81b5 | 1049 | |
1050 | Float_t sumd02s=d->Getd0Prong(0)*d->Getd0Prong(0)*factor[0]*factor[0]+d->Getd0Prong(1)*d->Getd0Prong(1)*factor[1]*factor[1]+d->Getd0Prong(2)*d->Getd0Prong(2)*factor[2]*factor[2]; | |
1051 | fSumd02Hist[index]->Fill(sumd02s); | |
1052 | fSigVertHist[index]->Fill(sigvert,fact); | |
1053 | fPtMaxHist[index]->Fill(ptmax,fact); | |
1054 | fPtKHist[index]->Fill(d->PtProng(1),fact); | |
1055 | fPtpi1Hist[index]->Fill(d->PtProng(0),fact); | |
1056 | fPtpi2Hist[index]->Fill(d->PtProng(2),fact); | |
1057 | fDCAHist[index]->Fill(maxdca,fact); | |
1058 | fCorreld0Kd0pi[1]->Fill(d->Getd0Prong(0)*d->Getd0Prong(1), | |
cdc197b1 | 1059 | d->Getd0Prong(2)*d->Getd0Prong(1)); |
2edd194d | 1060 | } |
d48d81b5 | 1061 | if(passTightCuts){ |
1062 | fMassHistTC[index]->Fill(invMass); | |
1063 | if(fCutsDistr){ | |
2edd194d | 1064 | fDLxyTC[index]->Fill(dlxy); |
1065 | fCosxyTC[index]->Fill(cxy); | |
d48d81b5 | 1066 | } |
bb69f127 | 1067 | if(d->GetCharge()>0) fMassHistTCPlus[index]->Fill(invMass); |
1068 | else if(d->GetCharge()<0) fMassHistTCMinus[index]->Fill(invMass); | |
d48d81b5 | 1069 | } |
1070 | }else{//outside fidAcc | |
1071 | if(labDp>=0){ | |
595cc7e2 | 1072 | fYVsPtSig->Fill(ptCand,rapid); |
d48d81b5 | 1073 | if(passTightCuts)fYVsPtSigTC->Fill(ptCand,rapid); |
2bf2e62b | 1074 | } |
3ec9254b | 1075 | } |
d48d81b5 | 1076 | }//readmc |
2edd194d | 1077 | |
d48d81b5 | 1078 | if(recVtx)fRDCutsAnalysis->CleanOwnPrimaryVtx(d,aod,origownvtx); |
1079 | ||
1080 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
d486095a | 1081 | } |
d48d81b5 | 1082 | fCounter->StoreCandidates(aod,nSelectedloose,kTRUE); |
1083 | fCounter->StoreCandidates(aod,nSelectedtight,kFALSE); | |
3ec9254b | 1084 | } |
4afc48a2 | 1085 | //start LS analysis |
1086 | if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS); | |
82bb8d4b | 1087 | |
ad42e35b | 1088 | PostData(1,fOutput); |
1089 | PostData(2,fListCuts); | |
a96083b9 | 1090 | PostData(3,fCounter); |
d486095a | 1091 | return; |
1092 | } | |
1093 | ||
7d9ca2b5 | 1094 | //________________________________________________________________________ |
1095 | void AliAnalysisTaskSEDplus::CreateLikeSignHistos(){ | |
1096 | // Histos for Like Sign bckground | |
1097 | ||
1098 | TString hisname; | |
1099 | Int_t indexLS=0; | |
1100 | Int_t index=0; | |
1101 | Int_t nbins=GetNBinsHistos(); | |
1102 | for(Int_t i=0;i<fNPtBins;i++){ | |
1103 | ||
1104 | index=GetHistoIndex(i); | |
1105 | indexLS=GetLSHistoIndex(i); | |
1106 | ||
1107 | hisname.Form("hLSPt%dLC",i); | |
1108 | fMassHistLS[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1109 | fMassHistLS[indexLS]->Sumw2(); | |
1110 | hisname.Form("hLSPt%dTC",i); | |
1111 | fMassHistLSTC[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1112 | fMassHistLSTC[indexLS]->Sumw2(); | |
1113 | ||
1114 | hisname.Form("hCosPAllPt%dLS",i); | |
1115 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); | |
1116 | fCosPHistLS[index]->Sumw2(); | |
1117 | hisname.Form("hDLenAllPt%dLS",i); | |
1118 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); | |
1119 | fDLenHistLS[index]->Sumw2(); | |
1120 | hisname.Form("hSumd02AllPt%dLS",i); | |
1121 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); | |
1122 | fSumd02HistLS[index]->Sumw2(); | |
1123 | hisname.Form("hSigVertAllPt%dLS",i); | |
1124 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1125 | fSigVertHistLS[index]->Sumw2(); | |
1126 | hisname.Form("hPtMaxAllPt%dLS",i); | |
1127 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
1128 | fPtMaxHistLS[index]->Sumw2(); | |
1129 | hisname.Form("hDCAAllPt%dLS",i); | |
1130 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1131 | fDCAHistLS[index]->Sumw2(); | |
1132 | ||
1133 | index=GetSignalHistoIndex(i); | |
1134 | indexLS++; | |
1135 | ||
1136 | hisname.Form("hLSPt%dLCnw",i); | |
1137 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1138 | fMassHistLS[indexLS]->Sumw2(); | |
1139 | hisname.Form("hLSPt%dTCnw",i); | |
1140 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1141 | fMassHistLSTC[indexLS]->Sumw2(); | |
1142 | ||
1143 | hisname.Form("hCosPSigPt%dLS",i); | |
1144 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); | |
1145 | fCosPHistLS[index]->Sumw2(); | |
1146 | hisname.Form("hDLenSigPt%dLS",i); | |
1147 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); | |
1148 | fDLenHistLS[index]->Sumw2(); | |
1149 | hisname.Form("hSumd02SigPt%dLS",i); | |
1150 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); | |
1151 | fSumd02HistLS[index]->Sumw2(); | |
1152 | hisname.Form("hSigVertSigPt%dLS",i); | |
1153 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1154 | fSigVertHistLS[index]->Sumw2(); | |
1155 | hisname.Form("hPtMaxSigPt%dLS",i); | |
1156 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
1157 | fPtMaxHistLS[index]->Sumw2(); | |
1158 | hisname.Form("hDCASigPt%dLS",i); | |
1159 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1160 | fDCAHistLS[index]->Sumw2(); | |
1161 | ||
1162 | index=GetBackgroundHistoIndex(i); | |
1163 | indexLS++; | |
1164 | ||
1165 | hisname.Form("hLSPt%dLCntrip",i); | |
1166 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1167 | fMassHistLS[indexLS]->Sumw2(); | |
1168 | hisname.Form("hLSPt%dTCntrip",i); | |
1169 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1170 | fMassHistLSTC[indexLS]->Sumw2(); | |
1171 | ||
1172 | hisname.Form("hCosPBkgPt%dLS",i); | |
1173 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); | |
1174 | fCosPHistLS[index]->Sumw2(); | |
1175 | hisname.Form("hDLenBkgPt%dLS",i); | |
1176 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); | |
1177 | fDLenHistLS[index]->Sumw2(); | |
1178 | hisname.Form("hSumd02BkgPt%dLS",i); | |
1179 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); | |
1180 | fSumd02HistLS[index]->Sumw2(); | |
1181 | hisname.Form("hSigVertBkgPt%dLS",i); | |
1182 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1183 | fSigVertHistLS[index]->Sumw2(); | |
1184 | hisname.Form("hPtMaxBkgPt%dLS",i); | |
1185 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); | |
1186 | fPtMaxHistLS[index]->Sumw2(); | |
1187 | hisname.Form("hDCABkgPt%dLS",i); | |
1188 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); | |
1189 | fDCAHistLS[index]->Sumw2(); | |
1190 | ||
1191 | indexLS++; | |
1192 | hisname.Form("hLSPt%dLCntripsinglecut",i); | |
1193 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1194 | fMassHistLS[indexLS]->Sumw2(); | |
1195 | hisname.Form("hLSPt%dTCntripsinglecut",i); | |
1196 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1197 | fMassHistLSTC[indexLS]->Sumw2(); | |
1198 | ||
1199 | indexLS++; | |
1200 | hisname.Form("hLSPt%dLCspc",i); | |
1201 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1202 | fMassHistLS[indexLS]->Sumw2(); | |
1203 | hisname.Form("hLSPt%dTCspc",i); | |
1204 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); | |
1205 | fMassHistLSTC[indexLS]->Sumw2(); | |
1206 | } | |
1207 | ||
1208 | for(Int_t i=0; i<3*fNPtBins; i++){ | |
1209 | fOutput->Add(fCosPHistLS[i]); | |
1210 | fOutput->Add(fDLenHistLS[i]); | |
1211 | fOutput->Add(fSumd02HistLS[i]); | |
1212 | fOutput->Add(fSigVertHistLS[i]); | |
1213 | fOutput->Add(fPtMaxHistLS[i]); | |
1214 | fOutput->Add(fDCAHistLS[i]); | |
1215 | } | |
1216 | for(Int_t i=0; i<5*fNPtBins; i++){ | |
1217 | fOutput->Add(fMassHistLS[i]); | |
1218 | fOutput->Add(fMassHistLSTC[i]); | |
1219 | } | |
1220 | } | |
1221 | ||
1222 | //________________________________________________________________________ | |
1223 | void AliAnalysisTaskSEDplus::CreateImpactParameterHistos(){ | |
1224 | // Histos for impact paramter study | |
4afc48a2 | 1225 | |
3de19caa | 1226 | Int_t nmassbins=GetNBinsHistos(); |
d48d81b5 | 1227 | Int_t nbins[6]={nmassbins,200,fNImpParBins,5,50,100}; |
1228 | Double_t xmin[6]={fLowmasslimit,0.,fLowerImpPar,0.95,0.,-0.5}; | |
1229 | Double_t xmax[6]={fUpmasslimit,20.,fHigherImpPar,1.,1.,99.5}; | |
3de19caa | 1230 | |
1231 | fHistMassPtImpParTC[0]=new THnSparseF("hMassPtImpParAll", | |
1232 | "Mass vs. pt vs.imppar - All", | |
d48d81b5 | 1233 | 6,nbins,xmin,xmax); |
3de19caa | 1234 | fHistMassPtImpParTC[1]=new THnSparseF("hMassPtImpParPrompt", |
1235 | "Mass vs. pt vs.imppar - promptD", | |
d48d81b5 | 1236 | 6,nbins,xmin,xmax); |
3de19caa | 1237 | fHistMassPtImpParTC[2]=new THnSparseF("hMassPtImpParBfeed", |
1238 | "Mass vs. pt vs.imppar - DfromB", | |
d48d81b5 | 1239 | 6,nbins,xmin,xmax); |
3de19caa | 1240 | fHistMassPtImpParTC[3]=new THnSparseF("hMassPtImpParTrueBfeed", |
1241 | "Mass vs. pt vs.true imppar -DfromB", | |
d48d81b5 | 1242 | 6,nbins,xmin,xmax); |
3de19caa | 1243 | fHistMassPtImpParTC[4]=new THnSparseF("hMassPtImpParBkg", |
1244 | "Mass vs. pt vs.imppar - backgr.", | |
d48d81b5 | 1245 | 6,nbins,xmin,xmax); |
7d9ca2b5 | 1246 | for(Int_t i=0; i<5;i++){ |
1247 | fOutput->Add(fHistMassPtImpParTC[i]); | |
1248 | } | |
1249 | } | |
4afc48a2 | 1250 | |
82bb8d4b | 1251 | //________________________________________________________________________ |
d486095a | 1252 | void AliAnalysisTaskSEDplus::Terminate(Option_t */*option*/) |
1253 | { | |
1254 | // Terminate analysis | |
1255 | // | |
1256 | if(fDebug > 1) printf("AnalysisTaskSEDplus: Terminate() \n"); | |
82bb8d4b | 1257 | |
d486095a | 1258 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); |
1259 | if (!fOutput) { | |
1260 | printf("ERROR: fOutput not available\n"); | |
1261 | return; | |
1262 | } | |
595cc7e2 | 1263 | fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents")); |
82bb8d4b | 1264 | |
595cc7e2 | 1265 | TString hisname; |
1266 | Int_t index=0; | |
ba9ae5b2 | 1267 | |
595cc7e2 | 1268 | for(Int_t i=0;i<fNPtBins;i++){ |
82bb8d4b | 1269 | index=GetHistoIndex(i); |
ba9ae5b2 | 1270 | |
37fc80e6 | 1271 | hisname.Form("hMassPt%dTC",i); |
82bb8d4b | 1272 | fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); |
37fc80e6 | 1273 | } |
ba9ae5b2 | 1274 | |
13808a30 | 1275 | TCanvas *c1=new TCanvas("c1","D+ invariant mass distribution",500,500); |
1276 | c1->cd(); | |
1277 | TH1F *hMassPt=(TH1F*)fOutput->FindObject("hMassPt3TC"); | |
1278 | hMassPt->SetLineColor(kBlue); | |
1279 | hMassPt->SetXTitle("M[GeV/c^{2}]"); | |
1280 | hMassPt->Draw(); | |
1281 | ||
595cc7e2 | 1282 | return; |
d486095a | 1283 | } |
7d9ca2b5 | 1284 | //_________________________________________________________________________________________________ |
5d836c02 | 1285 | Int_t AliAnalysisTaskSEDplus::CheckOrigin(TClonesArray* arrayMC, const AliAODMCParticle *mcPartCandidate) const { |
7d9ca2b5 | 1286 | // |
1287 | // checking whether the mother of the particles come from a charm or a bottom quark | |
1288 | // | |
1289 | ||
1290 | Int_t pdgGranma = 0; | |
1291 | Int_t mother = 0; | |
1292 | mother = mcPartCandidate->GetMother(); | |
1293 | Int_t istep = 0; | |
1294 | Int_t abspdgGranma =0; | |
1295 | Bool_t isFromB=kFALSE; | |
1296 | Bool_t isQuarkFound=kFALSE; | |
1297 | while (mother >0 ){ | |
1298 | istep++; | |
1299 | AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(arrayMC->At(mother)); | |
1300 | if (mcGranma){ | |
1301 | pdgGranma = mcGranma->GetPdgCode(); | |
1302 | abspdgGranma = TMath::Abs(pdgGranma); | |
1303 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){ | |
1304 | isFromB=kTRUE; | |
1305 | } | |
1306 | if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE; | |
1307 | mother = mcGranma->GetMother(); | |
1308 | }else{ | |
1309 | AliError("Failed casting the mother particle!"); | |
1310 | break; | |
1311 | } | |
1312 | } | |
1313 | ||
1314 | if(isFromB) return 5; | |
1315 | else return 4; | |
1316 | } | |
af636507 | 1317 | //_________________________________________________________________________________________________ |
5d836c02 | 1318 | Float_t AliAnalysisTaskSEDplus::GetTrueImpactParameter(const AliAODMCHeader *mcHeader, TClonesArray* arrayMC, const AliAODMCParticle *partDp) const { |
af636507 | 1319 | // true impact parameter calculation |
1320 | ||
1321 | Double_t vtxTrue[3]; | |
1322 | mcHeader->GetVertex(vtxTrue); | |
1323 | Double_t origD[3]; | |
94da94c4 | 1324 | partDp->XvYvZv(origD); |
af636507 | 1325 | Short_t charge=partDp->Charge(); |
1326 | Double_t pXdauTrue[3],pYdauTrue[3],pZdauTrue[3]; | |
1327 | for(Int_t iDau=0; iDau<3; iDau++){ | |
1328 | pXdauTrue[iDau]=0.; | |
1329 | pYdauTrue[iDau]=0.; | |
1330 | pZdauTrue[iDau]=0.; | |
1331 | } | |
1332 | ||
1333 | Int_t nDau=partDp->GetNDaughters(); | |
1334 | Int_t labelFirstDau = partDp->GetDaughter(0); | |
1335 | if(nDau==3){ | |
1336 | for(Int_t iDau=0; iDau<3; iDau++){ | |
1337 | Int_t ind = labelFirstDau+iDau; | |
1338 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(arrayMC->At(ind)); | |
3de19caa | 1339 | if(!part){ |
1340 | AliError("Daughter particle not found in MC array"); | |
1341 | return 99999.; | |
1342 | } | |
af636507 | 1343 | pXdauTrue[iDau]=part->Px(); |
1344 | pYdauTrue[iDau]=part->Py(); | |
1345 | pZdauTrue[iDau]=part->Pz(); | |
1346 | } | |
1347 | }else if(nDau==2){ | |
1348 | Int_t theDau=0; | |
1349 | for(Int_t iDau=0; iDau<2; iDau++){ | |
1350 | Int_t ind = labelFirstDau+iDau; | |
1351 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(arrayMC->At(ind)); | |
3de19caa | 1352 | if(!part){ |
1353 | AliError("Daughter particle not found in MC array"); | |
1354 | return 99999.; | |
1355 | } | |
af636507 | 1356 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); |
1357 | if(pdgCode==211 || pdgCode==321){ | |
1358 | pXdauTrue[theDau]=part->Px(); | |
1359 | pYdauTrue[theDau]=part->Py(); | |
1360 | pZdauTrue[theDau]=part->Pz(); | |
1361 | ++theDau; | |
1362 | }else{ | |
1363 | Int_t nDauRes=part->GetNDaughters(); | |
1364 | if(nDauRes==2){ | |
1365 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
1366 | for(Int_t iDauRes=0; iDauRes<2; iDauRes++){ | |
1367 | Int_t indDR = labelFirstDauRes+iDauRes; | |
1368 | AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(arrayMC->At(indDR)); | |
3de19caa | 1369 | if(!partDR){ |
1370 | AliError("Daughter particle not found in MC array"); | |
1371 | return 99999.; | |
1372 | } | |
1373 | ||
1374 | Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode()); | |
1375 | if(pdgCodeDR==211 || pdgCodeDR==321){ | |
af636507 | 1376 | pXdauTrue[theDau]=partDR->Px(); |
1377 | pYdauTrue[theDau]=partDR->Py(); | |
1378 | pZdauTrue[theDau]=partDR->Pz(); | |
1379 | ++theDau; | |
1380 | } | |
1381 | } | |
1382 | } | |
1383 | } | |
1384 | } | |
3de19caa | 1385 | if(theDau!=3){ |
1386 | AliError("Wrong number of decay prongs"); | |
1387 | return 99999.; | |
1388 | } | |
af636507 | 1389 | } |
1390 | ||
1391 | Double_t d0dummy[3]={0.,0.,0.}; | |
1392 | AliAODRecoDecayHF aodDplusMC(vtxTrue,origD,3,charge,pXdauTrue,pYdauTrue,pZdauTrue,d0dummy); | |
1393 | return aodDplusMC.ImpParXY(); | |
1394 | ||
1395 | } | |
70675e50 | 1396 | //_________________________________________________________________________________________________ |
1397 | Float_t AliAnalysisTaskSEDplus::GetStrangenessWeights(const AliAODRecoDecayHF3Prong* d, TClonesArray* arrayMC, Float_t factor[3]) const { | |
1398 | // Computes weights to adapt strangeness in MC to data | |
1399 | ||
1400 | for(Int_t iprong=0;iprong<3;iprong++){ | |
1401 | factor[iprong]=1; | |
1402 | AliAODTrack *trad = (AliAODTrack*)d->GetDaughter(iprong); | |
1403 | Int_t labd= trad->GetLabel(); | |
1404 | if(labd>=0){ | |
1405 | AliAODMCParticle *dau = (AliAODMCParticle*)arrayMC->At(labd); | |
1406 | if(dau){ | |
1407 | Int_t labm = dau->GetMother(); | |
1408 | if(labm>=0){ | |
1409 | AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(labm); | |
1410 | if(mot){ | |
1411 | if(TMath::Abs(mot->GetPdgCode())==310 || TMath::Abs(mot->GetPdgCode())==130 || TMath::Abs(mot->GetPdgCode())==321){ //K0_S, K0_L, K^+- | |
1412 | if(d->PtProng(iprong)<=1)factor[iprong]=1./.7; | |
1413 | else factor[iprong]=1./.6; | |
1414 | // fNentries->Fill(12); | |
1415 | } | |
1416 | if(TMath::Abs(mot->GetPdgCode())==3122) { //Lambda | |
1417 | factor[iprong]=1./0.25; | |
1418 | // fNentries->Fill(13); | |
1419 | }//if 3122 | |
1420 | }//if(mot) | |
1421 | }//if labm>0 | |
1422 | }//if(dau) | |
1423 | }//if labd>=0 | |
1424 | }//prong loop | |
1425 | ||
1426 | Float_t fact=1.; | |
1427 | for(Int_t k=0;k<3;k++)fact=fact*factor[k]; | |
1428 | return fact; | |
1429 | ||
1430 | } |