1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
17 // First implementation of a class
18 // to reject tagged electron coming from conversion, pi0 and eta
19 // by calculating the e+e- invariant mass
20 // of the tagged electron with other tracks
21 // after looser cuts for the partner.
22 // PostProcess should extract the background yield
23 // If running with MC, it can be compared to the expected background yield
26 // Raphaelle Bailhache <rbailhache@ikf.uni-frankfurt.de > <R.Bailhache@gsi.de >
30 #include <THnSparse.h>
31 #include <TParticle.h>
44 #include <AliESDEvent.h>
45 #include <AliAODEvent.h>
46 #include <AliESDtrack.h>
47 #include <AliAODTrack.h>
48 #include "AliHFEelecbackground.h"
49 #include <AliMCEvent.h>
51 #include <AliKFParticle.h>
52 #include "AliCFContainer.h"
53 #include "AliHFEpid.h"
54 #include "AliESDpid.h"
56 #include "AliITSPIDResponse.h"
57 #include "AliTPCPIDResponse.h"
59 ClassImp(AliHFEelecbackground)
61 Bool_t AliHFEelecbackground::fgUseMCPID = kFALSE;
62 const Double_t AliHFEelecbackground::fgkMe = 0.00051099892;
64 //___________________________________________________________________________________________
65 AliHFEelecbackground::AliHFEelecbackground():
85 ,fIsSplittedTrack(kFALSE)
86 ,fOpeningAngleCut(0.35)
88 ,fChi2NdfCut(999999999.0)
90 ,fSharedClusterCut(kFALSE)
91 ,fRequireITSStandalone(0)
96 ,fPIDMethodPartner(0x0)
97 ,fPIDMethodPartnerITS(0x0)
100 ,fListPostProcess(0x0)
103 // Default constructor
105 for(Int_t k =0; k < 10; k++) {
111 //_______________________________________________________________________________________________
112 AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p):
121 ,fkVertex(p.fkVertex)
133 ,fIsSplittedTrack(kFALSE)
134 ,fOpeningAngleCut(0.35)
136 ,fChi2NdfCut(999999999.0)
137 ,fUseAliKFCode(kTRUE)
138 ,fSharedClusterCut(kFALSE)
139 ,fRequireITSStandalone(0)
144 ,fPIDMethodPartner(0x0)
145 ,fPIDMethodPartnerITS(0x0)
148 ,fListPostProcess(0x0)
153 for(Int_t k =0; k < 10; k++) {
158 //_______________________________________________________________________________________________
159 AliHFEelecbackground&
160 AliHFEelecbackground::operator=(const AliHFEelecbackground &)
163 // Assignment operator
166 AliInfo("Not yet implemented.");
170 //_______________________________________________________________________________________________
171 AliHFEelecbackground::~AliHFEelecbackground()
176 if(fPIDMethodPartner) delete fPIDMethodPartner;
177 if(fPIDMethodPartnerITS) delete fPIDMethodPartnerITS;
184 if(fListPostProcess){
185 fListPostProcess->Clear();
186 delete fListPostProcess;
189 //___________________________________________________________________________________________
190 Bool_t AliHFEelecbackground::Load(const Char_t * filename)
193 // Generic container loader
196 if(!TFile::Open(filename)){
200 if(!(o = (TList*)gFile->Get("Results"))){
204 if(!(oe = (TList*)dynamic_cast<TList *>(o->FindObject("HFEelecbackground")))){
207 fList = (TList*)oe->Clone("HFEelecbackground");
211 //___________________________________________________________________________________________
212 Bool_t AliHFEelecbackground::Load(TList * const outputlist)
215 // Generic container loader
217 if(!outputlist) return kFALSE;
218 else fList = (TList*)outputlist->Clone("HFEelecbackground");
221 //_______________________________________________________________________________________________
222 void AliHFEelecbackground::Reset()
238 fIsSplittedTrack = kFALSE;
239 for(Int_t id = 0; id < 10; id++) {
244 //_______________________________________________________________________________________________
245 void AliHFEelecbackground::CreateHistograms(TList * const qaList)
253 fList->SetName("HFEelecbackground");
259 const Int_t nBinsPt = 25;
260 Double_t minPt = 0.01;
261 Double_t maxPt = 10.0;
263 const Int_t nBinsPtMore = 100;
264 Double_t minPtMore = 0.01;
265 Double_t maxPtMore = 10.0;
267 const Int_t nBinsInv = 50;
268 Double_t minInv = 0.0;
269 Double_t maxInv = 0.2;
271 const Int_t nBinsOp = 50;
272 Double_t minOp = 0.0;
275 const Int_t nBinsCh = 4;
276 Double_t minCh = 0.0;
277 Double_t maxCh = 4.0;
279 Double_t binLimLogPt[nBinsPt+1];
280 Double_t binLimPt[nBinsPt+1];
281 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 ;
282 for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
284 Double_t binLimLogPtMore[nBinsPtMore+1];
285 Double_t binLimPtMore[nBinsPtMore+1];
286 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 ;
287 for(Int_t i=0; i<=nBinsPtMore; i++) binLimPtMore[i]=(Double_t)TMath::Power(10,binLimLogPtMore[i]);
289 Double_t binLimInv[nBinsInv+1];
290 for(Int_t i=0; i<=nBinsInv; i++) binLimInv[i]=(Double_t)minInv + (maxInv-minInv) /nBinsInv*(Double_t)i ;
292 Double_t binLimOp[nBinsOp+1];
293 for(Int_t i=0; i<=nBinsOp; i++) binLimOp[i]=(Double_t)minOp + (maxOp-minOp) /nBinsOp*(Double_t)i ;
295 Double_t binLimCh[nBinsCh+1];
296 for(Int_t i=0; i<=nBinsCh; i++) binLimCh[i]=(Double_t)minCh + (maxCh-minCh) /nBinsCh*(Double_t)i ;
298 const Int_t nvarData = 5;
299 // pt reconstructed tagged e
300 // pt reconstructed mother
303 // Data: charge (0-opposite sign, 1-like sign ++, 2-like sign --, 3-rotated tracks)
305 Int_t iBinData[nvarData];
309 iBinData[3]=nBinsInv;
313 // Opening angle and invariant mass
316 THnSparseF *hsSparseData = new THnSparseF("OpeningangleinvmassData","",nvarData,iBinData);
317 hsSparseData->SetBinEdges(0,&binLimPt[0]);
318 hsSparseData->SetBinEdges(1,&binLimPt[0]);
319 hsSparseData->SetBinEdges(2,&binLimOp[0]);
320 hsSparseData->SetBinEdges(3,&binLimInv[0]);
321 hsSparseData->SetBinEdges(4,&binLimCh[0]);
322 hsSparseData->Sumw2();
324 fList->AddAt(hsSparseData,kDatai);
327 // Radius, DCA and Chi2Ndf
330 TH1F *dataRadiusHisto = new TH1F("DataRadius","", 200, 0.0, 200.0); // recontructed radius from the AliKF of the e+e- pair
331 fList->AddAt(dataRadiusHisto,kDatar);
333 TH1F *dataDcaHisto = new TH1F("DataDCA","", 100, 0.0, 6.0); // dca distribution
334 fList->AddAt(dataDcaHisto,kDatadca);
336 TH1F *dataChi2NdfHisto = new TH1F("DataChi2Ndf","", 100, 0.0, 5.0); // chi2Ndf distribution
337 fList->AddAt(dataChi2NdfHisto,kDatachi2Ndf);
343 // Opening angle and invariant mass with MC infos
346 const Int_t nvarMCo = 6;
347 // pt reconstructed tagged e
348 // pt reconstructed mother
351 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
352 // MCSplitted: 0-not, 1-splittedOs, 2-ksplittedSs
355 const Int_t nBinsMCOrigin = 6;
356 Double_t minMCOrigin = 0.0;
357 Double_t maxMCOrigin = 6.0;
359 Double_t binLimMCOrigin[nBinsMCOrigin+1];
360 for(Int_t i=0; i<=nBinsMCOrigin; i++) binLimMCOrigin[i]=(Double_t)minMCOrigin + (maxMCOrigin-minMCOrigin) /nBinsMCOrigin*(Double_t)i ;
362 const Int_t nBinsMCSplitted = 3;
363 Double_t minMCSplitted = 0.0;
364 Double_t maxMCSplitted = 3.0;
366 Double_t binLimMCSplitted[nBinsMCSplitted+1];
367 for(Int_t i=0; i<=nBinsMCSplitted; i++) binLimMCSplitted[i]=(Double_t)minMCSplitted + (maxMCSplitted-minMCSplitted) /nBinsMCSplitted*(Double_t)i ;
369 Int_t iBinMCo[nvarMCo];
374 iBinMCo[4]=nBinsMCOrigin;
375 iBinMCo[5]=nBinsMCSplitted;
377 THnSparseF *hsSparseMCo = new THnSparseF("OpeningangleinvmassMC","",nvarMCo,iBinMCo);
378 hsSparseMCo->SetBinEdges(0,&binLimPt[0]);
379 hsSparseMCo->SetBinEdges(1,&binLimPt[0]);
380 hsSparseMCo->SetBinEdges(2,&binLimOp[0]);
381 hsSparseMCo->SetBinEdges(3,&binLimInv[0]);
382 hsSparseMCo->SetBinEdges(4,&binLimMCOrigin[0]);
383 hsSparseMCo->SetBinEdges(5,&binLimMCSplitted[0]);
384 hsSparseMCo->Sumw2();
386 fList->AddAt(hsSparseMCo,kMCo);
389 // Radius, DCA and Chi2Ndf with MC info
392 TH2F *mcRadiusHisto = new TH2F("MCRadius","", 200, 0.0, 200.0,6,-0.5,5.5); // recontructed radius from the AliKF of the e+e- pair
393 fList->AddAt(mcRadiusHisto,kMCr);
395 TH2F *mcDcaHisto = new TH2F("MCDCA","", 100, 0.0, 6.0,6,-0.5,5.5); // dca distribution
396 fList->AddAt(mcDcaHisto,kMCdca);
398 TH2F *mcChi2NdfHisto = new TH2F("MCChi2Ndf","", 100, 0.0, 5.0,6,-0.5,5.5); // chi2Ndf distribution
399 fList->AddAt(mcChi2NdfHisto,kMCchi2Ndf);
401 //////////////////////////////////////////////////////////
402 // if fDebugLevel 1: Rejection efficiencies of the cuts
403 //////////////////////////////////////////////////////////
405 if(fDebugLevel > 0) {
409 const Int_t nvarMCe = 3;
410 // pt reconstructed tagged e
411 // 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
412 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
414 const Int_t nBinsMCCutPassed = 10;
415 Double_t minMCCutPassed = -0.5;
416 Double_t maxMCCutPassed = 9.5;
418 Double_t binLimMCCutPassed[nBinsMCCutPassed+1];
419 for(Int_t i=0; i<=nBinsMCCutPassed; i++) binLimMCCutPassed[i]=(Double_t)minMCCutPassed + (maxMCCutPassed-minMCCutPassed) /nBinsMCCutPassed*(Double_t)i ;
421 Int_t iBinMCe[nvarMCe];
423 iBinMCe[1]=nBinsMCCutPassed;
424 iBinMCe[2]=nBinsMCOrigin;
426 THnSparseF *hsSparseMCe = new THnSparseF("CutPassedMC","",nvarMCe,iBinMCe);
427 hsSparseMCe->SetBinEdges(0,&binLimPt[0]);
428 hsSparseMCe->SetBinEdges(1,&binLimMCCutPassed[0]);
429 hsSparseMCe->SetBinEdges(2,&binLimMCOrigin[0]);
430 hsSparseMCe->Sumw2();
432 fList->AddAt(hsSparseMCe,kMCe);
437 /////////////////////////////////////////////////////////////////
438 // if fDebugLevel 1: PIDPartCut and ShareClusters
439 /////////////////////////////////////////////////////////////////
441 if(fDebugLevel > 1) {
443 if(!fRequireITSStandalone){
449 TH2F *tpcPartner0 = new TH2F("TPCPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
450 fList->AddAt(tpcPartner0,kMCcutPart0);
451 TH2F *tpcPartner1 = new TH2F("TPCPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
452 fList->AddAt(tpcPartner1,kMCcutPart1);
461 TH2F *itsPartner0 = new TH2F("ITSPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
462 fList->AddAt(itsPartner0,kMCcutPart0);
463 TH2F *itsPartner1 = new TH2F("ITSPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
464 fList->AddAt(itsPartner1,kMCcutPart1);
466 /////////////////////////////////////////////////////
467 // dEdx of the four layers for the track partner
468 /////////////////////////////////////////////////////
469 const Int_t nvarITSsignal = 5;
471 const Int_t nBinsITSsignal = 100;
472 Double_t minITSsignal = 0.0;
473 Double_t maxITSsignal = 350.0;
475 Double_t binLimITSsignal[nBinsITSsignal+1];
476 for(Int_t i=0; i<=nBinsITSsignal; i++) binLimITSsignal[i]=(Double_t)minITSsignal + (maxITSsignal-minITSsignal) /nBinsITSsignal*(Double_t)i ;
478 Int_t iBinITSsignal[nvarITSsignal];
479 iBinITSsignal[0]=nBinsPt;
480 iBinITSsignal[1]=nBinsITSsignal;
481 iBinITSsignal[2]=nBinsITSsignal;
482 iBinITSsignal[3]=nBinsITSsignal;
483 iBinITSsignal[4]=nBinsITSsignal;
485 THnSparseF *hsSparseITSpid = new THnSparseF("SparseITSsignal","",nvarITSsignal,iBinITSsignal);
486 hsSparseITSpid->SetBinEdges(0,&binLimPt[0]);
487 hsSparseITSpid->SetBinEdges(1,&binLimITSsignal[0]);
488 hsSparseITSpid->SetBinEdges(2,&binLimITSsignal[0]);
489 hsSparseITSpid->SetBinEdges(3,&binLimITSsignal[0]);
490 hsSparseITSpid->SetBinEdges(4,&binLimITSsignal[0]);
491 hsSparseITSpid->Sumw2();
493 fList->AddAt(hsSparseITSpid,kMCcutPart2);
495 ///////////////////////////////////////////////////////////////////////////////////////
496 // dEdx of the four layers for the track partner and track to reject splitted track
497 ///////////////////////////////////////////////////////////////////////////////////////
498 const Int_t nvarITSsignalSplit = 5;
500 const Int_t nBinsITSSplit = 2;
501 Double_t minITSSplit = 0.0;
502 Double_t maxITSSplit = 2.0;
504 Double_t binLimITSSplit[nBinsITSSplit+1];
505 for(Int_t i=0; i<=nBinsITSSplit; i++) binLimITSSplit[i]=(Double_t)minITSSplit + (maxITSSplit-minITSSplit) /nBinsITSSplit*(Double_t)i ;
508 const Int_t nBinsITSsignalSplit = 50;
509 Double_t minITSsignalSplit = -25.0;
510 Double_t maxITSsignalSplit = 25.0;
512 Double_t binLimITSsignalSplit[nBinsITSsignalSplit+1];
513 for(Int_t i=0; i<=nBinsITSsignalSplit; i++) binLimITSsignalSplit[i]=(Double_t)minITSsignalSplit + (maxITSsignalSplit-minITSsignalSplit) /nBinsITSsignalSplit*(Double_t)i ;
515 Int_t iBinITSsignalSplit[nvarITSsignalSplit];
516 iBinITSsignalSplit[0]=nBinsITSSplit;
517 for(Int_t k = 1; k < 5; k++){
518 iBinITSsignalSplit[k]=nBinsITSsignalSplit;
521 THnSparseF *hsSparseITSpidSplit = new THnSparseF("SparseITSsignalSplit","",nvarITSsignalSplit,iBinITSsignalSplit);
522 hsSparseITSpidSplit->SetBinEdges(0,&binLimITSSplit[0]);
523 for(Int_t k = 1; k < 5; k++) {
524 hsSparseITSpidSplit->SetBinEdges(k,&binLimITSsignalSplit[0]);
526 hsSparseITSpidSplit->Sumw2();
528 fList->AddAt(hsSparseITSpidSplit,kMCcutPart3);
536 //qaList->Add(fList);
539 //_______________________________________________________________________________________________
540 void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackPart)
543 // calculate (tagged e-partner) dca, opening angle, invariant mass
546 /////////////////////
548 //////////////////////
551 track->PxPyPz(&pxyz[0]);
552 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
553 fPtESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]);
555 ////////////////////////
557 ////////////////////////
558 Int_t indexTrack = TMath::Abs(track->GetLabel());
559 Int_t indexTrackPart = TMath::Abs(trackPart->GetLabel());
561 /////////////////////////
563 ////////////////////////
567 // Take info track if not already done
568 if(indexTrack!= fIndexTrack) {
570 for(Int_t id = 0; id < 10; id++) {
574 fIsFrom = kElectronFromBackground;
576 fPdg = GetPdg(indexTrack);
577 fLabMother = GetLabMother(indexTrack);
579 fMotherGamma = IsMotherGamma(indexTrack);
580 if((fMotherGamma != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromGamma;
581 fMotherPi0 = IsMotherPi0(indexTrack);
582 if((fMotherPi0 != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromPi0;
583 fMotherC = IsMotherC(indexTrack);
584 if((fMotherC != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromC;
585 fMotherB = IsMotherB(indexTrack);
586 if((fMotherB != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromB;
587 fMotherEta = IsMotherEta(indexTrack);
588 if((fMotherEta != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromEta;
590 fIndexTrack = indexTrack;
596 if(TMath::Abs(fPdg) != 11) return;
601 Int_t pdgPart = GetPdg(indexTrackPart);
602 if(TMath::Abs(pdgPart) == 11) {
603 Int_t labMotherPart = GetLabMother(indexTrackPart);
604 if((labMotherPart == fLabMother) && (indexTrack != indexTrackPart) && (TMath::Abs(fPdg) == 11) && (fPdg*pdgPart < 0) && (fLabMother >=0) && (fLabMother < (((AliStack *)fMCEvent->Stack())->GetNtrack()))) fIsPartner = kTRUE;
605 // special case of c and b
606 Int_t motherCPart = IsMotherC(indexTrackPart);
607 if((motherCPart != -1) && (fIsFrom == kElectronFromC) && (fPdg*pdgPart < 0)){
610 Int_t motherBPart = IsMotherB(indexTrackPart);
611 if((motherBPart != -1) && (fIsFrom == kElectronFromB) && (fPdg*pdgPart < 0)){
616 // Look at splitted tracks
617 fIsSplittedTrack = kFALSE;
618 if(indexTrackPart == fIndexTrack) fIsSplittedTrack = kTRUE;
622 //////////////////////
624 /////////////////////
626 if((track->Charge() > 0.0) && (trackPart->Charge() > 0.0)) sign = kPp;
627 if((track->Charge() < 0.0) && (trackPart->Charge() < 0.0)) sign = kNn;
628 if(((track->Charge() > 0.0) && (trackPart->Charge() < 0.0)) || ((track->Charge() < 0.0) && (trackPart->Charge() > 0.0))) sign = kOs;
630 /////////////////////////
632 ////////////////////////
633 Double_t cuteffect[3];
635 if(fDebugLevel > 0) {
637 cuteffect[0] = fPtESD;
639 cuteffect[2] = fIsFrom;
641 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
642 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
649 ///////////////////////////////
650 // Cut effect: Partner track
651 ///////////////////////////////
653 if(fDebugLevel > 0) {
654 if(HasMCData() && fIsPartner) {
657 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
658 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
664 ///////////////////////////////
665 // Cut effect: Opposite sign
666 ///////////////////////////////
668 if(fDebugLevel > 0) {
669 if(HasMCData() && fIsPartner && (sign == kOs)) {
672 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
673 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
679 ////////////////////////
681 ////////////////////////
682 if(!SingleTrackCut(trackPart)) return;
684 if(fDebugLevel > 0) {
685 if(HasMCData() && fIsPartner && (sign==kOs)) {
688 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
689 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
695 /////////////////////////
696 // shared clusters cut
697 /////////////////////////
698 if(fSharedClusterCut && ShareCluster(track,trackPart)) return;
700 if(fDebugLevel > 0) {
701 if(HasMCData() && fIsPartner && (sign==kOs)) {
704 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
705 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
711 ////////////////////////
713 ////////////////////////
714 if(!PIDTrackCut(trackPart)) return;
716 if(fDebugLevel > 0) {
717 if(HasMCData() && fIsPartner && (sign==kOs)) {
720 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
721 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
728 //////////////////////
730 /////////////////////
733 Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp);
734 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatadca)))) fhtmpp->Fill(dca);
736 //printf("has MC data for DCA\n");
737 //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom);
738 if(fIsFrom==kElectronFromBackground) {
739 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
743 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
748 if(TMath::Abs(dca) > 3.0) return;
750 if(fDebugLevel > 0) {
751 if(HasMCData() && fIsPartner && (sign==kOs)) {
754 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
755 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
761 ///////////////////////////////////
762 // Calcul mother variables
763 ///////////////////////////////////
765 Double_t resultsr[5];
770 /////////////////////////////
772 ////////////////////////////
774 Double_t norradius = TMath::Sqrt(fkVertex->GetX()*fkVertex->GetX()+fkVertex->GetY()*fkVertex->GetY());
776 AliESDtrack *trackCopy = new AliESDtrack(*track);
777 AliESDtrack *trackPartCopy = new AliESDtrack(*trackPart);
778 Bool_t propagateok = kTRUE;
779 if((!(trackPartCopy->PropagateTo(norradius,fBz))) || (!(trackCopy->PropagateTo(norradius,fBz)))) propagateok = kFALSE;
781 if(trackCopy) delete trackCopy;
782 if(trackPartCopy) delete trackPartCopy;
786 CalculateMotherVariable(trackCopy,trackPartCopy,&results[0]);
787 CalculateMotherVariableR(trackCopy,trackPartCopy,&resultsr[0]);
789 if(trackCopy) delete trackCopy;
790 if(trackPartCopy) delete trackPartCopy;
795 if(!CalculateMotherVariable(track,trackPart,&results[0])) return;
796 if(fDebugLevel > 0) {
797 if(HasMCData() && fIsPartner && (sign==kOs)) {
800 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
801 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
809 /////////////////////////////////////
811 /////////////////////////////////////
813 FillOutput(results, resultsr, sign);
815 if(fDebugLevel > 0) {
816 if(HasMCData() && fIsPartner && (sign==kOs)) {
818 if(TMath::Abs(results[4]) < fOpeningAngleCut) {
822 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
823 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
826 if(TMath::Abs(results[1]) < fInvMassCut) {
829 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
830 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
840 //_____________________________________________________________________________________
841 Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
844 // variables mother and take the pt of the track
846 // results contain: ptmother, invmass, etamother, phimother, openingangle
848 // with a chi2Ndf cut for AliKF code
857 track->PxPyPz(&pxyz[0]);
858 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
860 Double_t pxyzpart[3];
861 trackpart->PxPyPz(&pxyzpart[0]);
862 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
865 TVector3 motherrec = v3Dtagged + v3Dpart;
867 Double_t etaESDmother = motherrec.Eta();
868 Double_t ptESDmother = motherrec.Pt();
869 Double_t phiESDmother = motherrec.Phi();
870 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
873 // openinganglepropagated
874 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
877 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
878 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
881 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
882 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
884 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
886 if(!results) return kFALSE;
888 results[0] = ptESDmother;
889 results[1] = etaESDmother;
890 results[2] = phiESDmother;
891 results[3] = invmass;
892 results[4] = openingangle;
904 if(track->Charge() > 0.0) pid1 = 11;
906 if(trackpart->Charge() > 0.0) pid2 = 11;
910 AliKFParticle kf(*track,pid1);
911 AliKFParticle kfpart(*trackpart,pid2);
913 pair.AddDaughter(kf);
914 pair.AddDaughter(kfpart);
917 Double_t openingangle = kf.GetAngle(kfpart);
918 Double_t chi2ndf = pair.GetChi2()/pair.GetNDF();
919 //Double_t decayLength = pair.GetDecayLength();
920 Double_t radius = pair.GetR();
921 //Double_t masserror = pair.GetErrMass()>0?pair.GetErrMass()/pair.GetMass():1000000;
922 Double_t ptpair = pair.GetPt();
923 Double_t etapair = pair.GetEta();
924 Double_t phipair = pair.GetPhi();
925 Double_t masspair = pair.GetMass();
928 if(!results) return kFALSE;
931 results[1] = etapair;
932 results[2] = phipair;
933 results[3] = masspair;
934 results[4] = openingangle;
937 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf);
938 //if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
940 if(fIsFrom==kElectronFromBackground) {
941 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
945 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
949 if(chi2ndf > fChi2NdfCut) return kFALSE;
951 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatar)))) fhtmpp->Fill(radius);
952 //if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
954 if(fIsFrom==kElectronFromBackground) {
955 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
956 //if(fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
960 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
970 //_____________________________________________________________________________________
971 void AliHFEelecbackground::CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
976 // results contain: ptmother, invmass, etamother, phimother, openingangle
977 // Implemented only for no AliKF
986 track->PxPyPz(&pxyz[0]);
987 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
988 Double_t pxyzpart[3];
989 trackpart->PxPyPz(&pxyzpart[0]);
990 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
992 // rotate the partner
993 v3Dpart.RotateZ(TMath::Pi());
994 v3Dpart.GetXYZ(pxyzpart);
997 TVector3 motherrec = v3Dtagged + v3Dpart;
999 Double_t etaESDmother = motherrec.Eta();
1000 Double_t ptESDmother = motherrec.Pt();
1001 Double_t phiESDmother = motherrec.Phi();
1002 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
1005 // openinganglepropagated
1006 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
1007 //printf("Openingangle %f\n",openingangle);
1010 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
1011 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
1013 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
1014 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
1016 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
1018 if(!results) return;
1020 results[0] = ptESDmother;
1021 results[1] = etaESDmother;
1022 results[2] = phiESDmother;
1023 results[3] = invmass;
1024 results[4] = openingangle;
1029 //_________________________________________________________________________________
1030 void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int_t sign)
1033 // Fill the Data and MC THnSparseF
1036 if((!results) || (!resultsr)) return;
1041 co[2] = TMath::Abs(results[4]);
1046 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1047 //if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1049 if((sign==kOs) && (!fUseAliKFCode)) {
1051 co[1] = resultsr[0];
1052 co[2] = TMath::Abs(resultsr[4]);
1053 co[3] = resultsr[3];
1057 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1058 //if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1066 co[2] = TMath::Abs(results[4]);
1070 co[4] = kElectronFromBackground;
1071 if((sign==kOs) && fIsPartner) co[4] = fIsFrom;
1074 co[5] = kNotSplitted;
1075 if(fIsSplittedTrack) {
1077 co[5] = kSplittedOs;
1080 co[5] = kSplittedSs;
1084 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCo)))) fhtmp->Fill(co);
1085 //if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
1090 //_______________________________________________________________________________________________
1091 Bool_t AliHFEelecbackground::SingleTrackCut(AliESDtrack* const trackPart) const
1094 // Return minimum quality for the partner
1097 if(trackPart->GetKinkIndex(0)>0) return kFALSE;
1100 UInt_t status = trackPart->GetStatus();
1102 if(fRequireITSStandalone > 0) {
1104 /////////////////////
1106 ////////////////////
1108 if(fRequireITSStandalone==1) {
1109 if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit)==0))) return kFALSE;
1112 if(fRequireITSStandalone==2) {
1113 if(!trackPart->IsPureITSStandalone() || ((status&AliESDtrack::kITSrefit)==0)) return kFALSE;
1117 Double_t chi2 = trackPart->GetITSchi2();
1118 if(chi2 > fMinITSChi2) return kFALSE;
1120 // Min Nb of clusters
1121 Int_t nbcl = trackPart->GetITSclusters(0);
1122 if(nbcl < fMinNbCls) return kFALSE;
1124 // Min Nb of points in SDD and SPD
1126 for(Int_t layer = 0; layer < 4; layer++){
1127 if(trackPart->HasPointOnITSLayer(layer)) nbSDDSPD++;
1129 if(nbSDDSPD < fMinNbClsSDDSPD) return kFALSE;
1139 if((status&AliESDtrack::kTPCrefit)==0) return kFALSE;
1141 // Min Nb of clusters
1142 Int_t nbcl = trackPart->GetTPCclusters(0);
1143 if(nbcl < fMinNbCls) return kFALSE;
1150 //_______________________________________________________________________________________________
1151 Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
1154 // PID for the partner using TPC or ITS
1157 if(fRequireITSStandalone > 0) {
1159 /////////////////////
1161 ////////////////////
1164 Double_t itsSignal = trackPart->GetITSsignal();
1165 Double_t p = trackPart->P();
1167 if(fDebugLevel > 1) {
1168 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal);
1169 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
1177 // Take signal trackPart
1178 Double_t dEdxSamplesPart[4];
1179 trackPart->GetITSdEdxSamples(dEdxSamplesPart);
1182 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1183 Float_t nsigma = fPIDMethodPartnerITS->NumberOfSigmasITS(trackPart, AliPID::kElectron);
1184 if(TMath::Abs(nsigma) > 2.0) return kFALSE;
1187 if(fDebugLevel > 1) {
1189 Double_t entries[5];
1191 entries[1] = dEdxSamplesPart[0];
1192 entries[2] = dEdxSamplesPart[1];
1193 entries[3] = dEdxSamplesPart[2];
1194 entries[4] = dEdxSamplesPart[3];
1196 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
1197 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal);
1198 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))) fhtmp->Fill(entries);
1199 //if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
1212 Double_t tpcSignal = trackPart->GetTPCsignal();
1213 Double_t p = trackPart->GetInnerParam() ? trackPart->GetInnerParam()->P() : trackPart->P();
1215 if(fDebugLevel > 1) {
1216 //printf("tpcSignal %f\n",tpcSignal);
1217 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
1218 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal);
1223 if(!fPIDMethodPartner) return kFALSE;
1224 AliHFEpidObject hfetrack;
1225 hfetrack.fAnalysisType = AliHFEpidObject::kESDanalysis;
1226 hfetrack.fRecTrack = trackPart;
1227 //if(HasMCData()) hfetrack.fMCtrack = mctrack;
1228 if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE;
1230 if(fDebugLevel > 1) {
1231 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal);
1232 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
1241 //__________________________________________________________________________________________
1242 Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2)
1245 // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method
1248 // hsfval: number of shared clusters
1249 // hsmval: quality of the tracks
1252 // compare the dEdx in the ITS
1255 if(!fRequireITSStandalone) {
1265 Float_t hsmval = 0.0;
1266 Float_t hsfval = 0.0;
1268 for(unsigned int imap=0;imap<track1->GetTPCClusterMap().GetNbits(); imap++) {
1269 if(track1->GetTPCClusterMap().TestBitNumber(imap) &&
1270 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1271 // Do they share it ?
1272 if (track1->GetTPCSharedMap().TestBitNumber(imap) &&
1273 track2->GetTPCSharedMap().TestBitNumber(imap))
1284 else if (track1->GetTPCClusterMap().TestBitNumber(imap) ||
1285 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1297 if((hsfval > 0.15) || (hsmval > -0.15)) return kTRUE; //they share cluster
1310 Double_t dEdxSamples1[4];
1311 track1->GetITSdEdxSamples(dEdxSamples1);
1312 Double_t dEdxSamples2[4];
1313 track2->GetITSdEdxSamples(dEdxSamples2);
1315 // If there are matching
1316 Int_t nbClusters = 0;
1317 Bool_t match[4] = {kTRUE,kTRUE,kTRUE,kTRUE};
1318 Double_t limit[4] = {1.5,1.5,1.5,1.5};
1319 for(Int_t layer = 0; layer < 4; layer++) {
1320 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1321 if(TMath::Abs(dEdxSamples1[layer]-dEdxSamples2[layer])>limit[layer]) match[layer] = kFALSE;
1325 //printf("nbClusters %d\n",nbClusters);
1328 if(fDebugLevel > 1) {
1329 Double_t entriesSplit[5];
1330 entriesSplit[0] = 0.0;
1331 if(fIsSplittedTrack) entriesSplit[0] = 1.0;
1333 for(Int_t layer = 0; layer < 4; layer++) {
1334 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1335 entriesSplit[layer+1] = dEdxSamples1[layer]-dEdxSamples2[layer];
1337 else entriesSplit[layer+1] = -100.0;
1339 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit);
1340 //if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
1344 Int_t nbClustersNotClose = 0;
1345 for(Int_t layer = 0; layer < 4; layer++) {
1346 if(!match[layer]) nbClustersNotClose++;
1348 if((nbClusters > 1) && (nbClustersNotClose > 0.75*nbClusters)) return kFALSE;
1354 //____________________________________________________________________________________________________________
1355 void AliHFEelecbackground::SetPIDPartner() {
1358 // Init the stuff for PID on the partner track
1361 fPIDPartner = kTRUE;
1363 if(fRequireITSStandalone == 0) {
1365 if(!fPIDMethodPartner) {
1366 fPIDMethodPartner = new AliHFEpid();
1367 fPIDMethodPartner->InitializePID("Strategy1"); // 3 sigma cut in TPC
1373 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1378 //______________________________________________________________________________________________
1379 void AliHFEelecbackground::SetEvent(AliESDEvent* const ESD)
1382 // Set the AliESD Event, the magnetic field and the primary vertex
1386 fBz=fESD1->GetMagneticField();
1387 fkVertex = fESD1->GetPrimaryVertex();
1390 //____________________________________________________________________________________________________________
1391 Int_t AliHFEelecbackground::IsMotherGamma(Int_t tr) {
1394 // Return the lab of gamma mother or -1 if not gamma
1397 AliStack* stack = fMCEvent->Stack();
1398 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1401 TParticle * particle = stack->Particle(tr);
1402 if(!particle) return -1;
1403 Int_t imother = particle->GetFirstMother();
1404 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1405 TParticle * mother = stack->Particle(imother);
1406 if(!mother) return -1;
1409 Int_t pdg = mother->GetPdgCode();
1410 if(TMath::Abs(pdg) == 22) return imother;
1411 if(TMath::Abs(pdg) == 11) {
1412 return IsMotherGamma(imother);
1418 //____________________________________________________________________________________________________________
1419 Int_t AliHFEelecbackground::IsMotherPi0(Int_t tr) {
1422 // Return the lab of pi0 mother or -1 if not pi0
1425 AliStack* stack = fMCEvent->Stack();
1426 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1429 TParticle * particle = stack->Particle(tr);
1430 if(!particle) return -1;
1431 Int_t imother = particle->GetFirstMother();
1432 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1433 TParticle * mother = stack->Particle(imother);
1434 if(!mother) return -1;
1437 Int_t pdg = mother->GetPdgCode();
1438 if(TMath::Abs(pdg) == 111) return imother;
1439 if(TMath::Abs(pdg) == 11) {
1440 return IsMotherPi0(imother);
1445 //____________________________________________________________________________________________________________
1446 Int_t AliHFEelecbackground::IsMotherEta(Int_t tr) {
1449 // Return the lab of pi0 mother or -1 if not pi0
1452 AliStack* stack = fMCEvent->Stack();
1453 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1456 TParticle * particle = stack->Particle(tr);
1457 if(!particle) return -1;
1458 Int_t imother = particle->GetFirstMother();
1459 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1460 TParticle * mother = stack->Particle(imother);
1461 if(!mother) return -1;
1464 Int_t pdg = mother->GetPdgCode();
1465 if(TMath::Abs(pdg) == 221) return imother;
1466 if(TMath::Abs(pdg) == 11) {
1467 return IsMotherEta(imother);
1472 //____________________________________________________________________________________________________________
1473 Int_t AliHFEelecbackground::IsMotherC(Int_t tr) {
1476 // Return the lab of signal mother or -1 if not signal
1479 AliStack* stack = fMCEvent->Stack();
1480 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1483 TParticle * particle = stack->Particle(tr);
1484 if(!particle) return -1;
1485 Int_t imother = particle->GetFirstMother();
1486 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1487 TParticle * mother = stack->Particle(imother);
1488 if(!mother) return -1;
1491 Int_t pdg = mother->GetPdgCode();
1492 if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
1493 if(TMath::Abs(pdg) == 11) {
1494 return IsMotherC(imother);
1499 //____________________________________________________________________________________________________________
1500 Int_t AliHFEelecbackground::IsMotherB(Int_t tr) {
1503 // Return the lab of signal mother or -1 if not signal
1506 AliStack* stack = fMCEvent->Stack();
1507 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1510 TParticle * particle = stack->Particle(tr);
1511 if(!particle) return -1;
1512 Int_t imother = particle->GetFirstMother();
1513 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1514 TParticle * mother = stack->Particle(imother);
1515 if(!mother) return -1;
1518 Int_t pdg = mother->GetPdgCode();
1519 if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
1520 if(TMath::Abs(pdg) == 11) {
1521 return IsMotherB(imother);
1526 //____________________________________________________________________________________________________________
1527 Int_t AliHFEelecbackground::GetPdg(Int_t tr) {
1533 AliStack* stack = fMCEvent->Stack();
1534 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1537 TParticle * particle = stack->Particle(tr);
1538 if(!particle) return -1;
1539 Int_t pdg = particle->GetPdgCode();
1544 //____________________________________________________________________________________________________________
1545 Int_t AliHFEelecbackground::GetLabMother(Int_t tr) {
1548 // Simply lab mother
1551 AliStack* stack = fMCEvent->Stack();
1552 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1555 TParticle * particle = stack->Particle(tr);
1556 if(!particle) return -1;
1557 Int_t imother = particle->GetFirstMother();
1562 //_______________________________________________________________________________________________
1563 void AliHFEelecbackground::PostProcess()
1566 // Post process the histos and extract the background pt spectra
1571 gStyle->SetPalette(1);
1572 gStyle->SetOptStat(1111);
1573 gStyle->SetPadBorderMode(0);
1574 gStyle->SetCanvasColor(10);
1575 gStyle->SetPadLeftMargin(0.13);
1576 gStyle->SetPadRightMargin(0.13);
1578 /////////////////////////
1579 // Take the THnSparseF
1580 /////////////////////////
1581 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1582 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1583 THnSparseF *hsSparseCutPassedMC = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
1585 /////////////////////////////////
1586 // Cuts on the opening angle
1587 ////////////////////////////////
1588 if(!hsSparseData) return;
1589 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1590 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1591 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1594 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
1595 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
1596 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
1599 /////////////////////////
1600 // Prepare the histos
1601 ////////////////////////
1603 TAxis *ptaxisinvmass = hsSparseData->GetAxis(3);
1604 Int_t nbinsptinvmass = ptaxisinvmass->GetNbins();
1606 TH1D **invmassosptproj = new TH1D*[nbinsptinvmass];
1607 TH1D **invmassssptproj = new TH1D*[nbinsptinvmass];
1608 TH1D **invmassrptproj = new TH1D*[nbinsptinvmass];
1609 TH1D **invmassdiffptproj = new TH1D*[nbinsptinvmass];
1610 TH1D **invmassgammaptproj = new TH1D*[nbinsptinvmass];
1611 TH1D **invmasspi0ptproj = new TH1D*[nbinsptinvmass];
1612 TH1D **invmassetaptproj = new TH1D*[nbinsptinvmass];
1613 TH1D **invmassCptproj = new TH1D*[nbinsptinvmass];
1614 TH1D **invmassBptproj = new TH1D*[nbinsptinvmass];
1616 TH1D *yieldPtFound = (TH1D *) hsSparseData->Projection(0);
1617 yieldPtFound->SetName("Found yield");
1618 yieldPtFound->Reset();
1620 TH1D *yieldPtSourcesMC = 0x0;
1621 TH1D *yieldPtSignalCutMC = 0x0;
1623 yieldPtSourcesMC = (TH1D *) hsSparseMC->Projection(0);
1624 yieldPtSourcesMC->SetName("Found yield");
1625 yieldPtSourcesMC->Reset();
1627 yieldPtSignalCutMC = (TH1D *) hsSparseMC->Projection(0);
1628 yieldPtSignalCutMC->SetName("Found yield");
1629 yieldPtSignalCutMC->Reset();
1635 Int_t nbrow = (Int_t) (nbinsptinvmass/5);
1636 TString namecanvas("InvMassSpectra");
1637 TCanvas * canvas =new TCanvas(namecanvas,namecanvas,800,800);
1638 canvas->Divide(5,nbrow+1);
1640 /////////////////////////////
1642 /////////////////////////////
1644 for(Int_t k=1; k <= nbinsptinvmass; k++){
1646 Double_t lowedge = ptaxisinvmass->GetBinLowEdge(k);
1647 Double_t upedge = ptaxisinvmass->GetBinUpEdge(k);
1650 hsSparseData->GetAxis(0)->SetRange(k,k);
1651 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(k,k);
1654 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1655 invmassosptproj[k-1] = hsSparseData->Projection(3);
1656 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1657 invmassssptproj[k-1] = hsSparseData->Projection(3);
1658 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1659 invmassrptproj[k-1] = hsSparseData->Projection(3);
1660 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1661 invmassgammaptproj[k-1] = 0x0;
1662 invmasspi0ptproj[k-1] = 0x0;
1663 invmassetaptproj[k-1] = 0x0;
1664 invmassCptproj[k-1] = 0x0;
1665 invmassBptproj[k-1] = 0x0;
1667 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1668 invmassgammaptproj[k-1] = hsSparseMC->Projection(3);
1669 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1670 invmasspi0ptproj[k-1] = hsSparseMC->Projection(3);
1671 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1672 invmassetaptproj[k-1] = hsSparseMC->Projection(3);
1673 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1674 invmassCptproj[k-1] = hsSparseMC->Projection(3);
1675 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1676 invmassBptproj[k-1] = hsSparseMC->Projection(3);
1677 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1680 invmassdiffptproj[k-1] = (TH1D *) invmassosptproj[k-1]->Clone();
1681 TString name("Invmassdiffptbin");
1683 invmassdiffptproj[k-1]->SetName(name);
1684 invmassdiffptproj[k-1]->Add(invmassssptproj[k-1],-1.0);
1686 TString namee("p_{T} tagged from ");
1688 namee += " GeV/c to ";
1692 invmassosptproj[k-1]->SetTitle((const char*)namee);
1693 invmassssptproj[k-1]->SetTitle((const char*)namee);
1694 invmassrptproj[k-1]->SetTitle((const char*)namee);
1695 invmassdiffptproj[k-1]->SetTitle((const char*)namee);
1696 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetTitle((const char*)namee);
1697 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetTitle((const char*)namee);
1698 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetTitle((const char*)namee);
1699 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetTitle((const char*)namee);
1700 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetTitle((const char*)namee);
1702 invmassosptproj[k-1]->SetStats(0);
1703 invmassssptproj[k-1]->SetStats(0);
1704 invmassrptproj[k-1]->SetStats(0);
1705 invmassdiffptproj[k-1]->SetStats(0);
1706 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetStats(0);
1707 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetStats(0);
1708 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetStats(0);
1709 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetStats(0);
1710 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetStats(0);
1712 Double_t yieldf = invmassdiffptproj[k-1]->Integral();
1713 if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) {
1714 Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral();
1715 if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg);
1717 Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral();
1718 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
1721 yieldPtFound->SetBinContent(k,yieldf);
1724 invmassosptproj[k-1]->Draw();
1725 invmassssptproj[k-1]->Draw("same");
1726 invmassdiffptproj[k-1]->Draw("same");
1727 invmassrptproj[k-1]->Draw("same");
1728 TLegend *legiv = new TLegend(0.4,0.6,0.89,0.89);
1729 legiv->AddEntry(invmassosptproj[k-1],"Opposite signs","p");
1730 legiv->AddEntry(invmassssptproj[k-1],"Same signs","p");
1731 legiv->AddEntry(invmassdiffptproj[k-1],"(Opposite - Same) signs","p");
1732 legiv->AddEntry(invmassrptproj[k-1],"rotated","p");
1733 if(invmassgammaptproj[k-1]) legiv->AddEntry(invmassgammaptproj[k-1],"e^{+}e^{-} from #gamma","p");
1734 if(invmasspi0ptproj[k-1]) legiv->AddEntry(invmasspi0ptproj[k-1],"e^{+}e^{-} from #pi^{0}","p");
1735 if(invmassetaptproj[k-1]) legiv->AddEntry(invmassetaptproj[k-1],"e^{+}e^{-} from #eta","p");
1736 legiv->Draw("same");
1738 hsSparseData->GetAxis(0)->SetRange(1,hsSparseData->GetAxis(0)->GetNbins());
1739 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(1,hsSparseMC->GetAxis(0)->GetNbins());
1743 ////////////////////////////////////////////////////
1744 // End of plotting: do subtraction of background
1745 ///////////////////////////////////////////////////
1747 yieldPtFound->SetStats(0);
1748 if(yieldPtSourcesMC) yieldPtSourcesMC->SetStats(0);
1749 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetStats(0);
1751 TCanvas * canvasfin =new TCanvas("ResultsElecBackGround","ResultsElecBackGround",800,800);
1753 yieldPtFound->Draw();
1754 if(yieldPtSourcesMC && yieldPtSignalCutMC) {
1755 yieldPtSourcesMC->Draw("same");
1756 yieldPtSignalCutMC->Draw("same");
1757 TLegend *lega = new TLegend(0.4,0.6,0.89,0.89);
1758 lega->AddEntry(yieldPtFound,"Contributions found","l");
1759 lega->AddEntry(yieldPtSourcesMC,"Contributions of e^{+}e^{-} from #gamma, #pi^{0} and #eta","l");
1760 lega->AddEntry(yieldPtSignalCutMC,"Contributions of e^{+}e^{-} from C and B","l");
1764 if(hsSparseCutPassedMC){
1765 hsSparseCutPassedMC->GetAxis(1)->SetRange(1,1);
1766 hsSparseCutPassedMC->GetAxis(2)->SetRange(1,4);
1767 TH1D *hsSparseCutPassedMCproj = hsSparseCutPassedMC->Projection(0);
1769 TH1D *cYieldPtFound = (TH1D*)yieldPtFound->Clone("RatioEfficiency");
1770 if(hsSparseCutPassedMCproj->Integral() > 0.0) cYieldPtFound->Divide(hsSparseCutPassedMCproj);
1772 TCanvas * canvasfratio =new TCanvas("RatioEfficiency","RatioEfficiency",800,800);
1773 canvasfratio->cd(1);
1774 cYieldPtFound->Draw();
1777 //////////////////////////
1779 /////////////////////////
1781 if(!fListPostProcess) fListPostProcess = new TList();
1782 fListPostProcess->SetName("ListPostProcess");
1784 for(Int_t k=0; k < nbinsptinvmass; k++){
1785 fListPostProcess->AddAt(invmassosptproj[k],kOos+kNOutput*k);
1786 fListPostProcess->AddAt(invmassssptproj[k],kOss+kNOutput*k);
1787 fListPostProcess->AddAt(invmassrptproj[k],kOr+kNOutput*k);
1788 fListPostProcess->AddAt(invmassdiffptproj[k],kOdiff+kNOutput*k);
1789 if(invmassgammaptproj[k]) fListPostProcess->AddAt(invmassgammaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromGamma);
1790 if(invmasspi0ptproj[k]) fListPostProcess->AddAt(invmasspi0ptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromPi0);
1791 if(invmassetaptproj[k]) fListPostProcess->AddAt(invmassetaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromEta);
1792 if(invmassCptproj[k]) fListPostProcess->AddAt(invmassCptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromC);
1793 if(invmassBptproj[k]) fListPostProcess->AddAt(invmassBptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromB);
1796 fListPostProcess->AddAt(yieldPtFound,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass);
1797 if(yieldPtSourcesMC) fListPostProcess->AddAt(yieldPtSourcesMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+1);
1798 if(yieldPtSignalCutMC) fListPostProcess->AddAt(yieldPtSignalCutMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+2);
1800 // delete dynamic array
1801 delete[] invmassosptproj;
1802 delete[] invmassssptproj;
1803 delete[] invmassrptproj;
1804 delete[] invmassdiffptproj;
1805 delete[] invmassgammaptproj;
1806 delete[] invmasspi0ptproj;
1807 delete[] invmassetaptproj;
1808 delete[] invmassCptproj;
1809 delete[] invmassBptproj;
1812 //_______________________________________________________________________________________________
1813 void AliHFEelecbackground::Plot() const
1821 gStyle->SetPalette(1);
1822 gStyle->SetOptStat(1111);
1823 gStyle->SetPadBorderMode(0);
1824 gStyle->SetCanvasColor(10);
1825 gStyle->SetPadLeftMargin(0.13);
1826 gStyle->SetPadRightMargin(0.13);
1829 /////////////////////////
1830 // Take the THnSparseF
1831 /////////////////////////
1832 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1833 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1834 if(!hsSparseData) return;
1836 ////////////////////
1838 ////////////////////
1840 // Opening angle one direction
1841 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1842 TH1D *openingangleppproj = hsSparseData->Projection(2);
1843 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1844 TH1D *openinganglennproj = hsSparseData->Projection(2);
1845 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1846 TH1D *openinganglessproj = hsSparseData->Projection(2);
1847 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1848 TH1D *openinganglerproj = hsSparseData->Projection(2);
1849 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1850 TH1D *openingangleosproj = hsSparseData->Projection(2);
1851 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1853 TH1D *openinganglegammaproj = 0x0;
1854 TH1D *openinganglepi0proj = 0x0;
1855 TH1D *openingangleCproj = 0x0;
1856 TH1D *openingangleBproj = 0x0;
1857 TH1D *openingangleetaproj = 0x0;
1858 TH1D *openingangleSplittedTrackssproj = 0x0;
1859 TH1D *openingangleSplittedTrackosproj = 0x0;
1861 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1862 openinganglegammaproj = hsSparseMC->Projection(2);
1863 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1864 openinganglepi0proj = hsSparseMC->Projection(2);
1865 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1866 openingangleetaproj = hsSparseMC->Projection(2);
1867 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1868 openingangleCproj = hsSparseMC->Projection(2);
1869 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1870 openingangleBproj = hsSparseMC->Projection(2);
1871 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1872 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1873 openingangleSplittedTrackssproj = hsSparseMC->Projection(2);
1874 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1875 openingangleSplittedTrackosproj = hsSparseMC->Projection(2);
1876 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1879 // Projection pt-opening angle
1880 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1881 TH2D *openingangleppproj2D = hsSparseData->Projection(0,2);
1882 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1883 TH2D *openinganglennproj2D = hsSparseData->Projection(0,2);
1884 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1885 TH2D *openinganglessproj2D = hsSparseData->Projection(0,2);
1886 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1887 TH2D *openinganglerproj2D = hsSparseData->Projection(0,2);
1888 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1889 TH2D *openingangleosproj2D = hsSparseData->Projection(0,2);
1890 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1892 TH2D *openinganglegammaproj2D = 0x0;
1893 TH2D *openinganglepi0proj2D = 0x0;
1894 TH2D *openingangleCproj2D = 0x0;
1895 TH2D *openingangleBproj2D = 0x0;
1896 TH2D *openingangleetaproj2D = 0x0;
1897 TH2D *openingangleSplittedTrackssproj2D = 0x0;
1898 TH2D *openingangleSplittedTrackosproj2D = 0x0;
1900 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1901 openinganglegammaproj2D = hsSparseMC->Projection(0,2);
1902 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1903 openinganglepi0proj2D = hsSparseMC->Projection(0,2);
1904 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1905 openingangleetaproj2D = hsSparseMC->Projection(0,2);
1906 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1907 openingangleCproj2D = hsSparseMC->Projection(0,2);
1908 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1909 openingangleBproj2D = hsSparseMC->Projection(0,2);
1910 hsSparseMC->GetAxis(4)->SetRange(1, hsSparseMC->GetAxis(4)->GetNbins());
1911 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1912 openingangleSplittedTrackssproj2D = hsSparseMC->Projection(0,2);
1913 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1914 openingangleSplittedTrackosproj2D = hsSparseMC->Projection(0,2);
1915 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1918 openingangleppproj2D->SetStats(0);
1919 openinganglennproj2D->SetStats(0);
1920 openinganglessproj2D->SetStats(0);
1921 openinganglerproj2D->SetStats(0);
1922 openingangleosproj2D->SetStats(0);
1923 if(openinganglegammaproj2D) openinganglegammaproj2D->SetStats(0);
1924 if(openinganglepi0proj2D) openinganglepi0proj2D->SetStats(0);
1925 if(openingangleCproj2D) openingangleCproj2D->SetStats(0);
1926 if(openingangleBproj2D) openingangleBproj2D->SetStats(0);
1927 if(openingangleetaproj2D) openingangleetaproj2D->SetStats(0);
1928 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetStats(0);
1929 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetStats(0);
1931 openingangleppproj2D->SetTitle("openingangleppproj2D");
1932 openinganglennproj2D->SetTitle("openinganglennproj2D");
1933 openinganglessproj2D->SetTitle("openinganglessproj2D");
1934 openinganglerproj2D->SetTitle("openinganglerproj2D");
1935 openingangleosproj2D->SetTitle("openingangleosproj2D");
1936 if(openinganglegammaproj2D) openinganglegammaproj2D->SetTitle("openinganglegammaproj2D");
1937 if(openinganglepi0proj2D) openinganglepi0proj2D->SetTitle("openinganglepi0proj2D");
1938 if(openingangleCproj2D) openingangleCproj2D->SetTitle("openingangleCproj2D");
1939 if(openingangleBproj2D) openingangleBproj2D->SetTitle("openingangleBproj2D");
1940 if(openingangleetaproj2D) openingangleetaproj2D->SetTitle("openingangleetaproj2D");
1941 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetTitle("openingangleSplittedTrackssproj2D");
1942 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetTitle("openingangleSplittedTrackosproj2D");
1944 openingangleppproj->SetStats(0);
1945 openinganglennproj->SetStats(0);
1946 openinganglessproj->SetStats(0);
1947 openinganglerproj->SetStats(0);
1948 openingangleosproj->SetStats(0);
1949 if(openinganglegammaproj) openinganglegammaproj->SetStats(0);
1950 if(openinganglepi0proj) openinganglepi0proj->SetStats(0);
1951 if(openingangleCproj) openingangleCproj->SetStats(0);
1952 if(openingangleBproj) openingangleBproj->SetStats(0);
1953 if(openingangleetaproj) openingangleetaproj->SetStats(0);
1954 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetStats(0);
1955 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetStats(0);
1957 openingangleppproj->SetTitle("");
1958 openinganglennproj->SetTitle("");
1959 openinganglessproj->SetTitle("");
1960 openinganglerproj->SetTitle("");
1961 openingangleosproj->SetTitle("");
1962 if(openinganglegammaproj) openinganglegammaproj->SetTitle("");
1963 if(openinganglepi0proj) openinganglepi0proj->SetTitle("");
1964 if(openingangleCproj) openingangleCproj->SetTitle("");
1965 if(openingangleBproj) openingangleBproj->SetTitle("");
1966 if(openingangleetaproj) openingangleetaproj->SetTitle("");
1967 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetTitle("");
1968 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetTitle("");
1970 ////////////////////////////
1972 ///////////////////////////
1974 // Cuts on the opening angle
1975 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1976 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1977 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1980 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseData\n",axisOpeningAngleData->GetBinLowEdge(binCutData),axisOpeningAngleData->GetBinUpEdge(binCutData));
1983 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1984 TH1D *invmassppproj = hsSparseData->Projection(3);
1985 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1986 TH1D *invmassnnproj = hsSparseData->Projection(3);
1987 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1988 TH1D *invmassssproj = hsSparseData->Projection(3);
1989 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1990 TH1D *invmassrproj = hsSparseData->Projection(3);
1991 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1992 TH1D *invmassosproj = hsSparseData->Projection(3);
1993 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1995 TH1D *invmassgammaproj = 0x0;
1996 TH1D *invmasspi0proj = 0x0;
1997 TH1D *invmassCproj = 0x0;
1998 TH1D *invmassBproj = 0x0;
1999 TH1D *invmassetaproj = 0x0;
2000 TH1D *invmassSplittedTrackssproj = 0x0;
2001 TH1D *invmassSplittedTrackosproj = 0x0;
2003 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
2004 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
2005 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
2008 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseMC\n",axisOpeningAngleMC->GetBinLowEdge(binCutMC),axisOpeningAngleMC->GetBinUpEdge(binCutMC));
2010 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2011 invmassgammaproj = hsSparseMC->Projection(3);
2012 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2013 invmasspi0proj = hsSparseMC->Projection(3);
2014 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2015 invmassetaproj = hsSparseMC->Projection(3);
2016 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2017 invmassCproj = hsSparseMC->Projection(3);
2018 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2019 invmassBproj = hsSparseMC->Projection(3);
2020 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2021 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2022 invmassSplittedTrackssproj = hsSparseMC->Projection(3);
2023 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2024 invmassSplittedTrackosproj = hsSparseMC->Projection(3);
2025 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2028 invmassppproj->SetStats(0);
2029 invmassnnproj->SetStats(0);
2030 invmassssproj->SetStats(0);
2031 invmassrproj->SetStats(0);
2032 invmassosproj->SetStats(0);
2033 if(invmassgammaproj) invmassgammaproj->SetStats(0);
2034 if(invmasspi0proj) invmasspi0proj->SetStats(0);
2035 if(invmassCproj) invmassCproj->SetStats(0);
2036 if(invmassBproj) invmassBproj->SetStats(0);
2037 if(invmassetaproj) invmassetaproj->SetStats(0);
2038 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetStats(0);
2039 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetStats(0);
2041 invmassppproj->SetTitle("");
2042 invmassnnproj->SetTitle("");
2043 invmassssproj->SetTitle("");
2044 invmassrproj->SetTitle("");
2045 invmassosproj->SetTitle("");
2046 if(invmassgammaproj) invmassgammaproj->SetTitle("");
2047 if(invmasspi0proj) invmasspi0proj->SetTitle("");
2048 if(invmassCproj) invmassCproj->SetTitle("");
2049 if(invmassBproj) invmassBproj->SetTitle("");
2050 if(invmassetaproj) invmassetaproj->SetTitle("");
2051 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetTitle("");
2052 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetTitle("");
2054 // Projection pt-invariant mass angle
2055 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
2056 TH2D *invmassppproj2D = hsSparseData->Projection(0,3);
2057 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
2058 TH2D *invmassnnproj2D = hsSparseData->Projection(0,3);
2059 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
2060 TH2D *invmassssproj2D = hsSparseData->Projection(0,3);
2061 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
2062 TH2D *invmassrproj2D = hsSparseData->Projection(0,3);
2063 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
2064 TH2D *invmassosproj2D = hsSparseData->Projection(0,3);
2065 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
2067 TH2D *invmassgammaproj2D = 0x0;
2068 TH2D *invmasspi0proj2D = 0x0;
2069 TH2D *invmassCproj2D = 0x0;
2070 TH2D *invmassBproj2D = 0x0;
2071 TH2D *invmassetaproj2D = 0x0;
2072 TH2D *invmassSplittedTrackssproj2D = 0x0;
2073 TH2D *invmassSplittedTrackosproj2D = 0x0;
2075 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2076 invmassgammaproj2D = hsSparseMC->Projection(0,3);
2077 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2078 invmasspi0proj2D = hsSparseMC->Projection(0,3);
2079 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2080 invmassetaproj2D = hsSparseMC->Projection(0,3);
2081 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2082 invmassCproj2D = hsSparseMC->Projection(0,3);
2083 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2084 invmassBproj2D = hsSparseMC->Projection(0,3);
2085 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2086 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2087 invmassSplittedTrackssproj2D = hsSparseMC->Projection(0,3);
2088 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2089 invmassSplittedTrackosproj2D = hsSparseMC->Projection(0,3);
2090 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2094 invmassppproj2D->SetStats(0);
2095 invmassnnproj2D->SetStats(0);
2096 invmassssproj2D->SetStats(0);
2097 invmassrproj2D->SetStats(0);
2098 invmassosproj2D->SetStats(0);
2099 if(invmassgammaproj2D) invmassgammaproj2D->SetStats(0);
2100 if(invmasspi0proj2D) invmasspi0proj2D->SetStats(0);
2101 if(invmassCproj2D) invmassCproj2D->SetStats(0);
2102 if(invmassBproj2D) invmassBproj2D->SetStats(0);
2103 if(invmassetaproj2D) invmassetaproj2D->SetStats(0);
2104 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetStats(0);
2105 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetStats(0);
2107 invmassppproj2D->SetTitle("invmassppproj2D");
2108 invmassnnproj2D->SetTitle("invmassnnproj2D");
2109 invmassssproj2D->SetTitle("invmassssproj2D");
2110 invmassrproj2D->SetTitle("invmassrproj2D");
2111 invmassosproj2D->SetTitle("invmassosproj2D");
2112 if(invmassgammaproj2D) invmassgammaproj2D->SetTitle("invmassgammaproj2D");
2113 if(invmasspi0proj2D) invmasspi0proj2D->SetTitle("invmasspi0proj2D");
2114 if(invmassCproj2D) invmassCproj2D->SetTitle("invmassCproj2D");
2115 if(invmassBproj2D) invmassBproj2D->SetTitle("invmassBproj2D");
2116 if(invmassetaproj2D) invmassetaproj2D->SetTitle("invmassetaproj2D");
2117 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetTitle("invmassSplittedTrackssproj2D");
2118 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetTitle("invmassSplittedTrackosproj2D");
2125 // Draw histograms for opening angle
2126 TCanvas * copeningangle =new TCanvas("openingangle","Openingangle",800,800);
2127 copeningangle->cd();
2128 //openingangleppproj->Draw();
2129 //openinganglennproj->Draw("same");
2130 openinganglessproj->Draw();
2131 //openinganglerproj->Draw("same");
2132 openingangleosproj->Draw("same");
2133 if(openinganglegammaproj) openinganglegammaproj->Draw("same");
2134 if(openinganglepi0proj) openinganglepi0proj->Draw("same");
2135 //if(openingangleCproj) openingangleCproj->Draw("same");
2136 //if(openingangleBproj) openingangleBproj->Draw("same");
2137 if(openingangleetaproj) openingangleetaproj->Draw("same");
2138 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->Draw("same");
2139 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->Draw("same");
2140 TLegend *lego = new TLegend(0.4,0.6,0.89,0.89);
2141 //lego->AddEntry(openingangleppproj,"positive-positive","p");
2142 //lego->AddEntry(openinganglennproj,"negative-negative","p");
2143 lego->AddEntry(openinganglessproj,"same-sign","p");
2144 //lego->AddEntry(openinganglerproj,"rotated","p");
2145 lego->AddEntry(openingangleosproj,"positive-negative","p");
2146 if(openinganglegammaproj) lego->AddEntry(openinganglegammaproj,"e^{+}e^{-} from #gamma","p");
2147 if(openinganglepi0proj) lego->AddEntry(openinganglepi0proj,"e^{+}e^{-} from #pi^{0}","p");
2148 //if(openingangleCproj) lego->AddEntry(openingangleCproj,"e^{+}e^{-} from c","p");
2149 //if(openingangleBproj) lego->AddEntry(openingangleBproj,"e^{+}e^{-} from b","p");
2150 if(openingangleetaproj) lego->AddEntry(openingangleetaproj,"e^{+}e^{-} from #eta","p");
2151 if(openingangleSplittedTrackssproj) lego->AddEntry(openingangleSplittedTrackssproj,"Splitted tracks same sign","p");
2152 if(openingangleSplittedTrackosproj) lego->AddEntry(openingangleSplittedTrackosproj,"Splitted tracks opposite sign","p");
2155 // Draw histograms for invariant mass
2156 TCanvas * cinvmass =new TCanvas("invmass","Invmass",800,800);
2158 //invmassppproj->Draw();
2159 //invmassnnproj->Draw("same");
2160 invmassssproj->Draw();
2161 //invmassrproj->Draw("same");
2162 invmassosproj->Draw("same");
2163 if(invmassgammaproj) invmassgammaproj->Draw("same");
2164 if(invmasspi0proj) invmasspi0proj->Draw("same");
2165 //if(invmassCproj) invmassCproj->Draw("same");
2166 //if(invmassBproj) invmassBproj->Draw("same");
2167 if(invmassetaproj) invmassetaproj->Draw("same");
2168 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->Draw("same");
2169 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->Draw("same");
2170 TLegend *legi = new TLegend(0.4,0.6,0.89,0.89);
2171 //legi->AddEntry(invmassppproj,"positive-positive","p");
2172 //legi->AddEntry(invmassnnproj,"negative-negative","p");
2173 legi->AddEntry(invmassssproj,"same-sign","p");
2174 //legi->AddEntry(invmassrproj,"rotated","p");
2175 legi->AddEntry(invmassosproj,"positive-negative","p");
2176 if(invmassgammaproj) legi->AddEntry(invmassgammaproj,"e^{+}e^{-} from #gamma","p");
2177 if(invmasspi0proj) legi->AddEntry(invmasspi0proj,"e^{+}e^{-} from #pi^{0}","p");
2178 //if(invmassCproj) legi->AddEntry(invmassCproj,"e^{+}e^{-} from c","p");
2179 //if(invmassBproj) legi->AddEntry(invmassBproj,"e^{+}e^{-} from b","p");
2180 if(invmassetaproj) legi->AddEntry(invmassetaproj,"e^{+}e^{-} from #eta","p");
2181 if(invmassSplittedTrackssproj) legi->AddEntry(invmassSplittedTrackssproj,"Splitted tracks same sign","p");
2182 if(invmassSplittedTrackosproj) legi->AddEntry(invmassSplittedTrackosproj,"Splitted tracks opposite sign","p");
2187 // Draw histograms for opening angle 2D
2188 TCanvas * copeningangle2D =new TCanvas("openingangle2D","Openingangle2D",800,800);
2189 copeningangle2D->Divide(6,2);
2190 copeningangle2D->cd(1);
2191 openingangleppproj2D->Draw("lego");
2192 copeningangle2D->cd(2);
2193 openinganglennproj2D->Draw("lego");
2194 copeningangle2D->cd(3);
2195 openinganglessproj2D->Draw("lego");
2196 copeningangle2D->cd(4);
2197 openinganglerproj2D->Draw("lego");
2198 copeningangle2D->cd(5);
2199 openingangleosproj2D->Draw("lego");
2200 copeningangle2D->cd(6);
2201 if(openinganglegammaproj2D) openinganglegammaproj2D->Draw("lego");
2202 copeningangle2D->cd(7);
2203 if(openinganglepi0proj2D) openinganglepi0proj2D->Draw("lego");
2204 copeningangle2D->cd(8);
2205 if(openingangleCproj2D) openingangleCproj2D->Draw("lego");
2206 copeningangle2D->cd(9);
2207 if(openingangleBproj2D) openingangleBproj2D->Draw("lego");
2208 copeningangle2D->cd(10);
2209 if(openingangleetaproj2D) openingangleetaproj2D->Draw("lego");
2210 copeningangle2D->cd(11);
2211 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->Draw("lego");
2212 copeningangle2D->cd(12);
2213 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->Draw("lego");
2215 // Draw histograms for invariant mass 2D
2216 TCanvas * cinvmass2D =new TCanvas("invmass2D","Invmass2D",800,800);
2217 cinvmass2D->Divide(6,2);
2219 invmassppproj2D->Draw("lego");
2221 invmassnnproj2D->Draw("lego");
2223 invmassssproj2D->Draw("lego");
2225 invmassrproj2D->Draw("lego");
2227 invmassosproj2D->Draw("lego");
2229 if(invmassgammaproj2D) invmassgammaproj2D->Draw("lego");
2231 if(invmasspi0proj2D) invmasspi0proj2D->Draw("lego");
2233 if(invmassCproj2D) invmassCproj2D->Draw("lego");
2235 if(invmassBproj2D) invmassBproj2D->Draw("lego");
2237 if(invmassetaproj2D) invmassetaproj2D->Draw("lego");
2239 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->Draw("lego");
2241 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->Draw("lego");
2244 ////////////////////////
2246 ////////////////////////
2248 THnSparseF *hsSparseMCe = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
2253 TAxis *axissources = hsSparseMCe->GetAxis(2);
2254 Int_t nbsources = axissources->GetNbins();
2255 TAxis *axiscuts = hsSparseMCe->GetAxis(1);
2256 Int_t nbcuts = axiscuts->GetNbins();
2257 TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts];
2258 Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts];
2260 //printf("Number of cuts %d\n",nbcuts);
2263 TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800);
2264 chsSparseMCeeff->Divide(3,1);
2267 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2268 hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1);
2269 for(Int_t cut = 0; cut < nbcuts; cut++){
2270 hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1);
2271 histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0);
2272 hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins());
2274 hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins());
2277 // calcul efficiencies
2278 ///////////////////////
2280 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2281 // Next is compared to the partner tracked
2282 for(Int_t cut = 2; cut < nbcuts; cut++){
2283 nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries();
2284 if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]);
2286 // First one is if the partner is tracked.
2287 nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries();
2288 if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]);
2289 // First one is input
2290 nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries();
2296 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2297 for(Int_t cut = 1; cut < nbcuts; cut++){
2298 if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts];
2301 TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0);
2302 TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0);
2303 TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0);
2304 for(Int_t k = 1; k < nbcuts; k++){
2305 ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]);
2306 ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]);
2307 ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]);
2310 TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis();
2311 xAxisGamma->SetBinLabel(1,"Partner tracked");
2312 xAxisGamma->SetBinLabel(2,"Opposite sign");
2313 xAxisGamma->SetBinLabel(3,"Single Track Cut");
2314 xAxisGamma->SetBinLabel(4,"Shared Clusters");
2315 xAxisGamma->SetBinLabel(5,"PID");
2316 xAxisGamma->SetBinLabel(6,"DCA");
2317 xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf");
2318 xAxisGamma->SetBinLabel(8,"Opening angle");
2319 xAxisGamma->SetBinLabel(9,"Invariant mass");
2321 TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis();
2322 xAxisPi0->SetBinLabel(1,"Partner tracked");
2323 xAxisPi0->SetBinLabel(2,"Opposite sign");
2324 xAxisPi0->SetBinLabel(3,"Single Track Cut");
2325 xAxisPi0->SetBinLabel(4,"Shared Clusters");
2326 xAxisPi0->SetBinLabel(5,"PID");
2327 xAxisPi0->SetBinLabel(6,"DCA");
2328 xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf");
2329 xAxisPi0->SetBinLabel(8,"Opening angle");
2330 xAxisPi0->SetBinLabel(9,"Invariant mass");
2332 TAxis *xAxisC = ratioHistoEntriesC->GetXaxis();
2333 xAxisC->SetBinLabel(1,"Partner tracked");
2334 xAxisC->SetBinLabel(2,"Opposite sign");
2335 xAxisC->SetBinLabel(3,"Single Track Cut");
2336 xAxisC->SetBinLabel(4,"Shared Clusters");
2337 xAxisC->SetBinLabel(5,"PID");
2338 xAxisC->SetBinLabel(6,"DCA");
2339 xAxisC->SetBinLabel(7,"Chi^{2}/Ndf");
2340 xAxisC->SetBinLabel(8,"Opening angle");
2341 xAxisC->SetBinLabel(9,"Invariant mass");
2343 TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800);
2344 cRatioHistoEntries->cd(1);
2345 ratioHistoEntriesGamma->SetStats(0);
2346 ratioHistoEntriesGamma->Draw();
2347 ratioHistoEntriesPi0->SetStats(0);
2348 ratioHistoEntriesPi0->Draw("same");
2349 ratioHistoEntriesC->SetStats(0);
2350 //ratioHistoEntriesC->Draw("same");
2351 TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89);
2352 legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l");
2353 legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l");
2354 //legEntries->AddEntry(ratioHistoEntriesC,"c","p");
2355 legEntries->Draw("same");
2357 ////////////////////
2361 chsSparseMCeeff->cd(1);
2362 histopassedcuts[source*nbcuts+0]->SetTitle("#gamma");
2363 histopassedcuts[source*nbcuts+1]->SetTitle("#gamma");
2364 histopassedcuts[source*nbcuts+2]->SetTitle("#gamma");
2365 histopassedcuts[source*nbcuts+3]->SetTitle("#gamma");
2366 histopassedcuts[source*nbcuts+4]->SetTitle("#gamma");
2367 histopassedcuts[source*nbcuts+5]->SetTitle("#gamma");
2368 histopassedcuts[source*nbcuts+6]->SetTitle("#gamma");
2369 histopassedcuts[source*nbcuts+7]->SetTitle("#gamma");
2370 histopassedcuts[source*nbcuts+8]->SetTitle("#gamma");
2371 histopassedcuts[source*nbcuts+9]->SetTitle("#gamma");
2372 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2373 histopassedcuts[source*nbcuts+1]->SetStats(0);
2374 histopassedcuts[source*nbcuts+2]->SetStats(0);
2375 histopassedcuts[source*nbcuts+3]->SetStats(0);
2376 histopassedcuts[source*nbcuts+4]->SetStats(0);
2377 histopassedcuts[source*nbcuts+5]->SetStats(0);
2378 histopassedcuts[source*nbcuts+6]->SetStats(0);
2379 histopassedcuts[source*nbcuts+7]->SetStats(0);
2380 histopassedcuts[source*nbcuts+8]->SetStats(0);
2381 histopassedcuts[source*nbcuts+9]->SetStats(0);
2382 //histopassedcuts[source*nbcuts+0]->Draw();
2383 //histopassedcuts[source*nbcuts+1]->Draw("");
2384 histopassedcuts[source*nbcuts+2]->Draw();
2385 histopassedcuts[source*nbcuts+3]->Draw("same");
2386 //histopassedcuts[source*nbcuts+4]->Draw("same");
2387 histopassedcuts[source*nbcuts+5]->Draw("same");
2388 histopassedcuts[source*nbcuts+6]->Draw("same");
2389 //histopassedcuts[source*nbcuts+7]->Draw("same");
2390 histopassedcuts[source*nbcuts+8]->Draw("same");
2391 histopassedcuts[source*nbcuts+9]->Draw("same");
2392 TLegend *legb = new TLegend(0.4,0.6,0.89,0.89);
2393 //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2394 //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2395 legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2396 legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2397 //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2398 legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2399 legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2400 //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2401 legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2402 legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2406 chsSparseMCeeff->cd(2);
2407 histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}");
2408 histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}");
2409 histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}");
2410 histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}");
2411 histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}");
2412 histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}");
2413 histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}");
2414 histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}");
2415 histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}");
2416 histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}");
2417 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2418 histopassedcuts[source*nbcuts+1]->SetStats(0);
2419 histopassedcuts[source*nbcuts+2]->SetStats(0);
2420 histopassedcuts[source*nbcuts+3]->SetStats(0);
2421 histopassedcuts[source*nbcuts+4]->SetStats(0);
2422 histopassedcuts[source*nbcuts+5]->SetStats(0);
2423 histopassedcuts[source*nbcuts+6]->SetStats(0);
2424 histopassedcuts[source*nbcuts+7]->SetStats(0);
2425 histopassedcuts[source*nbcuts+8]->SetStats(0);
2426 histopassedcuts[source*nbcuts+9]->SetStats(0);
2427 //histopassedcuts[source*nbcuts+0]->Draw();
2428 //histopassedcuts[source*nbcuts+1]->Draw();
2429 histopassedcuts[source*nbcuts+2]->Draw();
2430 histopassedcuts[source*nbcuts+3]->Draw("same");
2431 //histopassedcuts[source*nbcuts+4]->Draw("same");
2432 histopassedcuts[source*nbcuts+5]->Draw("same");
2433 histopassedcuts[source*nbcuts+6]->Draw("same");
2434 //histopassedcuts[source*nbcuts+7]->Draw("same");
2435 histopassedcuts[source*nbcuts+8]->Draw("same");
2436 histopassedcuts[source*nbcuts+9]->Draw("same");
2437 TLegend *legc = new TLegend(0.4,0.6,0.89,0.89);
2438 //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2439 //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2440 legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2441 legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2442 //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2443 legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2444 legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2445 //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2446 legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2447 legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2451 chsSparseMCeeff->cd(3);
2452 histopassedcuts[source*nbcuts+0]->SetTitle("C");
2453 histopassedcuts[source*nbcuts+1]->SetTitle("C");
2454 histopassedcuts[source*nbcuts+2]->SetTitle("C");
2455 histopassedcuts[source*nbcuts+3]->SetTitle("C");
2456 histopassedcuts[source*nbcuts+4]->SetTitle("C");
2457 histopassedcuts[source*nbcuts+5]->SetTitle("C");
2458 histopassedcuts[source*nbcuts+6]->SetTitle("C");
2459 histopassedcuts[source*nbcuts+7]->SetTitle("C");
2460 histopassedcuts[source*nbcuts+8]->SetTitle("C");
2461 histopassedcuts[source*nbcuts+9]->SetTitle("C");
2462 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2463 histopassedcuts[source*nbcuts+1]->SetStats(0);
2464 histopassedcuts[source*nbcuts+2]->SetStats(0);
2465 histopassedcuts[source*nbcuts+3]->SetStats(0);
2466 histopassedcuts[source*nbcuts+4]->SetStats(0);
2467 histopassedcuts[source*nbcuts+5]->SetStats(0);
2468 histopassedcuts[source*nbcuts+6]->SetStats(0);
2469 histopassedcuts[source*nbcuts+7]->SetStats(0);
2470 histopassedcuts[source*nbcuts+8]->SetStats(0);
2471 histopassedcuts[source*nbcuts+9]->SetStats(0);
2472 //histopassedcuts[source*nbcuts+0]->Draw();
2473 //histopassedcuts[source*nbcuts+1]->Draw();
2474 histopassedcuts[source*nbcuts+2]->Draw();
2475 histopassedcuts[source*nbcuts+3]->Draw("same");
2476 //histopassedcuts[source*nbcuts+4]->Draw("same");
2477 histopassedcuts[source*nbcuts+5]->Draw("same");
2478 histopassedcuts[source*nbcuts+6]->Draw("same");
2479 //histopassedcuts[source*nbcuts+7]->Draw("same");
2480 histopassedcuts[source*nbcuts+8]->Draw("same");
2481 histopassedcuts[source*nbcuts+9]->Draw("same");
2482 TLegend *lege = new TLegend(0.4,0.6,0.89,0.89);
2483 //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2484 //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2485 lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2486 lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2487 //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2488 lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2489 lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2490 //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2491 lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2492 lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2495 //////////////////////
2497 //////////////////////
2499 TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800);
2500 chsSparseMCein->cd(1);
2501 Double_t nbGamma = 0.0;
2503 nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries();
2504 histopassedcuts[source*nbcuts+0]->SetStats(0);
2505 histopassedcuts[source*nbcuts+0]->Draw();
2506 TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89);
2507 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p");
2508 Double_t nbPi0 = 0.0;
2510 nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries();
2511 histopassedcuts[source*nbcuts+0]->SetStats(0);
2512 histopassedcuts[source*nbcuts+0]->Draw("same");
2513 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p");
2514 Double_t nbEta = 0.0;
2516 nbEta = histopassedcuts[source*nbcuts+0]->GetEntries();
2517 histopassedcuts[source*nbcuts+0]->SetStats(0);
2518 histopassedcuts[source*nbcuts+0]->Draw("same");
2519 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p");
2522 nbC = histopassedcuts[source*nbcuts+0]->GetEntries();
2523 histopassedcuts[source*nbcuts+0]->SetStats(0);
2524 histopassedcuts[source*nbcuts+0]->Draw("same");
2525 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p");
2526 leginput->Draw("same");
2528 //printf("Gamma %f, pi^{0} %f and #eta %f, c %f\n",nbGamma,nbPi0,nbEta,nbC);
2530 //////////////////////
2532 //////////////////////
2534 TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800);
2537 histopassedcuts[source*nbcuts+1]->Draw();
2538 TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89);
2539 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p");
2541 histopassedcuts[source*nbcuts+1]->Draw("same");
2542 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p");
2543 legTracked->Draw("same");
2547 /////////////////////////////////////
2548 // Data Radius and chi2Ndf if AliKF
2549 ////////////////////////////////////
2551 TH1F *hDataRadius = dynamic_cast<TH1F *>(fList->FindObject("DataRadius"));
2552 TH1F *hDataChi2Ndf = dynamic_cast<TH1F *>(fList->FindObject("DataChi2Ndf"));
2554 if(hDataRadius || hDataChi2Ndf) {
2555 TCanvas * cDataRadiusChi2Ndf =new TCanvas("CanvasDataRadiusChi2Ndf","CanvasDataRadiusChi2Ndf",800,800);
2556 cDataRadiusChi2Ndf->Divide(2,1);
2557 cDataRadiusChi2Ndf->cd(1);
2558 if(hDataRadius) hDataRadius->Draw();
2559 cDataRadiusChi2Ndf->cd(2);
2560 if(hDataChi2Ndf) hDataChi2Ndf->Draw();
2563 ///////////////////////
2565 //////////////////////
2567 TH1F *hDataDCA = dynamic_cast<TH1F *>(fList->FindObject("DataDCA"));
2570 TCanvas * cDataDCA =new TCanvas("CanvasDataDCA","CanvasDataDCA",800,800);
2575 /////////////////////////////////////
2576 // MC Radius and chi2Ndf if AliKF
2577 ////////////////////////////////////
2579 TH2F *hMCRadius = dynamic_cast<TH2F *>(fList->FindObject("MCRadius"));
2580 TH2F *hMCChi2Ndf = dynamic_cast<TH2F *>(fList->FindObject("MCChi2Ndf"));
2582 if(hMCRadius || hMCChi2Ndf) {
2583 TCanvas * cMCRadiusChi2Ndf =new TCanvas("CanvasMCRadiusChi2Ndf","CanvasMCRadiusChi2Ndf",800,800);
2584 cMCRadiusChi2Ndf->Divide(2,1);
2585 cMCRadiusChi2Ndf->cd(1);
2586 //TH1D *hMCRadiusBackground = hMCRadius->ProjectionX("MCRadiusBackGround",1,1,"e");
2587 TH1D *hMCRadiusGamma = hMCRadius->ProjectionX("MCRadiusGamma",2,2,"e");
2588 TH1D *hMCRadiusPi0 = hMCRadius->ProjectionX("MCRadiusPi0",3,3,"e");
2589 TH1D *hMCRadiusEta = hMCRadius->ProjectionX("MCRadiusEta",4,4,"e");
2590 TH1D *hMCRadiusC = hMCRadius->ProjectionX("MCRadiusC",5,5,"e");
2591 TH1D *hMCRadiusB = hMCRadius->ProjectionX("MCRadiusB",6,6,"e");
2592 //hMCRadiusBackground->Draw();
2593 hMCRadiusGamma->Draw();
2594 hMCRadiusPi0->Draw("same");
2595 hMCRadiusEta->Draw("same");
2596 hMCRadiusC->Draw("same");
2597 hMCRadiusB->Draw("same");
2598 TLegend *legRadius = new TLegend(0.4,0.6,0.89,0.89);
2599 //legRadius->AddEntry(hMCRadiusBackground,"Background","p");
2600 legRadius->AddEntry(hMCRadiusGamma,"#gamma","p");
2601 legRadius->AddEntry(hMCRadiusPi0,"#pi^{0}","p");
2602 legRadius->AddEntry(hMCRadiusEta,"#eta","p");
2603 legRadius->AddEntry(hMCRadiusC,"c","p");
2604 legRadius->AddEntry(hMCRadiusB,"b","p");
2605 legRadius->Draw("same");
2606 cMCRadiusChi2Ndf->cd(2);
2607 //TH1D *hMCChi2NdfBackground = hMCChi2Ndf->ProjectionX("MCChi2NdfBackGround",1,1,"e");
2608 TH1D *hMCChi2NdfGamma = hMCChi2Ndf->ProjectionX("MCChi2NdfGamma",2,2,"e");
2609 TH1D *hMCChi2NdfPi0 = hMCChi2Ndf->ProjectionX("MCChi2NdfPi0",3,3,"e");
2610 TH1D *hMCChi2NdfEta = hMCChi2Ndf->ProjectionX("MCChi2NdfEta",4,4,"e");
2611 TH1D *hMCChi2NdfC = hMCChi2Ndf->ProjectionX("MCChi2NdfC",5,5,"e");
2612 TH1D *hMCChi2NdfB = hMCChi2Ndf->ProjectionX("MCChi2NdfB",6,6,"e");
2613 //hMCChi2NdfBackground->Draw();
2614 hMCChi2NdfGamma->Draw();
2615 hMCChi2NdfPi0->Draw("same");
2616 hMCChi2NdfEta->Draw("same");
2617 hMCChi2NdfC->Draw("same");
2618 hMCChi2NdfB->Draw("same");
2619 TLegend *legChi2Ndf = new TLegend(0.4,0.6,0.89,0.89);
2620 //legChi2Ndf->AddEntry(hMCChi2NdfBackground,"Background","p");
2621 legChi2Ndf->AddEntry(hMCChi2NdfGamma,"#gamma","p");
2622 legChi2Ndf->AddEntry(hMCChi2NdfPi0,"#pi^{0}","p");
2623 legChi2Ndf->AddEntry(hMCChi2NdfEta,"#eta","p");
2624 legChi2Ndf->AddEntry(hMCChi2NdfC,"c","p");
2625 legChi2Ndf->AddEntry(hMCChi2NdfB,"b","p");
2626 legChi2Ndf->Draw("same");
2629 ///////////////////////
2631 //////////////////////
2633 TH2F *hMCDCA = dynamic_cast<TH2F *>(fList->FindObject("MCDCA"));
2636 TCanvas * cMCDCA =new TCanvas("CanvasMCDCA","CanvasMCDCA",800,800);
2638 //TH1D *hMCDCABackground = hMCDCA->ProjectionX("MCDCABackGround",1,1,"e");
2639 TH1D *hMCDCAGamma = hMCDCA->ProjectionX("MCDCAGamma",2,2,"e");
2640 TH1D *hMCDCAPi0 = hMCDCA->ProjectionX("MCDCAPi0",3,3,"e");
2641 TH1D *hMCDCAEta = hMCDCA->ProjectionX("MCDCAEta",4,4,"e");
2642 TH1D *hMCDCAC = hMCDCA->ProjectionX("MCDCAC",5,5,"e");
2643 TH1D *hMCDCAB = hMCDCA->ProjectionX("MCDCAB",6,6,"e");
2644 //hMCDCABackground->Draw();
2645 hMCDCAGamma->Draw();
2646 hMCDCAPi0->Draw("same");
2647 hMCDCAEta->Draw("same");
2648 hMCDCAC->Draw("same");
2649 hMCDCAB->Draw("same");
2650 TLegend *legDCA = new TLegend(0.4,0.6,0.89,0.89);
2651 //legDCA->AddEntry(hMCDCABackground,"Background","p");
2652 legDCA->AddEntry(hMCDCAGamma,"#gamma","p");
2653 legDCA->AddEntry(hMCDCAPi0,"#pi^{0}","p");
2654 legDCA->AddEntry(hMCDCAEta,"#eta","p");
2655 legDCA->AddEntry(hMCDCAC,"c","p");
2656 legDCA->AddEntry(hMCDCAB,"b","p");
2657 legDCA->Draw("same");
2661 /////////////////////////
2662 // PID Partner Signal
2663 /////////////////////////
2664 TF1 *betheBlochElectron = 0x0;
2665 TF1 *betheBlochMuon = 0x0;
2666 TF1 *betheBlochPion = 0x0;
2667 TF1 *betheBlochKaon = 0x0;
2668 TF1 *betheBlochProton = 0x0;
2670 TH2F *hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner0"));
2671 TH2F *hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner1"));
2672 if((!hsignalPidPartner0) && (!hsignalPidPartner1)) {
2673 hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner0"));
2674 hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner1"));
2676 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronITS,0.1,10.0,0);
2677 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonITS,0.1,10.0,0);
2678 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionITS,0.1,10.0,0);
2679 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonITS,0.1,10.0,0);
2680 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonITS,0.1,10.0,0);
2685 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronTPC,0.1,10.0,0);
2686 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonTPC,0.1,10.0,0);
2687 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionTPC,0.1,10.0,0);
2688 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonTPC,0.1,10.0,0);
2689 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonTPC,0.1,10.0,0);
2694 if((hsignalPidPartner0) || (hsignalPidPartner1)) {
2695 TCanvas * cPidSignal =new TCanvas("cPidSignal","cPidSignal",800,800);
2696 cPidSignal->Divide(2,1);
2698 if(hsignalPidPartner0) hsignalPidPartner0->Draw("colz");
2699 if(betheBlochElectron) betheBlochElectron->Draw("same");
2700 if(betheBlochMuon) betheBlochMuon->Draw("same");
2701 if(betheBlochPion) betheBlochPion->Draw("same");
2702 if(betheBlochKaon) betheBlochKaon->Draw("same");
2703 if(betheBlochProton) betheBlochProton->Draw("same");
2705 if(hsignalPidPartner1) hsignalPidPartner1->Draw("colz");
2706 if(betheBlochElectron) betheBlochElectron->Draw("same");
2707 if(betheBlochMuon) betheBlochMuon->Draw("same");
2708 if(betheBlochPion) betheBlochPion->Draw("same");
2709 if(betheBlochKaon) betheBlochKaon->Draw("same");
2710 if(betheBlochProton) betheBlochProton->Draw("same");
2713 THnSparseF *hsSparseITSsignal = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignal"));
2714 if(hsSparseITSsignal) {
2717 TH2D *sddsdd = hsSparseITSsignal->Projection(1,2);
2718 TH2D *ssdssd = hsSparseITSsignal->Projection(3,4);
2719 TH2D *sddssda = hsSparseITSsignal->Projection(1,3);
2720 TH2D *sddssdb = hsSparseITSsignal->Projection(2,4);
2721 TH2D *sddssdc = hsSparseITSsignal->Projection(1,4);
2722 TH2D *sddssdd = hsSparseITSsignal->Projection(2,3);
2724 TCanvas * cITSSignal =new TCanvas("cITSSignal","cITSSignal",800,800);
2725 cITSSignal->Divide(2,3);
2727 sddsdd->Draw("colz");
2729 ssdssd->Draw("colz");
2731 sddssda->Draw("colz");
2733 sddssdb->Draw("colz");
2735 sddssdc->Draw("colz");
2737 sddssdd->Draw("colz");
2741 THnSparseF *hsSparseITSsignalSplit = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignalSplit"));
2742 if(hsSparseITSsignalSplit) {
2745 hsSparseITSsignalSplit->GetAxis(0)->SetRange(1,1);
2747 TH1D *layerITS2 = hsSparseITSsignalSplit->Projection(1);
2748 TH1D *layerITS3 = hsSparseITSsignalSplit->Projection(2);
2749 TH1D *layerITS4 = hsSparseITSsignalSplit->Projection(3);
2750 TH1D *layerITS5 = hsSparseITSsignalSplit->Projection(4);
2753 hsSparseITSsignalSplit->GetAxis(0)->SetRange(2,2);
2755 TH1D *layerITS2s = hsSparseITSsignalSplit->Projection(1);
2756 TH1D *layerITS3s = hsSparseITSsignalSplit->Projection(2);
2757 TH1D *layerITS4s = hsSparseITSsignalSplit->Projection(3);
2758 TH1D *layerITS5s = hsSparseITSsignalSplit->Projection(4);
2760 TCanvas * cITSSignalSplit =new TCanvas("cITSSignalSplit","cITSSignalSplit",800,800);
2761 cITSSignalSplit->Divide(2,2);
2762 cITSSignalSplit->cd(1);
2764 layerITS2s->Draw("same");
2765 TLegend *legITS2 = new TLegend(0.4,0.6,0.89,0.89);
2766 legITS2->AddEntry(layerITS2,"No splitted","p");
2767 legITS2->AddEntry(layerITS2s,"Splitted","p");
2768 legITS2->Draw("same");
2769 cITSSignalSplit->cd(2);
2771 layerITS3s->Draw("same");
2772 TLegend *legITS3 = new TLegend(0.4,0.6,0.89,0.89);
2773 legITS3->AddEntry(layerITS3,"No splitted","p");
2774 legITS3->AddEntry(layerITS3s,"Splitted","p");
2775 legITS3->Draw("same");
2776 cITSSignalSplit->cd(3);
2778 layerITS4s->Draw("same");
2779 TLegend *legITS4 = new TLegend(0.4,0.6,0.89,0.89);
2780 legITS4->AddEntry(layerITS4,"No splitted","p");
2781 legITS4->AddEntry(layerITS4s,"Splitted","p");
2782 legITS4->Draw("same");
2783 cITSSignalSplit->cd(4);
2785 layerITS5s->Draw("same");
2786 TLegend *legITS5 = new TLegend(0.4,0.6,0.89,0.89);
2787 legITS5->AddEntry(layerITS5,"No splitted","p");
2788 legITS5->AddEntry(layerITS5s,"Splitted","p");
2789 legITS5->Draw("same");
2795 //_____________________________________________________________________________
2796 Double_t AliHFEelecbackground::BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/)
2799 // Bethe Bloch for ITS
2801 static AliITSPIDResponse itsPidResponse;
2802 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(0));
2804 //_____________________________________________________________________________
2805 Double_t AliHFEelecbackground::BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/)
2808 // Bethe Bloch for ITS
2810 static AliITSPIDResponse itsPidResponse;
2811 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(1));
2813 //_____________________________________________________________________________
2814 Double_t AliHFEelecbackground::BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/)
2817 // Bethe Bloch for ITS
2819 static AliITSPIDResponse itsPidResponse;
2820 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(2));
2822 //_____________________________________________________________________________
2823 Double_t AliHFEelecbackground::BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/)
2826 // Bethe Bloch for ITS
2828 static AliITSPIDResponse itsPidResponse;
2829 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(3));
2831 //_____________________________________________________________________________
2832 Double_t AliHFEelecbackground::BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/)
2835 // Bethe Bloch for ITS
2837 static AliITSPIDResponse itsPidResponse;
2838 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(4));
2840 //_____________________________________________________________________________
2841 Double_t AliHFEelecbackground::BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/)
2844 // Bethe Bloch for TPC
2846 static AliTPCPIDResponse tpcPidResponse;
2847 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kElectron);
2849 //_____________________________________________________________________________
2850 Double_t AliHFEelecbackground::BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/)
2853 // Bethe Bloch for TPC
2855 static AliTPCPIDResponse tpcPidResponse;
2856 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kMuon);
2858 //_____________________________________________________________________________
2859 Double_t AliHFEelecbackground::BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/)
2862 // Bethe Bloch for TPC
2864 static AliTPCPIDResponse tpcPidResponse;
2865 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kPion);
2867 //_____________________________________________________________________________
2868 Double_t AliHFEelecbackground::BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/)
2871 // Bethe Bloch for TPC
2873 static AliTPCPIDResponse tpcPidResponse;
2874 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kKaon);
2876 //_____________________________________________________________________________
2877 Double_t AliHFEelecbackground::BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/)
2880 // Bethe Bloch for TPC
2882 static AliTPCPIDResponse tpcPidResponse;
2883 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kProton);