1 /**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // AliAnalysisTaskSESignificane to calculate effects on
19 // significance of D mesons cut
20 // Authors: G. Ortona, ortona@to.infn.it
21 // F. Prino, prino@to.infn.it
22 // Renu Bala, bala@to.infn.it
23 // Chiara Bianchin, cbianchi@pd.infn.it
24 /////////////////////////////////////////////////////////////
26 #include <Riostream.h>
27 #include <TClonesArray.h>
33 #include <TDatabasePDG.h>
36 #include "AliAnalysisManager.h"
37 #include "AliAODHandler.h"
38 #include "AliAODEvent.h"
39 #include "AliAODVertex.h"
40 #include "AliAODTrack.h"
41 #include "AliAODMCHeader.h"
42 #include "AliAODMCParticle.h"
43 #include "AliAODRecoDecayHF3Prong.h"
44 #include "AliAODRecoDecayHF.h"
45 #include "AliAODRecoDecayHF2Prong.h"
46 #include "AliAODRecoDecayHF4Prong.h"
47 #include "AliAODRecoCascadeHF.h"
49 #include "AliAnalysisTaskSE.h"
50 #include "AliRDHFCutsDplustoKpipi.h"
51 #include "AliRDHFCutsD0toKpipipi.h"
52 #include "AliRDHFCutsDstoKKpi.h"
53 #include "AliRDHFCutsDStartoKpipi.h"
54 #include "AliRDHFCutsD0toKpi.h"
55 #include "AliRDHFCutsLctopKpi.h"
56 #include "AliMultiDimVector.h"
58 #include "AliAnalysisTaskSESignificance.h"
60 ClassImp(AliAnalysisTaskSESignificance)
63 //________________________________________________________________________
64 AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance():
80 // Default constructor
83 //________________________________________________________________________
84 AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance(const char *name, TList* listMDV,AliRDHFCuts *rdCuts,Int_t decaychannel,Int_t selectionlevel):
85 AliAnalysisTaskSE(name),
95 fDecChannel(decaychannel),
96 fSelectionlevel(selectionlevel),
123 SetMassLimits(0.15,pdg); //check range
124 fNPtBins=fRDCuts->GetNPtBins();
126 if(fDebug>1)fRDCuts->PrintAll();
127 // Output slot #1 writes into a TList container
128 DefineOutput(1,TList::Class()); //My private output
129 DefineOutput(2,TList::Class());
130 DefineOutput(3,AliRDHFCuts::Class()); //class of the cuts
134 //________________________________________________________________________
135 AliAnalysisTaskSESignificance::~AliAnalysisTaskSESignificance()
159 //_________________________________________________________________
160 Bool_t AliAnalysisTaskSESignificance::CheckConsistency(){
162 Bool_t result = kTRUE;
164 const Int_t nvars=fRDCuts->GetNVars();//ForOpt();
165 //Float_t *vars = new Float_t[nvars];
166 Bool_t *varsforopt = fRDCuts->GetVarsForOpt();
167 Bool_t *uppervars = fRDCuts->GetIsUpperCut();
168 TString *names = fRDCuts->GetVarNames();
170 for(Int_t i=0;i<fNPtBins;i++){
171 TString mdvname=Form("multiDimVectorPtBin%d",i);
174 for(Int_t ivar=0;ivar<nvars;ivar++){
175 if(varsforopt[ivar]){
176 Float_t min = ((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetMinLimit(ic);
177 Float_t max = ((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetMaxLimit(ic);
179 AliFatal(Form("tight and loose cut for optimization variable number %d are the same in ptbin %d\n",ic,i));
182 Bool_t lowermdv = ((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetGreaterThan(ic);
183 if(uppervars[ivar]&&lowermdv){
184 AliFatal(Form("%s is declared as uppercut, but as been given tighter cut larger then loose cut in ptbin %d \n ---please check your cuts \n ",names[ivar].Data(),i));
187 if(!uppervars[ivar]&&!lowermdv){
188 AliFatal(Form("%s is declared as lower cut, but as been given tighter cut smaller then loose cut in ptbin %d \n ---please check your cuts \n",names[ivar].Data(),i));
197 //_________________________________________________________________
198 void AliAnalysisTaskSESignificance::SetBFeedDown(FeedDownEnum flagB){
199 if(fReadMC)fBFeedDown=flagB;
201 AliInfo("B feed down not allowed without MC info\n");
205 //_________________________________________________________________
206 void AliAnalysisTaskSESignificance::SetMassLimits(Float_t range, Int_t pdg){
208 Int_t abspdg=TMath::Abs(pdg);
209 mass=TDatabasePDG::Instance()->GetParticle(abspdg)->Mass();
210 fUpmasslimit = mass+range;
211 fLowmasslimit = mass-range;
213 //_________________________________________________________________
214 void AliAnalysisTaskSESignificance::SetMassLimits(Float_t lowlimit, Float_t uplimit){
217 fUpmasslimit = uplimit;
218 fLowmasslimit = lowlimit;
224 //________________________________________________________________________
225 void AliAnalysisTaskSESignificance::LocalInit()
229 if(fDebug > 1) printf("AnalysisTaskSESignificance::Init() \n");
234 AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fRDCuts)));
241 AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fRDCuts)));
248 AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fRDCuts)));
255 AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fRDCuts)));
262 AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fRDCuts)));
269 AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fRDCuts)));
279 TList *mdvList = new TList();
287 //________________________________________________________________________
288 void AliAnalysisTaskSESignificance::UserCreateOutputObjects()
290 // Create the output container
292 if(fDebug > 1) printf("AnalysisTaskSESignificance::UserCreateOutputObjects() \n");
294 // Several histograms are more conveniently managed in a TList
295 fOutput = new TList();
297 fOutput->SetName("OutputHistos");
299 //same number of steps in each multiDimVectorPtBin%d !
300 Int_t nHist=((AliMultiDimVector*)fCutList->FindObject("multiDimVectorPtBin0"))->GetNTotCells();
301 cout<<"ncells = "<<nHist<<" n ptbins = "<<fNPtBins<<endl;
302 nHist=nHist*fNPtBins;
303 cout<<"Total = "<<nHist<<endl;
304 for(Int_t i=0;i<nHist;i++){
312 hisname.Form("hMass_%d",i);
313 signame.Form("hSig_%d",i);
314 bkgname.Form("hBkg_%d",i);
315 rflname.Form("hRfl_%d",i);
317 title.Form("Invariant mass;M[GeV/c^{2}];Entries");
319 fMassHist[i]=new TH1F(hisname.Data(),title.Data(),fNBins,fLowmasslimit,fUpmasslimit);
320 fMassHist[i]->Sumw2();
321 fOutput->Add(fMassHist[i]);
324 fSigHist[i]=new TH1F(signame.Data(),title.Data(),fNBins,fLowmasslimit,fUpmasslimit);
325 fSigHist[i]->Sumw2();
326 fOutput->Add(fSigHist[i]);
328 fBkgHist[i]=new TH1F(bkgname.Data(),title.Data(),fNBins,fLowmasslimit,fUpmasslimit);
329 fBkgHist[i]->Sumw2();
330 fOutput->Add(fBkgHist[i]);
332 if(fDecChannel != AliAnalysisTaskSESignificance::kDplustoKpipi){
333 fRflHist[i]=new TH1F(rflname.Data(),title.Data(),fNBins,fLowmasslimit,fUpmasslimit);
334 fRflHist[i]->Sumw2();
335 fOutput->Add(fRflHist[i]);
340 fHistNEvents=new TH1F("fHistNEvents","Number of AODs scanned",8,-0.5,7.5);
341 fHistNEvents->GetXaxis()->SetBinLabel(1,"nEventsAnal");
342 fHistNEvents->GetXaxis()->SetBinLabel(2,"nEvSelected (vtx)");
343 fHistNEvents->GetXaxis()->SetBinLabel(3,"nCandidatesSelected");
344 fHistNEvents->GetXaxis()->SetBinLabel(4,"nTotEntries Mass hists");
345 fHistNEvents->GetXaxis()->SetBinLabel(5,"Pile-up Rej");
346 fHistNEvents->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
348 fHistNEvents->GetXaxis()->SetBinLabel(7,"MC Cand from c");
349 fHistNEvents->GetXaxis()->SetBinLabel(8,"MC Cand from b");
351 fHistNEvents->GetXaxis()->SetBinLabel(7,"N candidates");
353 fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
354 fOutput->Add(fHistNEvents);
360 //________________________________________________________________________
361 void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
363 // Execute analysis for current event:
364 // heavy flavor candidates association to MC truth
366 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
367 if(fDebug>2) printf("Analysing decay %d\n",fDecChannel);
368 // Post the data already here
370 TClonesArray *arrayProng =0;
372 if(!aod && AODEvent() && IsStandardAOD()) {
373 // In case there is an AOD handler writing a standard AOD, use the AOD
374 // event in memory rather than the input (ESD) event.
375 aod = dynamic_cast<AliAODEvent*> (AODEvent());
376 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
377 // have to taken from the AOD event hold by the AliAODExtension
378 AliAODHandler* aodHandler = (AliAODHandler*)
379 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
380 if(aodHandler->GetExtensions()) {
382 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
383 AliAODEvent *aodFromExt = ext->GetAOD();
388 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
391 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
394 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
397 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
400 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
403 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
410 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
413 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
416 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
419 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
422 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
425 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
429 if(!aod || !arrayProng) {
430 AliError("AliAnalysisTaskSESignificance::UserExec:Branch not found!\n");
434 // fix for temporary bug in ESDfilter
435 // the AODs with null vertex pointer didn't pass the PhysSel
436 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
437 TClonesArray *arrayMC=0;
438 AliAODMCHeader *mcHeader=0;
443 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
445 AliError("AliAnalysisTaskSESignificance::UserExec:MC particles branch not found!\n");
450 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
452 AliError("AliAnalysisTaskSESignificance::UserExec:MC header branch not found!\n");
457 fHistNEvents->Fill(0); // count event
459 AliAODRecoDecayHF *d=0;
461 Int_t *pdgdaughters=0x0;
468 pdgdaughters =new Int_t[3];
469 pdgdaughters[0]=211;//pi
470 pdgdaughters[1]=321;//K
471 pdgdaughters[2]=211;//pi
477 pdgdaughters =new Int_t[2];
478 pdgdaughters[0]=211;//pi
479 pdgdaughters[1]=321;//K
485 pdgdaughters =new Int_t[3];
486 pdgdaughters[1]=211;//pi
487 pdgdaughters[0]=321;//K
488 pdgdaughters[2]=211;//pi (soft?)
494 pdgdaughters =new Int_t[3];
495 pdgdaughters[0]=321;//K
496 pdgdaughters[1]=321;//K
497 pdgdaughters[2]=211;//pi
503 pdgdaughters =new Int_t[4];
513 pdgdaughters =new Int_t[3];
514 pdgdaughters[0]=2212;//p
515 pdgdaughters[1]=321;//K
516 pdgdaughters[2]=211;//pi
522 Int_t nHistpermv=((AliMultiDimVector*)fCutList->FindObject("multiDimVectorPtBin0"))->GetNTotCells();
523 Int_t nProng = arrayProng->GetEntriesFast();
524 if(fDebug>1) printf("Number of D2H: %d\n",nProng);
526 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
527 TString trigclass=aod->GetFiredTriggerClasses();
528 if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fHistNEvents->Fill(5);
530 if(fRDCuts->IsEventSelected(aod)) fHistNEvents->Fill(1);
532 if(fRDCuts->GetWhyRejection()==1) // rejected for pileup
533 fHistNEvents->Fill(4);
537 for (Int_t iProng = 0; iProng < nProng; iProng++) {
538 fHistNEvents->Fill(6);
539 d=(AliAODRecoDecayHF*)arrayProng->UncheckedAt(iProng);
541 Bool_t isFidAcc = fRDCuts->IsInFiducialAcceptance(d->Pt(),d->Y(absPdgMom));
542 Int_t isSelected=fRDCuts->IsSelected(d,fSelectionlevel,aod);
544 if(fReadMC && fBFeedDown!=kBoth && isSelected){
545 Int_t labD = d->MatchToMC(absPdgMom,arrayMC,nprongs,pdgdaughters);
547 AliAODMCParticle *partD = (AliAODMCParticle*)arrayMC->At(labD);
548 Int_t label=partD->GetMother();
549 AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(label);
550 while(label>=0){//get first mother
551 mot = (AliAODMCParticle*)arrayMC->At(label);
552 label=mot->GetMother();
554 Int_t pdgMotCode = mot->GetPdgCode();
556 if(TMath::Abs(pdgMotCode)<=4){
557 fHistNEvents->Fill(6);
558 if(fBFeedDown==kBeautyOnly)isSelected=kFALSE; //from primary charm
560 fHistNEvents->Fill(7);
561 if(fBFeedDown==kCharmOnly) isSelected=kFALSE; //from beauty
568 if(isSelected&&isFidAcc) {
569 fHistNEvents->Fill(2); // count selected with loosest cuts
570 if(fDebug>1) printf("+++++++Is Selected\n");
572 Double_t* invMass=0x0;
574 CalculateInvMasses(d,invMass,nmasses);
576 const Int_t nvars=fRDCuts->GetNVarsForOpt();
577 Float_t *vars = new Float_t[nvars];
580 fRDCuts->GetCutVarsForOpt(d,vars,nvars,pdgdaughters);
581 Int_t ptbin=fRDCuts->PtBin(d->Pt());
582 if(ptbin==-1) continue;
583 TString mdvname=Form("multiDimVectorPtBin%d",ptbin);
584 ULong64_t *addresses = ((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetGlobalAddressesAboveCuts(vars,(Float_t)d->Pt(),nVals);
585 if(fDebug>1)printf("nvals = %d\n",nVals);
586 for(Int_t ivals=0;ivals<nVals;ivals++){
587 if(addresses[ivals]>=((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetNTotCells()){
588 if (fDebug>1) printf("Overflow!!\n");
593 fHistNEvents->Fill(3);
595 //fill the histograms with the appropriate method
596 switch (fDecChannel){
598 FillDplus(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
601 FillD02p(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
604 FillDstar(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
607 FillDs(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
610 FillD04p(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
613 FillLambdac(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),invMass,isSelected);
625 if(pdgdaughters) {delete [] pdgdaughters; pdgdaughters=NULL;}
631 //***************************************************************************
633 // Methods used in the UserExec
635 void AliAnalysisTaskSESignificance::CalculateInvMasses(AliAODRecoDecayHF* d,Double_t*& masses,Int_t& nmasses){
636 //Calculates all the possible invariant masses for each candidate
637 //NB: the implementation for each candidate is responsibility of the corresponding developer
641 //D+ -- Giacomo, Renu ?
644 masses=new Double_t[nmasses];
645 Int_t pdgdaughters[3] = {211,321,211};
646 masses[0]=d->InvMass(3,(UInt_t*)pdgdaughters);
654 masses=new Double_t[nmasses];
655 Int_t pdgdaughtersD0[ndght]={211,321};//pi,K
656 masses[0]=d->InvMass(ndght,(UInt_t*)pdgdaughtersD0); //D0
657 Int_t pdgdaughtersD0bar[ndght]={321,211};//K,pi
658 masses[1]=d->InvMass(ndght,(UInt_t*)pdgdaughtersD0bar); //D0bar
662 //D* -- ? Yifei, Alessandro
668 //Ds -- Sergey, Sahdana
672 masses=new Double_t[nmasses];
673 Int_t pdgdaughtersDsKKpi[ndght]={321,321,211};//K,K,pi
674 masses[0]=d->InvMass(ndght,(UInt_t*)pdgdaughtersDsKKpi); //Ds
675 Int_t pdgdaughtersDspiKK[ndght]={211,321,321};//pi,K,K
676 masses[1]=d->InvMass(ndght,(UInt_t*)pdgdaughtersDspiKK); //Dsbar
682 //D0 (Kpipipi) -- ? Rossella, Fabio ???
688 //Lambda_c -- Rossella
698 //********************************************************************************************
700 //Methods to fill the istograms with MC information, one for each candidate
701 //NB: the implementation for each candidate is responsibility of the corresponding developer
703 void AliAnalysisTaskSESignificance::FillDplus(AliAODRecoDecayHF* d,TClonesArray *arrayMC,Int_t index,Double_t* masses,Int_t isSel){
706 AliError("Candidate not selected\n");
710 if(fPartOrAndAntiPart*d->GetCharge()<0)return;
712 fMassHist[index]->Fill(masses[0]);
714 Int_t pdgdaughters[3] = {211,321,211};
718 lab = d->MatchToMC(411,arrayMC,3,pdgdaughters);
720 fSigHist[index]->Fill(masses[0]);
722 fBkgHist[index]->Fill(masses[0]);
728 void AliAnalysisTaskSESignificance::FillD02p(AliAODRecoDecayHF* d,TClonesArray *arrayMC,Int_t index,Double_t* masses,Int_t isSel){
734 AliError("Masses not calculated\n");
737 if((isSel==1 || isSel==3) && fPartOrAndAntiPart>=0) fMassHist[index]->Fill(masses[0]);
738 if(isSel>=2 && fPartOrAndAntiPart<=0) fMassHist[index]->Fill(masses[1]);
748 Int_t pdgdaughters[2];
749 pdgdaughters[0]=211;//pi
750 pdgdaughters[1]=321;//K
754 matchtoMC = d->MatchToMC(absPdgMom,arrayMC,nprongs,pdgdaughters);
756 Int_t prongPdgPlus=421,prongPdgMinus=(-1)*421;
757 if((isSel==1 || isSel==3) && fPartOrAndAntiPart>=0){ //D0
759 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
760 Int_t pdgMC = dMC->GetPdgCode();
762 if(pdgMC==prongPdgPlus) fSigHist[index]->Fill(masses[0]);
763 else fRflHist[index]->Fill(masses[0]);
765 } else fBkgHist[index]->Fill(masses[0]);
768 if(isSel>=2 && fPartOrAndAntiPart<=0){ //D0bar
770 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
771 Int_t pdgMC = dMC->GetPdgCode();
773 if(pdgMC==prongPdgMinus) fSigHist[index]->Fill(masses[1]);
774 else fRflHist[index]->Fill(masses[1]);
775 } else fBkgHist[index]->Fill(masses[1]);
780 void AliAnalysisTaskSESignificance::FillDstar(AliAODRecoDecayHF* /*d*/,TClonesArray */*arrayMC*/,Int_t /*index*/,Double_t* /*masses*/,Int_t /*matchtoMC*/){
783 AliInfo("Dstar channel not implemented\n");
788 void AliAnalysisTaskSESignificance::FillDs(AliAODRecoDecayHF* d,TClonesArray *arrayMC,Int_t index,Double_t* masses,Int_t isSel){
790 //AliInfo("Ds channel not implemented\n");
794 AliError("Masses not calculated\n");
798 Int_t pdgDstoKKpi[3]={321,321,211};
801 labDs = d->MatchToMC(431,arrayMC,3,pdgDstoKKpi);
805 if(isSel&1 && fPartOrAndAntiPart*d->GetCharge()>=0) {
807 fMassHist[index]->Fill(masses[0]);
812 Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
813 AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(labDau0);
814 Int_t pdgCode0=TMath::Abs(p->GetPdgCode());
818 fSigHist[index]->Fill(masses[0]); //signal
820 fRflHist[index]->Fill(masses[0]); //Reflected signal
823 fBkgHist[index]->Fill(masses[0]); // Background
828 if(isSel&2 && fPartOrAndAntiPart*d->GetCharge()>=0){
829 fMassHist[index]->Fill(masses[1]);
832 Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
833 AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(labDau0);
834 Int_t pdgCode0=TMath::Abs(p->GetPdgCode());
838 fSigHist[index]->Fill(masses[1]);
840 fRflHist[index]->Fill(masses[1]);
843 fBkgHist[index]->Fill(masses[1]);
852 void AliAnalysisTaskSESignificance::FillD04p(AliAODRecoDecayHF* /*d*/,TClonesArray */*arrayMC*/,Int_t /*index*/,Double_t* /*masses*/,Int_t /*matchtoMC*/){
853 //D0->Kpipipi channel
854 AliInfo("D0 in 4 prongs channel not implemented\n");
858 void AliAnalysisTaskSESignificance::FillLambdac(AliAODRecoDecayHF* /*d*/,TClonesArray */*arrayMC*/,Int_t /*index*/,Double_t* /*masses*/,Int_t /*matchtoMC*/){
859 AliInfo("Lambdac channel not implemented\n");
866 //________________________________________________________________________
867 void AliAnalysisTaskSESignificance::Terminate(Option_t */*option*/)
869 // Terminate analysis
871 if(fDebug > 1) printf("AnalysisTaskSESignificance: Terminate() \n");
874 fOutput = dynamic_cast<TList*> (GetOutputData(1));
876 printf("ERROR: fOutput not available\n");
880 fCutList = dynamic_cast<TList*> (GetOutputData(2));
882 printf("ERROR: fCutList not available\n");
886 AliMultiDimVector* mdvtmp=(AliMultiDimVector*)fCutList->FindObject("multiDimVectorPtBin0");
888 cout<<"multidimvec not found in TList"<<endl;
892 Int_t nHist=mdvtmp->GetNTotCells();
893 TCanvas *c1=new TCanvas("c1","Invariant mass distribution - loose cuts",500,500);
895 for(Int_t i=0;i<nHist;i++){
902 hisname.Form("hMass_%d",i);
903 signame.Form("hSig_%d",i);
904 bkgname.Form("hBkg_%d",i);
905 rflname.Form("hRfl_%d",i);
907 fMassHist[i]=dynamic_cast<TH1F*>(fOutput->FindObject(hisname.Data()));
909 if (!drawn && fMassHist[i]->GetEntries() > 0){
911 fMassHist[i]->Draw();
916 fSigHist[i]=dynamic_cast<TH1F*>(fOutput->FindObject(signame.Data()));
917 fBkgHist[i]=dynamic_cast<TH1F*>(fOutput->FindObject(bkgname.Data()));
918 if(fDecChannel != AliAnalysisTaskSESignificance::kDplustoKpipi) fRflHist[i]=dynamic_cast<TH1F*>(fOutput->FindObject(rflname.Data()));
928 //-------------------------------------------