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;
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;
179 if(fListPostProcess){
180 fListPostProcess->SetOwner(kTRUE);
181 delete fListPostProcess;
185 if(fhtmp) delete fhtmp;
186 if(fhtmpf) delete fhtmpf;
187 if(fhtmpp) delete fhtmpp;
191 //___________________________________________________________________________________________
192 Bool_t AliHFEelecbackground::Load(const Char_t * filename)
195 // Generic container loader
198 if(!TFile::Open(filename)){
202 if(!(o = (TList*)gFile->Get("Results"))){
206 if(!(oe = (TList*)dynamic_cast<TList *>(o->FindObject("HFEelecbackground")))){
209 fList = (TList*)oe->Clone("HFEelecbackground");
213 //___________________________________________________________________________________________
214 Bool_t AliHFEelecbackground::Load(TList * const outputlist)
217 // Generic container loader
219 if(!outputlist) return kFALSE;
220 else fList = (TList*)outputlist->Clone("HFEelecbackground");
223 //_______________________________________________________________________________________________
224 void AliHFEelecbackground::Reset()
240 fIsSplittedTrack = kFALSE;
241 for(Int_t id = 0; id < 10; id++) {
246 //_______________________________________________________________________________________________
247 void AliHFEelecbackground::CreateHistograms(TList * const qaList)
255 fList->SetName("HFEelecbackground");
261 const Int_t nBinsPt = 25;
262 Double_t minPt = 0.01;
263 Double_t maxPt = 10.0;
265 const Int_t nBinsPtMore = 100;
266 Double_t minPtMore = 0.01;
267 Double_t maxPtMore = 10.0;
269 const Int_t nBinsInv = 50;
270 Double_t minInv = 0.0;
271 Double_t maxInv = 0.2;
273 const Int_t nBinsOp = 50;
274 Double_t minOp = 0.0;
277 const Int_t nBinsCh = 4;
278 Double_t minCh = 0.0;
279 Double_t maxCh = 4.0;
281 Double_t binLimLogPt[nBinsPt+1];
282 Double_t binLimPt[nBinsPt+1];
283 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 ;
284 for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
286 Double_t binLimLogPtMore[nBinsPtMore+1];
287 Double_t binLimPtMore[nBinsPtMore+1];
288 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 ;
289 for(Int_t i=0; i<=nBinsPtMore; i++) binLimPtMore[i]=(Double_t)TMath::Power(10,binLimLogPtMore[i]);
291 Double_t binLimInv[nBinsInv+1];
292 for(Int_t i=0; i<=nBinsInv; i++) binLimInv[i]=(Double_t)minInv + (maxInv-minInv) /nBinsInv*(Double_t)i ;
294 Double_t binLimOp[nBinsOp+1];
295 for(Int_t i=0; i<=nBinsOp; i++) binLimOp[i]=(Double_t)minOp + (maxOp-minOp) /nBinsOp*(Double_t)i ;
297 Double_t binLimCh[nBinsCh+1];
298 for(Int_t i=0; i<=nBinsCh; i++) binLimCh[i]=(Double_t)minCh + (maxCh-minCh) /nBinsCh*(Double_t)i ;
300 const Int_t nvarData = 5;
301 // pt reconstructed tagged e
302 // pt reconstructed mother
305 // Data: charge (0-opposite sign, 1-like sign ++, 2-like sign --, 3-rotated tracks)
307 Int_t iBinData[nvarData];
311 iBinData[3]=nBinsInv;
315 // Opening angle and invariant mass
318 THnSparseF *hsSparseData = new THnSparseF("OpeningangleinvmassData","",nvarData,iBinData);
319 hsSparseData->SetBinEdges(0,&binLimPt[0]);
320 hsSparseData->SetBinEdges(1,&binLimPt[0]);
321 hsSparseData->SetBinEdges(2,&binLimOp[0]);
322 hsSparseData->SetBinEdges(3,&binLimInv[0]);
323 hsSparseData->SetBinEdges(4,&binLimCh[0]);
324 hsSparseData->Sumw2();
326 fList->AddAt(hsSparseData,kDatai);
329 // Radius, DCA and Chi2Ndf
332 TH1F *dataRadiusHisto = new TH1F("DataRadius","", 200, 0.0, 200.0); // recontructed radius from the AliKF of the e+e- pair
333 fList->AddAt(dataRadiusHisto,kDatar);
335 TH1F *dataDcaHisto = new TH1F("DataDCA","", 100, 0.0, 6.0); // dca distribution
336 fList->AddAt(dataDcaHisto,kDatadca);
338 TH1F *dataChi2NdfHisto = new TH1F("DataChi2Ndf","", 100, 0.0, 5.0); // chi2Ndf distribution
339 fList->AddAt(dataChi2NdfHisto,kDatachi2Ndf);
345 // Opening angle and invariant mass with MC infos
348 const Int_t nvarMCo = 6;
349 // pt reconstructed tagged e
350 // pt reconstructed mother
353 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
354 // MCSplitted: 0-not, 1-splittedOs, 2-ksplittedSs
357 const Int_t nBinsMCOrigin = 6;
358 Double_t minMCOrigin = 0.0;
359 Double_t maxMCOrigin = 6.0;
361 Double_t binLimMCOrigin[nBinsMCOrigin+1];
362 for(Int_t i=0; i<=nBinsMCOrigin; i++) binLimMCOrigin[i]=(Double_t)minMCOrigin + (maxMCOrigin-minMCOrigin) /nBinsMCOrigin*(Double_t)i ;
364 const Int_t nBinsMCSplitted = 3;
365 Double_t minMCSplitted = 0.0;
366 Double_t maxMCSplitted = 3.0;
368 Double_t binLimMCSplitted[nBinsMCSplitted+1];
369 for(Int_t i=0; i<=nBinsMCSplitted; i++) binLimMCSplitted[i]=(Double_t)minMCSplitted + (maxMCSplitted-minMCSplitted) /nBinsMCSplitted*(Double_t)i ;
371 Int_t iBinMCo[nvarMCo];
376 iBinMCo[4]=nBinsMCOrigin;
377 iBinMCo[5]=nBinsMCSplitted;
379 THnSparseF *hsSparseMCo = new THnSparseF("OpeningangleinvmassMC","",nvarMCo,iBinMCo);
380 hsSparseMCo->SetBinEdges(0,&binLimPt[0]);
381 hsSparseMCo->SetBinEdges(1,&binLimPt[0]);
382 hsSparseMCo->SetBinEdges(2,&binLimOp[0]);
383 hsSparseMCo->SetBinEdges(3,&binLimInv[0]);
384 hsSparseMCo->SetBinEdges(4,&binLimMCOrigin[0]);
385 hsSparseMCo->SetBinEdges(5,&binLimMCSplitted[0]);
386 hsSparseMCo->Sumw2();
388 fList->AddAt(hsSparseMCo,kMCo);
391 // Radius, DCA and Chi2Ndf with MC info
394 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
395 fList->AddAt(mcRadiusHisto,kMCr);
397 TH2F *mcDcaHisto = new TH2F("MCDCA","", 100, 0.0, 6.0,6,-0.5,5.5); // dca distribution
398 fList->AddAt(mcDcaHisto,kMCdca);
400 TH2F *mcChi2NdfHisto = new TH2F("MCChi2Ndf","", 100, 0.0, 5.0,6,-0.5,5.5); // chi2Ndf distribution
401 fList->AddAt(mcChi2NdfHisto,kMCchi2Ndf);
403 //////////////////////////////////////////////////////////
404 // if fDebugLevel 1: Rejection efficiencies of the cuts
405 //////////////////////////////////////////////////////////
407 if(fDebugLevel > 0) {
411 const Int_t nvarMCe = 3;
412 // pt reconstructed tagged e
413 // 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
414 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
416 const Int_t nBinsMCCutPassed = 10;
417 Double_t minMCCutPassed = -0.5;
418 Double_t maxMCCutPassed = 9.5;
420 Double_t binLimMCCutPassed[nBinsMCCutPassed+1];
421 for(Int_t i=0; i<=nBinsMCCutPassed; i++) binLimMCCutPassed[i]=(Double_t)minMCCutPassed + (maxMCCutPassed-minMCCutPassed) /nBinsMCCutPassed*(Double_t)i ;
423 Int_t iBinMCe[nvarMCe];
425 iBinMCe[1]=nBinsMCCutPassed;
426 iBinMCe[2]=nBinsMCOrigin;
428 THnSparseF *hsSparseMCe = new THnSparseF("CutPassedMC","",nvarMCe,iBinMCe);
429 hsSparseMCe->SetBinEdges(0,&binLimPt[0]);
430 hsSparseMCe->SetBinEdges(1,&binLimMCCutPassed[0]);
431 hsSparseMCe->SetBinEdges(2,&binLimMCOrigin[0]);
432 hsSparseMCe->Sumw2();
434 fList->AddAt(hsSparseMCe,kMCe);
439 /////////////////////////////////////////////////////////////////
440 // if fDebugLevel 1: PIDPartCut and ShareClusters
441 /////////////////////////////////////////////////////////////////
443 if(fDebugLevel > 1) {
445 if(!fRequireITSStandalone){
451 TH2F *tpcPartner0 = new TH2F("TPCPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
452 fList->AddAt(tpcPartner0,kMCcutPart0);
453 TH2F *tpcPartner1 = new TH2F("TPCPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
454 fList->AddAt(tpcPartner1,kMCcutPart1);
463 TH2F *itsPartner0 = new TH2F("ITSPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
464 fList->AddAt(itsPartner0,kMCcutPart0);
465 TH2F *itsPartner1 = new TH2F("ITSPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
466 fList->AddAt(itsPartner1,kMCcutPart1);
468 /////////////////////////////////////////////////////
469 // dEdx of the four layers for the track partner
470 /////////////////////////////////////////////////////
471 const Int_t nvarITSsignal = 5;
473 const Int_t nBinsITSsignal = 100;
474 Double_t minITSsignal = 0.0;
475 Double_t maxITSsignal = 350.0;
477 Double_t binLimITSsignal[nBinsITSsignal+1];
478 for(Int_t i=0; i<=nBinsITSsignal; i++) binLimITSsignal[i]=(Double_t)minITSsignal + (maxITSsignal-minITSsignal) /nBinsITSsignal*(Double_t)i ;
480 Int_t iBinITSsignal[nvarITSsignal];
481 iBinITSsignal[0]=nBinsPt;
482 iBinITSsignal[1]=nBinsITSsignal;
483 iBinITSsignal[2]=nBinsITSsignal;
484 iBinITSsignal[3]=nBinsITSsignal;
485 iBinITSsignal[4]=nBinsITSsignal;
487 THnSparseF *hsSparseITSpid = new THnSparseF("SparseITSsignal","",nvarITSsignal,iBinITSsignal);
488 hsSparseITSpid->SetBinEdges(0,&binLimPt[0]);
489 hsSparseITSpid->SetBinEdges(1,&binLimITSsignal[0]);
490 hsSparseITSpid->SetBinEdges(2,&binLimITSsignal[0]);
491 hsSparseITSpid->SetBinEdges(3,&binLimITSsignal[0]);
492 hsSparseITSpid->SetBinEdges(4,&binLimITSsignal[0]);
493 hsSparseITSpid->Sumw2();
495 fList->AddAt(hsSparseITSpid,kMCcutPart2);
497 ///////////////////////////////////////////////////////////////////////////////////////
498 // dEdx of the four layers for the track partner and track to reject splitted track
499 ///////////////////////////////////////////////////////////////////////////////////////
500 const Int_t nvarITSsignalSplit = 5;
502 const Int_t nBinsITSSplit = 2;
503 Double_t minITSSplit = 0.0;
504 Double_t maxITSSplit = 2.0;
506 Double_t binLimITSSplit[nBinsITSSplit+1];
507 for(Int_t i=0; i<=nBinsITSSplit; i++) binLimITSSplit[i]=(Double_t)minITSSplit + (maxITSSplit-minITSSplit) /nBinsITSSplit*(Double_t)i ;
510 const Int_t nBinsITSsignalSplit = 50;
511 Double_t minITSsignalSplit = -25.0;
512 Double_t maxITSsignalSplit = 25.0;
514 Double_t binLimITSsignalSplit[nBinsITSsignalSplit+1];
515 for(Int_t i=0; i<=nBinsITSsignalSplit; i++) binLimITSsignalSplit[i]=(Double_t)minITSsignalSplit + (maxITSsignalSplit-minITSsignalSplit) /nBinsITSsignalSplit*(Double_t)i ;
517 Int_t iBinITSsignalSplit[nvarITSsignalSplit];
518 iBinITSsignalSplit[0]=nBinsITSSplit;
519 for(Int_t k = 1; k < 5; k++){
520 iBinITSsignalSplit[k]=nBinsITSsignalSplit;
523 THnSparseF *hsSparseITSpidSplit = new THnSparseF("SparseITSsignalSplit","",nvarITSsignalSplit,iBinITSsignalSplit);
524 hsSparseITSpidSplit->SetBinEdges(0,&binLimITSSplit[0]);
525 for(Int_t k = 1; k < 5; k++) {
526 hsSparseITSpidSplit->SetBinEdges(k,&binLimITSsignalSplit[0]);
528 hsSparseITSpidSplit->Sumw2();
530 fList->AddAt(hsSparseITSpidSplit,kMCcutPart3);
538 //qaList->Add(fList);
541 //_______________________________________________________________________________________________
542 void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackPart)
545 // calculate (tagged e-partner) dca, opening angle, invariant mass
548 /////////////////////
550 //////////////////////
553 track->PxPyPz(&pxyz[0]);
554 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
555 fPtESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]);
557 ////////////////////////
559 ////////////////////////
560 Int_t indexTrack = TMath::Abs(track->GetLabel());
561 Int_t indexTrackPart = TMath::Abs(trackPart->GetLabel());
563 /////////////////////////
565 ////////////////////////
569 // Take info track if not already done
570 if(indexTrack!= fIndexTrack) {
572 for(Int_t id = 0; id < 10; id++) {
576 fIsFrom = kElectronFromBackground;
578 fPdg = GetPdg(indexTrack);
579 fLabMother = GetLabMother(indexTrack);
581 fMotherGamma = IsMotherGamma(indexTrack);
582 if((fMotherGamma != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromGamma;
583 fMotherPi0 = IsMotherPi0(indexTrack);
584 if((fMotherPi0 != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromPi0;
585 fMotherC = IsMotherC(indexTrack);
586 if((fMotherC != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromC;
587 fMotherB = IsMotherB(indexTrack);
588 if((fMotherB != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromB;
589 fMotherEta = IsMotherEta(indexTrack);
590 if((fMotherEta != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromEta;
592 fIndexTrack = indexTrack;
598 if(TMath::Abs(fPdg) != 11) return;
603 Int_t pdgPart = GetPdg(indexTrackPart);
604 if(TMath::Abs(pdgPart) == 11) {
605 Int_t labMotherPart = GetLabMother(indexTrackPart);
606 if((labMotherPart == fLabMother) && (indexTrack != indexTrackPart) && (TMath::Abs(fPdg) == 11) && (fPdg*pdgPart < 0) && (fLabMother >=0) && (fLabMother < (((AliStack *)fMCEvent->Stack())->GetNtrack()))) fIsPartner = kTRUE;
607 // special case of c and b
608 Int_t motherCPart = IsMotherC(indexTrackPart);
609 if((motherCPart != -1) && (fIsFrom == kElectronFromC) && (fPdg*pdgPart < 0)){
612 Int_t motherBPart = IsMotherB(indexTrackPart);
613 if((motherBPart != -1) && (fIsFrom == kElectronFromB) && (fPdg*pdgPart < 0)){
618 // Look at splitted tracks
619 fIsSplittedTrack = kFALSE;
620 if(indexTrackPart == fIndexTrack) fIsSplittedTrack = kTRUE;
624 //////////////////////
626 /////////////////////
628 if((track->Charge() > 0.0) && (trackPart->Charge() > 0.0)) sign = kPp;
629 if((track->Charge() < 0.0) && (trackPart->Charge() < 0.0)) sign = kNn;
630 if(((track->Charge() > 0.0) && (trackPart->Charge() < 0.0)) || ((track->Charge() < 0.0) && (trackPart->Charge() > 0.0))) sign = kOs;
632 /////////////////////////
634 ////////////////////////
635 Double_t cuteffect[3];
637 if(fDebugLevel > 0) {
639 cuteffect[0] = fPtESD;
641 cuteffect[2] = fIsFrom;
643 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
644 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
651 ///////////////////////////////
652 // Cut effect: Partner track
653 ///////////////////////////////
655 if(fDebugLevel > 0) {
656 if(HasMCData() && fIsPartner) {
659 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
660 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
666 ///////////////////////////////
667 // Cut effect: Opposite sign
668 ///////////////////////////////
670 if(fDebugLevel > 0) {
671 if(HasMCData() && fIsPartner && (sign == kOs)) {
674 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
675 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
681 ////////////////////////
683 ////////////////////////
684 if(!SingleTrackCut(trackPart)) return;
686 if(fDebugLevel > 0) {
687 if(HasMCData() && fIsPartner && (sign==kOs)) {
690 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
691 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
697 /////////////////////////
698 // shared clusters cut
699 /////////////////////////
700 if(fSharedClusterCut && ShareCluster(track,trackPart)) return;
702 if(fDebugLevel > 0) {
703 if(HasMCData() && fIsPartner && (sign==kOs)) {
706 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
707 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
713 ////////////////////////
715 ////////////////////////
716 if(!PIDTrackCut(trackPart)) return;
718 if(fDebugLevel > 0) {
719 if(HasMCData() && fIsPartner && (sign==kOs)) {
722 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
723 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
730 //////////////////////
732 /////////////////////
735 Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp);
736 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatadca)))) fhtmpp->Fill(dca);
738 //printf("has MC data for DCA\n");
739 //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom);
740 if(fIsFrom==kElectronFromBackground) {
741 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
745 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
750 if(TMath::Abs(dca) > 3.0) return;
752 if(fDebugLevel > 0) {
753 if(HasMCData() && fIsPartner && (sign==kOs)) {
756 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
757 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
763 ///////////////////////////////////
764 // Calcul mother variables
765 ///////////////////////////////////
767 Double_t resultsr[5];
772 /////////////////////////////
774 ////////////////////////////
776 Double_t norradius = TMath::Sqrt(fkVertex->GetX()*fkVertex->GetX()+fkVertex->GetY()*fkVertex->GetY());
778 AliESDtrack trackCopy = AliESDtrack(*track);
779 AliESDtrack trackPartCopy = AliESDtrack(*trackPart);
780 Bool_t propagateok = kTRUE;
781 if((!(trackPartCopy.PropagateTo(norradius,fBz))) || (!(trackCopy.PropagateTo(norradius,fBz)))) propagateok = kFALSE;
783 //if(trackCopy) delete trackCopy;
784 //if(trackPartCopy) delete trackPartCopy;
788 CalculateMotherVariable(&trackCopy,&trackPartCopy,&results[0]);
789 CalculateMotherVariableR(&trackCopy,&trackPartCopy,&resultsr[0]);
791 //if(trackCopy) delete trackCopy;
792 //if(trackPartCopy) delete trackPartCopy;
797 if(!CalculateMotherVariable(track,trackPart,&results[0])) return;
798 if(fDebugLevel > 0) {
799 if(HasMCData() && fIsPartner && (sign==kOs)) {
802 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
803 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
811 /////////////////////////////////////
813 /////////////////////////////////////
815 FillOutput(results, resultsr, sign);
817 if(fDebugLevel > 0) {
818 if(HasMCData() && fIsPartner && (sign==kOs)) {
820 if(TMath::Abs(results[4]) < fOpeningAngleCut) {
824 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
825 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
828 if(TMath::Abs(results[1]) < fInvMassCut) {
831 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
832 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
842 //_____________________________________________________________________________________
843 Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
846 // variables mother and take the pt of the track
848 // results contain: ptmother, invmass, etamother, phimother, openingangle
850 // with a chi2Ndf cut for AliKF code
859 track->PxPyPz(&pxyz[0]);
860 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
862 Double_t pxyzpart[3];
863 trackpart->PxPyPz(&pxyzpart[0]);
864 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
867 TVector3 motherrec = v3Dtagged + v3Dpart;
869 Double_t etaESDmother = motherrec.Eta();
870 Double_t ptESDmother = motherrec.Pt();
871 Double_t phiESDmother = motherrec.Phi();
872 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
875 // openinganglepropagated
876 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
879 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
880 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
883 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
884 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
886 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
888 if(!results) return kFALSE;
890 results[0] = ptESDmother;
891 results[1] = etaESDmother;
892 results[2] = phiESDmother;
893 results[3] = invmass;
894 results[4] = openingangle;
906 if(track->Charge() > 0.0) pid1 = 11;
908 if(trackpart->Charge() > 0.0) pid2 = 11;
912 AliKFParticle kf(*track,pid1);
913 AliKFParticle kfpart(*trackpart,pid2);
915 pair.AddDaughter(kf);
916 pair.AddDaughter(kfpart);
919 Double_t openingangle = kf.GetAngle(kfpart);
920 Double_t chi2ndf = pair.GetChi2()/pair.GetNDF();
921 //Double_t decayLength = pair.GetDecayLength();
922 Double_t radius = pair.GetR();
923 //Double_t masserror = pair.GetErrMass()>0?pair.GetErrMass()/pair.GetMass():1000000;
924 Double_t ptpair = pair.GetPt();
925 Double_t etapair = pair.GetEta();
926 Double_t phipair = pair.GetPhi();
927 Double_t masspair = pair.GetMass();
930 if(!results) return kFALSE;
933 results[1] = etapair;
934 results[2] = phipair;
935 results[3] = masspair;
936 results[4] = openingangle;
939 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf);
940 //if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
942 if(fIsFrom==kElectronFromBackground) {
943 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
947 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
951 if(chi2ndf > fChi2NdfCut) return kFALSE;
953 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatar)))) fhtmpp->Fill(radius);
954 //if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
956 if(fIsFrom==kElectronFromBackground) {
957 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
958 //if(fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
962 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
972 //_____________________________________________________________________________________
973 void AliHFEelecbackground::CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
978 // results contain: ptmother, invmass, etamother, phimother, openingangle
979 // Implemented only for no AliKF
988 track->PxPyPz(&pxyz[0]);
989 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
990 Double_t pxyzpart[3];
991 trackpart->PxPyPz(&pxyzpart[0]);
992 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
994 // rotate the partner
995 v3Dpart.RotateZ(TMath::Pi());
996 v3Dpart.GetXYZ(pxyzpart);
999 TVector3 motherrec = v3Dtagged + v3Dpart;
1001 Double_t etaESDmother = motherrec.Eta();
1002 Double_t ptESDmother = motherrec.Pt();
1003 Double_t phiESDmother = motherrec.Phi();
1004 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
1007 // openinganglepropagated
1008 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
1009 //printf("Openingangle %f\n",openingangle);
1012 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
1013 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
1015 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
1016 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
1018 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
1020 if(!results) return;
1022 results[0] = ptESDmother;
1023 results[1] = etaESDmother;
1024 results[2] = phiESDmother;
1025 results[3] = invmass;
1026 results[4] = openingangle;
1031 //_________________________________________________________________________________
1032 void AliHFEelecbackground::FillOutput(const Double_t *results, const Double_t *resultsr,Int_t sign)
1035 // Fill the Data and MC THnSparseF
1038 if((!results) || (!resultsr)) return;
1043 co[2] = TMath::Abs(results[4]);
1048 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1049 //if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1051 if((sign==kOs) && (!fUseAliKFCode)) {
1053 co[1] = resultsr[0];
1054 co[2] = TMath::Abs(resultsr[4]);
1055 co[3] = resultsr[3];
1059 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1060 //if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1068 co[2] = TMath::Abs(results[4]);
1072 co[4] = kElectronFromBackground;
1073 if((sign==kOs) && fIsPartner) co[4] = fIsFrom;
1076 co[5] = kNotSplitted;
1077 if(fIsSplittedTrack) {
1079 co[5] = kSplittedOs;
1082 co[5] = kSplittedSs;
1086 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCo)))) fhtmp->Fill(co);
1087 //if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
1092 //_______________________________________________________________________________________________
1093 Bool_t AliHFEelecbackground::SingleTrackCut(const AliESDtrack* const trackPart) const
1096 // Return minimum quality for the partner
1099 if(trackPart->GetKinkIndex(0)>0) return kFALSE;
1102 UInt_t status = trackPart->GetStatus();
1104 if(fRequireITSStandalone > 0) {
1106 /////////////////////
1108 ////////////////////
1110 if(fRequireITSStandalone==1) {
1111 if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit)==0))) return kFALSE;
1114 if(fRequireITSStandalone==2) {
1115 if(!trackPart->IsPureITSStandalone() || ((status&AliESDtrack::kITSrefit)==0)) return kFALSE;
1119 Double_t chi2 = trackPart->GetITSchi2();
1120 if(chi2 > fMinITSChi2) return kFALSE;
1122 // Min Nb of clusters
1123 Int_t nbcl = trackPart->GetITSclusters(0);
1124 if(nbcl < fMinNbCls) return kFALSE;
1126 // Min Nb of points in SDD and SPD
1128 for(Int_t layer = 0; layer < 4; layer++){
1129 if(trackPart->HasPointOnITSLayer(layer)) nbSDDSPD++;
1131 if(nbSDDSPD < fMinNbClsSDDSPD) return kFALSE;
1141 if((status&AliESDtrack::kTPCrefit)==0) return kFALSE;
1143 // Min Nb of clusters
1144 Int_t nbcl = trackPart->GetTPCclusters(0);
1145 if(nbcl < fMinNbCls) return kFALSE;
1152 //_______________________________________________________________________________________________
1153 Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
1156 // PID for the partner using TPC or ITS
1159 if(fRequireITSStandalone > 0) {
1161 /////////////////////
1163 ////////////////////
1166 Double_t itsSignal = trackPart->GetITSsignal();
1167 Double_t p = trackPart->P();
1169 if(fDebugLevel > 1) {
1170 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal);
1171 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
1179 // Take signal trackPart
1180 Double_t dEdxSamplesPart[4];
1181 trackPart->GetITSdEdxSamples(dEdxSamplesPart);
1184 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1185 Float_t nsigma = fPIDMethodPartnerITS->NumberOfSigmasITS(trackPart, AliPID::kElectron);
1186 if(TMath::Abs(nsigma) > 2.0) return kFALSE;
1189 if(fDebugLevel > 1) {
1191 Double_t entries[5];
1193 entries[1] = dEdxSamplesPart[0];
1194 entries[2] = dEdxSamplesPart[1];
1195 entries[3] = dEdxSamplesPart[2];
1196 entries[4] = dEdxSamplesPart[3];
1198 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
1199 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal);
1200 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))) fhtmp->Fill(entries);
1201 //if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
1214 Double_t tpcSignal = trackPart->GetTPCsignal();
1215 Double_t p = trackPart->GetInnerParam() ? trackPart->GetInnerParam()->P() : trackPart->P();
1217 if(fDebugLevel > 1) {
1218 //printf("tpcSignal %f\n",tpcSignal);
1219 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
1220 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal);
1225 if(!fPIDMethodPartner) return kFALSE;
1226 AliHFEpidObject hfetrack;
1227 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
1228 hfetrack.SetRecTrack(trackPart);
1229 //if(HasMCData()) hfetrack.fMCtrack = mctrack;
1230 if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE;
1232 if(fDebugLevel > 1) {
1233 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal);
1234 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
1243 //__________________________________________________________________________________________
1244 Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2)
1247 // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method
1250 // hsfval: number of shared clusters
1251 // hsmval: quality of the tracks
1254 // compare the dEdx in the ITS
1257 if(!fRequireITSStandalone) {
1267 Float_t hsmval = 0.0;
1268 Float_t hsfval = 0.0;
1270 for(unsigned int imap=0;imap<track1->GetTPCClusterMap().GetNbits(); imap++) {
1271 if(track1->GetTPCClusterMap().TestBitNumber(imap) &&
1272 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1273 // Do they share it ?
1274 if (track1->GetTPCSharedMap().TestBitNumber(imap) &&
1275 track2->GetTPCSharedMap().TestBitNumber(imap))
1286 else if (track1->GetTPCClusterMap().TestBitNumber(imap) ||
1287 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1299 if((hsfval > 0.15) || (hsmval > -0.15)) return kTRUE; //they share cluster
1312 Double_t dEdxSamples1[4];
1313 track1->GetITSdEdxSamples(dEdxSamples1);
1314 Double_t dEdxSamples2[4];
1315 track2->GetITSdEdxSamples(dEdxSamples2);
1317 // If there are matching
1318 Int_t nbClusters = 0;
1319 Bool_t match[4] = {kTRUE,kTRUE,kTRUE,kTRUE};
1320 Double_t limit[4] = {1.5,1.5,1.5,1.5};
1321 for(Int_t layer = 0; layer < 4; layer++) {
1322 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1323 if(TMath::Abs(dEdxSamples1[layer]-dEdxSamples2[layer])>limit[layer]) match[layer] = kFALSE;
1327 //printf("nbClusters %d\n",nbClusters);
1330 if(fDebugLevel > 1) {
1331 Double_t entriesSplit[5];
1332 entriesSplit[0] = 0.0;
1333 if(fIsSplittedTrack) entriesSplit[0] = 1.0;
1335 for(Int_t layer = 0; layer < 4; layer++) {
1336 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1337 entriesSplit[layer+1] = dEdxSamples1[layer]-dEdxSamples2[layer];
1339 else entriesSplit[layer+1] = -100.0;
1341 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit);
1342 //if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
1346 Int_t nbClustersNotClose = 0;
1347 for(Int_t layer = 0; layer < 4; layer++) {
1348 if(!match[layer]) nbClustersNotClose++;
1350 if((nbClusters > 1) && (nbClustersNotClose > 0.75*nbClusters)) return kFALSE;
1356 //____________________________________________________________________________________________________________
1357 void AliHFEelecbackground::SetPIDPartner() {
1360 // Init the stuff for PID on the partner track
1363 fPIDPartner = kTRUE;
1365 if(fRequireITSStandalone == 0) {
1367 if(!fPIDMethodPartner) {
1368 fPIDMethodPartner = new AliHFEpid();
1369 fPIDMethodPartner->AddDetector("TPC", 0);
1370 fPIDMethodPartner->InitializePID(); // 3 sigma cut in TPC
1376 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1381 //______________________________________________________________________________________________
1382 void AliHFEelecbackground::SetEvent(AliESDEvent* const ESD)
1385 // Set the AliESD Event, the magnetic field and the primary vertex
1389 fBz=fESD1->GetMagneticField();
1390 fkVertex = fESD1->GetPrimaryVertex();
1393 //____________________________________________________________________________________________________________
1394 Int_t AliHFEelecbackground::IsMotherGamma(Int_t tr) {
1397 // Return the lab of gamma mother or -1 if not gamma
1400 AliStack* stack = fMCEvent->Stack();
1401 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1404 TParticle * particle = stack->Particle(tr);
1405 if(!particle) return -1;
1406 Int_t imother = particle->GetFirstMother();
1407 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1408 TParticle * mother = stack->Particle(imother);
1409 if(!mother) return -1;
1412 Int_t pdg = mother->GetPdgCode();
1413 if(TMath::Abs(pdg) == 22) return imother;
1414 if(TMath::Abs(pdg) == 11) {
1415 return IsMotherGamma(imother);
1421 //____________________________________________________________________________________________________________
1422 Int_t AliHFEelecbackground::IsMotherPi0(Int_t tr) {
1425 // Return the lab of pi0 mother or -1 if not pi0
1428 AliStack* stack = fMCEvent->Stack();
1429 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1432 TParticle * particle = stack->Particle(tr);
1433 if(!particle) return -1;
1434 Int_t imother = particle->GetFirstMother();
1435 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1436 TParticle * mother = stack->Particle(imother);
1437 if(!mother) return -1;
1440 Int_t pdg = mother->GetPdgCode();
1441 if(TMath::Abs(pdg) == 111) return imother;
1442 if(TMath::Abs(pdg) == 11) {
1443 return IsMotherPi0(imother);
1448 //____________________________________________________________________________________________________________
1449 Int_t AliHFEelecbackground::IsMotherEta(Int_t tr) {
1452 // Return the lab of pi0 mother or -1 if not pi0
1455 AliStack* stack = fMCEvent->Stack();
1456 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1459 TParticle * particle = stack->Particle(tr);
1460 if(!particle) return -1;
1461 Int_t imother = particle->GetFirstMother();
1462 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1463 TParticle * mother = stack->Particle(imother);
1464 if(!mother) return -1;
1467 Int_t pdg = mother->GetPdgCode();
1468 if(TMath::Abs(pdg) == 221) return imother;
1469 if(TMath::Abs(pdg) == 11) {
1470 return IsMotherEta(imother);
1475 //____________________________________________________________________________________________________________
1476 Int_t AliHFEelecbackground::IsMotherC(Int_t tr) {
1479 // Return the lab of signal mother or -1 if not signal
1482 AliStack* stack = fMCEvent->Stack();
1483 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1486 TParticle * particle = stack->Particle(tr);
1487 if(!particle) return -1;
1488 Int_t imother = particle->GetFirstMother();
1489 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1490 TParticle * mother = stack->Particle(imother);
1491 if(!mother) return -1;
1494 Int_t pdg = mother->GetPdgCode();
1495 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;
1496 if(TMath::Abs(pdg) == 11) {
1497 return IsMotherC(imother);
1502 //____________________________________________________________________________________________________________
1503 Int_t AliHFEelecbackground::IsMotherB(Int_t tr) {
1506 // Return the lab of signal mother or -1 if not signal
1509 AliStack* stack = fMCEvent->Stack();
1510 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1513 TParticle * particle = stack->Particle(tr);
1514 if(!particle) return -1;
1515 Int_t imother = particle->GetFirstMother();
1516 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1517 TParticle * mother = stack->Particle(imother);
1518 if(!mother) return -1;
1521 Int_t pdg = mother->GetPdgCode();
1522 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;
1523 if(TMath::Abs(pdg) == 11) {
1524 return IsMotherB(imother);
1529 //____________________________________________________________________________________________________________
1530 Int_t AliHFEelecbackground::GetPdg(Int_t tr) {
1536 AliStack* stack = fMCEvent->Stack();
1537 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1540 TParticle * particle = stack->Particle(tr);
1541 if(!particle) return -1;
1542 Int_t pdg = particle->GetPdgCode();
1547 //____________________________________________________________________________________________________________
1548 Int_t AliHFEelecbackground::GetLabMother(Int_t tr) {
1551 // Simply lab mother
1554 AliStack* stack = fMCEvent->Stack();
1555 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1558 TParticle * particle = stack->Particle(tr);
1559 if(!particle) return -1;
1560 Int_t imother = particle->GetFirstMother();
1565 //_______________________________________________________________________________________________
1566 void AliHFEelecbackground::PostProcess()
1569 // Post process the histos and extract the background pt spectra
1574 gStyle->SetPalette(1);
1575 gStyle->SetOptStat(1111);
1576 gStyle->SetPadBorderMode(0);
1577 gStyle->SetCanvasColor(10);
1578 gStyle->SetPadLeftMargin(0.13);
1579 gStyle->SetPadRightMargin(0.13);
1581 /////////////////////////
1582 // Take the THnSparseF
1583 /////////////////////////
1584 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1585 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1586 THnSparseF *hsSparseCutPassedMC = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
1588 /////////////////////////////////
1589 // Cuts on the opening angle
1590 ////////////////////////////////
1591 if(!hsSparseData) return;
1592 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1593 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1594 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1597 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
1598 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
1599 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
1602 /////////////////////////
1603 // Prepare the histos
1604 ////////////////////////
1606 TAxis *ptaxisinvmass = hsSparseData->GetAxis(3);
1607 Int_t nbinsptinvmass = ptaxisinvmass->GetNbins();
1609 TH1D **invmassosptproj = new TH1D*[nbinsptinvmass];
1610 TH1D **invmassssptproj = new TH1D*[nbinsptinvmass];
1611 TH1D **invmassrptproj = new TH1D*[nbinsptinvmass];
1612 TH1D **invmassdiffptproj = new TH1D*[nbinsptinvmass];
1613 TH1D **invmassgammaptproj = new TH1D*[nbinsptinvmass];
1614 TH1D **invmasspi0ptproj = new TH1D*[nbinsptinvmass];
1615 TH1D **invmassetaptproj = new TH1D*[nbinsptinvmass];
1616 TH1D **invmassCptproj = new TH1D*[nbinsptinvmass];
1617 TH1D **invmassBptproj = new TH1D*[nbinsptinvmass];
1619 TH1D *yieldPtFound = (TH1D *) hsSparseData->Projection(0);
1620 yieldPtFound->SetName("Found yield");
1621 yieldPtFound->Reset();
1623 TH1D *yieldPtSourcesMC = 0x0;
1624 TH1D *yieldPtSignalCutMC = 0x0;
1626 yieldPtSourcesMC = (TH1D *) hsSparseMC->Projection(0);
1627 yieldPtSourcesMC->SetName("Found yield");
1628 yieldPtSourcesMC->Reset();
1630 yieldPtSignalCutMC = (TH1D *) hsSparseMC->Projection(0);
1631 yieldPtSignalCutMC->SetName("Found yield");
1632 yieldPtSignalCutMC->Reset();
1638 Int_t nbrow = (Int_t) (nbinsptinvmass/5);
1639 TString namecanvas("InvMassSpectra");
1640 TCanvas * canvas =new TCanvas(namecanvas,namecanvas,800,800);
1641 canvas->Divide(5,nbrow+1);
1643 /////////////////////////////
1645 /////////////////////////////
1647 for(Int_t k=1; k <= nbinsptinvmass; k++){
1649 Double_t lowedge = ptaxisinvmass->GetBinLowEdge(k);
1650 Double_t upedge = ptaxisinvmass->GetBinUpEdge(k);
1653 hsSparseData->GetAxis(0)->SetRange(k,k);
1654 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(k,k);
1657 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1658 invmassosptproj[k-1] = hsSparseData->Projection(3);
1659 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1660 invmassssptproj[k-1] = hsSparseData->Projection(3);
1661 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1662 invmassrptproj[k-1] = hsSparseData->Projection(3);
1663 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1664 invmassgammaptproj[k-1] = 0x0;
1665 invmasspi0ptproj[k-1] = 0x0;
1666 invmassetaptproj[k-1] = 0x0;
1667 invmassCptproj[k-1] = 0x0;
1668 invmassBptproj[k-1] = 0x0;
1670 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1671 invmassgammaptproj[k-1] = hsSparseMC->Projection(3);
1672 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1673 invmasspi0ptproj[k-1] = hsSparseMC->Projection(3);
1674 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1675 invmassetaptproj[k-1] = hsSparseMC->Projection(3);
1676 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1677 invmassCptproj[k-1] = hsSparseMC->Projection(3);
1678 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1679 invmassBptproj[k-1] = hsSparseMC->Projection(3);
1680 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1683 invmassdiffptproj[k-1] = (TH1D *) invmassosptproj[k-1]->Clone();
1684 TString name("Invmassdiffptbin");
1686 invmassdiffptproj[k-1]->SetName(name);
1687 invmassdiffptproj[k-1]->Add(invmassssptproj[k-1],-1.0);
1689 TString namee("p_{T} tagged from ");
1691 namee += " GeV/c to ";
1695 invmassosptproj[k-1]->SetTitle((const char*)namee);
1696 invmassssptproj[k-1]->SetTitle((const char*)namee);
1697 invmassrptproj[k-1]->SetTitle((const char*)namee);
1698 invmassdiffptproj[k-1]->SetTitle((const char*)namee);
1699 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetTitle((const char*)namee);
1700 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetTitle((const char*)namee);
1701 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetTitle((const char*)namee);
1702 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetTitle((const char*)namee);
1703 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetTitle((const char*)namee);
1705 invmassosptproj[k-1]->SetStats(0);
1706 invmassssptproj[k-1]->SetStats(0);
1707 invmassrptproj[k-1]->SetStats(0);
1708 invmassdiffptproj[k-1]->SetStats(0);
1709 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetStats(0);
1710 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetStats(0);
1711 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetStats(0);
1712 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetStats(0);
1713 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetStats(0);
1715 Double_t yieldf = invmassdiffptproj[k-1]->Integral();
1716 if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) {
1717 Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral();
1718 if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg);
1720 Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral();
1721 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
1724 yieldPtFound->SetBinContent(k,yieldf);
1727 invmassosptproj[k-1]->Draw();
1728 invmassssptproj[k-1]->Draw("same");
1729 invmassdiffptproj[k-1]->Draw("same");
1730 invmassrptproj[k-1]->Draw("same");
1731 TLegend *legiv = new TLegend(0.4,0.6,0.89,0.89);
1732 legiv->AddEntry(invmassosptproj[k-1],"Opposite signs","p");
1733 legiv->AddEntry(invmassssptproj[k-1],"Same signs","p");
1734 legiv->AddEntry(invmassdiffptproj[k-1],"(Opposite - Same) signs","p");
1735 legiv->AddEntry(invmassrptproj[k-1],"rotated","p");
1736 if(invmassgammaptproj[k-1]) legiv->AddEntry(invmassgammaptproj[k-1],"e^{+}e^{-} from #gamma","p");
1737 if(invmasspi0ptproj[k-1]) legiv->AddEntry(invmasspi0ptproj[k-1],"e^{+}e^{-} from #pi^{0}","p");
1738 if(invmassetaptproj[k-1]) legiv->AddEntry(invmassetaptproj[k-1],"e^{+}e^{-} from #eta","p");
1739 legiv->Draw("same");
1741 hsSparseData->GetAxis(0)->SetRange(1,hsSparseData->GetAxis(0)->GetNbins());
1742 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(1,hsSparseMC->GetAxis(0)->GetNbins());
1746 ////////////////////////////////////////////////////
1747 // End of plotting: do subtraction of background
1748 ///////////////////////////////////////////////////
1750 yieldPtFound->SetStats(0);
1751 if(yieldPtSourcesMC) yieldPtSourcesMC->SetStats(0);
1752 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetStats(0);
1754 TCanvas * canvasfin =new TCanvas("ResultsElecBackGround","ResultsElecBackGround",800,800);
1756 yieldPtFound->Draw();
1757 if(yieldPtSourcesMC && yieldPtSignalCutMC) {
1758 yieldPtSourcesMC->Draw("same");
1759 yieldPtSignalCutMC->Draw("same");
1760 TLegend *lega = new TLegend(0.4,0.6,0.89,0.89);
1761 lega->AddEntry(yieldPtFound,"Contributions found","l");
1762 lega->AddEntry(yieldPtSourcesMC,"Contributions of e^{+}e^{-} from #gamma, #pi^{0} and #eta","l");
1763 lega->AddEntry(yieldPtSignalCutMC,"Contributions of e^{+}e^{-} from C and B","l");
1767 if(hsSparseCutPassedMC){
1768 hsSparseCutPassedMC->GetAxis(1)->SetRange(1,1);
1769 hsSparseCutPassedMC->GetAxis(2)->SetRange(1,4);
1770 TH1D *hsSparseCutPassedMCproj = hsSparseCutPassedMC->Projection(0);
1772 TH1D *cYieldPtFound = (TH1D*)yieldPtFound->Clone("RatioEfficiency");
1773 if(hsSparseCutPassedMCproj->Integral() > 0.0) cYieldPtFound->Divide(hsSparseCutPassedMCproj);
1775 TCanvas * canvasfratio =new TCanvas("RatioEfficiency","RatioEfficiency",800,800);
1776 canvasfratio->cd(1);
1777 cYieldPtFound->Draw();
1780 //////////////////////////
1782 /////////////////////////
1784 if(!fListPostProcess) fListPostProcess = new TList();
1785 fListPostProcess->SetName("ListPostProcess");
1787 for(Int_t k=0; k < nbinsptinvmass; k++){
1788 fListPostProcess->AddAt(invmassosptproj[k],kOos+kNOutput*k);
1789 fListPostProcess->AddAt(invmassssptproj[k],kOss+kNOutput*k);
1790 fListPostProcess->AddAt(invmassrptproj[k],kOr+kNOutput*k);
1791 fListPostProcess->AddAt(invmassdiffptproj[k],kOdiff+kNOutput*k);
1792 if(invmassgammaptproj[k]) fListPostProcess->AddAt(invmassgammaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromGamma);
1793 if(invmasspi0ptproj[k]) fListPostProcess->AddAt(invmasspi0ptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromPi0);
1794 if(invmassetaptproj[k]) fListPostProcess->AddAt(invmassetaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromEta);
1795 if(invmassCptproj[k]) fListPostProcess->AddAt(invmassCptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromC);
1796 if(invmassBptproj[k]) fListPostProcess->AddAt(invmassBptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromB);
1799 fListPostProcess->AddAt(yieldPtFound,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass);
1800 if(yieldPtSourcesMC) fListPostProcess->AddAt(yieldPtSourcesMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+1);
1801 if(yieldPtSignalCutMC) fListPostProcess->AddAt(yieldPtSignalCutMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+2);
1803 // delete dynamic array
1804 delete[] invmassosptproj;
1805 delete[] invmassssptproj;
1806 delete[] invmassrptproj;
1807 delete[] invmassdiffptproj;
1808 delete[] invmassgammaptproj;
1809 delete[] invmasspi0ptproj;
1810 delete[] invmassetaptproj;
1811 delete[] invmassCptproj;
1812 delete[] invmassBptproj;
1815 //_______________________________________________________________________________________________
1816 void AliHFEelecbackground::Plot() const
1824 gStyle->SetPalette(1);
1825 gStyle->SetOptStat(1111);
1826 gStyle->SetPadBorderMode(0);
1827 gStyle->SetCanvasColor(10);
1828 gStyle->SetPadLeftMargin(0.13);
1829 gStyle->SetPadRightMargin(0.13);
1832 /////////////////////////
1833 // Take the THnSparseF
1834 /////////////////////////
1835 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1836 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1837 if(!hsSparseData) return;
1839 ////////////////////
1841 ////////////////////
1843 // Opening angle one direction
1844 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1845 TH1D *openingangleppproj = hsSparseData->Projection(2);
1846 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1847 TH1D *openinganglennproj = hsSparseData->Projection(2);
1848 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1849 TH1D *openinganglessproj = hsSparseData->Projection(2);
1850 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1851 TH1D *openinganglerproj = hsSparseData->Projection(2);
1852 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1853 TH1D *openingangleosproj = hsSparseData->Projection(2);
1854 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1856 TH1D *openinganglegammaproj = 0x0;
1857 TH1D *openinganglepi0proj = 0x0;
1858 TH1D *openingangleCproj = 0x0;
1859 TH1D *openingangleBproj = 0x0;
1860 TH1D *openingangleetaproj = 0x0;
1861 TH1D *openingangleSplittedTrackssproj = 0x0;
1862 TH1D *openingangleSplittedTrackosproj = 0x0;
1864 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1865 openinganglegammaproj = hsSparseMC->Projection(2);
1866 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1867 openinganglepi0proj = hsSparseMC->Projection(2);
1868 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1869 openingangleetaproj = hsSparseMC->Projection(2);
1870 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1871 openingangleCproj = hsSparseMC->Projection(2);
1872 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1873 openingangleBproj = hsSparseMC->Projection(2);
1874 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1875 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1876 openingangleSplittedTrackssproj = hsSparseMC->Projection(2);
1877 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1878 openingangleSplittedTrackosproj = hsSparseMC->Projection(2);
1879 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1882 // Projection pt-opening angle
1883 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1884 TH2D *openingangleppproj2D = hsSparseData->Projection(0,2);
1885 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1886 TH2D *openinganglennproj2D = hsSparseData->Projection(0,2);
1887 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1888 TH2D *openinganglessproj2D = hsSparseData->Projection(0,2);
1889 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1890 TH2D *openinganglerproj2D = hsSparseData->Projection(0,2);
1891 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1892 TH2D *openingangleosproj2D = hsSparseData->Projection(0,2);
1893 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1895 TH2D *openinganglegammaproj2D = 0x0;
1896 TH2D *openinganglepi0proj2D = 0x0;
1897 TH2D *openingangleCproj2D = 0x0;
1898 TH2D *openingangleBproj2D = 0x0;
1899 TH2D *openingangleetaproj2D = 0x0;
1900 TH2D *openingangleSplittedTrackssproj2D = 0x0;
1901 TH2D *openingangleSplittedTrackosproj2D = 0x0;
1903 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1904 openinganglegammaproj2D = hsSparseMC->Projection(0,2);
1905 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1906 openinganglepi0proj2D = hsSparseMC->Projection(0,2);
1907 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1908 openingangleetaproj2D = hsSparseMC->Projection(0,2);
1909 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1910 openingangleCproj2D = hsSparseMC->Projection(0,2);
1911 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1912 openingangleBproj2D = hsSparseMC->Projection(0,2);
1913 hsSparseMC->GetAxis(4)->SetRange(1, hsSparseMC->GetAxis(4)->GetNbins());
1914 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1915 openingangleSplittedTrackssproj2D = hsSparseMC->Projection(0,2);
1916 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1917 openingangleSplittedTrackosproj2D = hsSparseMC->Projection(0,2);
1918 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1921 openingangleppproj2D->SetStats(0);
1922 openinganglennproj2D->SetStats(0);
1923 openinganglessproj2D->SetStats(0);
1924 openinganglerproj2D->SetStats(0);
1925 openingangleosproj2D->SetStats(0);
1926 if(openinganglegammaproj2D) openinganglegammaproj2D->SetStats(0);
1927 if(openinganglepi0proj2D) openinganglepi0proj2D->SetStats(0);
1928 if(openingangleCproj2D) openingangleCproj2D->SetStats(0);
1929 if(openingangleBproj2D) openingangleBproj2D->SetStats(0);
1930 if(openingangleetaproj2D) openingangleetaproj2D->SetStats(0);
1931 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetStats(0);
1932 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetStats(0);
1934 openingangleppproj2D->SetTitle("openingangleppproj2D");
1935 openinganglennproj2D->SetTitle("openinganglennproj2D");
1936 openinganglessproj2D->SetTitle("openinganglessproj2D");
1937 openinganglerproj2D->SetTitle("openinganglerproj2D");
1938 openingangleosproj2D->SetTitle("openingangleosproj2D");
1939 if(openinganglegammaproj2D) openinganglegammaproj2D->SetTitle("openinganglegammaproj2D");
1940 if(openinganglepi0proj2D) openinganglepi0proj2D->SetTitle("openinganglepi0proj2D");
1941 if(openingangleCproj2D) openingangleCproj2D->SetTitle("openingangleCproj2D");
1942 if(openingangleBproj2D) openingangleBproj2D->SetTitle("openingangleBproj2D");
1943 if(openingangleetaproj2D) openingangleetaproj2D->SetTitle("openingangleetaproj2D");
1944 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetTitle("openingangleSplittedTrackssproj2D");
1945 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetTitle("openingangleSplittedTrackosproj2D");
1947 openingangleppproj->SetStats(0);
1948 openinganglennproj->SetStats(0);
1949 openinganglessproj->SetStats(0);
1950 openinganglerproj->SetStats(0);
1951 openingangleosproj->SetStats(0);
1952 if(openinganglegammaproj) openinganglegammaproj->SetStats(0);
1953 if(openinganglepi0proj) openinganglepi0proj->SetStats(0);
1954 if(openingangleCproj) openingangleCproj->SetStats(0);
1955 if(openingangleBproj) openingangleBproj->SetStats(0);
1956 if(openingangleetaproj) openingangleetaproj->SetStats(0);
1957 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetStats(0);
1958 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetStats(0);
1960 openingangleppproj->SetTitle("");
1961 openinganglennproj->SetTitle("");
1962 openinganglessproj->SetTitle("");
1963 openinganglerproj->SetTitle("");
1964 openingangleosproj->SetTitle("");
1965 if(openinganglegammaproj) openinganglegammaproj->SetTitle("");
1966 if(openinganglepi0proj) openinganglepi0proj->SetTitle("");
1967 if(openingangleCproj) openingangleCproj->SetTitle("");
1968 if(openingangleBproj) openingangleBproj->SetTitle("");
1969 if(openingangleetaproj) openingangleetaproj->SetTitle("");
1970 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetTitle("");
1971 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetTitle("");
1973 ////////////////////////////
1975 ///////////////////////////
1977 // Cuts on the opening angle
1978 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1979 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1980 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1983 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseData\n",axisOpeningAngleData->GetBinLowEdge(binCutData),axisOpeningAngleData->GetBinUpEdge(binCutData));
1986 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1987 TH1D *invmassppproj = hsSparseData->Projection(3);
1988 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1989 TH1D *invmassnnproj = hsSparseData->Projection(3);
1990 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1991 TH1D *invmassssproj = hsSparseData->Projection(3);
1992 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1993 TH1D *invmassrproj = hsSparseData->Projection(3);
1994 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1995 TH1D *invmassosproj = hsSparseData->Projection(3);
1996 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1998 TH1D *invmassgammaproj = 0x0;
1999 TH1D *invmasspi0proj = 0x0;
2000 TH1D *invmassCproj = 0x0;
2001 TH1D *invmassBproj = 0x0;
2002 TH1D *invmassetaproj = 0x0;
2003 TH1D *invmassSplittedTrackssproj = 0x0;
2004 TH1D *invmassSplittedTrackosproj = 0x0;
2006 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
2007 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
2008 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
2011 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseMC\n",axisOpeningAngleMC->GetBinLowEdge(binCutMC),axisOpeningAngleMC->GetBinUpEdge(binCutMC));
2013 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2014 invmassgammaproj = hsSparseMC->Projection(3);
2015 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2016 invmasspi0proj = hsSparseMC->Projection(3);
2017 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2018 invmassetaproj = hsSparseMC->Projection(3);
2019 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2020 invmassCproj = hsSparseMC->Projection(3);
2021 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2022 invmassBproj = hsSparseMC->Projection(3);
2023 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2024 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2025 invmassSplittedTrackssproj = hsSparseMC->Projection(3);
2026 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2027 invmassSplittedTrackosproj = hsSparseMC->Projection(3);
2028 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2031 invmassppproj->SetStats(0);
2032 invmassnnproj->SetStats(0);
2033 invmassssproj->SetStats(0);
2034 invmassrproj->SetStats(0);
2035 invmassosproj->SetStats(0);
2036 if(invmassgammaproj) invmassgammaproj->SetStats(0);
2037 if(invmasspi0proj) invmasspi0proj->SetStats(0);
2038 if(invmassCproj) invmassCproj->SetStats(0);
2039 if(invmassBproj) invmassBproj->SetStats(0);
2040 if(invmassetaproj) invmassetaproj->SetStats(0);
2041 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetStats(0);
2042 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetStats(0);
2044 invmassppproj->SetTitle("");
2045 invmassnnproj->SetTitle("");
2046 invmassssproj->SetTitle("");
2047 invmassrproj->SetTitle("");
2048 invmassosproj->SetTitle("");
2049 if(invmassgammaproj) invmassgammaproj->SetTitle("");
2050 if(invmasspi0proj) invmasspi0proj->SetTitle("");
2051 if(invmassCproj) invmassCproj->SetTitle("");
2052 if(invmassBproj) invmassBproj->SetTitle("");
2053 if(invmassetaproj) invmassetaproj->SetTitle("");
2054 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetTitle("");
2055 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetTitle("");
2057 // Projection pt-invariant mass angle
2058 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
2059 TH2D *invmassppproj2D = hsSparseData->Projection(0,3);
2060 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
2061 TH2D *invmassnnproj2D = hsSparseData->Projection(0,3);
2062 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
2063 TH2D *invmassssproj2D = hsSparseData->Projection(0,3);
2064 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
2065 TH2D *invmassrproj2D = hsSparseData->Projection(0,3);
2066 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
2067 TH2D *invmassosproj2D = hsSparseData->Projection(0,3);
2068 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
2070 TH2D *invmassgammaproj2D = 0x0;
2071 TH2D *invmasspi0proj2D = 0x0;
2072 TH2D *invmassCproj2D = 0x0;
2073 TH2D *invmassBproj2D = 0x0;
2074 TH2D *invmassetaproj2D = 0x0;
2075 TH2D *invmassSplittedTrackssproj2D = 0x0;
2076 TH2D *invmassSplittedTrackosproj2D = 0x0;
2078 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2079 invmassgammaproj2D = hsSparseMC->Projection(0,3);
2080 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2081 invmasspi0proj2D = hsSparseMC->Projection(0,3);
2082 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2083 invmassetaproj2D = hsSparseMC->Projection(0,3);
2084 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2085 invmassCproj2D = hsSparseMC->Projection(0,3);
2086 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2087 invmassBproj2D = hsSparseMC->Projection(0,3);
2088 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2089 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2090 invmassSplittedTrackssproj2D = hsSparseMC->Projection(0,3);
2091 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2092 invmassSplittedTrackosproj2D = hsSparseMC->Projection(0,3);
2093 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2097 invmassppproj2D->SetStats(0);
2098 invmassnnproj2D->SetStats(0);
2099 invmassssproj2D->SetStats(0);
2100 invmassrproj2D->SetStats(0);
2101 invmassosproj2D->SetStats(0);
2102 if(invmassgammaproj2D) invmassgammaproj2D->SetStats(0);
2103 if(invmasspi0proj2D) invmasspi0proj2D->SetStats(0);
2104 if(invmassCproj2D) invmassCproj2D->SetStats(0);
2105 if(invmassBproj2D) invmassBproj2D->SetStats(0);
2106 if(invmassetaproj2D) invmassetaproj2D->SetStats(0);
2107 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetStats(0);
2108 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetStats(0);
2110 invmassppproj2D->SetTitle("invmassppproj2D");
2111 invmassnnproj2D->SetTitle("invmassnnproj2D");
2112 invmassssproj2D->SetTitle("invmassssproj2D");
2113 invmassrproj2D->SetTitle("invmassrproj2D");
2114 invmassosproj2D->SetTitle("invmassosproj2D");
2115 if(invmassgammaproj2D) invmassgammaproj2D->SetTitle("invmassgammaproj2D");
2116 if(invmasspi0proj2D) invmasspi0proj2D->SetTitle("invmasspi0proj2D");
2117 if(invmassCproj2D) invmassCproj2D->SetTitle("invmassCproj2D");
2118 if(invmassBproj2D) invmassBproj2D->SetTitle("invmassBproj2D");
2119 if(invmassetaproj2D) invmassetaproj2D->SetTitle("invmassetaproj2D");
2120 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetTitle("invmassSplittedTrackssproj2D");
2121 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetTitle("invmassSplittedTrackosproj2D");
2128 // Draw histograms for opening angle
2129 TCanvas * copeningangle =new TCanvas("openingangle","Openingangle",800,800);
2130 copeningangle->cd();
2131 //openingangleppproj->Draw();
2132 //openinganglennproj->Draw("same");
2133 openinganglessproj->Draw();
2134 //openinganglerproj->Draw("same");
2135 openingangleosproj->Draw("same");
2136 if(openinganglegammaproj) openinganglegammaproj->Draw("same");
2137 if(openinganglepi0proj) openinganglepi0proj->Draw("same");
2138 //if(openingangleCproj) openingangleCproj->Draw("same");
2139 //if(openingangleBproj) openingangleBproj->Draw("same");
2140 if(openingangleetaproj) openingangleetaproj->Draw("same");
2141 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->Draw("same");
2142 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->Draw("same");
2143 TLegend *lego = new TLegend(0.4,0.6,0.89,0.89);
2144 //lego->AddEntry(openingangleppproj,"positive-positive","p");
2145 //lego->AddEntry(openinganglennproj,"negative-negative","p");
2146 lego->AddEntry(openinganglessproj,"same-sign","p");
2147 //lego->AddEntry(openinganglerproj,"rotated","p");
2148 lego->AddEntry(openingangleosproj,"positive-negative","p");
2149 if(openinganglegammaproj) lego->AddEntry(openinganglegammaproj,"e^{+}e^{-} from #gamma","p");
2150 if(openinganglepi0proj) lego->AddEntry(openinganglepi0proj,"e^{+}e^{-} from #pi^{0}","p");
2151 //if(openingangleCproj) lego->AddEntry(openingangleCproj,"e^{+}e^{-} from c","p");
2152 //if(openingangleBproj) lego->AddEntry(openingangleBproj,"e^{+}e^{-} from b","p");
2153 if(openingangleetaproj) lego->AddEntry(openingangleetaproj,"e^{+}e^{-} from #eta","p");
2154 if(openingangleSplittedTrackssproj) lego->AddEntry(openingangleSplittedTrackssproj,"Splitted tracks same sign","p");
2155 if(openingangleSplittedTrackosproj) lego->AddEntry(openingangleSplittedTrackosproj,"Splitted tracks opposite sign","p");
2158 // Draw histograms for invariant mass
2159 TCanvas * cinvmass =new TCanvas("invmass","Invmass",800,800);
2161 //invmassppproj->Draw();
2162 //invmassnnproj->Draw("same");
2163 invmassssproj->Draw();
2164 //invmassrproj->Draw("same");
2165 invmassosproj->Draw("same");
2166 if(invmassgammaproj) invmassgammaproj->Draw("same");
2167 if(invmasspi0proj) invmasspi0proj->Draw("same");
2168 //if(invmassCproj) invmassCproj->Draw("same");
2169 //if(invmassBproj) invmassBproj->Draw("same");
2170 if(invmassetaproj) invmassetaproj->Draw("same");
2171 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->Draw("same");
2172 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->Draw("same");
2173 TLegend *legi = new TLegend(0.4,0.6,0.89,0.89);
2174 //legi->AddEntry(invmassppproj,"positive-positive","p");
2175 //legi->AddEntry(invmassnnproj,"negative-negative","p");
2176 legi->AddEntry(invmassssproj,"same-sign","p");
2177 //legi->AddEntry(invmassrproj,"rotated","p");
2178 legi->AddEntry(invmassosproj,"positive-negative","p");
2179 if(invmassgammaproj) legi->AddEntry(invmassgammaproj,"e^{+}e^{-} from #gamma","p");
2180 if(invmasspi0proj) legi->AddEntry(invmasspi0proj,"e^{+}e^{-} from #pi^{0}","p");
2181 //if(invmassCproj) legi->AddEntry(invmassCproj,"e^{+}e^{-} from c","p");
2182 //if(invmassBproj) legi->AddEntry(invmassBproj,"e^{+}e^{-} from b","p");
2183 if(invmassetaproj) legi->AddEntry(invmassetaproj,"e^{+}e^{-} from #eta","p");
2184 if(invmassSplittedTrackssproj) legi->AddEntry(invmassSplittedTrackssproj,"Splitted tracks same sign","p");
2185 if(invmassSplittedTrackosproj) legi->AddEntry(invmassSplittedTrackosproj,"Splitted tracks opposite sign","p");
2190 // Draw histograms for opening angle 2D
2191 TCanvas * copeningangle2D =new TCanvas("openingangle2D","Openingangle2D",800,800);
2192 copeningangle2D->Divide(6,2);
2193 copeningangle2D->cd(1);
2194 openingangleppproj2D->Draw("lego");
2195 copeningangle2D->cd(2);
2196 openinganglennproj2D->Draw("lego");
2197 copeningangle2D->cd(3);
2198 openinganglessproj2D->Draw("lego");
2199 copeningangle2D->cd(4);
2200 openinganglerproj2D->Draw("lego");
2201 copeningangle2D->cd(5);
2202 openingangleosproj2D->Draw("lego");
2203 copeningangle2D->cd(6);
2204 if(openinganglegammaproj2D) openinganglegammaproj2D->Draw("lego");
2205 copeningangle2D->cd(7);
2206 if(openinganglepi0proj2D) openinganglepi0proj2D->Draw("lego");
2207 copeningangle2D->cd(8);
2208 if(openingangleCproj2D) openingangleCproj2D->Draw("lego");
2209 copeningangle2D->cd(9);
2210 if(openingangleBproj2D) openingangleBproj2D->Draw("lego");
2211 copeningangle2D->cd(10);
2212 if(openingangleetaproj2D) openingangleetaproj2D->Draw("lego");
2213 copeningangle2D->cd(11);
2214 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->Draw("lego");
2215 copeningangle2D->cd(12);
2216 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->Draw("lego");
2218 // Draw histograms for invariant mass 2D
2219 TCanvas * cinvmass2D =new TCanvas("invmass2D","Invmass2D",800,800);
2220 cinvmass2D->Divide(6,2);
2222 invmassppproj2D->Draw("lego");
2224 invmassnnproj2D->Draw("lego");
2226 invmassssproj2D->Draw("lego");
2228 invmassrproj2D->Draw("lego");
2230 invmassosproj2D->Draw("lego");
2232 if(invmassgammaproj2D) invmassgammaproj2D->Draw("lego");
2234 if(invmasspi0proj2D) invmasspi0proj2D->Draw("lego");
2236 if(invmassCproj2D) invmassCproj2D->Draw("lego");
2238 if(invmassBproj2D) invmassBproj2D->Draw("lego");
2240 if(invmassetaproj2D) invmassetaproj2D->Draw("lego");
2242 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->Draw("lego");
2244 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->Draw("lego");
2246 /////////////////////////////////////
2247 // Data Radius and chi2Ndf if AliKF
2248 ////////////////////////////////////
2250 TH1F *hDataRadius = dynamic_cast<TH1F *>(fList->FindObject("DataRadius"));
2251 TH1F *hDataChi2Ndf = dynamic_cast<TH1F *>(fList->FindObject("DataChi2Ndf"));
2253 if(hDataRadius || hDataChi2Ndf) {
2254 TCanvas * cDataRadiusChi2Ndf =new TCanvas("CanvasDataRadiusChi2Ndf","CanvasDataRadiusChi2Ndf",800,800);
2255 cDataRadiusChi2Ndf->Divide(2,1);
2256 cDataRadiusChi2Ndf->cd(1);
2257 if(hDataRadius) hDataRadius->Draw();
2258 cDataRadiusChi2Ndf->cd(2);
2259 if(hDataChi2Ndf) hDataChi2Ndf->Draw();
2262 ///////////////////////
2264 //////////////////////
2266 TH1F *hDataDCA = dynamic_cast<TH1F *>(fList->FindObject("DataDCA"));
2269 TCanvas * cDataDCA =new TCanvas("CanvasDataDCA","CanvasDataDCA",800,800);
2274 /////////////////////////////////////
2275 // MC Radius and chi2Ndf if AliKF
2276 ////////////////////////////////////
2278 TH2F *hMCRadius = dynamic_cast<TH2F *>(fList->FindObject("MCRadius"));
2279 TH2F *hMCChi2Ndf = dynamic_cast<TH2F *>(fList->FindObject("MCChi2Ndf"));
2281 if(hMCRadius || hMCChi2Ndf) {
2282 TCanvas * cMCRadiusChi2Ndf =new TCanvas("CanvasMCRadiusChi2Ndf","CanvasMCRadiusChi2Ndf",800,800);
2283 cMCRadiusChi2Ndf->Divide(2,1);
2284 cMCRadiusChi2Ndf->cd(1);
2285 //TH1D *hMCRadiusBackground = hMCRadius->ProjectionX("MCRadiusBackGround",1,1,"e");
2286 TH1D *hMCRadiusGamma = hMCRadius->ProjectionX("MCRadiusGamma",2,2,"e");
2287 TH1D *hMCRadiusPi0 = hMCRadius->ProjectionX("MCRadiusPi0",3,3,"e");
2288 TH1D *hMCRadiusEta = hMCRadius->ProjectionX("MCRadiusEta",4,4,"e");
2289 TH1D *hMCRadiusC = hMCRadius->ProjectionX("MCRadiusC",5,5,"e");
2290 TH1D *hMCRadiusB = hMCRadius->ProjectionX("MCRadiusB",6,6,"e");
2291 //hMCRadiusBackground->Draw();
2292 hMCRadiusGamma->Draw();
2293 hMCRadiusPi0->Draw("same");
2294 hMCRadiusEta->Draw("same");
2295 hMCRadiusC->Draw("same");
2296 hMCRadiusB->Draw("same");
2297 TLegend *legRadius = new TLegend(0.4,0.6,0.89,0.89);
2298 //legRadius->AddEntry(hMCRadiusBackground,"Background","p");
2299 legRadius->AddEntry(hMCRadiusGamma,"#gamma","p");
2300 legRadius->AddEntry(hMCRadiusPi0,"#pi^{0}","p");
2301 legRadius->AddEntry(hMCRadiusEta,"#eta","p");
2302 legRadius->AddEntry(hMCRadiusC,"c","p");
2303 legRadius->AddEntry(hMCRadiusB,"b","p");
2304 legRadius->Draw("same");
2305 cMCRadiusChi2Ndf->cd(2);
2306 //TH1D *hMCChi2NdfBackground = hMCChi2Ndf->ProjectionX("MCChi2NdfBackGround",1,1,"e");
2307 TH1D *hMCChi2NdfGamma = hMCChi2Ndf->ProjectionX("MCChi2NdfGamma",2,2,"e");
2308 TH1D *hMCChi2NdfPi0 = hMCChi2Ndf->ProjectionX("MCChi2NdfPi0",3,3,"e");
2309 TH1D *hMCChi2NdfEta = hMCChi2Ndf->ProjectionX("MCChi2NdfEta",4,4,"e");
2310 TH1D *hMCChi2NdfC = hMCChi2Ndf->ProjectionX("MCChi2NdfC",5,5,"e");
2311 TH1D *hMCChi2NdfB = hMCChi2Ndf->ProjectionX("MCChi2NdfB",6,6,"e");
2312 //hMCChi2NdfBackground->Draw();
2313 hMCChi2NdfGamma->Draw();
2314 hMCChi2NdfPi0->Draw("same");
2315 hMCChi2NdfEta->Draw("same");
2316 hMCChi2NdfC->Draw("same");
2317 hMCChi2NdfB->Draw("same");
2318 TLegend *legChi2Ndf = new TLegend(0.4,0.6,0.89,0.89);
2319 //legChi2Ndf->AddEntry(hMCChi2NdfBackground,"Background","p");
2320 legChi2Ndf->AddEntry(hMCChi2NdfGamma,"#gamma","p");
2321 legChi2Ndf->AddEntry(hMCChi2NdfPi0,"#pi^{0}","p");
2322 legChi2Ndf->AddEntry(hMCChi2NdfEta,"#eta","p");
2323 legChi2Ndf->AddEntry(hMCChi2NdfC,"c","p");
2324 legChi2Ndf->AddEntry(hMCChi2NdfB,"b","p");
2325 legChi2Ndf->Draw("same");
2328 ///////////////////////
2330 //////////////////////
2332 TH2F *hMCDCA = dynamic_cast<TH2F *>(fList->FindObject("MCDCA"));
2335 TCanvas * cMCDCA =new TCanvas("CanvasMCDCA","CanvasMCDCA",800,800);
2337 //TH1D *hMCDCABackground = hMCDCA->ProjectionX("MCDCABackGround",1,1,"e");
2338 TH1D *hMCDCAGamma = hMCDCA->ProjectionX("MCDCAGamma",2,2,"e");
2339 TH1D *hMCDCAPi0 = hMCDCA->ProjectionX("MCDCAPi0",3,3,"e");
2340 TH1D *hMCDCAEta = hMCDCA->ProjectionX("MCDCAEta",4,4,"e");
2341 TH1D *hMCDCAC = hMCDCA->ProjectionX("MCDCAC",5,5,"e");
2342 TH1D *hMCDCAB = hMCDCA->ProjectionX("MCDCAB",6,6,"e");
2343 //hMCDCABackground->Draw();
2344 hMCDCAGamma->Draw();
2345 hMCDCAPi0->Draw("same");
2346 hMCDCAEta->Draw("same");
2347 hMCDCAC->Draw("same");
2348 hMCDCAB->Draw("same");
2349 TLegend *legDCA = new TLegend(0.4,0.6,0.89,0.89);
2350 //legDCA->AddEntry(hMCDCABackground,"Background","p");
2351 legDCA->AddEntry(hMCDCAGamma,"#gamma","p");
2352 legDCA->AddEntry(hMCDCAPi0,"#pi^{0}","p");
2353 legDCA->AddEntry(hMCDCAEta,"#eta","p");
2354 legDCA->AddEntry(hMCDCAC,"c","p");
2355 legDCA->AddEntry(hMCDCAB,"b","p");
2356 legDCA->Draw("same");
2360 /////////////////////////
2361 // PID Partner Signal
2362 /////////////////////////
2363 TF1 *betheBlochElectron = 0x0;
2364 TF1 *betheBlochMuon = 0x0;
2365 TF1 *betheBlochPion = 0x0;
2366 TF1 *betheBlochKaon = 0x0;
2367 TF1 *betheBlochProton = 0x0;
2369 TH2F *hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner0"));
2370 TH2F *hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner1"));
2371 if((!hsignalPidPartner0) && (!hsignalPidPartner1)) {
2372 hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner0"));
2373 hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner1"));
2375 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronITS,0.1,10.0,0);
2376 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonITS,0.1,10.0,0);
2377 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionITS,0.1,10.0,0);
2378 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonITS,0.1,10.0,0);
2379 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonITS,0.1,10.0,0);
2384 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronTPC,0.1,10.0,0);
2385 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonTPC,0.1,10.0,0);
2386 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionTPC,0.1,10.0,0);
2387 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonTPC,0.1,10.0,0);
2388 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonTPC,0.1,10.0,0);
2393 if((hsignalPidPartner0) || (hsignalPidPartner1)) {
2394 TCanvas * cPidSignal =new TCanvas("cPidSignal","cPidSignal",800,800);
2395 cPidSignal->Divide(2,1);
2397 if(hsignalPidPartner0) hsignalPidPartner0->Draw("colz");
2398 if(betheBlochElectron) betheBlochElectron->Draw("same");
2399 if(betheBlochMuon) betheBlochMuon->Draw("same");
2400 if(betheBlochPion) betheBlochPion->Draw("same");
2401 if(betheBlochKaon) betheBlochKaon->Draw("same");
2402 if(betheBlochProton) betheBlochProton->Draw("same");
2404 if(hsignalPidPartner1) hsignalPidPartner1->Draw("colz");
2405 if(betheBlochElectron) betheBlochElectron->Draw("same");
2406 if(betheBlochMuon) betheBlochMuon->Draw("same");
2407 if(betheBlochPion) betheBlochPion->Draw("same");
2408 if(betheBlochKaon) betheBlochKaon->Draw("same");
2409 if(betheBlochProton) betheBlochProton->Draw("same");
2412 THnSparseF *hsSparseITSsignal = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignal"));
2413 if(hsSparseITSsignal) {
2416 TH2D *sddsdd = hsSparseITSsignal->Projection(1,2);
2417 TH2D *ssdssd = hsSparseITSsignal->Projection(3,4);
2418 TH2D *sddssda = hsSparseITSsignal->Projection(1,3);
2419 TH2D *sddssdb = hsSparseITSsignal->Projection(2,4);
2420 TH2D *sddssdc = hsSparseITSsignal->Projection(1,4);
2421 TH2D *sddssdd = hsSparseITSsignal->Projection(2,3);
2423 TCanvas * cITSSignal =new TCanvas("cITSSignal","cITSSignal",800,800);
2424 cITSSignal->Divide(2,3);
2426 sddsdd->Draw("colz");
2428 ssdssd->Draw("colz");
2430 sddssda->Draw("colz");
2432 sddssdb->Draw("colz");
2434 sddssdc->Draw("colz");
2436 sddssdd->Draw("colz");
2440 THnSparseF *hsSparseITSsignalSplit = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignalSplit"));
2441 if(hsSparseITSsignalSplit) {
2444 hsSparseITSsignalSplit->GetAxis(0)->SetRange(1,1);
2446 TH1D *layerITS2 = hsSparseITSsignalSplit->Projection(1);
2447 TH1D *layerITS3 = hsSparseITSsignalSplit->Projection(2);
2448 TH1D *layerITS4 = hsSparseITSsignalSplit->Projection(3);
2449 TH1D *layerITS5 = hsSparseITSsignalSplit->Projection(4);
2452 hsSparseITSsignalSplit->GetAxis(0)->SetRange(2,2);
2454 TH1D *layerITS2s = hsSparseITSsignalSplit->Projection(1);
2455 TH1D *layerITS3s = hsSparseITSsignalSplit->Projection(2);
2456 TH1D *layerITS4s = hsSparseITSsignalSplit->Projection(3);
2457 TH1D *layerITS5s = hsSparseITSsignalSplit->Projection(4);
2459 TCanvas * cITSSignalSplit =new TCanvas("cITSSignalSplit","cITSSignalSplit",800,800);
2460 cITSSignalSplit->Divide(2,2);
2461 cITSSignalSplit->cd(1);
2463 layerITS2s->Draw("same");
2464 TLegend *legITS2 = new TLegend(0.4,0.6,0.89,0.89);
2465 legITS2->AddEntry(layerITS2,"No splitted","p");
2466 legITS2->AddEntry(layerITS2s,"Splitted","p");
2467 legITS2->Draw("same");
2468 cITSSignalSplit->cd(2);
2470 layerITS3s->Draw("same");
2471 TLegend *legITS3 = new TLegend(0.4,0.6,0.89,0.89);
2472 legITS3->AddEntry(layerITS3,"No splitted","p");
2473 legITS3->AddEntry(layerITS3s,"Splitted","p");
2474 legITS3->Draw("same");
2475 cITSSignalSplit->cd(3);
2477 layerITS4s->Draw("same");
2478 TLegend *legITS4 = new TLegend(0.4,0.6,0.89,0.89);
2479 legITS4->AddEntry(layerITS4,"No splitted","p");
2480 legITS4->AddEntry(layerITS4s,"Splitted","p");
2481 legITS4->Draw("same");
2482 cITSSignalSplit->cd(4);
2484 layerITS5s->Draw("same");
2485 TLegend *legITS5 = new TLegend(0.4,0.6,0.89,0.89);
2486 legITS5->AddEntry(layerITS5,"No splitted","p");
2487 legITS5->AddEntry(layerITS5s,"Splitted","p");
2488 legITS5->Draw("same");
2493 ////////////////////////
2495 ////////////////////////
2497 THnSparseF *hsSparseMCe = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
2498 if(!hsSparseMCe) return;
2501 TAxis *axissources = hsSparseMCe->GetAxis(2);
2502 Int_t nbsources = axissources->GetNbins();
2503 TAxis *axiscuts = hsSparseMCe->GetAxis(1);
2504 Int_t nbcuts = axiscuts->GetNbins();
2505 TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts];
2506 Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts];
2507 for(Int_t k =0; k < nbsources*nbcuts; k++){
2508 nbEntriesCuts[k] = 0.0;
2509 histopassedcuts[k] = 0x0;
2512 //printf("Number of cuts %d\n",nbcuts);
2515 TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800);
2516 chsSparseMCeeff->Divide(3,1);
2519 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2520 hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1);
2521 for(Int_t cut = 0; cut < nbcuts; cut++){
2522 hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1);
2523 histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0);
2524 hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins());
2526 hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins());
2529 // calcul efficiencies
2532 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2533 // Next is compared to the partner tracked
2534 for(Int_t cut = 2; cut < nbcuts; cut++){
2535 nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries();
2536 if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]);
2538 // First one is if the partner is tracked.
2539 nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries();
2540 if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]);
2541 // First one is input
2542 nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries();
2546 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2547 for(Int_t cut = 1; cut < nbcuts; cut++){
2548 if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts];
2551 TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0);
2552 TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0);
2553 TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0);
2554 for(Int_t k = 1; k < nbcuts; k++){
2555 if((nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]);
2556 if((2*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]);
2557 if((4*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]);
2560 TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis();
2561 xAxisGamma->SetBinLabel(1,"Partner tracked");
2562 xAxisGamma->SetBinLabel(2,"Opposite sign");
2563 xAxisGamma->SetBinLabel(3,"Single Track Cut");
2564 xAxisGamma->SetBinLabel(4,"Shared Clusters");
2565 xAxisGamma->SetBinLabel(5,"PID");
2566 xAxisGamma->SetBinLabel(6,"DCA");
2567 xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf");
2568 xAxisGamma->SetBinLabel(8,"Opening angle");
2569 xAxisGamma->SetBinLabel(9,"Invariant mass");
2571 TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis();
2572 xAxisPi0->SetBinLabel(1,"Partner tracked");
2573 xAxisPi0->SetBinLabel(2,"Opposite sign");
2574 xAxisPi0->SetBinLabel(3,"Single Track Cut");
2575 xAxisPi0->SetBinLabel(4,"Shared Clusters");
2576 xAxisPi0->SetBinLabel(5,"PID");
2577 xAxisPi0->SetBinLabel(6,"DCA");
2578 xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf");
2579 xAxisPi0->SetBinLabel(8,"Opening angle");
2580 xAxisPi0->SetBinLabel(9,"Invariant mass");
2582 TAxis *xAxisC = ratioHistoEntriesC->GetXaxis();
2583 xAxisC->SetBinLabel(1,"Partner tracked");
2584 xAxisC->SetBinLabel(2,"Opposite sign");
2585 xAxisC->SetBinLabel(3,"Single Track Cut");
2586 xAxisC->SetBinLabel(4,"Shared Clusters");
2587 xAxisC->SetBinLabel(5,"PID");
2588 xAxisC->SetBinLabel(6,"DCA");
2589 xAxisC->SetBinLabel(7,"Chi^{2}/Ndf");
2590 xAxisC->SetBinLabel(8,"Opening angle");
2591 xAxisC->SetBinLabel(9,"Invariant mass");
2593 TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800);
2594 cRatioHistoEntries->cd(1);
2595 ratioHistoEntriesGamma->SetStats(0);
2596 ratioHistoEntriesGamma->Draw();
2597 ratioHistoEntriesPi0->SetStats(0);
2598 ratioHistoEntriesPi0->Draw("same");
2599 ratioHistoEntriesC->SetStats(0);
2600 //ratioHistoEntriesC->Draw("same");
2601 TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89);
2602 legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l");
2603 legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l");
2604 //legEntries->AddEntry(ratioHistoEntriesC,"c","p");
2605 legEntries->Draw("same");
2609 chsSparseMCeeff->cd(1);
2610 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2611 delete [] histopassedcuts;
2612 delete [] nbEntriesCuts;
2615 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2616 delete [] histopassedcuts;
2617 delete [] nbEntriesCuts;
2620 histopassedcuts[source*nbcuts+0]->SetTitle("#gamma");
2621 histopassedcuts[source*nbcuts+1]->SetTitle("#gamma");
2622 histopassedcuts[source*nbcuts+2]->SetTitle("#gamma");
2623 histopassedcuts[source*nbcuts+3]->SetTitle("#gamma");
2624 histopassedcuts[source*nbcuts+4]->SetTitle("#gamma");
2625 histopassedcuts[source*nbcuts+5]->SetTitle("#gamma");
2626 histopassedcuts[source*nbcuts+6]->SetTitle("#gamma");
2627 histopassedcuts[source*nbcuts+7]->SetTitle("#gamma");
2628 histopassedcuts[source*nbcuts+8]->SetTitle("#gamma");
2629 histopassedcuts[source*nbcuts+9]->SetTitle("#gamma");
2630 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2631 histopassedcuts[source*nbcuts+1]->SetStats(0);
2632 histopassedcuts[source*nbcuts+2]->SetStats(0);
2633 histopassedcuts[source*nbcuts+3]->SetStats(0);
2634 histopassedcuts[source*nbcuts+4]->SetStats(0);
2635 histopassedcuts[source*nbcuts+5]->SetStats(0);
2636 histopassedcuts[source*nbcuts+6]->SetStats(0);
2637 histopassedcuts[source*nbcuts+7]->SetStats(0);
2638 histopassedcuts[source*nbcuts+8]->SetStats(0);
2639 histopassedcuts[source*nbcuts+9]->SetStats(0);
2640 //histopassedcuts[source*nbcuts+0]->Draw();
2641 //histopassedcuts[source*nbcuts+1]->Draw("");
2642 histopassedcuts[source*nbcuts+2]->Draw();
2643 histopassedcuts[source*nbcuts+3]->Draw("same");
2644 //histopassedcuts[source*nbcuts+4]->Draw("same");
2645 histopassedcuts[source*nbcuts+5]->Draw("same");
2646 histopassedcuts[source*nbcuts+6]->Draw("same");
2647 //histopassedcuts[source*nbcuts+7]->Draw("same");
2648 histopassedcuts[source*nbcuts+8]->Draw("same");
2649 histopassedcuts[source*nbcuts+9]->Draw("same");
2650 TLegend *legb = new TLegend(0.4,0.6,0.89,0.89);
2651 //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2652 //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2653 legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2654 legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2655 //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2656 legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2657 legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2658 //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2659 legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2660 legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2664 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2665 delete [] histopassedcuts;
2666 delete [] nbEntriesCuts;
2669 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2670 delete [] histopassedcuts;
2671 delete [] nbEntriesCuts;
2674 chsSparseMCeeff->cd(2);
2675 histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}");
2676 histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}");
2677 histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}");
2678 histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}");
2679 histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}");
2680 histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}");
2681 histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}");
2682 histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}");
2683 histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}");
2684 histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}");
2685 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2686 histopassedcuts[source*nbcuts+1]->SetStats(0);
2687 histopassedcuts[source*nbcuts+2]->SetStats(0);
2688 histopassedcuts[source*nbcuts+3]->SetStats(0);
2689 histopassedcuts[source*nbcuts+4]->SetStats(0);
2690 histopassedcuts[source*nbcuts+5]->SetStats(0);
2691 histopassedcuts[source*nbcuts+6]->SetStats(0);
2692 histopassedcuts[source*nbcuts+7]->SetStats(0);
2693 histopassedcuts[source*nbcuts+8]->SetStats(0);
2694 histopassedcuts[source*nbcuts+9]->SetStats(0);
2695 //histopassedcuts[source*nbcuts+0]->Draw();
2696 //histopassedcuts[source*nbcuts+1]->Draw();
2697 histopassedcuts[source*nbcuts+2]->Draw();
2698 histopassedcuts[source*nbcuts+3]->Draw("same");
2699 //histopassedcuts[source*nbcuts+4]->Draw("same");
2700 histopassedcuts[source*nbcuts+5]->Draw("same");
2701 histopassedcuts[source*nbcuts+6]->Draw("same");
2702 //histopassedcuts[source*nbcuts+7]->Draw("same");
2703 histopassedcuts[source*nbcuts+8]->Draw("same");
2704 histopassedcuts[source*nbcuts+9]->Draw("same");
2705 TLegend *legc = new TLegend(0.4,0.6,0.89,0.89);
2706 //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2707 //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2708 legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2709 legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2710 //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2711 legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2712 legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2713 //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2714 legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2715 legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2719 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2720 delete [] histopassedcuts;
2721 delete [] nbEntriesCuts;
2724 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2725 delete [] histopassedcuts;
2726 delete [] nbEntriesCuts;
2729 chsSparseMCeeff->cd(3);
2730 histopassedcuts[source*nbcuts+0]->SetTitle("C");
2731 histopassedcuts[source*nbcuts+1]->SetTitle("C");
2732 histopassedcuts[source*nbcuts+2]->SetTitle("C");
2733 histopassedcuts[source*nbcuts+3]->SetTitle("C");
2734 histopassedcuts[source*nbcuts+4]->SetTitle("C");
2735 histopassedcuts[source*nbcuts+5]->SetTitle("C");
2736 histopassedcuts[source*nbcuts+6]->SetTitle("C");
2737 histopassedcuts[source*nbcuts+7]->SetTitle("C");
2738 histopassedcuts[source*nbcuts+8]->SetTitle("C");
2739 histopassedcuts[source*nbcuts+9]->SetTitle("C");
2740 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2741 histopassedcuts[source*nbcuts+1]->SetStats(0);
2742 histopassedcuts[source*nbcuts+2]->SetStats(0);
2743 histopassedcuts[source*nbcuts+3]->SetStats(0);
2744 histopassedcuts[source*nbcuts+4]->SetStats(0);
2745 histopassedcuts[source*nbcuts+5]->SetStats(0);
2746 histopassedcuts[source*nbcuts+6]->SetStats(0);
2747 histopassedcuts[source*nbcuts+7]->SetStats(0);
2748 histopassedcuts[source*nbcuts+8]->SetStats(0);
2749 histopassedcuts[source*nbcuts+9]->SetStats(0);
2750 //histopassedcuts[source*nbcuts+0]->Draw();
2751 //histopassedcuts[source*nbcuts+1]->Draw();
2752 histopassedcuts[source*nbcuts+2]->Draw();
2753 histopassedcuts[source*nbcuts+3]->Draw("same");
2754 //histopassedcuts[source*nbcuts+4]->Draw("same");
2755 histopassedcuts[source*nbcuts+5]->Draw("same");
2756 histopassedcuts[source*nbcuts+6]->Draw("same");
2757 //histopassedcuts[source*nbcuts+7]->Draw("same");
2758 histopassedcuts[source*nbcuts+8]->Draw("same");
2759 histopassedcuts[source*nbcuts+9]->Draw("same");
2760 TLegend *lege = new TLegend(0.4,0.6,0.89,0.89);
2761 //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2762 //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2763 lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2764 lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2765 //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2766 lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2767 lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2768 //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2769 lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2770 lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2773 //////////////////////
2775 //////////////////////
2777 TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800);
2778 chsSparseMCein->cd(1);
2779 Double_t nbGamma = 0.0;
2781 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2782 delete [] histopassedcuts;
2783 delete [] nbEntriesCuts;
2786 nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries();
2787 histopassedcuts[source*nbcuts+0]->SetStats(0);
2788 histopassedcuts[source*nbcuts+0]->Draw();
2789 TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89);
2790 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p");
2791 Double_t nbPi0 = 0.0;
2793 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2794 delete [] histopassedcuts;
2795 delete [] nbEntriesCuts;
2798 nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries();
2799 histopassedcuts[source*nbcuts+0]->SetStats(0);
2800 histopassedcuts[source*nbcuts+0]->Draw("same");
2801 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p");
2802 Double_t nbEta = 0.0;
2804 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2805 delete [] histopassedcuts;
2806 delete [] nbEntriesCuts;
2809 nbEta = histopassedcuts[source*nbcuts+0]->GetEntries();
2810 histopassedcuts[source*nbcuts+0]->SetStats(0);
2811 histopassedcuts[source*nbcuts+0]->Draw("same");
2812 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p");
2815 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2816 delete [] histopassedcuts;
2817 delete [] nbEntriesCuts;
2820 nbC = histopassedcuts[source*nbcuts+0]->GetEntries();
2821 histopassedcuts[source*nbcuts+0]->SetStats(0);
2822 histopassedcuts[source*nbcuts+0]->Draw("same");
2823 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p");
2824 leginput->Draw("same");
2826 AliInfo(Form("Gamma %f, pi^{0} %f and #eta %f, c %f",nbGamma,nbPi0,nbEta,nbC));
2828 //////////////////////
2830 //////////////////////
2832 TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800);
2835 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2836 delete [] histopassedcuts;
2837 delete [] nbEntriesCuts;
2840 histopassedcuts[source*nbcuts+1]->Draw();
2841 TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89);
2842 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p");
2844 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2845 delete [] histopassedcuts;
2846 delete [] nbEntriesCuts;
2849 histopassedcuts[source*nbcuts+1]->Draw("same");
2850 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p");
2851 legTracked->Draw("same");
2853 delete [] histopassedcuts;
2854 delete [] nbEntriesCuts;
2857 //_____________________________________________________________________________
2858 Double_t AliHFEelecbackground::BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/)
2861 // Bethe Bloch for ITS
2863 static AliITSPIDResponse itsPidResponse;
2864 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(0));
2866 //_____________________________________________________________________________
2867 Double_t AliHFEelecbackground::BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/)
2870 // Bethe Bloch for ITS
2872 static AliITSPIDResponse itsPidResponse;
2873 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(1));
2875 //_____________________________________________________________________________
2876 Double_t AliHFEelecbackground::BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/)
2879 // Bethe Bloch for ITS
2881 static AliITSPIDResponse itsPidResponse;
2882 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(2));
2884 //_____________________________________________________________________________
2885 Double_t AliHFEelecbackground::BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/)
2888 // Bethe Bloch for ITS
2890 static AliITSPIDResponse itsPidResponse;
2891 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(3));
2893 //_____________________________________________________________________________
2894 Double_t AliHFEelecbackground::BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/)
2897 // Bethe Bloch for ITS
2899 static AliITSPIDResponse itsPidResponse;
2900 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(4));
2902 //_____________________________________________________________________________
2903 Double_t AliHFEelecbackground::BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/)
2906 // Bethe Bloch for TPC
2908 static AliTPCPIDResponse tpcPidResponse;
2909 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kElectron);
2911 //_____________________________________________________________________________
2912 Double_t AliHFEelecbackground::BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/)
2915 // Bethe Bloch for TPC
2917 static AliTPCPIDResponse tpcPidResponse;
2918 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kMuon);
2920 //_____________________________________________________________________________
2921 Double_t AliHFEelecbackground::BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/)
2924 // Bethe Bloch for TPC
2926 static AliTPCPIDResponse tpcPidResponse;
2927 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kPion);
2929 //_____________________________________________________________________________
2930 Double_t AliHFEelecbackground::BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/)
2933 // Bethe Bloch for TPC
2935 static AliTPCPIDResponse tpcPidResponse;
2936 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kKaon);
2938 //_____________________________________________________________________________
2939 Double_t AliHFEelecbackground::BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/)
2942 // Bethe Bloch for TPC
2944 static AliTPCPIDResponse tpcPidResponse;
2945 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kProton);