X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWG3%2Fhfe%2FAliHFEelecbackground.cxx;h=20fa73367249bc6d5962a3485d55ddcea345190f;hb=215ffe88eb06606e7086309bfe8887ae3e6eff1d;hp=a6d887b82c79d3b75fe7b54ca86a1ec716864721;hpb=d0dc749f924c15e2dbb59c82ae66cfe687007906;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWG3/hfe/AliHFEelecbackground.cxx b/PWG3/hfe/AliHFEelecbackground.cxx index a6d887b82c7..20fa7336724 100644 --- a/PWG3/hfe/AliHFEelecbackground.cxx +++ b/PWG3/hfe/AliHFEelecbackground.cxx @@ -12,6 +12,9 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ + +/* $Id$ */ + // // // First implementation of a class @@ -52,6 +55,7 @@ #include "AliCFContainer.h" #include "AliHFEpid.h" #include "AliESDpid.h" +#include "AliLog.h" #include "AliITSPIDResponse.h" #include "AliTPCPIDResponse.h" @@ -62,7 +66,10 @@ const Double_t AliHFEelecbackground::fgkMe = 0.00051099892; //___________________________________________________________________________________________ AliHFEelecbackground::AliHFEelecbackground(): - fESD1(0x0) + fhtmp(0x0) + ,fhtmpf(0x0) + ,fhtmpp(0x0) + ,fESD1(0x0) ,fAOD1(0x0) ,fMCEvent(0x0) ,fBz(0) @@ -98,12 +105,18 @@ AliHFEelecbackground::AliHFEelecbackground(): // // Default constructor // + for(Int_t k =0; k < 10; k++) { + fCuts[k] = kFALSE; + } } //_______________________________________________________________________________________________ AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p): TObject(p) + ,fhtmp(0x0) + ,fhtmpf(0x0) + ,fhtmpp(0x0) ,fESD1(0x0) ,fAOD1(0x0) ,fMCEvent(0x0) @@ -140,6 +153,9 @@ AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p): // // Copy constructor // + for(Int_t k =0; k < 10; k++) { + fCuts[k] = kFALSE; + } } //_______________________________________________________________________________________________ @@ -163,15 +179,17 @@ AliHFEelecbackground::~AliHFEelecbackground() if(fPIDMethodPartner) delete fPIDMethodPartner; if(fPIDMethodPartnerITS) delete fPIDMethodPartnerITS; - if(fList){ - fList->Clear(); - delete fList; - } - if(fListPostProcess){ - fListPostProcess->Clear(); + fListPostProcess->SetOwner(kTRUE); delete fListPostProcess; } + +/* + if(fhtmp) delete fhtmp; + if(fhtmpf) delete fhtmpf; + if(fhtmpp) delete fhtmpp; +*/ + } //___________________________________________________________________________________________ Bool_t AliHFEelecbackground::Load(const Char_t * filename) @@ -243,43 +261,43 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) // bins ///////// - Int_t nBinsPt = 25; + const Int_t nBinsPt = 25; Double_t minPt = 0.01; Double_t maxPt = 10.0; - Int_t nBinsPtMore = 100; + const Int_t nBinsPtMore = 100; Double_t minPtMore = 0.01; Double_t maxPtMore = 10.0; - Int_t nBinsInv = 50; + const Int_t nBinsInv = 50; Double_t minInv = 0.0; Double_t maxInv = 0.2; - Int_t nBinsOp = 50; + const Int_t nBinsOp = 50; Double_t minOp = 0.0; Double_t maxOp = 2; - Int_t nBinsCh = 4; + const Int_t nBinsCh = 4; Double_t minCh = 0.0; Double_t maxCh = 4.0; - Double_t *binLimLogPt = new Double_t[nBinsPt+1]; - Double_t *binLimPt = new Double_t[nBinsPt+1]; + Double_t binLimLogPt[nBinsPt+1]; + Double_t binLimPt[nBinsPt+1]; for(Int_t i=0; i<=nBinsPt; i++) binLimLogPt[i]=(Double_t)TMath::Log10(minPt) + (TMath::Log10(maxPt)-TMath::Log10(minPt))/nBinsPt*(Double_t)i ; for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]); - Double_t *binLimLogPtMore = new Double_t[nBinsPtMore+1]; - Double_t *binLimPtMore = new Double_t[nBinsPtMore+1]; + Double_t binLimLogPtMore[nBinsPtMore+1]; + Double_t binLimPtMore[nBinsPtMore+1]; for(Int_t i=0; i<=nBinsPtMore; i++) binLimLogPtMore[i]=(Double_t)TMath::Log10(minPtMore) + (TMath::Log10(maxPtMore)-TMath::Log10(minPtMore))/nBinsPtMore*(Double_t)i ; for(Int_t i=0; i<=nBinsPtMore; i++) binLimPtMore[i]=(Double_t)TMath::Power(10,binLimLogPtMore[i]); - Double_t *binLimInv = new Double_t[nBinsInv+1]; + Double_t binLimInv[nBinsInv+1]; for(Int_t i=0; i<=nBinsInv; i++) binLimInv[i]=(Double_t)minInv + (maxInv-minInv) /nBinsInv*(Double_t)i ; - Double_t *binLimOp = new Double_t[nBinsOp+1]; + Double_t binLimOp[nBinsOp+1]; for(Int_t i=0; i<=nBinsOp; i++) binLimOp[i]=(Double_t)minOp + (maxOp-minOp) /nBinsOp*(Double_t)i ; - Double_t *binLimCh = new Double_t[nBinsCh+1]; + Double_t binLimCh[nBinsCh+1]; for(Int_t i=0; i<=nBinsCh; i++) binLimCh[i]=(Double_t)minCh + (maxCh-minCh) /nBinsCh*(Double_t)i ; const Int_t nvarData = 5; @@ -301,11 +319,11 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) // THnSparseF *hsSparseData = new THnSparseF("OpeningangleinvmassData","",nvarData,iBinData); - hsSparseData->SetBinEdges(0,binLimPt); - hsSparseData->SetBinEdges(1,binLimPt); - hsSparseData->SetBinEdges(2,binLimOp); - hsSparseData->SetBinEdges(3,binLimInv); - hsSparseData->SetBinEdges(4,binLimCh); + hsSparseData->SetBinEdges(0,&binLimPt[0]); + hsSparseData->SetBinEdges(1,&binLimPt[0]); + hsSparseData->SetBinEdges(2,&binLimOp[0]); + hsSparseData->SetBinEdges(3,&binLimInv[0]); + hsSparseData->SetBinEdges(4,&binLimCh[0]); hsSparseData->Sumw2(); fList->AddAt(hsSparseData,kDatai); @@ -339,18 +357,18 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) // MCSplitted: 0-not, 1-splittedOs, 2-ksplittedSs - Int_t nBinsMCOrigin = 6; + const Int_t nBinsMCOrigin = 6; Double_t minMCOrigin = 0.0; Double_t maxMCOrigin = 6.0; - Double_t *binLimMCOrigin = new Double_t[nBinsMCOrigin+1]; + Double_t binLimMCOrigin[nBinsMCOrigin+1]; for(Int_t i=0; i<=nBinsMCOrigin; i++) binLimMCOrigin[i]=(Double_t)minMCOrigin + (maxMCOrigin-minMCOrigin) /nBinsMCOrigin*(Double_t)i ; - Int_t nBinsMCSplitted = 3; + const Int_t nBinsMCSplitted = 3; Double_t minMCSplitted = 0.0; Double_t maxMCSplitted = 3.0; - Double_t *binLimMCSplitted = new Double_t[nBinsMCSplitted+1]; + Double_t binLimMCSplitted[nBinsMCSplitted+1]; for(Int_t i=0; i<=nBinsMCSplitted; i++) binLimMCSplitted[i]=(Double_t)minMCSplitted + (maxMCSplitted-minMCSplitted) /nBinsMCSplitted*(Double_t)i ; Int_t iBinMCo[nvarMCo]; @@ -362,12 +380,12 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) iBinMCo[5]=nBinsMCSplitted; THnSparseF *hsSparseMCo = new THnSparseF("OpeningangleinvmassMC","",nvarMCo,iBinMCo); - hsSparseMCo->SetBinEdges(0,binLimPt); - hsSparseMCo->SetBinEdges(1,binLimPt); - hsSparseMCo->SetBinEdges(2,binLimOp); - hsSparseMCo->SetBinEdges(3,binLimInv); - hsSparseMCo->SetBinEdges(4,binLimMCOrigin); - hsSparseMCo->SetBinEdges(5,binLimMCSplitted); + hsSparseMCo->SetBinEdges(0,&binLimPt[0]); + hsSparseMCo->SetBinEdges(1,&binLimPt[0]); + hsSparseMCo->SetBinEdges(2,&binLimOp[0]); + hsSparseMCo->SetBinEdges(3,&binLimInv[0]); + hsSparseMCo->SetBinEdges(4,&binLimMCOrigin[0]); + hsSparseMCo->SetBinEdges(5,&binLimMCSplitted[0]); hsSparseMCo->Sumw2(); fList->AddAt(hsSparseMCo,kMCo); @@ -398,11 +416,11 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) // cut passed: 0-all, 1-Partner tracked, 2-Opposite-sign, 3-SingleTrackCutPart, 4-ShareCluster, 5-PID, 6-DCA, 7-chi2Ndf AliKF, 8-Openingangle, 9-Invmass // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB - Int_t nBinsMCCutPassed = 10; + const Int_t nBinsMCCutPassed = 10; Double_t minMCCutPassed = -0.5; Double_t maxMCCutPassed = 9.5; - Double_t *binLimMCCutPassed = new Double_t[nBinsMCCutPassed+1]; + Double_t binLimMCCutPassed[nBinsMCCutPassed+1]; for(Int_t i=0; i<=nBinsMCCutPassed; i++) binLimMCCutPassed[i]=(Double_t)minMCCutPassed + (maxMCCutPassed-minMCCutPassed) /nBinsMCCutPassed*(Double_t)i ; Int_t iBinMCe[nvarMCe]; @@ -411,9 +429,9 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) iBinMCe[2]=nBinsMCOrigin; THnSparseF *hsSparseMCe = new THnSparseF("CutPassedMC","",nvarMCe,iBinMCe); - hsSparseMCe->SetBinEdges(0,binLimPt); - hsSparseMCe->SetBinEdges(1,binLimMCCutPassed); - hsSparseMCe->SetBinEdges(2,binLimMCOrigin); + hsSparseMCe->SetBinEdges(0,&binLimPt[0]); + hsSparseMCe->SetBinEdges(1,&binLimMCCutPassed[0]); + hsSparseMCe->SetBinEdges(2,&binLimMCOrigin[0]); hsSparseMCe->Sumw2(); fList->AddAt(hsSparseMCe,kMCe); @@ -455,11 +473,11 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) ///////////////////////////////////////////////////// const Int_t nvarITSsignal = 5; - Int_t nBinsITSsignal = 100; + const Int_t nBinsITSsignal = 100; Double_t minITSsignal = 0.0; Double_t maxITSsignal = 350.0; - Double_t *binLimITSsignal = new Double_t[nBinsITSsignal+1]; + Double_t binLimITSsignal[nBinsITSsignal+1]; for(Int_t i=0; i<=nBinsITSsignal; i++) binLimITSsignal[i]=(Double_t)minITSsignal + (maxITSsignal-minITSsignal) /nBinsITSsignal*(Double_t)i ; Int_t iBinITSsignal[nvarITSsignal]; @@ -470,11 +488,11 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) iBinITSsignal[4]=nBinsITSsignal; THnSparseF *hsSparseITSpid = new THnSparseF("SparseITSsignal","",nvarITSsignal,iBinITSsignal); - hsSparseITSpid->SetBinEdges(0,binLimPt); - hsSparseITSpid->SetBinEdges(1,binLimITSsignal); - hsSparseITSpid->SetBinEdges(2,binLimITSsignal); - hsSparseITSpid->SetBinEdges(3,binLimITSsignal); - hsSparseITSpid->SetBinEdges(4,binLimITSsignal); + hsSparseITSpid->SetBinEdges(0,&binLimPt[0]); + hsSparseITSpid->SetBinEdges(1,&binLimITSsignal[0]); + hsSparseITSpid->SetBinEdges(2,&binLimITSsignal[0]); + hsSparseITSpid->SetBinEdges(3,&binLimITSsignal[0]); + hsSparseITSpid->SetBinEdges(4,&binLimITSsignal[0]); hsSparseITSpid->Sumw2(); fList->AddAt(hsSparseITSpid,kMCcutPart2); @@ -484,19 +502,19 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) /////////////////////////////////////////////////////////////////////////////////////// const Int_t nvarITSsignalSplit = 5; - Int_t nBinsITSSplit = 2; + const Int_t nBinsITSSplit = 2; Double_t minITSSplit = 0.0; Double_t maxITSSplit = 2.0; - Double_t *binLimITSSplit = new Double_t[nBinsITSSplit+1]; + Double_t binLimITSSplit[nBinsITSSplit+1]; for(Int_t i=0; i<=nBinsITSSplit; i++) binLimITSSplit[i]=(Double_t)minITSSplit + (maxITSSplit-minITSSplit) /nBinsITSSplit*(Double_t)i ; - Int_t nBinsITSsignalSplit = 50; + const Int_t nBinsITSsignalSplit = 50; Double_t minITSsignalSplit = -25.0; Double_t maxITSsignalSplit = 25.0; - Double_t *binLimITSsignalSplit = new Double_t[nBinsITSsignalSplit+1]; + Double_t binLimITSsignalSplit[nBinsITSsignalSplit+1]; for(Int_t i=0; i<=nBinsITSsignalSplit; i++) binLimITSsignalSplit[i]=(Double_t)minITSsignalSplit + (maxITSsignalSplit-minITSsignalSplit) /nBinsITSsignalSplit*(Double_t)i ; Int_t iBinITSsignalSplit[nvarITSsignalSplit]; @@ -506,9 +524,9 @@ void AliHFEelecbackground::CreateHistograms(TList * const qaList) } THnSparseF *hsSparseITSpidSplit = new THnSparseF("SparseITSsignalSplit","",nvarITSsignalSplit,iBinITSsignalSplit); - hsSparseITSpidSplit->SetBinEdges(0,binLimITSSplit); + hsSparseITSpidSplit->SetBinEdges(0,&binLimITSSplit[0]); for(Int_t k = 1; k < 5; k++) { - hsSparseITSpidSplit->SetBinEdges(k,binLimITSsignalSplit); + hsSparseITSpidSplit->SetBinEdges(k,&binLimITSsignalSplit[0]); } hsSparseITSpidSplit->Sumw2(); @@ -534,8 +552,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c // pt tagged ////////////////////// TVector3 v3Dtagged; - Double_t *pxyz = new Double_t[3]; - track->PxPyPz(pxyz); + Double_t pxyz[3]; + track->PxPyPz(&pxyz[0]); v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]); fPtESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]); @@ -624,8 +642,9 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c cuteffect[0] = fPtESD; cuteffect[1] = 0.0; cuteffect[2] = fIsFrom; - if(!fCuts[0]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if(!fCuts[0]){ + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[0] = kTRUE; } } @@ -640,7 +659,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner) { cuteffect[1] = 1.0; if(!fCuts[1]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[1] = kTRUE; } } @@ -654,7 +674,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner && (sign == kOs)) { cuteffect[1] = 2.0; if(!fCuts[2]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[2] = kTRUE; } } @@ -669,7 +690,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner && (sign==kOs)) { cuteffect[1] = 3.0; if(!fCuts[3]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[3] = kTRUE; } } @@ -684,7 +706,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner && (sign==kOs)) { cuteffect[1] = 4.0; if(!fCuts[4]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[4] = kTRUE; } } @@ -699,7 +722,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner && (sign==kOs)) { cuteffect[1] = 5.0; if(!fCuts[5]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[5] = kTRUE; } } @@ -712,22 +736,28 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c Double_t xthis,xp; Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp); - (dynamic_cast(fList->At(kDatadca)))->Fill(dca); + if((fhtmpp = dynamic_cast(fList->At(kDatadca)))) fhtmpp->Fill(dca); if(HasMCData()) { //printf("has MC data for DCA\n"); //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom); - if(fIsFrom==kElectronFromBackground) (dynamic_cast(fList->At(kMCdca)))->Fill(dca,fIsFrom); + if(fIsFrom==kElectronFromBackground) { + if((fhtmpf = dynamic_cast(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom); + } else { - if(fIsPartner) (dynamic_cast(fList->At(kMCdca)))->Fill(dca,fIsFrom); + if(fIsPartner){ + if((fhtmpf = dynamic_cast(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom); + } } } + if(TMath::Abs(dca) > 3.0) return; - + if(fDebugLevel > 0) { if(HasMCData() && fIsPartner && (sign==kOs)) { cuteffect[1] = 6.0; if(!fCuts[6]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[6] = kTRUE; } } @@ -748,21 +778,21 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c Double_t norradius = TMath::Sqrt(fkVertex->GetX()*fkVertex->GetX()+fkVertex->GetY()*fkVertex->GetY()); - AliESDtrack *trackCopy = new AliESDtrack(*track); - AliESDtrack *trackPartCopy = new AliESDtrack(*trackPart); + AliESDtrack trackCopy = AliESDtrack(*track); + AliESDtrack trackPartCopy = AliESDtrack(*trackPart); Bool_t propagateok = kTRUE; - if((!(trackPartCopy->PropagateTo(norradius,fBz))) || (!(trackCopy->PropagateTo(norradius,fBz)))) propagateok = kFALSE; + if((!(trackPartCopy.PropagateTo(norradius,fBz))) || (!(trackCopy.PropagateTo(norradius,fBz)))) propagateok = kFALSE; if(!propagateok) { - if(trackCopy) delete trackCopy; - if(trackPartCopy) delete trackPartCopy; + //if(trackCopy) delete trackCopy; + //if(trackPartCopy) delete trackPartCopy; return; } - CalculateMotherVariable(trackCopy,trackPartCopy,&results[0]); - CalculateMotherVariableR(trackCopy,trackPartCopy,&resultsr[0]); + CalculateMotherVariable(&trackCopy,&trackPartCopy,&results[0]); + CalculateMotherVariableR(&trackCopy,&trackPartCopy,&resultsr[0]); - if(trackCopy) delete trackCopy; - if(trackPartCopy) delete trackPartCopy; + //if(trackCopy) delete trackCopy; + //if(trackPartCopy) delete trackPartCopy; } else { @@ -772,7 +802,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c if(HasMCData() && fIsPartner && (sign==kOs)) { cuteffect[1] = 7.0; if(!fCuts[7]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[7] = kTRUE; } } @@ -793,13 +824,15 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c cuteffect[1] = 8.0; if(!fCuts[8]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[8] = kTRUE; } if(TMath::Abs(results[1]) < fInvMassCut) { cuteffect[1] = 9.0; if(!fCuts[9]) { - (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); + if((fhtmp = dynamic_cast(fList->At(kMCe)))) fhtmp->Fill(cuteffect); + //if(fList->At(kMCe)) (dynamic_cast(fList->At(kMCe)))->Fill(cuteffect); fCuts[9] = kTRUE; } } @@ -825,12 +858,12 @@ Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, A TVector3 v3Dtagged; TVector3 v3Dpart; - Double_t *pxyz = new Double_t[3]; - track->PxPyPz(pxyz); + Double_t pxyz[3]; + track->PxPyPz(&pxyz[0]); v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]); - Double_t *pxyzpart = new Double_t[3]; - trackpart->PxPyPz(pxyzpart); + Double_t pxyzpart[3]; + trackpart->PxPyPz(&pxyzpart[0]); v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]); @@ -906,20 +939,31 @@ Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, A results[4] = openingangle; // chi2Ndf cut - (dynamic_cast(fList->At(kDatachi2Ndf)))->Fill(chi2ndf); + if((fhtmpp = dynamic_cast(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf); + //if(fList->At(kDatachi2Ndf)) (dynamic_cast(fList->At(kDatachi2Ndf)))->Fill(chi2ndf); if(HasMCData()){ - if(fIsFrom==kElectronFromBackground) (dynamic_cast(fList->At(kMCchi2Ndf)))->Fill(chi2ndf,fIsFrom); + if(fIsFrom==kElectronFromBackground) { + if((fhtmpf = dynamic_cast(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom); + } else { - if(fIsPartner) (dynamic_cast(fList->At(kMCchi2Ndf)))->Fill(chi2ndf,fIsFrom); + if(fIsPartner){ + if((fhtmpf = dynamic_cast(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom); + } } } if(chi2ndf > fChi2NdfCut) return kFALSE; else { - (dynamic_cast(fList->At(kDatar)))->Fill(radius); + if((fhtmpp = dynamic_cast(fList->At(kDatar)))) fhtmpp->Fill(radius); + //if(fList->At(kDatar)) (dynamic_cast(fList->At(kDatar)))->Fill(radius); if(HasMCData()) { - if(fIsFrom==kElectronFromBackground) (dynamic_cast(fList->At(kMCr)))->Fill(radius,fIsFrom); + if(fIsFrom==kElectronFromBackground) { + if((fhtmpf = dynamic_cast(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom); + //if(fList->At(kMCr))) (dynamic_cast(fList->At(kMCr)))->Fill(radius,fIsFrom); + } else { - if(fIsPartner) (dynamic_cast(fList->At(kMCr)))->Fill(radius,fIsFrom); + if(fIsPartner) { + if((fhtmpf = dynamic_cast(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom); + } } } return kTRUE; @@ -943,11 +987,11 @@ void AliHFEelecbackground::CalculateMotherVariableR(AliESDtrack* const track, Al TVector3 v3Dtagged; TVector3 v3Dpart; - Double_t *pxyz = new Double_t[3]; - track->PxPyPz(pxyz); + Double_t pxyz[3]; + track->PxPyPz(&pxyz[0]); v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]); - Double_t *pxyzpart = new Double_t[3]; - trackpart->PxPyPz(pxyzpart); + Double_t pxyzpart[3]; + trackpart->PxPyPz(&pxyzpart[0]); v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]); // rotate the partner @@ -1004,7 +1048,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int co[4] = sign; co[5] = 0.0; - (dynamic_cast(fList->At(kDatai)))->Fill(co); + if((fhtmp = dynamic_cast(fList->At(kDatai)))) fhtmp->Fill(co); + //if(fList->At(kDatai))(dynamic_cast(fList->At(kDatai)))->Fill(co); if((sign==kOs) && (!fUseAliKFCode)) { @@ -1014,7 +1059,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int co[4] = kR; co[5] = 0.0; - (dynamic_cast(fList->At(kDatai)))->Fill(co); + if((fhtmp = dynamic_cast(fList->At(kDatai)))) fhtmp->Fill(co); + //if(fList->At(kDatai)) (dynamic_cast(fList->At(kDatai)))->Fill(co); } @@ -1040,7 +1086,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int } } - (dynamic_cast(fList->At(kMCo)))->Fill(co); + if((fhtmp = dynamic_cast(fList->At(kMCo)))) fhtmp->Fill(co); + //if(fList->At(kMCo)) (dynamic_cast(fList->At(kMCo)))->Fill(co); } @@ -1064,7 +1111,7 @@ Bool_t AliHFEelecbackground::SingleTrackCut(AliESDtrack* const trackPart) const //////////////////// if(fRequireITSStandalone==1) { - if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit) ==0))) return kFALSE; + if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit)==0))) return kFALSE; } if(fRequireITSStandalone==2) { @@ -1122,8 +1169,9 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart) Double_t itsSignal = trackPart->GetITSsignal(); Double_t p = trackPart->P(); - if(fDebugLevel > 1) { - (dynamic_cast(fList->At(kMCcutPart0)))->Fill(p,itsSignal); + if(fDebugLevel > 1) { + if((fhtmpf = dynamic_cast(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal); + //if(fList->At(kMCcutPart0)) (dynamic_cast(fList->At(kMCcutPart0)))->Fill(p,itsSignal); } /////////// @@ -1150,8 +1198,10 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart) entries[3] = dEdxSamplesPart[2]; entries[4] = dEdxSamplesPart[3]; - (dynamic_cast(fList->At(kMCcutPart1)))->Fill(p,itsSignal); - (dynamic_cast(fList->At(kMCcutPart2)))->Fill(entries); + //if(fList->At(kMCcutPart1)) (dynamic_cast(fList->At(kMCcutPart1)))->Fill(p,itsSignal); + if((fhtmpf = dynamic_cast(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal); + if((fhtmp = dynamic_cast(fList->At(kMCcutPart2)))) fhtmp->Fill(entries); + //if(fList->At(kMCcutPart2)) (dynamic_cast(fList->At(kMCcutPart2)))->Fill(entries); } @@ -1169,20 +1219,22 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart) if(fDebugLevel > 1) { //printf("tpcSignal %f\n",tpcSignal); - (dynamic_cast(fList->At(kMCcutPart0)))->Fill(p,tpcSignal); + //if(fList->At(kMCcutPart0)) (dynamic_cast(fList->At(kMCcutPart0)))->Fill(p,tpcSignal); + if((fhtmpf = dynamic_cast(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal); } // PID if(fPIDPartner) { if(!fPIDMethodPartner) return kFALSE; AliHFEpidObject hfetrack; - hfetrack.fAnalysisType = AliHFEpidObject::kESDanalysis; - hfetrack.fRecTrack = trackPart; + hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); + hfetrack.SetRecTrack(trackPart); //if(HasMCData()) hfetrack.fMCtrack = mctrack; if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE; if(fDebugLevel > 1) { - (dynamic_cast(fList->At(kMCcutPart1)))->Fill(p,tpcSignal); + if((fhtmpf = dynamic_cast(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal); + //if(fList->At(kMCcutPart1)) (dynamic_cast(fList->At(kMCcutPart1)))->Fill(p,tpcSignal); } } @@ -1192,7 +1244,7 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart) } //__________________________________________________________________________________________ -Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2) const +Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2) { // // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method @@ -1289,7 +1341,8 @@ Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack } else entriesSplit[layer+1] = -100.0; } - (dynamic_cast(fList->At(kMCcutPart3)))->Fill(entriesSplit); + if((fhtmp = dynamic_cast(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit); + //if(fList->At(kMCcutPart3)) (dynamic_cast(fList->At(kMCcutPart3)))->Fill(entriesSplit); } // Return @@ -1316,7 +1369,8 @@ void AliHFEelecbackground::SetPIDPartner() { if(!fPIDMethodPartner) { fPIDMethodPartner = new AliHFEpid(); - fPIDMethodPartner->InitializePID("Strategy1"); // 3 sigma cut in TPC + fPIDMethodPartner->AddDetector("TPC", 0); + fPIDMethodPartner->InitializePID(); // 3 sigma cut in TPC } } @@ -1537,6 +1591,7 @@ void AliHFEelecbackground::PostProcess() ///////////////////////////////// // Cuts on the opening angle //////////////////////////////// + if(!hsSparseData) return; TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2); Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut); hsSparseData->GetAxis(2)->SetRange(1,binCutData); @@ -1663,10 +1718,10 @@ void AliHFEelecbackground::PostProcess() Double_t yieldf = invmassdiffptproj[k-1]->Integral(); if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) { Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral(); - yieldPtSourcesMC->SetBinContent(k,yieldg); + if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg); Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral(); - yieldPtSignalCutMC->SetBinContent(k,yieldsignal); + if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal); } yieldPtFound->SetBinContent(k,yieldf); @@ -1782,6 +1837,7 @@ void AliHFEelecbackground::Plot() const ///////////////////////// THnSparseF *hsSparseData = dynamic_cast(fList->FindObject("OpeningangleinvmassData")); THnSparseF *hsSparseMC = dynamic_cast(fList->FindObject("OpeningangleinvmassMC")); + if(!hsSparseData) return; //////////////////// // Opening angle @@ -2190,310 +2246,6 @@ void AliHFEelecbackground::Plot() const cinvmass2D->cd(12); if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->Draw("lego"); - - //////////////////////// - // Cut efficiencies - //////////////////////// - - THnSparseF *hsSparseMCe = dynamic_cast(fList->FindObject("CutPassedMC")); - - if(hsSparseMCe) { - - // init histos - TAxis *axissources = hsSparseMCe->GetAxis(2); - Int_t nbsources = axissources->GetNbins(); - TAxis *axiscuts = hsSparseMCe->GetAxis(1); - Int_t nbcuts = axiscuts->GetNbins(); - TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts]; - Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts]; - - //printf("Number of cuts %d\n",nbcuts); - - // canvas - TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800); - chsSparseMCeeff->Divide(3,1); - - // histos - for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { - hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1); - for(Int_t cut = 0; cut < nbcuts; cut++){ - hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1); - histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0); - hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins()); - } - hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins()); - } - - // calcul efficiencies - /////////////////////// - // histos - for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { - // Next is compared to the partner tracked - for(Int_t cut = 2; cut < nbcuts; cut++){ - nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries(); - if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]); - } - // First one is if the partner is tracked. - nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries(); - if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]); - // First one is input - nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries(); - } - - ///////////// - // ratios - //////////// - for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { - for(Int_t cut = 1; cut < nbcuts; cut++){ - if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts]; - } - } - TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0); - TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0); - TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0); - for(Int_t k = 1; k < nbcuts; k++){ - ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]); - ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]); - ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]); - } - // - TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis(); - xAxisGamma->SetBinLabel(1,"Partner tracked"); - xAxisGamma->SetBinLabel(2,"Opposite sign"); - xAxisGamma->SetBinLabel(3,"Single Track Cut"); - xAxisGamma->SetBinLabel(4,"Shared Clusters"); - xAxisGamma->SetBinLabel(5,"PID"); - xAxisGamma->SetBinLabel(6,"DCA"); - xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf"); - xAxisGamma->SetBinLabel(8,"Opening angle"); - xAxisGamma->SetBinLabel(9,"Invariant mass"); - // - TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis(); - xAxisPi0->SetBinLabel(1,"Partner tracked"); - xAxisPi0->SetBinLabel(2,"Opposite sign"); - xAxisPi0->SetBinLabel(3,"Single Track Cut"); - xAxisPi0->SetBinLabel(4,"Shared Clusters"); - xAxisPi0->SetBinLabel(5,"PID"); - xAxisPi0->SetBinLabel(6,"DCA"); - xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf"); - xAxisPi0->SetBinLabel(8,"Opening angle"); - xAxisPi0->SetBinLabel(9,"Invariant mass"); - // - TAxis *xAxisC = ratioHistoEntriesC->GetXaxis(); - xAxisC->SetBinLabel(1,"Partner tracked"); - xAxisC->SetBinLabel(2,"Opposite sign"); - xAxisC->SetBinLabel(3,"Single Track Cut"); - xAxisC->SetBinLabel(4,"Shared Clusters"); - xAxisC->SetBinLabel(5,"PID"); - xAxisC->SetBinLabel(6,"DCA"); - xAxisC->SetBinLabel(7,"Chi^{2}/Ndf"); - xAxisC->SetBinLabel(8,"Opening angle"); - xAxisC->SetBinLabel(9,"Invariant mass"); - // - TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800); - cRatioHistoEntries->cd(1); - ratioHistoEntriesGamma->SetStats(0); - ratioHistoEntriesGamma->Draw(); - ratioHistoEntriesPi0->SetStats(0); - ratioHistoEntriesPi0->Draw("same"); - ratioHistoEntriesC->SetStats(0); - //ratioHistoEntriesC->Draw("same"); - TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89); - legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l"); - legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l"); - //legEntries->AddEntry(ratioHistoEntriesC,"c","p"); - legEntries->Draw("same"); - - //////////////////// - // plot Debug - /////////////////// - Int_t source = 1; - chsSparseMCeeff->cd(1); - histopassedcuts[source*nbcuts+0]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+1]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+2]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+3]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+4]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+5]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+6]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+7]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+8]->SetTitle("#gamma"); - histopassedcuts[source*nbcuts+9]->SetTitle("#gamma"); - //histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+1]->SetStats(0); - histopassedcuts[source*nbcuts+2]->SetStats(0); - histopassedcuts[source*nbcuts+3]->SetStats(0); - histopassedcuts[source*nbcuts+4]->SetStats(0); - histopassedcuts[source*nbcuts+5]->SetStats(0); - histopassedcuts[source*nbcuts+6]->SetStats(0); - histopassedcuts[source*nbcuts+7]->SetStats(0); - histopassedcuts[source*nbcuts+8]->SetStats(0); - histopassedcuts[source*nbcuts+9]->SetStats(0); - //histopassedcuts[source*nbcuts+0]->Draw(); - //histopassedcuts[source*nbcuts+1]->Draw(""); - histopassedcuts[source*nbcuts+2]->Draw(); - histopassedcuts[source*nbcuts+3]->Draw("same"); - //histopassedcuts[source*nbcuts+4]->Draw("same"); - histopassedcuts[source*nbcuts+5]->Draw("same"); - histopassedcuts[source*nbcuts+6]->Draw("same"); - //histopassedcuts[source*nbcuts+7]->Draw("same"); - histopassedcuts[source*nbcuts+8]->Draw("same"); - histopassedcuts[source*nbcuts+9]->Draw("same"); - TLegend *legb = new TLegend(0.4,0.6,0.89,0.89); - //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); - //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); - //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); - //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); - legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); - legb->Draw("same"); - - source = 2; - chsSparseMCeeff->cd(2); - histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}"); - histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}"); - //histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+1]->SetStats(0); - histopassedcuts[source*nbcuts+2]->SetStats(0); - histopassedcuts[source*nbcuts+3]->SetStats(0); - histopassedcuts[source*nbcuts+4]->SetStats(0); - histopassedcuts[source*nbcuts+5]->SetStats(0); - histopassedcuts[source*nbcuts+6]->SetStats(0); - histopassedcuts[source*nbcuts+7]->SetStats(0); - histopassedcuts[source*nbcuts+8]->SetStats(0); - histopassedcuts[source*nbcuts+9]->SetStats(0); - //histopassedcuts[source*nbcuts+0]->Draw(); - //histopassedcuts[source*nbcuts+1]->Draw(); - histopassedcuts[source*nbcuts+2]->Draw(); - histopassedcuts[source*nbcuts+3]->Draw("same"); - //histopassedcuts[source*nbcuts+4]->Draw("same"); - histopassedcuts[source*nbcuts+5]->Draw("same"); - histopassedcuts[source*nbcuts+6]->Draw("same"); - //histopassedcuts[source*nbcuts+7]->Draw("same"); - histopassedcuts[source*nbcuts+8]->Draw("same"); - histopassedcuts[source*nbcuts+9]->Draw("same"); - TLegend *legc = new TLegend(0.4,0.6,0.89,0.89); - //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); - //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); - //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); - //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); - legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); - legc->Draw("same"); - - source = 4; - chsSparseMCeeff->cd(3); - histopassedcuts[source*nbcuts+0]->SetTitle("C"); - histopassedcuts[source*nbcuts+1]->SetTitle("C"); - histopassedcuts[source*nbcuts+2]->SetTitle("C"); - histopassedcuts[source*nbcuts+3]->SetTitle("C"); - histopassedcuts[source*nbcuts+4]->SetTitle("C"); - histopassedcuts[source*nbcuts+5]->SetTitle("C"); - histopassedcuts[source*nbcuts+6]->SetTitle("C"); - histopassedcuts[source*nbcuts+7]->SetTitle("C"); - histopassedcuts[source*nbcuts+8]->SetTitle("C"); - histopassedcuts[source*nbcuts+9]->SetTitle("C"); - //histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+1]->SetStats(0); - histopassedcuts[source*nbcuts+2]->SetStats(0); - histopassedcuts[source*nbcuts+3]->SetStats(0); - histopassedcuts[source*nbcuts+4]->SetStats(0); - histopassedcuts[source*nbcuts+5]->SetStats(0); - histopassedcuts[source*nbcuts+6]->SetStats(0); - histopassedcuts[source*nbcuts+7]->SetStats(0); - histopassedcuts[source*nbcuts+8]->SetStats(0); - histopassedcuts[source*nbcuts+9]->SetStats(0); - //histopassedcuts[source*nbcuts+0]->Draw(); - //histopassedcuts[source*nbcuts+1]->Draw(); - histopassedcuts[source*nbcuts+2]->Draw(); - histopassedcuts[source*nbcuts+3]->Draw("same"); - //histopassedcuts[source*nbcuts+4]->Draw("same"); - histopassedcuts[source*nbcuts+5]->Draw("same"); - histopassedcuts[source*nbcuts+6]->Draw("same"); - //histopassedcuts[source*nbcuts+7]->Draw("same"); - histopassedcuts[source*nbcuts+8]->Draw("same"); - histopassedcuts[source*nbcuts+9]->Draw("same"); - TLegend *lege = new TLegend(0.4,0.6,0.89,0.89); - //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); - //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); - //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); - //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); - lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); - lege->Draw("same"); - - ////////////////////// - // Input - ////////////////////// - - TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800); - chsSparseMCein->cd(1); - Double_t nbGamma = 0.0; - source = 1; - nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries(); - histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+0]->Draw(); - TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89); - leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p"); - Double_t nbPi0 = 0.0; - source = 2; - nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries(); - histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+0]->Draw("same"); - leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p"); - Double_t nbEta = 0.0; - source = 3; - nbEta = histopassedcuts[source*nbcuts+0]->GetEntries(); - histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+0]->Draw("same"); - leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p"); - Double_t nbC = 0.0; - source = 4; - nbC = histopassedcuts[source*nbcuts+0]->GetEntries(); - histopassedcuts[source*nbcuts+0]->SetStats(0); - histopassedcuts[source*nbcuts+0]->Draw("same"); - leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p"); - leginput->Draw("same"); - - //printf("Gamma %f, pi^{0} %f and #eta %f, c %f\n",nbGamma,nbPi0,nbEta,nbC); - - ////////////////////// - // Tracked - ////////////////////// - - TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800); - cTracked->cd(1); - source = 1; - histopassedcuts[source*nbcuts+1]->Draw(); - TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89); - legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p"); - source = 2; - histopassedcuts[source*nbcuts+1]->Draw("same"); - legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p"); - legTracked->Draw("same"); - - } - ///////////////////////////////////// // Data Radius and chi2Ndf if AliKF //////////////////////////////////// @@ -2739,8 +2491,371 @@ void AliHFEelecbackground::Plot() const legITS5->Draw("same"); - } + } + //////////////////////// + // Cut efficiencies + //////////////////////// + + THnSparseF *hsSparseMCe = dynamic_cast(fList->FindObject("CutPassedMC")); + if(!hsSparseMCe) return; + + // init histos + TAxis *axissources = hsSparseMCe->GetAxis(2); + Int_t nbsources = axissources->GetNbins(); + TAxis *axiscuts = hsSparseMCe->GetAxis(1); + Int_t nbcuts = axiscuts->GetNbins(); + TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts]; + Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts]; + for(Int_t k =0; k < nbsources*nbcuts; k++){ + nbEntriesCuts[k] = 0.0; + histopassedcuts[k] = 0x0; + } + + //printf("Number of cuts %d\n",nbcuts); + + // canvas + TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800); + chsSparseMCeeff->Divide(3,1); + + // histos + for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { + hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1); + for(Int_t cut = 0; cut < nbcuts; cut++){ + hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1); + histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0); + hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins()); + } + hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins()); + } + + // calcul efficiencies + + // histos + for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { + // Next is compared to the partner tracked + for(Int_t cut = 2; cut < nbcuts; cut++){ + nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries(); + if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]); + } + // First one is if the partner is tracked. + nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries(); + if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]); + // First one is input + nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries(); + } + + // ratios + for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) { + for(Int_t cut = 1; cut < nbcuts; cut++){ + if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts]; + } + } + TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0); + TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0); + TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0); + for(Int_t k = 1; k < nbcuts; k++){ + if((nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]); + if((2*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]); + if((4*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]); + } + // + TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis(); + xAxisGamma->SetBinLabel(1,"Partner tracked"); + xAxisGamma->SetBinLabel(2,"Opposite sign"); + xAxisGamma->SetBinLabel(3,"Single Track Cut"); + xAxisGamma->SetBinLabel(4,"Shared Clusters"); + xAxisGamma->SetBinLabel(5,"PID"); + xAxisGamma->SetBinLabel(6,"DCA"); + xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf"); + xAxisGamma->SetBinLabel(8,"Opening angle"); + xAxisGamma->SetBinLabel(9,"Invariant mass"); + // + TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis(); + xAxisPi0->SetBinLabel(1,"Partner tracked"); + xAxisPi0->SetBinLabel(2,"Opposite sign"); + xAxisPi0->SetBinLabel(3,"Single Track Cut"); + xAxisPi0->SetBinLabel(4,"Shared Clusters"); + xAxisPi0->SetBinLabel(5,"PID"); + xAxisPi0->SetBinLabel(6,"DCA"); + xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf"); + xAxisPi0->SetBinLabel(8,"Opening angle"); + xAxisPi0->SetBinLabel(9,"Invariant mass"); + // + TAxis *xAxisC = ratioHistoEntriesC->GetXaxis(); + xAxisC->SetBinLabel(1,"Partner tracked"); + xAxisC->SetBinLabel(2,"Opposite sign"); + xAxisC->SetBinLabel(3,"Single Track Cut"); + xAxisC->SetBinLabel(4,"Shared Clusters"); + xAxisC->SetBinLabel(5,"PID"); + xAxisC->SetBinLabel(6,"DCA"); + xAxisC->SetBinLabel(7,"Chi^{2}/Ndf"); + xAxisC->SetBinLabel(8,"Opening angle"); + xAxisC->SetBinLabel(9,"Invariant mass"); + // + TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800); + cRatioHistoEntries->cd(1); + ratioHistoEntriesGamma->SetStats(0); + ratioHistoEntriesGamma->Draw(); + ratioHistoEntriesPi0->SetStats(0); + ratioHistoEntriesPi0->Draw("same"); + ratioHistoEntriesC->SetStats(0); + //ratioHistoEntriesC->Draw("same"); + TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89); + legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l"); + legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l"); + //legEntries->AddEntry(ratioHistoEntriesC,"c","p"); + legEntries->Draw("same"); + + // plot Debug + Int_t source = 1; + chsSparseMCeeff->cd(1); + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + histopassedcuts[source*nbcuts+0]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+1]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+2]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+3]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+4]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+5]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+6]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+7]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+8]->SetTitle("#gamma"); + histopassedcuts[source*nbcuts+9]->SetTitle("#gamma"); + //histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+1]->SetStats(0); + histopassedcuts[source*nbcuts+2]->SetStats(0); + histopassedcuts[source*nbcuts+3]->SetStats(0); + histopassedcuts[source*nbcuts+4]->SetStats(0); + histopassedcuts[source*nbcuts+5]->SetStats(0); + histopassedcuts[source*nbcuts+6]->SetStats(0); + histopassedcuts[source*nbcuts+7]->SetStats(0); + histopassedcuts[source*nbcuts+8]->SetStats(0); + histopassedcuts[source*nbcuts+9]->SetStats(0); + //histopassedcuts[source*nbcuts+0]->Draw(); + //histopassedcuts[source*nbcuts+1]->Draw(""); + histopassedcuts[source*nbcuts+2]->Draw(); + histopassedcuts[source*nbcuts+3]->Draw("same"); + //histopassedcuts[source*nbcuts+4]->Draw("same"); + histopassedcuts[source*nbcuts+5]->Draw("same"); + histopassedcuts[source*nbcuts+6]->Draw("same"); + //histopassedcuts[source*nbcuts+7]->Draw("same"); + histopassedcuts[source*nbcuts+8]->Draw("same"); + histopassedcuts[source*nbcuts+9]->Draw("same"); + TLegend *legb = new TLegend(0.4,0.6,0.89,0.89); + //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); + //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); + //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); + //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); + legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); + legb->Draw("same"); + + source = 2; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + chsSparseMCeeff->cd(2); + histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}"); + histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}"); + //histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+1]->SetStats(0); + histopassedcuts[source*nbcuts+2]->SetStats(0); + histopassedcuts[source*nbcuts+3]->SetStats(0); + histopassedcuts[source*nbcuts+4]->SetStats(0); + histopassedcuts[source*nbcuts+5]->SetStats(0); + histopassedcuts[source*nbcuts+6]->SetStats(0); + histopassedcuts[source*nbcuts+7]->SetStats(0); + histopassedcuts[source*nbcuts+8]->SetStats(0); + histopassedcuts[source*nbcuts+9]->SetStats(0); + //histopassedcuts[source*nbcuts+0]->Draw(); + //histopassedcuts[source*nbcuts+1]->Draw(); + histopassedcuts[source*nbcuts+2]->Draw(); + histopassedcuts[source*nbcuts+3]->Draw("same"); + //histopassedcuts[source*nbcuts+4]->Draw("same"); + histopassedcuts[source*nbcuts+5]->Draw("same"); + histopassedcuts[source*nbcuts+6]->Draw("same"); + //histopassedcuts[source*nbcuts+7]->Draw("same"); + histopassedcuts[source*nbcuts+8]->Draw("same"); + histopassedcuts[source*nbcuts+9]->Draw("same"); + TLegend *legc = new TLegend(0.4,0.6,0.89,0.89); + //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); + //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); + //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); + //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); + legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); + legc->Draw("same"); + + source = 4; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + chsSparseMCeeff->cd(3); + histopassedcuts[source*nbcuts+0]->SetTitle("C"); + histopassedcuts[source*nbcuts+1]->SetTitle("C"); + histopassedcuts[source*nbcuts+2]->SetTitle("C"); + histopassedcuts[source*nbcuts+3]->SetTitle("C"); + histopassedcuts[source*nbcuts+4]->SetTitle("C"); + histopassedcuts[source*nbcuts+5]->SetTitle("C"); + histopassedcuts[source*nbcuts+6]->SetTitle("C"); + histopassedcuts[source*nbcuts+7]->SetTitle("C"); + histopassedcuts[source*nbcuts+8]->SetTitle("C"); + histopassedcuts[source*nbcuts+9]->SetTitle("C"); + //histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+1]->SetStats(0); + histopassedcuts[source*nbcuts+2]->SetStats(0); + histopassedcuts[source*nbcuts+3]->SetStats(0); + histopassedcuts[source*nbcuts+4]->SetStats(0); + histopassedcuts[source*nbcuts+5]->SetStats(0); + histopassedcuts[source*nbcuts+6]->SetStats(0); + histopassedcuts[source*nbcuts+7]->SetStats(0); + histopassedcuts[source*nbcuts+8]->SetStats(0); + histopassedcuts[source*nbcuts+9]->SetStats(0); + //histopassedcuts[source*nbcuts+0]->Draw(); + //histopassedcuts[source*nbcuts+1]->Draw(); + histopassedcuts[source*nbcuts+2]->Draw(); + histopassedcuts[source*nbcuts+3]->Draw("same"); + //histopassedcuts[source*nbcuts+4]->Draw("same"); + histopassedcuts[source*nbcuts+5]->Draw("same"); + histopassedcuts[source*nbcuts+6]->Draw("same"); + //histopassedcuts[source*nbcuts+7]->Draw("same"); + histopassedcuts[source*nbcuts+8]->Draw("same"); + histopassedcuts[source*nbcuts+9]->Draw("same"); + TLegend *lege = new TLegend(0.4,0.6,0.89,0.89); + //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p"); + //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p"); + //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p"); + //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p"); + lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p"); + lege->Draw("same"); + + ////////////////////// + // Input + ////////////////////// + + TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800); + chsSparseMCein->cd(1); + Double_t nbGamma = 0.0; + source = 1; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries(); + histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+0]->Draw(); + TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89); + leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p"); + Double_t nbPi0 = 0.0; + source = 2; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries(); + histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+0]->Draw("same"); + leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p"); + Double_t nbEta = 0.0; + source = 3; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + nbEta = histopassedcuts[source*nbcuts+0]->GetEntries(); + histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+0]->Draw("same"); + leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p"); + Double_t nbC = 0.0; + source = 4; + if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + nbC = histopassedcuts[source*nbcuts+0]->GetEntries(); + histopassedcuts[source*nbcuts+0]->SetStats(0); + histopassedcuts[source*nbcuts+0]->Draw("same"); + leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p"); + leginput->Draw("same"); + + //printf("Gamma %f, pi^{0} %f and #eta %f, c %f\n",nbGamma,nbPi0,nbEta,nbC); + + ////////////////////// + // Tracked + ////////////////////// + + TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800); + cTracked->cd(1); + source = 1; + if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + histopassedcuts[source*nbcuts+1]->Draw(); + TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89); + legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p"); + source = 2; + if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) { + delete [] histopassedcuts; + delete [] nbEntriesCuts; + return; + } + histopassedcuts[source*nbcuts+1]->Draw("same"); + legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p"); + legTracked->Draw("same"); + + delete [] histopassedcuts; + delete [] nbEntriesCuts; + } //_____________________________________________________________________________ Double_t AliHFEelecbackground::BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/)