/************************************************************************** * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ ///////////////////////////////////////////////////////////// // // AliAnalysisTaskSE for D0 candidates invariant mass histogram // and comparison with the MC truth. // // Authors: A.Dainese, andrea.dainese@lnl.infn.it // and Chiara Bianchin, chiara.bianchin@pd.infn.it ///////////////////////////////////////////////////////////// #include #include #include #include #include #include "AliAODEvent.h" #include "AliAODVertex.h" #include "AliAODTrack.h" #include "AliAODMCHeader.h" #include "AliAODMCParticle.h" #include "AliAODRecoDecayHF2Prong.h" #include "AliAODRecoCascadeHF.h" #include "AliAnalysisVertexingHF.h" #include "AliAnalysisTaskSE.h" #include "AliAnalysisTaskSED0Mass.h" ClassImp(AliAnalysisTaskSED0Mass) //________________________________________________________________________ AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(): AliAnalysisTaskSE(), fOutputtight(0), fOutputloose(0), fVHFtight(0), fVHFloose(0), fNentries(0) { // Default constructor } //________________________________________________________________________ AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(const char *name): AliAnalysisTaskSE(name), fOutputtight(0), fOutputloose(0), fVHFtight(0), fVHFloose(0), fNentries(0) { // Default constructor // Output slot #1 writes into a TList container DefineOutput(1,TList::Class()); //My private output // Output slot #2 writes into a TList container DefineOutput(2,TList::Class()); //My private output // Output slot #3 writes into a TH1F container DefineOutput(3,TH1F::Class()); //My private output } //________________________________________________________________________ AliAnalysisTaskSED0Mass::~AliAnalysisTaskSED0Mass() { if (fOutputtight) { delete fOutputtight; fOutputtight = 0; } if (fVHFtight) { delete fVHFtight; fVHFtight = 0; } if (fOutputloose) { delete fOutputloose; fOutputloose = 0; } if (fVHFloose) { delete fVHFloose; fVHFloose = 0; } if (fNentries){ delete fNentries; fNentries = 0; } } //________________________________________________________________________ void AliAnalysisTaskSED0Mass::Init() { // Initialization if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n"); gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C"); // 2 sets of dedidcated cuts -- defined in UserExec fVHFtight = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); fVHFloose = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); return; } //________________________________________________________________________ void AliAnalysisTaskSED0Mass::UserCreateOutputObjects() { // Create the output container // if(fDebug > 1) printf("AnalysisTaskSED0Mass::UserCreateOutputObjects() \n"); // Several histograms are more conveniently managed in a TList fOutputtight = new TList(); fOutputtight->SetOwner(); fOutputtight->SetName("listtight"); fOutputloose = new TList(); fOutputloose->SetOwner(); fOutputloose->SetName("listloose"); const Int_t nhist=4; TString nameMass=" ", nameSgn=" ", nameBkg=" ", nameRfl=" "; for(Int_t i=0;iClone(); tmpMt->Sumw2(); tmpMl->Sumw2(); TH1F* tmpSt = new TH1F(nameSgn.Data(), "D^{0} invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); TH1F *tmpSl=(TH1F*)tmpSt->Clone(); tmpSt->Sumw2(); tmpSl->Sumw2(); TH1F* tmpBt = new TH1F(nameBkg.Data(), "Background invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); TH1F *tmpBl=(TH1F*)tmpBt->Clone(); tmpBt->Sumw2(); tmpBl->Sumw2(); //Reflection: histo filled with D0 which pass the cut (also) as D0bar and with D0bar which pass (also) the cut as D0 TH1F* tmpRt = new TH1F(nameRfl.Data(), "Reflected signal invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); TH1F *tmpRl=(TH1F*)tmpRt->Clone(); tmpRt->Sumw2(); tmpRl->Sumw2(); // printf("Created histograms %s\t%s\t%s\t%s\n",tmpM->GetName(),tmpS->GetName(),tmpB->GetName(),tmpR->GetName()); fOutputtight->Add(tmpMt); fOutputtight->Add(tmpSt); fOutputtight->Add(tmpBt); fOutputtight->Add(tmpRt); fOutputloose->Add(tmpMl); fOutputloose->Add(tmpSl); fOutputloose->Add(tmpBl); fOutputloose->Add(tmpRl); } //fOutputloose->ls(); //fOutputtight->ls(); fNentries=new TH1F("nentries", "Look at the number of entries! = number of AODs", 2,1.,2.); return; } //________________________________________________________________________ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) { // Execute analysis for current event: // heavy flavor candidates association to MC truth //cout<<"I'm in UserExec"< (InputEvent()); // load D0->Kpi candidates TClonesArray *inputArrayD0toKpi = (TClonesArray*)aod->GetList()->FindObject("D0toKpi"); if(!inputArrayD0toKpi) { printf("AliAnalysisTaskSECompareHFpt::UserExec: D0toKpi branch not found!\n"); return; } // AOD primary vertex AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); //vtx1->Print(); // load MC particles TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); if(!mcArray) { printf("AliAnalysisTaskSED0Mass::UserExec: MC particles branch not found!\n"); return; } // load MC header AliAODMCHeader *mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); if(!mcHeader) { printf("AliAnalysisTaskSED0Mass::UserExec: MC header branch not found!\n"); return; } //histogram filled with 1 for every AOD fNentries->Fill(1); PostData(3,fNentries); // loop over D0->Kpi candidates Int_t nInD0toKpi = inputArrayD0toKpi->GetEntriesFast(); if(fDebug>1) printf("Number of D0->Kpi: %d\n",nInD0toKpi); for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) { AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArrayD0toKpi->UncheckedAt(iD0toKpi); Bool_t unsetvtx=kFALSE; if(!d->GetOwnPrimaryVtx()) { d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables unsetvtx=kTRUE; } //cuts order // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]); // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]); // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]); // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]); // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]); // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]); // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]); // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]); // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]); Double_t pt = d->Pt(); Int_t ptbin=0; //cout<<"P_t = "<0. && pt<=1.) { ptbin=1; fVHFtight->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.0003,0.7); fVHFloose->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.00025,0.7); // fVHFtight->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.0002,0.7); // fVHFloose->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,1,1,-0.00015,0.5); //printf("I'm in the bin %d\n",ptbin); } if(pt>1. && pt<=3.) { ptbin=2; fVHFtight->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.0003,0.9); fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,1,1,-0.00025,0.8); //printf("I'm in the bin %d\n",ptbin); } if(pt>3. && pt<=5.){ ptbin=3; fVHFtight->SetD0toKpiCuts(0.7,0.015,0.8,0.7,0.7,0.05,0.05,-0.0002,0.9); fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.8); //printf("I'm in the bin %d\n",ptbin); } if(pt>5.){ ptbin=4; fVHFtight->SetD0toKpiCuts(0.7,0.015,0.8,0.7,0.7,0.05,0.05,-0.0002,0.95); fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.9); }//if(pt>5) //printf("I'm in the bin %d\n",ptbin); //old //fVHF->SetD0toKpiCuts(0.7,0.03,0.8,0.06,0.06,0.05,0.05,-0.0002,0.6); //2.p-p vertex reconstructed FillHists(ptbin,d,mcArray,fVHFtight,fOutputtight); FillHists(ptbin,d,mcArray,fVHFloose,fOutputloose); if(unsetvtx) d->UnsetOwnPrimaryVtx(); } // Post the data PostData(1,fOutputtight); PostData(2,fOutputloose); return; } //____________________________________________________________________________* void AliAnalysisTaskSED0Mass::FillHists(Int_t ptbin, AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliAnalysisVertexingHF *vhf, TList *listout){ // // function used in UserExec: // Int_t okD0=0,okD0bar=0; if(part->SelectD0(vhf->GetD0toKpiCuts(),okD0,okD0bar)) {//selected Double_t invmassD0 = part->InvMassD0(), invmassD0bar = part->InvMassD0bar(); //printf("SELECTED\n"); Int_t pdgDgD0toKpi[2]={321,211}; Int_t labD0 = part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) //printf("labD0 %d",labD0); TString fillthis=""; if (okD0==1) { fillthis="histMass_"; fillthis+=ptbin; //cout<<"Filling "<FindObject(fillthis)))->Fill(invmassD0); if(labD0>=0) { AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); Int_t pdgD0 = partD0->GetPdgCode(); //cout<<"pdg = "<FindObject(fillthis)))->Fill(invmassD0); } else{ //it was a D0bar fillthis="histRfl_"; fillthis+=ptbin; ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); } } else {//background fillthis="histBkg_"; fillthis+=ptbin; ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); } } if (okD0bar==1) { fillthis="histMass_"; fillthis+=ptbin; //printf("Fill mass with D0bar"); ((TH1F*)listout->FindObject(fillthis))->Fill(invmassD0bar); if(labD0>=0) { AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); Int_t pdgD0 = partD0->GetPdgCode(); //cout<<" pdg = "<FindObject(fillthis)))->Fill(invmassD0bar); } else{ fillthis="histRfl_"; fillthis+=ptbin; ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); } } else {//background fillthis="histBkg_"; fillthis+=ptbin; ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); } } } //else cout<<"NOT SELECTED"< 1) printf("AnalysisTaskSED0Mass: Terminate() \n"); fOutputtight = dynamic_cast (GetOutputData(1)); if (!fOutputtight) { printf("ERROR: fOutput not available\n"); return; } fOutputloose = dynamic_cast (GetOutputData(2)); if (!fOutputloose) { printf("ERROR: fOutput not available\n"); return; } return; }