From: dainese Date: Tue, 3 Nov 2009 21:52:13 +0000 (+0000) Subject: Changes to run also without reading the MC (Chiara B) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=ce39f0ace426b17e5ffd3000279ed40c6741d2f6;p=u%2Fmrichter%2FAliRoot.git Changes to run also without reading the MC (Chiara B) --- diff --git a/PWG3/vertexingHF/AddTaskD0Mass.C b/PWG3/vertexingHF/AddTaskD0Mass.C index feb72976591..1e5526933cc 100644 --- a/PWG3/vertexingHF/AddTaskD0Mass.C +++ b/PWG3/vertexingHF/AddTaskD0Mass.C @@ -1,4 +1,4 @@ -AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/) +AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kTRUE) { // // AddTask for the AliAnalysisTaskSE for D0 candidates @@ -37,6 +37,7 @@ AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/) AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass("D0MassAndDistrAnalysis"); massD0Task->SetDebugLevel(0); massD0Task->SetArray(flag); + massD0Task->SetReadMC(readMC); mgr->AddTask(massD0Task); // diff --git a/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx b/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx index 532040ee566..04e2b832c3b 100644 --- a/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx +++ b/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx @@ -58,6 +58,7 @@ fNentries(0), fVHFPPR(0), fVHFloose(0), fArray(0), +fReadMC(0), fLsNormalization(1.) { @@ -75,6 +76,7 @@ fNentries(0), fVHFPPR(0), fVHFloose(0), fArray(0), +fReadMC(0), fLsNormalization(1.) { // Default constructor @@ -344,20 +346,23 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) 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; - } + TClonesArray *mcArray = 0; + AliAODMCHeader *mcHeader = 0; + + if(fReadMC) { + // load MC particles + 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; + // load MC header + mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); + if(!mcHeader) { + printf("AliAnalysisTaskSED0Mass::UserExec: MC header branch not found!\n"); + return; + } } //printf("VERTEX Z %f %f\n",vtx1->GetZ(),mcHeader->GetVtxZ()); @@ -397,73 +402,75 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) pdgs[0]=321; Double_t minvD0bar = d->InvMassD0bar(); //apply cut on invariant mass on the pair - if(TMath::Abs(minvD0-mPDG)<0.03 || TMath::Abs(minvD0bar-mPDG)<0.03){ - //cout<<"inside mass cut"<MatchToMC(421,mcArray,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) - - if(lab>=0){ //signal - if(fArray==1) cout<<"LS signal: ERROR"<GetDaughter(iprong); - Int_t labprong=prong->GetLabel(); - - //cout<<"prong name = "<GetName()<<" label = "<GetLabel()<=0) mcprong= (AliAODMCParticle*)mcArray->At(labprong); - Int_t pdgprong=mcprong->GetPdgCode(); - if(TMath::Abs(pdgprong)==211) { - //cout<<"pi"<FindObject("hptpiS"))->Fill(d->PtProng(iprong)); - ((TH1F*)fDistr->FindObject("hd0piS"))->Fill(d->Getd0Prong(iprong)); - } - - if(TMath::Abs(pdgprong)==321) { - //cout<<"kappa"<FindObject("hptKS"))->Fill(d->PtProng(iprong)); - ((TH1F*)fDistr->FindObject("hd0KS"))->Fill(d->Getd0Prong(iprong)); - } - ((TH1F*)fDistr->FindObject("hdcaS"))->Fill(d->GetDCA()); - - } - - if (((AliAODMCParticle*)mcArray->At(lab))->GetPdgCode() == 421) - ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0()); - else ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0bar()); - - ((TH1F*)fDistr->FindObject("hd0d0S"))->Fill(d->Prodd0d0()); - - ((TH1F*)fDistr->FindObject("hcosthetapointS"))->Fill(d->CosPointingAngle()); - ((TH1F*)fDistr->FindObject("hcosthpointd0d0S"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); - - //cout<<"ok point"<MatchToMC(421,mcArray,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) + + if(lab>=0){ //signal + if(fArray==1) cout<<"LS signal: ERROR"<GetDaughter(iprong); + Int_t labprong=prong->GetLabel(); + + //cout<<"prong name = "<GetName()<<" label = "<GetLabel()<=0) mcprong= (AliAODMCParticle*)mcArray->At(labprong); + Int_t pdgprong=mcprong->GetPdgCode(); + if(TMath::Abs(pdgprong)==211) { + //cout<<"pi"<FindObject("hptpiS"))->Fill(d->PtProng(iprong)); + ((TH1F*)fDistr->FindObject("hd0piS"))->Fill(d->Getd0Prong(iprong)); + } + + if(TMath::Abs(pdgprong)==321) { + //cout<<"kappa"<FindObject("hptKS"))->Fill(d->PtProng(iprong)); + ((TH1F*)fDistr->FindObject("hd0KS"))->Fill(d->Getd0Prong(iprong)); + } + ((TH1F*)fDistr->FindObject("hdcaS"))->Fill(d->GetDCA()); + + } + + if (((AliAODMCParticle*)mcArray->At(lab))->GetPdgCode() == 421) + ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0()); + else ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0bar()); + + ((TH1F*)fDistr->FindObject("hd0d0S"))->Fill(d->Prodd0d0()); + + ((TH1F*)fDistr->FindObject("hcosthetapointS"))->Fill(d->CosPointingAngle()); + ((TH1F*)fDistr->FindObject("hcosthpointd0d0S"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); + + //cout<<"ok point"<GetDaughter(0); - if(!prong) cout<<"No daughter found"; - else{ - if(prong->Charge()==1) {fTotPosPairs[4]++;} else {fTotNegPairs[4]++;} - } - ((TH1F*)fDistr->FindObject("hptB"))->Fill(d->PtProng(0)); - //cout<<"ptok"<FindObject("hd0B"))->Fill(d->Getd0Prong(0)); - //cout<<"d0ok"<FindObject("hdcaB"))->Fill(d->GetDCA()); - //cout<<"dcaok"<FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0()); - ((TH1F*)fDistr->FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0bar()); - ((TH1F*)fDistr->FindObject("hd0d0B"))->Fill(d->Prodd0d0()); - //cout<<"d0d0ok"<FindObject("hcosthetapointB"))->Fill(d->CosPointingAngle()); - ((TH1F*)fDistr->FindObject("hcosthpointd0d0B"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); - - //cout<<"pointok"<GetDaughter(0); + if(!prong) cout<<"No daughter found"; + else{ + if(prong->Charge()==1) {fTotPosPairs[4]++;} else {fTotNegPairs[4]++;} + } + ((TH1F*)fDistr->FindObject("hptB"))->Fill(d->PtProng(0)); + //cout<<"ptok"<FindObject("hd0B"))->Fill(d->Getd0Prong(0)); + //cout<<"d0ok"<FindObject("hdcaB"))->Fill(d->GetDCA()); + //cout<<"dcaok"<FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0()); + ((TH1F*)fDistr->FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0bar()); + ((TH1F*)fDistr->FindObject("hd0d0B"))->Fill(d->Prodd0d0()); + //cout<<"d0d0ok"<FindObject("hcosthetapointB"))->Fill(d->CosPointingAngle()); + ((TH1F*)fDistr->FindObject("hcosthpointd0d0B"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); + + //cout<<"pointok"<MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) + Int_t labD0=-1; + if (fReadMC) labD0 = part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) //count candidates selected by cuts fNentries->Fill(2); diff --git a/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.h b/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.h index f289de2d7ac..7e75411d6a2 100644 --- a/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.h +++ b/PWG3/vertexingHF/AliAnalysisTaskSED0Mass.h @@ -38,9 +38,10 @@ class AliAnalysisTaskSED0Mass : public AliAnalysisTaskSE virtual void Terminate(Option_t *option); void SetArray(Int_t type=AliAnalysisTaskSED0Mass::kD0){fArray=type;} - enum{kD0,kLS}; - + + void SetReadMC(Bool_t readMC=kFALSE){fReadMC=readMC;} + private: AliAnalysisTaskSED0Mass(const AliAnalysisTaskSED0Mass &source); @@ -53,6 +54,7 @@ class AliAnalysisTaskSED0Mass : public AliAnalysisTaskSE AliAnalysisVertexingHF *fVHFPPR; // Vertexer heavy flavour (used to pass the cuts) AliAnalysisVertexingHF *fVHFloose; // Vertexer heavy flavour (used to pass the cuts) Int_t fArray; // can be D0 or Like Sign candidates + Bool_t fReadMC; // flag for MC array: kTRUE = read it, kFALSE = do not read it Int_t fTotPosPairs[5]; // Int_t fTotNegPairs[5]; //