]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliAnalysisTaskSEDplus.cxx
Possibility to set pt bins (Giacomo)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskSEDplus.cxx
CommitLineData
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
47ClassImp(AliAnalysisTaskSEDplus)
48
49
50//________________________________________________________________________
51AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus():
52AliAnalysisTaskSE(),
53fOutput(0),
4afc48a2 54fHistNEvents(0),
d486095a 55fNtupleDplus(0),
82bb8d4b 56fUpmasslimit(1.965),
57fLowmasslimit(1.765),
58fNPtBins(0),
993bfba1 59fBinWidth(0.002),
4c230f6d 60fListCuts(0),
61fRDCutsProduction(0),
62fRDCutsAnalysis(0),
1f4e9722 63fFillNtuple(kFALSE),
4afc48a2 64fReadMC(kFALSE),
4c230f6d 65fDoLS(kFALSE)
d486095a 66{
82bb8d4b 67 // Default constructor
d486095a 68}
69
70//________________________________________________________________________
4c230f6d 71AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(const char *name,AliRDHFCutsDplustoKpipi *dpluscutsana,AliRDHFCutsDplustoKpipi *dpluscutsprod,Bool_t fillNtuple):
d486095a 72AliAnalysisTaskSE(name),
4afc48a2 73fOutput(0),
74fHistNEvents(0),
d486095a 75fNtupleDplus(0),
82bb8d4b 76fUpmasslimit(1.965),
77fLowmasslimit(1.765),
78fNPtBins(0),
993bfba1 79fBinWidth(0.002),
4c230f6d 80fListCuts(0),
81fRDCutsProduction(dpluscutsprod),
82fRDCutsAnalysis(dpluscutsana),
1f4e9722 83fFillNtuple(fillNtuple),
4afc48a2 84fReadMC(kFALSE),
4c230f6d 85fDoLS(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//________________________________________________________________________
106AliAnalysisTaskSEDplus::~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//_________________________________________________________________
133void 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//_________________________________________________________________
141void 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 152void 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//________________________________________________________________
180void 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//_________________________________________________________________
195Double_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//_________________________________________________________________
201Int_t AliAnalysisTaskSEDplus::GetNBinsHistos(){
202 return (Int_t)((fUpmasslimit-fLowmasslimit)/fBinWidth+0.5);
203}
82bb8d4b 204//_________________________________________________________________
205void 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();
300 Double_t ptmax=0;
301 for(Int_t i=0;i<3;i++){
302 if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i);
303 }
304
82bb8d4b 305 index=GetLSHistoIndex(iPtBin);
306 fMassHistLS[index]->Fill(invMass,wei);
307 fMassHistLS[index+1]->Fill(invMass);
308 fMassHistLS[index+2]->Fill(invMass,wei2);
309 fMassHistLS[index+3]->Fill(invMass,wei3);
310 fMassHistLS[index+4]->Fill(invMass,wei4);
ba9ae5b2 311
312 Int_t indexcut=GetHistoIndex(iPtBin);
313 fCosPHistLS[indexcut]->Fill(cosp);
314 fDLenHistLS[indexcut]->Fill(dlen);
315 fSumd02HistLS[indexcut]->Fill(sumD02);
316 fPtMaxHistLS[indexcut]->Fill(ptmax);
317 fDCAHistLS[indexcut]->Fill(dca);
82bb8d4b 318
4c230f6d 319 if(passTightCuts==1){
82bb8d4b 320 fMassHistLSTC[index]->Fill(invMass,wei);
321 fMassHistLSTC[index+1]->Fill(invMass);
322 fMassHistLSTC[index+2]->Fill(invMass,wei2);
323 fMassHistLSTC[index+3]->Fill(invMass,wei3);
324 fMassHistLSTC[index+4]->Fill(invMass,wei4);
325 }
326 }
327 if(unsetvtx) d->UnsetOwnPrimaryVtx();
328 }
329
330 //printf("------------ N. of positive tracks in Event ----- %d \n", nPosTrks);
331 //printf("------------ N. of negative tracks in Event ----- %d \n", nNegTrks);
332
333 // printf("LS analysis...done\n");
334
335}
d486095a 336
d486095a 337
4c230f6d 338//__________________________________________
339void AliAnalysisTaskSEDplus::Init(){
340 //
341 // Initialization
342 //
d486095a 343 if(fDebug > 1) printf("AnalysisTaskSEDplus::Init() \n");
4c230f6d 344
345 //PostData(2,fRDCutsloose);//we should then put those cuts in a tlist if we have more than 1
346 fListCuts=new TList();
347 AliRDHFCutsDplustoKpipi *production = new AliRDHFCutsDplustoKpipi();
348 production=fRDCutsProduction;
349 AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi();
350 analysis=fRDCutsAnalysis;
351
352 fListCuts->Add(production);
353 fListCuts->Add(analysis);
354 PostData(2,fListCuts);
355
d486095a 356 return;
357}
358
359//________________________________________________________________________
360void AliAnalysisTaskSEDplus::UserCreateOutputObjects()
361{
362 // Create the output container
363 //
364 if(fDebug > 1) printf("AnalysisTaskSEDplus::UserCreateOutputObjects() \n");
365
366 // Several histograms are more conveniently managed in a TList
367 fOutput = new TList();
368 fOutput->SetOwner();
1f4e9722 369 fOutput->SetName("OutputHistos");
370
1f4e9722 371 TString hisname;
82bb8d4b 372 Int_t index=0;
373 Int_t indexLS=0;
993bfba1 374 Int_t nbins=GetNBinsHistos();
82bb8d4b 375 for(Int_t i=0;i<fNPtBins;i++){
1f4e9722 376
82bb8d4b 377 index=GetHistoIndex(i);
378 indexLS=GetLSHistoIndex(i);
ba9ae5b2 379
82bb8d4b 380 hisname.Form("hMassPt%d",i);
993bfba1 381 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 382 fMassHist[index]->Sumw2();
ba9ae5b2 383 hisname.Form("hCosPAllPt%d",i);
993bfba1 384 fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 385 fCosPHist[index]->Sumw2();
386 hisname.Form("hDLenAllPt%d",i);
993bfba1 387 fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 388 fDLenHist[index]->Sumw2();
389 hisname.Form("hSumd02AllPt%d",i);
993bfba1 390 fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 391 fSumd02Hist[index]->Sumw2();
392 hisname.Form("hSigVertAllPt%d",i);
993bfba1 393 fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 394 fSigVertHist[index]->Sumw2();
395 hisname.Form("hPtMaxAllPt%d",i);
993bfba1 396 fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 397 fPtMaxHist[index]->Sumw2();
398
399 hisname.Form("hDCAAllPt%d",i);
993bfba1 400 fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 401 fDCAHist[index]->Sumw2();
402
403
404
1f4e9722 405 hisname.Form("hMassPt%dTC",i);
993bfba1 406 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 407 fMassHistTC[index]->Sumw2();
ba9ae5b2 408
409
410
411
412
413 hisname.Form("hCosPAllPt%dLS",i);
993bfba1 414 fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 415 fCosPHistLS[index]->Sumw2();
416 hisname.Form("hDLenAllPt%dLS",i);
993bfba1 417 fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 418 fDLenHistLS[index]->Sumw2();
419 hisname.Form("hSumd02AllPt%dLS",i);
993bfba1 420 fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 421 fSumd02HistLS[index]->Sumw2();
422 hisname.Form("hSigVertAllPt%dLS",i);
993bfba1 423 fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 424 fSigVertHistLS[index]->Sumw2();
425 hisname.Form("hPtMaxAllPt%dLS",i);
993bfba1 426 fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 427 fPtMaxHistLS[index]->Sumw2();
428
429 hisname.Form("hDCAAllPt%dLS",i);
993bfba1 430 fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 431 fDCAHistLS[index]->Sumw2();
432
82bb8d4b 433 hisname.Form("hLSPt%dLC",i);
993bfba1 434 fMassHistLS[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 435 fMassHistLS[indexLS]->Sumw2();
436
ba9ae5b2 437 hisname.Form("hLSPt%dTC",i);
993bfba1 438 fMassHistLSTC[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
ba9ae5b2 439 fMassHistLSTC[indexLS]->Sumw2();
440
441
442
82bb8d4b 443 index=GetSignalHistoIndex(i);
444 indexLS++;
445 hisname.Form("hSigPt%d",i);
993bfba1 446 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 447 fMassHist[index]->Sumw2();
ba9ae5b2 448 hisname.Form("hCosPSigPt%d",i);
993bfba1 449 fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 450 fCosPHist[index]->Sumw2();
451 hisname.Form("hDLenSigPt%d",i);
993bfba1 452 fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 453 fDLenHist[index]->Sumw2();
454 hisname.Form("hSumd02SigPt%d",i);
993bfba1 455 fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 456 fSumd02Hist[index]->Sumw2();
457 hisname.Form("hSigVertSigPt%d",i);
993bfba1 458 fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 459 fSigVertHist[index]->Sumw2();
460 hisname.Form("hPtMaxSigPt%d",i);
993bfba1 461 fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 462 fPtMaxHist[index]->Sumw2();
463
464 hisname.Form("hDCASigPt%d",i);
993bfba1 465 fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 466 fDCAHist[index]->Sumw2();
467
468
1f4e9722 469 hisname.Form("hSigPt%dTC",i);
993bfba1 470 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 471 fMassHistTC[index]->Sumw2();
ba9ae5b2 472
82bb8d4b 473 hisname.Form("hLSPt%dLCnw",i);
993bfba1 474 fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 475 fMassHistLS[indexLS]->Sumw2();
476 hisname.Form("hLSPt%dTCnw",i);
993bfba1 477 fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 478 fMassHistLSTC[indexLS]->Sumw2();
479
ba9ae5b2 480
481
482 hisname.Form("hCosPSigPt%dLS",i);
993bfba1 483 fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 484 fCosPHistLS[index]->Sumw2();
485 hisname.Form("hDLenSigPt%dLS",i);
993bfba1 486 fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 487 fDLenHistLS[index]->Sumw2();
488 hisname.Form("hSumd02SigPt%dLS",i);
993bfba1 489 fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 490 fSumd02HistLS[index]->Sumw2();
491 hisname.Form("hSigVertSigPt%dLS",i);
993bfba1 492 fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 493 fSigVertHistLS[index]->Sumw2();
494 hisname.Form("hPtMaxSigPt%dLS",i);
993bfba1 495 fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 496 fPtMaxHistLS[index]->Sumw2();
497
498 hisname.Form("hDCASigPt%dLS",i);
993bfba1 499 fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 500 fDCAHistLS[index]->Sumw2();
501
502
503
82bb8d4b 504 index=GetBackgroundHistoIndex(i);
505 indexLS++;
506 hisname.Form("hBkgPt%d",i);
993bfba1 507 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 508 fMassHist[index]->Sumw2();
ba9ae5b2 509 hisname.Form("hCosPBkgPt%d",i);
993bfba1 510 fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 511 fCosPHist[index]->Sumw2();
512 hisname.Form("hDLenBkgPt%d",i);
993bfba1 513 fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 514 fDLenHist[index]->Sumw2();
515 hisname.Form("hSumd02BkgPt%d",i);
993bfba1 516 fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 517 fSumd02Hist[index]->Sumw2();
518 hisname.Form("hSigVertBkgPt%d",i);
993bfba1 519 fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 520 fSigVertHist[index]->Sumw2();
521 hisname.Form("hPtMaxBkgPt%d",i);
993bfba1 522 fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 523 fPtMaxHist[index]->Sumw2();
524
525 hisname.Form("hDCABkgPt%d",i);
993bfba1 526 fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 527 fDCAHist[index]->Sumw2();
528
529
1f4e9722 530 hisname.Form("hBkgPt%dTC",i);
993bfba1 531 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 532 fMassHistTC[index]->Sumw2();
ba9ae5b2 533
82bb8d4b 534 hisname.Form("hLSPt%dLCntrip",i);
993bfba1 535 fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 536 fMassHistLS[indexLS]->Sumw2();
537 hisname.Form("hLSPt%dTCntrip",i);
993bfba1 538 fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 539 fMassHistLSTC[indexLS]->Sumw2();
540
ba9ae5b2 541
542 hisname.Form("hCosPBkgPt%dLS",i);
993bfba1 543 fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
ba9ae5b2 544 fCosPHistLS[index]->Sumw2();
545 hisname.Form("hDLenBkgPt%dLS",i);
993bfba1 546 fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
ba9ae5b2 547 fDLenHistLS[index]->Sumw2();
548 hisname.Form("hSumd02BkgPt%dLS",i);
993bfba1 549 fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
ba9ae5b2 550 fSumd02HistLS[index]->Sumw2();
551 hisname.Form("hSigVertBkgPt%dLS",i);
993bfba1 552 fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 553 fSigVertHistLS[index]->Sumw2();
554 hisname.Form("hPtMaxBkgPt%dLS",i);
993bfba1 555 fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
ba9ae5b2 556 fPtMaxHistLS[index]->Sumw2();
557 hisname.Form("hDCABkgPt%dLS",i);
993bfba1 558 fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
ba9ae5b2 559 fDCAHistLS[index]->Sumw2();
560
561
82bb8d4b 562 indexLS++;
563 hisname.Form("hLSPt%dLCntripsinglecut",i);
993bfba1 564 fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 565 fMassHistLS[indexLS]->Sumw2();
566 hisname.Form("hLSPt%dTCntripsinglecut",i);
993bfba1 567 fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 568 fMassHistLSTC[indexLS]->Sumw2();
569
570 indexLS++;
571 hisname.Form("hLSPt%dLCspc",i);
993bfba1 572 fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 573 fMassHistLS[indexLS]->Sumw2();
574 hisname.Form("hLSPt%dTCspc",i);
993bfba1 575 fMassHistLSTC[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
82bb8d4b 576 fMassHistLSTC[indexLS]->Sumw2();
1f4e9722 577 }
8c34bd86 578
82bb8d4b 579 for(Int_t i=0; i<3*fNPtBins; i++){
580 fOutput->Add(fMassHist[i]);
ba9ae5b2 581 fOutput->Add(fCosPHist[i]);
582 fOutput->Add(fDLenHist[i]);
583 fOutput->Add(fSumd02Hist[i]);
584 fOutput->Add(fSigVertHist[i]);
585 fOutput->Add(fPtMaxHist[i]);
586 fOutput->Add(fDCAHist[i]);
82bb8d4b 587 fOutput->Add(fMassHistTC[i]);
588 }
ba9ae5b2 589 for(Int_t i=0; i<3*fNPtBins&&fDoLS; i++){
590 fOutput->Add(fCosPHistLS[i]);
591 fOutput->Add(fDLenHistLS[i]);
592 fOutput->Add(fSumd02HistLS[i]);
593 fOutput->Add(fSigVertHistLS[i]);
594 fOutput->Add(fPtMaxHistLS[i]);
595 fOutput->Add(fDCAHistLS[i]);
596 }
82bb8d4b 597 for(Int_t i=0; i<5*fNPtBins&&fDoLS; i++){
598 fOutput->Add(fMassHistLS[i]);
599 fOutput->Add(fMassHistLSTC[i]);
600 }
ba9ae5b2 601
4afc48a2 602
82bb8d4b 603 fHistNEvents = new TH1F("fHistNEvents", "Number of processed events; ; Events",3,-1.5,1.5);
ba9ae5b2 604 fHistNEvents->Sumw2();
605 fHistNEvents->SetMinimum(0);
606 fOutput->Add(fHistNEvents);
607
608
4afc48a2 609
1f4e9722 610 if(fFillNtuple){
611 OpenFile(2); // 2 is the slot number of the ntuple
ba9ae5b2 612
613 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");
614
1f4e9722 615 }
ba9ae5b2 616
d486095a 617 return;
618}
619
620//________________________________________________________________________
621void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
622{
623 // Execute analysis for current event:
624 // heavy flavor candidates association to MC truth
625
4c230f6d 626 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
627 fHistNEvents->Fill(0); // count event
4afc48a2 628 // Post the data already here
629 PostData(1,fOutput);
630
b557eb43 631 TClonesArray *array3Prong = 0;
4afc48a2 632 TClonesArray *arrayLikeSign =0;
b557eb43 633 if(!aod && AODEvent() && IsStandardAOD()) {
634 // In case there is an AOD handler writing a standard AOD, use the AOD
635 // event in memory rather than the input (ESD) event.
636 aod = dynamic_cast<AliAODEvent*> (AODEvent());
4c230f6d 637 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
638 // have to taken from the AOD event hold by the AliAODExtension
b557eb43 639 AliAODHandler* aodHandler = (AliAODHandler*)
640 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
641 if(aodHandler->GetExtensions()) {
642 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
643 AliAODEvent *aodFromExt = ext->GetAOD();
644 array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
4afc48a2 645 arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong");
b557eb43 646 }
647 } else {
648 array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
4afc48a2 649 arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong");
b557eb43 650 }
8931c313 651
d486095a 652 if(!array3Prong) {
653 printf("AliAnalysisTaskSEDplus::UserExec: Charm3Prong branch not found!\n");
654 return;
655 }
4afc48a2 656 if(!arrayLikeSign) {
657 printf("AliAnalysisTaskSEDplus::UserExec: LikeSign3Prong branch not found!\n");
82bb8d4b 658 return;
4afc48a2 659 }
660
661
662 TClonesArray *arrayMC=0;
663 AliAODMCHeader *mcHeader=0;
d486095a 664
665 // AOD primary vertex
1f4e9722 666 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
667 // vtx1->Print();
668
d486095a 669 // load MC particles
4afc48a2 670 if(fReadMC){
671
672 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
673 if(!arrayMC) {
674 printf("AliAnalysisTaskSEDplus::UserExec: MC particles branch not found!\n");
82bb8d4b 675 // return;
4afc48a2 676 }
1f4e9722 677
d486095a 678 // load MC header
4afc48a2 679 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
680 if(!mcHeader) {
82bb8d4b 681 printf("AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n");
682 return;
4afc48a2 683 }
d486095a 684 }
4afc48a2 685
1f4e9722 686 Int_t n3Prong = array3Prong->GetEntriesFast();
687 if(fDebug>1) printf("Number of D+->Kpipi: %d\n",n3Prong);
4afc48a2 688
689
690 Int_t nOS=0;
82bb8d4b 691 Int_t index;
1f4e9722 692 Int_t pdgDgDplustoKpipi[3]={321,211,211};
4c230f6d 693 // 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
694 //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts();
1f4e9722 695 for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
696 AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
697
698
699 Bool_t unsetvtx=kFALSE;
700 if(!d->GetOwnPrimaryVtx()){
701 d->SetOwnPrimaryVtx(vtx1);
702 unsetvtx=kTRUE;
703 }
4afc48a2 704
4c230f6d 705 if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)) {
82bb8d4b 706 Int_t iPtBin = -1;
1f4e9722 707 Double_t ptCand = d->Pt();
4c230f6d 708
82bb8d4b 709 for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){
710 if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin;
1f4e9722 711 }
82bb8d4b 712
4c230f6d 713 Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate);
714
4afc48a2 715 Int_t labDp=-1;
716 Float_t deltaPx=0.;
717 Float_t deltaPy=0.;
718 Float_t deltaPz=0.;
719 Float_t truePt=0.;
720 Float_t xDecay=0.;
721 Float_t yDecay=0.;
722 Float_t zDecay=0.;
723 Float_t pdgCode=-2;
724 if(fReadMC){
725 labDp = d->MatchToMC(411,arrayMC,3,pdgDgDplustoKpipi);
726 if(labDp>=0){
727 AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp);
728 AliAODMCParticle *dg0 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(0));
729 deltaPx=partDp->Px()-d->Px();
730 deltaPy=partDp->Py()-d->Py();
731 deltaPz=partDp->Pz()-d->Pz();
732 truePt=partDp->Pt();
733 xDecay=dg0->Xv();
734 yDecay=dg0->Yv();
735 zDecay=dg0->Zv();
736 pdgCode=TMath::Abs(partDp->GetPdgCode());
737 }else{
738 pdgCode=-1;
739 }
740 }
1f4e9722 741 Double_t invMass=d->InvMassDplus();
742
ba9ae5b2 743 Float_t tmp[24];
4afc48a2 744 if(fFillNtuple){
745 tmp[0]=pdgCode;
746 tmp[1]=deltaPx;
747 tmp[2]=deltaPy;
748 tmp[3]=deltaPz;
749 tmp[4]=truePt;
750 tmp[5]=xDecay;
751 tmp[6]=yDecay;
752 tmp[7]=zDecay;
753 tmp[8]=d->PtProng(0);
754 tmp[9]=d->PtProng(1);
755 tmp[10]=d->PtProng(2);
756 tmp[11]=d->Pt();
757 tmp[12]=d->CosPointingAngle();
758 tmp[13]=d->DecayLength();
759 tmp[14]=d->Xv();
760 tmp[15]=d->Yv();
761 tmp[16]=d->Zv();
762 tmp[17]=d->InvMassDplus();
763 tmp[18]=d->GetSigmaVert();
764 tmp[19]=d->Getd0Prong(0);
765 tmp[20]=d->Getd0Prong(1);
ba9ae5b2 766 tmp[21]=d->Getd0Prong(2);
767 tmp[22]=d->GetDCA();
768 tmp[23]=d->Prodd0d0();
4afc48a2 769 fNtupleDplus->Fill(tmp);
4c230f6d 770 PostData(3,fNtupleDplus);
4afc48a2 771 }
ba9ae5b2 772 Double_t dlen=d->DecayLength();
773 Double_t cosp=d->CosPointingAngle();
774 Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
775 Double_t dca=d->GetDCA();
776Double_t ptmax=0;
777 for(Int_t i=0;i<3;i++){
778 if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i);
779 }
82bb8d4b 780 if(iPtBin>=0){
781
782 index=GetHistoIndex(iPtBin);
783 fMassHist[index]->Fill(invMass);
ba9ae5b2 784 fCosPHist[index]->Fill(cosp);
785 fDLenHist[index]->Fill(dlen);
786 fSumd02Hist[index]->Fill(sumD02);
787 fPtMaxHist[index]->Fill(ptmax);
788 fDCAHist[index]->Fill(dca);
789
4c230f6d 790 if(passTightCuts==1){
82bb8d4b 791 fMassHistTC[index]->Fill(invMass);
82bb8d4b 792 }
793
794 if(fReadMC){
795 if(labDp>=0) {
796 index=GetSignalHistoIndex(iPtBin);
797 fMassHist[index]->Fill(invMass);
ba9ae5b2 798 fCosPHist[index]->Fill(cosp);
799 fDLenHist[index]->Fill(dlen);
800 fSumd02Hist[index]->Fill(sumD02);
801 fPtMaxHist[index]->Fill(ptmax);
802 fDCAHist[index]->Fill(dca);
4c230f6d 803 if(passTightCuts==1){
82bb8d4b 804 fMassHistTC[index]->Fill(invMass);
805
806 }
807
808 }else{
809 index=GetBackgroundHistoIndex(iPtBin);
810 fMassHist[index]->Fill(invMass);
ba9ae5b2 811 fCosPHist[index]->Fill(cosp);
812 fDLenHist[index]->Fill(dlen);
813 fSumd02Hist[index]->Fill(sumD02);
814 fPtMaxHist[index]->Fill(ptmax);
815 fDCAHist[index]->Fill(dca);
4c230f6d 816 if(passTightCuts==1){
82bb8d4b 817 fMassHistTC[index]->Fill(invMass);
818
819 }
4afc48a2 820 }
fc8d975b 821 }
8c34bd86 822 }
d486095a 823 }
1f4e9722 824 if(unsetvtx) d->UnsetOwnPrimaryVtx();
825 }
4c230f6d 826
4afc48a2 827 //start LS analysis
828 if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS);
82bb8d4b 829
4afc48a2 830 PostData(1,fOutput);
d486095a 831 return;
832}
833
4afc48a2 834
835
82bb8d4b 836//________________________________________________________________________
d486095a 837void AliAnalysisTaskSEDplus::Terminate(Option_t */*option*/)
838{
839 // Terminate analysis
840 //
841 if(fDebug > 1) printf("AnalysisTaskSEDplus: Terminate() \n");
82bb8d4b 842
d486095a 843 fOutput = dynamic_cast<TList*> (GetOutputData(1));
844 if (!fOutput) {
845 printf("ERROR: fOutput not available\n");
846 return;
847 }
82bb8d4b 848 fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
849
850 TString hisname;
851 Int_t index=0;
ba9ae5b2 852
853
82bb8d4b 854 Int_t indexLS=0;
855 for(Int_t i=0;i<fNPtBins;i++){
856 index=GetHistoIndex(i);
857 if(fDoLS)indexLS=GetLSHistoIndex(i);
858 hisname.Form("hMassPt%d",i);
859 fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 860 hisname.Form("hCosPAllPt%d",i);
861 fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
862 hisname.Form("hDLenAllPt%d",i);
863 fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
864 hisname.Form("hSumd02AllPt%d",i);
865 fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
866 hisname.Form("hSigVertAllPt%d",i);
867 fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
868 hisname.Form("hPtMaxAllPt%d",i);
869 fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
870 hisname.Form("hDCAAllPt%d",i);
871 fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
872 hisname.Form("hMassPt%dTC",i);
82bb8d4b 873 fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
874 if(fDoLS){
82bb8d4b 875 hisname.Form("hLSPt%dLC",i);
876 fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 877 hisname.Form("hCosPAllPt%dLS",i);
878 fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
879 hisname.Form("hDLenAllPt%dLS",i);
880 fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
881 hisname.Form("hSumd02AllPt%dLS",i);
882 fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
883 hisname.Form("hSigVertAllPt%dLS",i);
884 fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
885 hisname.Form("hPtMaxAllPt%dLS",i);
886 fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
887 hisname.Form("hDCAAllPt%dLS",i);
888 fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
889
890 hisname.Form("hLSPt%dTC",i);
891 fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
892
82bb8d4b 893 }
894
895 index=GetSignalHistoIndex(i);
896 if(fDoLS)indexLS++;
897 hisname.Form("hSigPt%d",i);
898 fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 899 hisname.Form("hCosPSigPt%d",i);
900 fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
901 hisname.Form("hDLenSigPt%d",i);
902 fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
903 hisname.Form("hSumd02SigPt%d",i);
904 fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
905 hisname.Form("hSigVertSigPt%d",i);
906 fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
907 hisname.Form("hPtMaxSigPt%d",i);
908 fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
909 hisname.Form("hDCASigPt%d",i);
910 fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
911
82bb8d4b 912 hisname.Form("hSigPt%dTC",i);
913 fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
914 if(fDoLS){
915 hisname.Form("hLSPt%dLCnw",i);
916 fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 917 hisname.Form("hCosPSigPt%dLS",i);
918 fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
919 hisname.Form("hDLenSigPt%dLS",i);
920 fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
921 hisname.Form("hSumd02SigPt%dLS",i);
922 fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
923 hisname.Form("hSigVertSigPt%dLS",i);
924 fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
925 hisname.Form("hPtMaxSigPt%dLS",i);
926 fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
927 hisname.Form("hDCASigPt%dLS",i);
928 fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
929
82bb8d4b 930 hisname.Form("hLSPt%dTCnw",i);
931 fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 932 }
933
82bb8d4b 934 index=GetBackgroundHistoIndex(i);
935 if(fDoLS)indexLS++;
936 hisname.Form("hBkgPt%d",i);
937 fMassHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 938 hisname.Form("hCosPBkgPt%d",i);
939 fCosPHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
940 hisname.Form("hDLenBkgPt%d",i);
941 fDLenHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
942 hisname.Form("hSumd02BkgPt%d",i);
943 fSumd02Hist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
944 hisname.Form("hSigVertBkgPt%d",i);
945 fSigVertHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
946 hisname.Form("hPtMaxBkgPt%d",i);
947 fPtMaxHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
948 hisname.Form("hDCABkgPt%d",i);
949 fDCAHist[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
82bb8d4b 950 hisname.Form("hBkgPt%dTC",i);
951 fMassHistTC[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
952 if(fDoLS){
953 hisname.Form("hLSPt%dLCntrip",i);
954 fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
955
ba9ae5b2 956
957 hisname.Form("hCosPBkgPt%dLS",i);
958 fCosPHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
959 hisname.Form("hDLenBkgPt%dLS",i);
960 fDLenHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
961 hisname.Form("hSumd02BkgPt%dLS",i);
962 fSumd02HistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
963 hisname.Form("hSigVertBkgPt%dLS",i);
964 fSigVertHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
965 hisname.Form("hPtMaxBkgPt%dLS",i);
966 fPtMaxHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
967 hisname.Form("hDCABkgPt%dLS",i);
968 fDCAHistLS[index]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
969
82bb8d4b 970 hisname.Form("hLSPt%dTCntrip",i);
971 fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
ba9ae5b2 972
973
82bb8d4b 974 indexLS++;
975 hisname.Form("hLSPt%dLCntripsinglecut",i);
976 fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
977
978 hisname.Form("hLSPt%dTCntripsinglecut",i);
979 fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
980
981
982 indexLS++;
983 hisname.Form("hLSPt%dLCspc",i);
984 fMassHistLS[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
985
986 hisname.Form("hLSPt%dTCspc",i);
987 fMassHistLSTC[indexLS]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
988 }
989
ba9ae5b2 990 }
82bb8d4b 991
1f4e9722 992 if(fFillNtuple){
4c230f6d 993 fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(3));
4afc48a2 994 }
fc8d975b 995
13808a30 996 TCanvas *c1=new TCanvas("c1","D+ invariant mass distribution",500,500);
997 c1->cd();
998 TH1F *hMassPt=(TH1F*)fOutput->FindObject("hMassPt3TC");
999 hMassPt->SetLineColor(kBlue);
1000 hMassPt->SetXTitle("M[GeV/c^{2}]");
1001 hMassPt->Draw();
1002
1003 return;
d486095a 1004}