]>
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 | ||
993bfba1 | 16 | //************************************************************************* |
17 | // Class AliAnalysisTaskSEDplus | |
18 | // AliAnalysisTaskSE for the D+ candidates Invariant Mass Histogram and | |
19 | //comparison of heavy-flavour decay candidates | |
20 | // to MC truth (kinematics stored in the AOD) | |
4afc48a2 | 21 | // Authors: Renu Bala, bala@to.infn.it |
22 | // F. Prino, prino@to.infn.it | |
23 | // G. Ortona, ortona@to.infn.it | |
d486095a | 24 | ///////////////////////////////////////////////////////////// |
25 | ||
26 | #include <TClonesArray.h> | |
27 | #include <TNtuple.h> | |
13808a30 | 28 | #include <TCanvas.h> |
d486095a | 29 | #include <TList.h> |
1f4e9722 | 30 | #include <TString.h> |
d486095a | 31 | #include <TH1F.h> |
4afc48a2 | 32 | #include <TDatabasePDG.h> |
b557eb43 | 33 | |
34 | #include "AliAnalysisManager.h" | |
4c230f6d | 35 | #include "AliRDHFCutsDplustoKpipi.h" |
b557eb43 | 36 | #include "AliAODHandler.h" |
d486095a | 37 | #include "AliAODEvent.h" |
38 | #include "AliAODVertex.h" | |
39 | #include "AliAODTrack.h" | |
40 | #include "AliAODMCHeader.h" | |
41 | #include "AliAODMCParticle.h" | |
42 | #include "AliAODRecoDecayHF3Prong.h" | |
43 | #include "AliAnalysisVertexingHF.h" | |
44 | #include "AliAnalysisTaskSE.h" | |
45 | #include "AliAnalysisTaskSEDplus.h" | |
46 | ||
47 | ClassImp(AliAnalysisTaskSEDplus) | |
48 | ||
49 | ||
50 | //________________________________________________________________________ | |
51 | AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(): | |
52 | AliAnalysisTaskSE(), | |
53 | fOutput(0), | |
4afc48a2 | 54 | fHistNEvents(0), |
d486095a | 55 | fNtupleDplus(0), |
82bb8d4b | 56 | fUpmasslimit(1.965), |
57 | fLowmasslimit(1.765), | |
58 | fNPtBins(0), | |
993bfba1 | 59 | fBinWidth(0.002), |
4c230f6d | 60 | fListCuts(0), |
61 | fRDCutsProduction(0), | |
62 | fRDCutsAnalysis(0), | |
1f4e9722 | 63 | fFillNtuple(kFALSE), |
4afc48a2 | 64 | fReadMC(kFALSE), |
4c230f6d | 65 | fDoLS(kFALSE) |
d486095a | 66 | { |
82bb8d4b | 67 | // Default constructor |
d486095a | 68 | } |
69 | ||
70 | //________________________________________________________________________ | |
4c230f6d | 71 | AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(const char *name,AliRDHFCutsDplustoKpipi *dpluscutsana,AliRDHFCutsDplustoKpipi *dpluscutsprod,Bool_t fillNtuple): |
d486095a | 72 | AliAnalysisTaskSE(name), |
4afc48a2 | 73 | fOutput(0), |
74 | fHistNEvents(0), | |
d486095a | 75 | fNtupleDplus(0), |
82bb8d4b | 76 | fUpmasslimit(1.965), |
77 | fLowmasslimit(1.765), | |
78 | fNPtBins(0), | |
993bfba1 | 79 | fBinWidth(0.002), |
4c230f6d | 80 | fListCuts(0), |
81 | fRDCutsProduction(dpluscutsprod), | |
82 | fRDCutsAnalysis(dpluscutsana), | |
1f4e9722 | 83 | fFillNtuple(fillNtuple), |
4afc48a2 | 84 | fReadMC(kFALSE), |
4c230f6d | 85 | fDoLS(kFALSE) |
d486095a | 86 | { |
4c230f6d | 87 | // |
88 | // Standrd constructor | |
89 | // | |
90 | //Double_t ptlim[5]={0.,2.,3.,5,9999999.}; | |
91 | //SetPtBinLimit(5, ptlim); | |
92 | SetPtBinLimit(fRDCutsAnalysis->GetNPtBins()+1,fRDCutsAnalysis->GetPtBinLimits()); | |
d486095a | 93 | // Default constructor |
82bb8d4b | 94 | // Output slot #1 writes into a TList container |
d486095a | 95 | DefineOutput(1,TList::Class()); //My private output |
4c230f6d | 96 | // Output slot #2 writes cut to private output |
97 | // DefineOutput(2,AliRDHFCutsDplustoKpipi::Class()); | |
98 | DefineOutput(2,TList::Class()); | |
1f4e9722 | 99 | if(fFillNtuple){ |
4c230f6d | 100 | // Output slot #3 writes into a TNtuple container |
101 | DefineOutput(3,TNtuple::Class()); //My private output | |
1f4e9722 | 102 | } |
d486095a | 103 | } |
104 | ||
105 | //________________________________________________________________________ | |
106 | AliAnalysisTaskSEDplus::~AliAnalysisTaskSEDplus() | |
107 | { | |
4c230f6d | 108 | // |
d486095a | 109 | // Destructor |
4c230f6d | 110 | // |
d486095a | 111 | if (fOutput) { |
112 | delete fOutput; | |
113 | fOutput = 0; | |
114 | } | |
4c230f6d | 115 | |
116 | if (fListCuts) { | |
117 | delete fListCuts; | |
118 | fListCuts = 0; | |
d486095a | 119 | } |
4c230f6d | 120 | |
121 | if(fRDCutsProduction){ | |
122 | delete fRDCutsProduction; | |
123 | fRDCutsProduction = 0; | |
124 | } | |
125 | ||
126 | if(fRDCutsAnalysis){ | |
127 | delete fRDCutsAnalysis; | |
128 | fRDCutsAnalysis = 0; | |
129 | } | |
130 | ||
d486095a | 131 | } |
82bb8d4b | 132 | //_________________________________________________________________ |
133 | void AliAnalysisTaskSEDplus::SetMassLimits(Float_t range){ | |
4c230f6d | 134 | // set invariant mass limits |
993bfba1 | 135 | Float_t bw=GetBinWidth(); |
82bb8d4b | 136 | fUpmasslimit = 1.865+range; |
137 | fLowmasslimit = 1.865-range; | |
993bfba1 | 138 | SetBinWidth(bw); |
82bb8d4b | 139 | } |
140 | //_________________________________________________________________ | |
141 | void AliAnalysisTaskSEDplus::SetMassLimits(Float_t lowlimit, Float_t uplimit){ | |
4c230f6d | 142 | // set invariant mass limits |
82bb8d4b | 143 | if(uplimit>lowlimit) |
144 | { | |
993bfba1 | 145 | Float_t bw=GetBinWidth(); |
82bb8d4b | 146 | fUpmasslimit = lowlimit; |
147 | fLowmasslimit = uplimit; | |
993bfba1 | 148 | SetBinWidth(bw); |
82bb8d4b | 149 | } |
150 | } | |
82bb8d4b | 151 | //________________________________________________________________________ |
4c230f6d | 152 | void AliAnalysisTaskSEDplus::SetPtBinLimit(Int_t n, Float_t* lim){ |
82bb8d4b | 153 | // define pt bins for analysis |
154 | if(n>kMaxPtBins){ | |
155 | printf("Max. number of Pt bins = %d\n",kMaxPtBins); | |
156 | fNPtBins=kMaxPtBins; | |
157 | fArrayBinLimits[0]=0.; | |
158 | fArrayBinLimits[1]=2.; | |
159 | fArrayBinLimits[2]=3.; | |
160 | fArrayBinLimits[3]=5.; | |
161 | for(Int_t i=4; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.; | |
162 | }else{ | |
163 | fNPtBins=n-1; | |
164 | fArrayBinLimits[0]=lim[0]; | |
165 | for(Int_t i=1; i<fNPtBins+1; i++) | |
166 | if(lim[i]>fArrayBinLimits[i-1]){ | |
167 | fArrayBinLimits[i]=lim[i]; | |
168 | } | |
169 | else { | |
170 | fArrayBinLimits[i]=fArrayBinLimits[i-1]; | |
171 | } | |
172 | for(Int_t i=fNPtBins; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.; | |
173 | } | |
174 | if(fDebug > 1){ | |
175 | printf("Number of Pt bins = %d\n",fNPtBins); | |
176 | for(Int_t i=0; i<fNPtBins+1; i++) printf(" Bin%d = %8.2f-%8.2f\n",i,fArrayBinLimits[i],fArrayBinLimits[i+1]); | |
177 | } | |
178 | } | |
993bfba1 | 179 | //________________________________________________________________ |
180 | void AliAnalysisTaskSEDplus::SetBinWidth(Float_t w){ | |
181 | Float_t width=w; | |
182 | Int_t nbins=(Int_t)((fUpmasslimit-fLowmasslimit)/width+0.5); | |
183 | Int_t missingbins=4-nbins%4; | |
184 | nbins=nbins+missingbins; | |
185 | width=(fUpmasslimit-fLowmasslimit)/nbins; | |
186 | if(missingbins!=0){ | |
187 | printf("AliAnalysisTaskSEDplus::SetBinWidth: W-bin width of %f will produce histograms not rebinnable by 4. New width set to %f\n",w,width); | |
188 | } | |
189 | else{ | |
190 | if(fDebug>1) printf("AliAnalysisTaskSEDplus::SetBinWidth: width set to %f\n",width); | |
191 | } | |
192 | fBinWidth=width; | |
193 | } | |
82bb8d4b | 194 | //_________________________________________________________________ |
195 | Double_t AliAnalysisTaskSEDplus::GetPtBinLimit(Int_t ibin){ | |
4c230f6d | 196 | // get pt bin limit |
82bb8d4b | 197 | if(ibin>fNPtBins)return -1; |
198 | return fArrayBinLimits[ibin]; | |
199 | } | |
993bfba1 | 200 | //_________________________________________________________________ |
201 | Int_t AliAnalysisTaskSEDplus::GetNBinsHistos(){ | |
202 | return (Int_t)((fUpmasslimit-fLowmasslimit)/fBinWidth+0.5); | |
203 | } | |
82bb8d4b | 204 | //_________________________________________________________________ |
205 | void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesArray *arrayLikeSign,AliAODEvent *aod,AliAODVertex *vtx1, Int_t nDplusOS){ | |
4c230f6d | 206 | // |
207 | // | |
208 | // Fill the Like Sign histograms | |
209 | // | |
82bb8d4b | 210 | |
211 | //count pos/neg tracks | |
212 | Int_t nPosTrks=0,nNegTrks=0; | |
213 | //counter for particles passing single particle cuts | |
214 | Int_t nspcplus=0; | |
215 | Int_t nspcminus=0; | |
216 | ||
217 | for(Int_t it=0;it<aod->GetNumberOfTracks();it++) { | |
218 | AliAODTrack *track = aod->GetTrack(it); | |
219 | if(track->Charge()>0){ | |
220 | nPosTrks++; | |
221 | if(track->Pt()>=0.4){ | |
222 | nspcplus++; | |
223 | } | |
224 | } | |
225 | if(track->Charge()<0) | |
226 | { | |
227 | nNegTrks++; | |
228 | if(track->Pt()>=0.4){ | |
229 | nspcminus++; | |
230 | } | |
231 | } | |
232 | } | |
233 | ||
234 | Int_t nOStriplets = arrayOppositeSign->GetEntriesFast(); | |
235 | ||
236 | Int_t nDplusLS=0; | |
237 | Int_t nLikeSign = arrayLikeSign->GetEntriesFast(); | |
238 | Int_t index; | |
239 | ||
240 | for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) { | |
241 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)arrayLikeSign->UncheckedAt(iLikeSign); | |
242 | Bool_t unsetvtx=kFALSE; | |
243 | if(!d->GetOwnPrimaryVtx()) { | |
244 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
245 | unsetvtx=kTRUE; | |
246 | } | |
4c230f6d | 247 | if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate))nDplusLS++; |
82bb8d4b | 248 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); |
249 | } | |
250 | ||
251 | Float_t wei2=0; | |
252 | if(nLikeSign!=0)wei2 = (Float_t)nOStriplets/(Float_t)nLikeSign; | |
253 | Float_t wei3=0; | |
254 | if(nDplusLS!=0)wei3 = (Float_t)nDplusOS/(Float_t)nDplusLS; | |
255 | ||
256 | // loop over like sign candidates | |
257 | for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) { | |
258 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)arrayLikeSign->UncheckedAt(iLikeSign); | |
259 | Bool_t unsetvtx=kFALSE; | |
260 | if(!d->GetOwnPrimaryVtx()) { | |
261 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
262 | unsetvtx=kTRUE; | |
263 | } | |
264 | ||
4c230f6d | 265 | if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)){ |
82bb8d4b | 266 | |
267 | //set tight cuts values | |
268 | Int_t iPtBin=-1; | |
269 | Double_t ptCand = d->Pt(); | |
82bb8d4b | 270 | for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){ |
271 | if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin; | |
272 | } | |
273 | ||
274 | if(iPtBin<0){ | |
275 | return; | |
276 | } | |
277 | ||
4c230f6d | 278 | Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate); |
82bb8d4b | 279 | |
280 | Int_t sign= d->GetCharge(); | |
281 | Float_t wei=1; | |
282 | Float_t wei4=1; | |
283 | if(sign>0&&nPosTrks>2&&nspcplus>2) { //wei* should be automatically protected, since to get a triplet there must be at least 3 good tracks in the event | |
284 | ||
285 | wei=3.*(Float_t)nNegTrks/((Float_t)nPosTrks-2.); | |
286 | wei4=3.*(Float_t)nspcminus/((Float_t)nspcplus-2.); | |
287 | } | |
288 | ||
289 | if(sign<0&&nNegTrks>2&&nspcminus>2){ | |
290 | wei=3.*(Float_t)nPosTrks/((Float_t)nNegTrks-2.); | |
291 | wei4=3.*(Float_t)nspcplus/((Float_t)nspcminus-2.); | |
292 | ||
293 | } | |
294 | ||
295 | Float_t invMass = d->InvMassDplus(); | |
ba9ae5b2 | 296 | Double_t dlen=d->DecayLength(); |
297 | Double_t cosp=d->CosPointingAngle(); | |
298 | Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2); | |
299 | Double_t dca=d->GetDCA(); | |
0db12536 | 300 | Double_t sigvert=d->GetSigmaVert(); |
ba9ae5b2 | 301 | Double_t ptmax=0; |
302 | for(Int_t i=0;i<3;i++){ | |
303 | if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i); | |
304 | } | |
305 | ||
82bb8d4b | 306 | index=GetLSHistoIndex(iPtBin); |
307 | fMassHistLS[index]->Fill(invMass,wei); | |
308 | fMassHistLS[index+1]->Fill(invMass); | |
309 | fMassHistLS[index+2]->Fill(invMass,wei2); | |
310 | fMassHistLS[index+3]->Fill(invMass,wei3); | |
311 | fMassHistLS[index+4]->Fill(invMass,wei4); | |
ba9ae5b2 | 312 | |
313 | Int_t indexcut=GetHistoIndex(iPtBin); | |
314 | fCosPHistLS[indexcut]->Fill(cosp); | |
315 | fDLenHistLS[indexcut]->Fill(dlen); | |
316 | fSumd02HistLS[indexcut]->Fill(sumD02); | |
0db12536 | 317 | fSigVertHistLS[indexcut]->Fill(sigvert); |
ba9ae5b2 | 318 | fPtMaxHistLS[indexcut]->Fill(ptmax); |
319 | fDCAHistLS[indexcut]->Fill(dca); | |
82bb8d4b | 320 | |
4c230f6d | 321 | if(passTightCuts==1){ |
82bb8d4b | 322 | fMassHistLSTC[index]->Fill(invMass,wei); |
323 | fMassHistLSTC[index+1]->Fill(invMass); | |
324 | fMassHistLSTC[index+2]->Fill(invMass,wei2); | |
325 | fMassHistLSTC[index+3]->Fill(invMass,wei3); | |
326 | fMassHistLSTC[index+4]->Fill(invMass,wei4); | |
327 | } | |
328 | } | |
329 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); | |
330 | } | |
331 | ||
332 | //printf("------------ N. of positive tracks in Event ----- %d \n", nPosTrks); | |
333 | //printf("------------ N. of negative tracks in Event ----- %d \n", nNegTrks); | |
334 | ||
335 | // printf("LS analysis...done\n"); | |
336 | ||
337 | } | |
d486095a | 338 | |
d486095a | 339 | |
4c230f6d | 340 | //__________________________________________ |
341 | void AliAnalysisTaskSEDplus::Init(){ | |
342 | // | |
343 | // Initialization | |
344 | // | |
d486095a | 345 | if(fDebug > 1) printf("AnalysisTaskSEDplus::Init() \n"); |
4c230f6d | 346 | |
347 | //PostData(2,fRDCutsloose);//we should then put those cuts in a tlist if we have more than 1 | |
348 | fListCuts=new TList(); | |
349 | AliRDHFCutsDplustoKpipi *production = new AliRDHFCutsDplustoKpipi(); | |
350 | production=fRDCutsProduction; | |
351 | AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi(); | |
352 | analysis=fRDCutsAnalysis; | |
353 | ||
354 | fListCuts->Add(production); | |
355 | fListCuts->Add(analysis); | |
356 | PostData(2,fListCuts); | |
357 | ||
d486095a | 358 | return; |
359 | } | |
360 | ||
361 | //________________________________________________________________________ | |
362 | void AliAnalysisTaskSEDplus::UserCreateOutputObjects() | |
363 | { | |
364 | // Create the output container | |
365 | // | |
366 | if(fDebug > 1) printf("AnalysisTaskSEDplus::UserCreateOutputObjects() \n"); | |
367 | ||
368 | // Several histograms are more conveniently managed in a TList | |
369 | fOutput = new TList(); | |
370 | fOutput->SetOwner(); | |
1f4e9722 | 371 | fOutput->SetName("OutputHistos"); |
372 | ||
1f4e9722 | 373 | TString hisname; |
82bb8d4b | 374 | Int_t index=0; |
375 | Int_t indexLS=0; | |
993bfba1 | 376 | Int_t nbins=GetNBinsHistos(); |
82bb8d4b | 377 | for(Int_t i=0;i<fNPtBins;i++){ |
1f4e9722 | 378 | |
82bb8d4b | 379 | index=GetHistoIndex(i); |
380 | indexLS=GetLSHistoIndex(i); | |
ba9ae5b2 | 381 | |
82bb8d4b | 382 | hisname.Form("hMassPt%d",i); |
993bfba1 | 383 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 384 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 385 | hisname.Form("hCosPAllPt%d",i); |
993bfba1 | 386 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 387 | fCosPHist[index]->Sumw2(); |
388 | hisname.Form("hDLenAllPt%d",i); | |
993bfba1 | 389 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 390 | fDLenHist[index]->Sumw2(); |
391 | hisname.Form("hSumd02AllPt%d",i); | |
993bfba1 | 392 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 393 | fSumd02Hist[index]->Sumw2(); |
394 | hisname.Form("hSigVertAllPt%d",i); | |
993bfba1 | 395 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 396 | fSigVertHist[index]->Sumw2(); |
397 | hisname.Form("hPtMaxAllPt%d",i); | |
993bfba1 | 398 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 399 | fPtMaxHist[index]->Sumw2(); |
400 | ||
401 | hisname.Form("hDCAAllPt%d",i); | |
993bfba1 | 402 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 403 | fDCAHist[index]->Sumw2(); |
404 | ||
405 | ||
406 | ||
1f4e9722 | 407 | hisname.Form("hMassPt%dTC",i); |
993bfba1 | 408 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 409 | fMassHistTC[index]->Sumw2(); |
ba9ae5b2 | 410 | |
411 | ||
412 | ||
413 | ||
414 | ||
415 | hisname.Form("hCosPAllPt%dLS",i); | |
993bfba1 | 416 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 417 | fCosPHistLS[index]->Sumw2(); |
418 | hisname.Form("hDLenAllPt%dLS",i); | |
993bfba1 | 419 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 420 | fDLenHistLS[index]->Sumw2(); |
421 | hisname.Form("hSumd02AllPt%dLS",i); | |
993bfba1 | 422 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 423 | fSumd02HistLS[index]->Sumw2(); |
424 | hisname.Form("hSigVertAllPt%dLS",i); | |
993bfba1 | 425 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 426 | fSigVertHistLS[index]->Sumw2(); |
427 | hisname.Form("hPtMaxAllPt%dLS",i); | |
993bfba1 | 428 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 429 | fPtMaxHistLS[index]->Sumw2(); |
430 | ||
431 | hisname.Form("hDCAAllPt%dLS",i); | |
993bfba1 | 432 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 433 | fDCAHistLS[index]->Sumw2(); |
434 | ||
82bb8d4b | 435 | hisname.Form("hLSPt%dLC",i); |
993bfba1 | 436 | fMassHistLS[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 437 | fMassHistLS[indexLS]->Sumw2(); |
438 | ||
ba9ae5b2 | 439 | hisname.Form("hLSPt%dTC",i); |
993bfba1 | 440 | fMassHistLSTC[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
ba9ae5b2 | 441 | fMassHistLSTC[indexLS]->Sumw2(); |
442 | ||
443 | ||
444 | ||
82bb8d4b | 445 | index=GetSignalHistoIndex(i); |
446 | indexLS++; | |
447 | hisname.Form("hSigPt%d",i); | |
993bfba1 | 448 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 449 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 450 | hisname.Form("hCosPSigPt%d",i); |
993bfba1 | 451 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 452 | fCosPHist[index]->Sumw2(); |
453 | hisname.Form("hDLenSigPt%d",i); | |
993bfba1 | 454 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 455 | fDLenHist[index]->Sumw2(); |
456 | hisname.Form("hSumd02SigPt%d",i); | |
993bfba1 | 457 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 458 | fSumd02Hist[index]->Sumw2(); |
459 | hisname.Form("hSigVertSigPt%d",i); | |
993bfba1 | 460 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 461 | fSigVertHist[index]->Sumw2(); |
462 | hisname.Form("hPtMaxSigPt%d",i); | |
993bfba1 | 463 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 464 | fPtMaxHist[index]->Sumw2(); |
465 | ||
466 | hisname.Form("hDCASigPt%d",i); | |
993bfba1 | 467 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 468 | fDCAHist[index]->Sumw2(); |
469 | ||
470 | ||
1f4e9722 | 471 | hisname.Form("hSigPt%dTC",i); |
993bfba1 | 472 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 473 | fMassHistTC[index]->Sumw2(); |
ba9ae5b2 | 474 | |
82bb8d4b | 475 | hisname.Form("hLSPt%dLCnw",i); |
993bfba1 | 476 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 477 | fMassHistLS[indexLS]->Sumw2(); |
478 | hisname.Form("hLSPt%dTCnw",i); | |
993bfba1 | 479 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 480 | fMassHistLSTC[indexLS]->Sumw2(); |
481 | ||
ba9ae5b2 | 482 | |
483 | ||
484 | hisname.Form("hCosPSigPt%dLS",i); | |
993bfba1 | 485 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 486 | fCosPHistLS[index]->Sumw2(); |
487 | hisname.Form("hDLenSigPt%dLS",i); | |
993bfba1 | 488 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 489 | fDLenHistLS[index]->Sumw2(); |
490 | hisname.Form("hSumd02SigPt%dLS",i); | |
993bfba1 | 491 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 492 | fSumd02HistLS[index]->Sumw2(); |
493 | hisname.Form("hSigVertSigPt%dLS",i); | |
993bfba1 | 494 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 495 | fSigVertHistLS[index]->Sumw2(); |
496 | hisname.Form("hPtMaxSigPt%dLS",i); | |
993bfba1 | 497 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 498 | fPtMaxHistLS[index]->Sumw2(); |
499 | ||
500 | hisname.Form("hDCASigPt%dLS",i); | |
993bfba1 | 501 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 502 | fDCAHistLS[index]->Sumw2(); |
503 | ||
504 | ||
505 | ||
82bb8d4b | 506 | index=GetBackgroundHistoIndex(i); |
507 | indexLS++; | |
508 | hisname.Form("hBkgPt%d",i); | |
993bfba1 | 509 | fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 510 | fMassHist[index]->Sumw2(); |
ba9ae5b2 | 511 | hisname.Form("hCosPBkgPt%d",i); |
993bfba1 | 512 | fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 513 | fCosPHist[index]->Sumw2(); |
514 | hisname.Form("hDLenBkgPt%d",i); | |
993bfba1 | 515 | fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 516 | fDLenHist[index]->Sumw2(); |
517 | hisname.Form("hSumd02BkgPt%d",i); | |
993bfba1 | 518 | fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 519 | fSumd02Hist[index]->Sumw2(); |
520 | hisname.Form("hSigVertBkgPt%d",i); | |
993bfba1 | 521 | fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 522 | fSigVertHist[index]->Sumw2(); |
523 | hisname.Form("hPtMaxBkgPt%d",i); | |
993bfba1 | 524 | fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 525 | fPtMaxHist[index]->Sumw2(); |
526 | ||
527 | hisname.Form("hDCABkgPt%d",i); | |
993bfba1 | 528 | fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 529 | fDCAHist[index]->Sumw2(); |
530 | ||
531 | ||
1f4e9722 | 532 | hisname.Form("hBkgPt%dTC",i); |
993bfba1 | 533 | fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 534 | fMassHistTC[index]->Sumw2(); |
ba9ae5b2 | 535 | |
82bb8d4b | 536 | hisname.Form("hLSPt%dLCntrip",i); |
993bfba1 | 537 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 538 | fMassHistLS[indexLS]->Sumw2(); |
539 | hisname.Form("hLSPt%dTCntrip",i); | |
993bfba1 | 540 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 541 | fMassHistLSTC[indexLS]->Sumw2(); |
542 | ||
ba9ae5b2 | 543 | |
544 | hisname.Form("hCosPBkgPt%dLS",i); | |
993bfba1 | 545 | fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.); |
ba9ae5b2 | 546 | fCosPHistLS[index]->Sumw2(); |
547 | hisname.Form("hDLenBkgPt%dLS",i); | |
993bfba1 | 548 | fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5); |
ba9ae5b2 | 549 | fDLenHistLS[index]->Sumw2(); |
550 | hisname.Form("hSumd02BkgPt%dLS",i); | |
993bfba1 | 551 | fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.); |
ba9ae5b2 | 552 | fSumd02HistLS[index]->Sumw2(); |
553 | hisname.Form("hSigVertBkgPt%dLS",i); | |
993bfba1 | 554 | fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 555 | fSigVertHistLS[index]->Sumw2(); |
556 | hisname.Form("hPtMaxBkgPt%dLS",i); | |
993bfba1 | 557 | fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.); |
ba9ae5b2 | 558 | fPtMaxHistLS[index]->Sumw2(); |
559 | hisname.Form("hDCABkgPt%dLS",i); | |
993bfba1 | 560 | fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1); |
ba9ae5b2 | 561 | fDCAHistLS[index]->Sumw2(); |
562 | ||
563 | ||
82bb8d4b | 564 | indexLS++; |
565 | hisname.Form("hLSPt%dLCntripsinglecut",i); | |
993bfba1 | 566 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 567 | fMassHistLS[indexLS]->Sumw2(); |
568 | hisname.Form("hLSPt%dTCntripsinglecut",i); | |
993bfba1 | 569 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 570 | fMassHistLSTC[indexLS]->Sumw2(); |
571 | ||
572 | indexLS++; | |
573 | hisname.Form("hLSPt%dLCspc",i); | |
993bfba1 | 574 | fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 575 | fMassHistLS[indexLS]->Sumw2(); |
576 | hisname.Form("hLSPt%dTCspc",i); | |
993bfba1 | 577 | fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit); |
82bb8d4b | 578 | fMassHistLSTC[indexLS]->Sumw2(); |
1f4e9722 | 579 | } |
8c34bd86 | 580 | |
82bb8d4b | 581 | for(Int_t i=0; i<3*fNPtBins; i++){ |
582 | fOutput->Add(fMassHist[i]); | |
ba9ae5b2 | 583 | fOutput->Add(fCosPHist[i]); |
584 | fOutput->Add(fDLenHist[i]); | |
585 | fOutput->Add(fSumd02Hist[i]); | |
586 | fOutput->Add(fSigVertHist[i]); | |
587 | fOutput->Add(fPtMaxHist[i]); | |
588 | fOutput->Add(fDCAHist[i]); | |
82bb8d4b | 589 | fOutput->Add(fMassHistTC[i]); |
590 | } | |
ba9ae5b2 | 591 | for(Int_t i=0; i<3*fNPtBins&&fDoLS; i++){ |
592 | fOutput->Add(fCosPHistLS[i]); | |
593 | fOutput->Add(fDLenHistLS[i]); | |
594 | fOutput->Add(fSumd02HistLS[i]); | |
595 | fOutput->Add(fSigVertHistLS[i]); | |
596 | fOutput->Add(fPtMaxHistLS[i]); | |
597 | fOutput->Add(fDCAHistLS[i]); | |
598 | } | |
82bb8d4b | 599 | for(Int_t i=0; i<5*fNPtBins&&fDoLS; i++){ |
600 | fOutput->Add(fMassHistLS[i]); | |
601 | fOutput->Add(fMassHistLSTC[i]); | |
602 | } | |
ba9ae5b2 | 603 | |
4afc48a2 | 604 | |
82bb8d4b | 605 | fHistNEvents = new TH1F("fHistNEvents", "Number of processed events; ; Events",3,-1.5,1.5); |
ba9ae5b2 | 606 | fHistNEvents->Sumw2(); |
607 | fHistNEvents->SetMinimum(0); | |
608 | fOutput->Add(fHistNEvents); | |
609 | ||
610 | ||
4afc48a2 | 611 | |
1f4e9722 | 612 | if(fFillNtuple){ |
613 | OpenFile(2); // 2 is the slot number of the ntuple | |
ba9ae5b2 | 614 | |
615 | fNtupleDplus = new TNtuple("fNtupleDplus","D +","pdg:Px:Py:Pz:PtTrue:VxTrue:VyTrue:VzTrue:Ptpi:PtK:Ptpi2:PtRec:PointingAngle:DecLeng:VxRec:VyRec:VzRec:InvMass:sigvert:d0Pi:d0K:d0Pi2:dca:d0square"); | |
616 | ||
1f4e9722 | 617 | } |
ba9ae5b2 | 618 | |
d486095a | 619 | return; |
620 | } | |
621 | ||
622 | //________________________________________________________________________ | |
623 | void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/) | |
624 | { | |
625 | // Execute analysis for current event: | |
626 | // heavy flavor candidates association to MC truth | |
627 | ||
4c230f6d | 628 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); |
629 | fHistNEvents->Fill(0); // count event | |
4afc48a2 | 630 | // Post the data already here |
631 | PostData(1,fOutput); | |
632 | ||
b557eb43 | 633 | TClonesArray *array3Prong = 0; |
4afc48a2 | 634 | TClonesArray *arrayLikeSign =0; |
b557eb43 | 635 | if(!aod && AODEvent() && IsStandardAOD()) { |
636 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
637 | // event in memory rather than the input (ESD) event. | |
638 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
4c230f6d | 639 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) |
640 | // have to taken from the AOD event hold by the AliAODExtension | |
b557eb43 | 641 | AliAODHandler* aodHandler = (AliAODHandler*) |
642 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
643 | if(aodHandler->GetExtensions()) { | |
644 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
645 | AliAODEvent *aodFromExt = ext->GetAOD(); | |
646 | array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong"); | |
4afc48a2 | 647 | arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong"); |
b557eb43 | 648 | } |
649 | } else { | |
650 | array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); | |
4afc48a2 | 651 | arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong"); |
b557eb43 | 652 | } |
8931c313 | 653 | |
d486095a | 654 | if(!array3Prong) { |
655 | printf("AliAnalysisTaskSEDplus::UserExec: Charm3Prong branch not found!\n"); | |
656 | return; | |
657 | } | |
4afc48a2 | 658 | if(!arrayLikeSign) { |
659 | printf("AliAnalysisTaskSEDplus::UserExec: LikeSign3Prong branch not found!\n"); | |
82bb8d4b | 660 | return; |
4afc48a2 | 661 | } |
662 | ||
663 | ||
664 | TClonesArray *arrayMC=0; | |
665 | AliAODMCHeader *mcHeader=0; | |
d486095a | 666 | |
667 | // AOD primary vertex | |
1f4e9722 | 668 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); |
669 | // vtx1->Print(); | |
670 | ||
d486095a | 671 | // load MC particles |
4afc48a2 | 672 | if(fReadMC){ |
673 | ||
674 | arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
675 | if(!arrayMC) { | |
676 | printf("AliAnalysisTaskSEDplus::UserExec: MC particles branch not found!\n"); | |
82bb8d4b | 677 | // return; |
4afc48a2 | 678 | } |
1f4e9722 | 679 | |
d486095a | 680 | // load MC header |
4afc48a2 | 681 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); |
682 | if(!mcHeader) { | |
82bb8d4b | 683 | printf("AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n"); |
684 | return; | |
4afc48a2 | 685 | } |
d486095a | 686 | } |
4afc48a2 | 687 | |
1f4e9722 | 688 | Int_t n3Prong = array3Prong->GetEntriesFast(); |
689 | if(fDebug>1) printf("Number of D+->Kpipi: %d\n",n3Prong); | |
4afc48a2 | 690 | |
691 | ||
692 | Int_t nOS=0; | |
82bb8d4b | 693 | Int_t index; |
1f4e9722 | 694 | Int_t pdgDgDplustoKpipi[3]={321,211,211}; |
4c230f6d | 695 | // 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 |
696 | //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts(); | |
1f4e9722 | 697 | for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) { |
698 | AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong); | |
699 | ||
700 | ||
701 | Bool_t unsetvtx=kFALSE; | |
702 | if(!d->GetOwnPrimaryVtx()){ | |
703 | d->SetOwnPrimaryVtx(vtx1); | |
704 | unsetvtx=kTRUE; | |
705 | } | |
4afc48a2 | 706 | |
4c230f6d | 707 | if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)) { |
82bb8d4b | 708 | Int_t iPtBin = -1; |
1f4e9722 | 709 | Double_t ptCand = d->Pt(); |
4c230f6d | 710 | |
82bb8d4b | 711 | for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){ |
712 | if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin; | |
1f4e9722 | 713 | } |
82bb8d4b | 714 | |
4c230f6d | 715 | Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate); |
716 | ||
4afc48a2 | 717 | Int_t labDp=-1; |
718 | Float_t deltaPx=0.; | |
719 | Float_t deltaPy=0.; | |
720 | Float_t deltaPz=0.; | |
721 | Float_t truePt=0.; | |
722 | Float_t xDecay=0.; | |
723 | Float_t yDecay=0.; | |
724 | Float_t zDecay=0.; | |
725 | Float_t pdgCode=-2; | |
726 | if(fReadMC){ | |
727 | labDp = d->MatchToMC(411,arrayMC,3,pdgDgDplustoKpipi); | |
728 | if(labDp>=0){ | |
729 | AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp); | |
730 | AliAODMCParticle *dg0 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(0)); | |
731 | deltaPx=partDp->Px()-d->Px(); | |
732 | deltaPy=partDp->Py()-d->Py(); | |
733 | deltaPz=partDp->Pz()-d->Pz(); | |
734 | truePt=partDp->Pt(); | |
735 | xDecay=dg0->Xv(); | |
736 | yDecay=dg0->Yv(); | |
737 | zDecay=dg0->Zv(); | |
738 | pdgCode=TMath::Abs(partDp->GetPdgCode()); | |
739 | }else{ | |
740 | pdgCode=-1; | |
741 | } | |
742 | } | |
1f4e9722 | 743 | Double_t invMass=d->InvMassDplus(); |
744 | ||
ba9ae5b2 | 745 | Float_t tmp[24]; |
4afc48a2 | 746 | if(fFillNtuple){ |
747 | tmp[0]=pdgCode; | |
748 | tmp[1]=deltaPx; | |
749 | tmp[2]=deltaPy; | |
750 | tmp[3]=deltaPz; | |
751 | tmp[4]=truePt; | |
752 | tmp[5]=xDecay; | |
753 | tmp[6]=yDecay; | |
754 | tmp[7]=zDecay; | |
755 | tmp[8]=d->PtProng(0); | |
756 | tmp[9]=d->PtProng(1); | |
757 | tmp[10]=d->PtProng(2); | |
758 | tmp[11]=d->Pt(); | |
759 | tmp[12]=d->CosPointingAngle(); | |
760 | tmp[13]=d->DecayLength(); | |
761 | tmp[14]=d->Xv(); | |
762 | tmp[15]=d->Yv(); | |
763 | tmp[16]=d->Zv(); | |
764 | tmp[17]=d->InvMassDplus(); | |
765 | tmp[18]=d->GetSigmaVert(); | |
766 | tmp[19]=d->Getd0Prong(0); | |
767 | tmp[20]=d->Getd0Prong(1); | |
ba9ae5b2 | 768 | tmp[21]=d->Getd0Prong(2); |
769 | tmp[22]=d->GetDCA(); | |
770 | tmp[23]=d->Prodd0d0(); | |
4afc48a2 | 771 | fNtupleDplus->Fill(tmp); |
4c230f6d | 772 | PostData(3,fNtupleDplus); |
4afc48a2 | 773 | } |
ba9ae5b2 | 774 | Double_t dlen=d->DecayLength(); |
775 | Double_t cosp=d->CosPointingAngle(); | |
776 | Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2); | |
0db12536 | 777 | Double_t dca=d->GetDCA(); |
778 | Double_t sigvert=d->GetSigmaVert(); | |
779 | Double_t ptmax=0; | |
ba9ae5b2 | 780 | for(Int_t i=0;i<3;i++){ |
781 | if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i); | |
782 | } | |
82bb8d4b | 783 | if(iPtBin>=0){ |
784 | ||
785 | index=GetHistoIndex(iPtBin); | |
786 | fMassHist[index]->Fill(invMass); | |
ba9ae5b2 | 787 | fCosPHist[index]->Fill(cosp); |
788 | fDLenHist[index]->Fill(dlen); | |
789 | fSumd02Hist[index]->Fill(sumD02); | |
0db12536 | 790 | fSigVertHist[index]->Fill(sigvert); |
ba9ae5b2 | 791 | fPtMaxHist[index]->Fill(ptmax); |
792 | fDCAHist[index]->Fill(dca); | |
793 | ||
4c230f6d | 794 | if(passTightCuts==1){ |
82bb8d4b | 795 | fMassHistTC[index]->Fill(invMass); |
82bb8d4b | 796 | } |
797 | ||
798 | if(fReadMC){ | |
799 | if(labDp>=0) { | |
800 | index=GetSignalHistoIndex(iPtBin); | |
801 | fMassHist[index]->Fill(invMass); | |
ba9ae5b2 | 802 | fCosPHist[index]->Fill(cosp); |
803 | fDLenHist[index]->Fill(dlen); | |
804 | fSumd02Hist[index]->Fill(sumD02); | |
0db12536 | 805 | fSigVertHist[index]->Fill(sigvert); |
ba9ae5b2 | 806 | fPtMaxHist[index]->Fill(ptmax); |
807 | fDCAHist[index]->Fill(dca); | |
4c230f6d | 808 | if(passTightCuts==1){ |
82bb8d4b | 809 | fMassHistTC[index]->Fill(invMass); |
810 | ||
811 | } | |
812 | ||
813 | }else{ | |
814 | index=GetBackgroundHistoIndex(iPtBin); | |
815 | fMassHist[index]->Fill(invMass); | |
ba9ae5b2 | 816 | fCosPHist[index]->Fill(cosp); |
817 | fDLenHist[index]->Fill(dlen); | |
818 | fSumd02Hist[index]->Fill(sumD02); | |
0db12536 | 819 | fSigVertHist[index]->Fill(sigvert); |
ba9ae5b2 | 820 | fPtMaxHist[index]->Fill(ptmax); |
821 | fDCAHist[index]->Fill(dca); | |
4c230f6d | 822 | if(passTightCuts==1){ |
82bb8d4b | 823 | fMassHistTC[index]->Fill(invMass); |
824 | ||
825 | } | |
4afc48a2 | 826 | } |
fc8d975b | 827 | } |
8c34bd86 | 828 | } |
d486095a | 829 | } |
1f4e9722 | 830 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); |
831 | } | |
4c230f6d | 832 | |
4afc48a2 | 833 | //start LS analysis |
834 | if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS); | |
82bb8d4b | 835 | |
4afc48a2 | 836 | PostData(1,fOutput); |
d486095a | 837 | return; |
838 | } | |
839 | ||
4afc48a2 | 840 | |
841 | ||
82bb8d4b | 842 | //________________________________________________________________________ |
d486095a | 843 | void AliAnalysisTaskSEDplus::Terminate(Option_t */*option*/) |
844 | { | |
845 | // Terminate analysis | |
846 | // | |
847 | if(fDebug > 1) printf("AnalysisTaskSEDplus: Terminate() \n"); | |
82bb8d4b | 848 | |
d486095a | 849 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); |
850 | if (!fOutput) { | |
851 | printf("ERROR: fOutput not available\n"); | |
852 | return; | |
853 | } | |
82bb8d4b | 854 | fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents")); |
855 | ||
856 | TString hisname; | |
857 | Int_t index=0; | |
ba9ae5b2 | 858 | |
859 | ||
82bb8d4b | 860 | Int_t indexLS=0; |
861 | for(Int_t i=0;i<fNPtBins;i++){ | |
862 | index=GetHistoIndex(i); | |
863 | if(fDoLS)indexLS=GetLSHistoIndex(i); | |
864 | hisname.Form("hMassPt%d",i); | |
865 | fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 866 | hisname.Form("hCosPAllPt%d",i); |
867 | fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
868 | hisname.Form("hDLenAllPt%d",i); | |
869 | fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
870 | hisname.Form("hSumd02AllPt%d",i); | |
871 | fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
872 | hisname.Form("hSigVertAllPt%d",i); | |
873 | fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
874 | hisname.Form("hPtMaxAllPt%d",i); | |
875 | fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
876 | hisname.Form("hDCAAllPt%d",i); | |
877 | fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
878 | hisname.Form("hMassPt%dTC",i); | |
82bb8d4b | 879 | fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); |
880 | if(fDoLS){ | |
82bb8d4b | 881 | hisname.Form("hLSPt%dLC",i); |
882 | fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 883 | hisname.Form("hCosPAllPt%dLS",i); |
884 | fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
885 | hisname.Form("hDLenAllPt%dLS",i); | |
886 | fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
887 | hisname.Form("hSumd02AllPt%dLS",i); | |
888 | fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
889 | hisname.Form("hSigVertAllPt%dLS",i); | |
890 | fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
891 | hisname.Form("hPtMaxAllPt%dLS",i); | |
892 | fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
893 | hisname.Form("hDCAAllPt%dLS",i); | |
894 | fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
895 | ||
896 | hisname.Form("hLSPt%dTC",i); | |
897 | fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
898 | ||
82bb8d4b | 899 | } |
900 | ||
901 | index=GetSignalHistoIndex(i); | |
902 | if(fDoLS)indexLS++; | |
903 | hisname.Form("hSigPt%d",i); | |
904 | fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 905 | hisname.Form("hCosPSigPt%d",i); |
906 | fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
907 | hisname.Form("hDLenSigPt%d",i); | |
908 | fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
909 | hisname.Form("hSumd02SigPt%d",i); | |
910 | fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
911 | hisname.Form("hSigVertSigPt%d",i); | |
912 | fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
913 | hisname.Form("hPtMaxSigPt%d",i); | |
914 | fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
915 | hisname.Form("hDCASigPt%d",i); | |
916 | fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
917 | ||
82bb8d4b | 918 | hisname.Form("hSigPt%dTC",i); |
919 | fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
920 | if(fDoLS){ | |
921 | hisname.Form("hLSPt%dLCnw",i); | |
922 | fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 923 | hisname.Form("hCosPSigPt%dLS",i); |
924 | fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
925 | hisname.Form("hDLenSigPt%dLS",i); | |
926 | fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
927 | hisname.Form("hSumd02SigPt%dLS",i); | |
928 | fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
929 | hisname.Form("hSigVertSigPt%dLS",i); | |
930 | fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
931 | hisname.Form("hPtMaxSigPt%dLS",i); | |
932 | fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
933 | hisname.Form("hDCASigPt%dLS",i); | |
934 | fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
935 | ||
82bb8d4b | 936 | hisname.Form("hLSPt%dTCnw",i); |
937 | fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 938 | } |
939 | ||
82bb8d4b | 940 | index=GetBackgroundHistoIndex(i); |
941 | if(fDoLS)indexLS++; | |
942 | hisname.Form("hBkgPt%d",i); | |
943 | fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 944 | hisname.Form("hCosPBkgPt%d",i); |
945 | fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
946 | hisname.Form("hDLenBkgPt%d",i); | |
947 | fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
948 | hisname.Form("hSumd02BkgPt%d",i); | |
949 | fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
950 | hisname.Form("hSigVertBkgPt%d",i); | |
951 | fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
952 | hisname.Form("hPtMaxBkgPt%d",i); | |
953 | fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
954 | hisname.Form("hDCABkgPt%d",i); | |
955 | fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
82bb8d4b | 956 | hisname.Form("hBkgPt%dTC",i); |
957 | fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
958 | if(fDoLS){ | |
959 | hisname.Form("hLSPt%dLCntrip",i); | |
960 | fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
961 | ||
ba9ae5b2 | 962 | |
963 | hisname.Form("hCosPBkgPt%dLS",i); | |
964 | fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
965 | hisname.Form("hDLenBkgPt%dLS",i); | |
966 | fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
967 | hisname.Form("hSumd02BkgPt%dLS",i); | |
968 | fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
969 | hisname.Form("hSigVertBkgPt%dLS",i); | |
970 | fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
971 | hisname.Form("hPtMaxBkgPt%dLS",i); | |
972 | fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
973 | hisname.Form("hDCABkgPt%dLS",i); | |
974 | fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
975 | ||
82bb8d4b | 976 | hisname.Form("hLSPt%dTCntrip",i); |
977 | fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
ba9ae5b2 | 978 | |
979 | ||
82bb8d4b | 980 | indexLS++; |
981 | hisname.Form("hLSPt%dLCntripsinglecut",i); | |
982 | fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
983 | ||
984 | hisname.Form("hLSPt%dTCntripsinglecut",i); | |
985 | fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
986 | ||
987 | ||
988 | indexLS++; | |
989 | hisname.Form("hLSPt%dLCspc",i); | |
990 | fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
991 | ||
992 | hisname.Form("hLSPt%dTCspc",i); | |
993 | fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data())); | |
994 | } | |
995 | ||
ba9ae5b2 | 996 | } |
82bb8d4b | 997 | |
1f4e9722 | 998 | if(fFillNtuple){ |
4c230f6d | 999 | fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(3)); |
4afc48a2 | 1000 | } |
fc8d975b | 1001 | |
13808a30 | 1002 | TCanvas *c1=new TCanvas("c1","D+ invariant mass distribution",500,500); |
1003 | c1->cd(); | |
1004 | TH1F *hMassPt=(TH1F*)fOutput->FindObject("hMassPt3TC"); | |
1005 | hMassPt->SetLineColor(kBlue); | |
1006 | hMassPt->SetXTitle("M[GeV/c^{2}]"); | |
1007 | hMassPt->Draw(); | |
1008 | ||
1009 | return; | |
d486095a | 1010 | } |