From b399d580df1063d8dcd4abf7706d7849911883f3 Mon Sep 17 00:00:00 2001 From: Jinjoo Seo Date: Fri, 2 Jun 2023 15:41:15 +0200 Subject: [PATCH 1/2] Add analysis task for Psi(2S) --- .../reducedTree/AliReducedAnalysisPsi2ee.cxx | 1543 +++++++++++++++++ PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.h | 212 +++ PWGDQ/reducedTree/CMakeLists.txt | 1 + PWGDQ/reducedTree/PWGDQreducedTreeLinkDef.h | 1 + 4 files changed, 1757 insertions(+) create mode 100644 PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.cxx create mode 100644 PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.h diff --git a/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.cxx b/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.cxx new file mode 100644 index 00000000000..5505b2f24a9 --- /dev/null +++ b/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.cxx @@ -0,0 +1,1543 @@ +// +// Creation date: 2023/05/22 +// Author: Jinjoo Seo, jseo@cern.ch +// Inspired from AliReducedAnalysisJpsi2ee +#include + +#include +#include +using std::cout; +using std::endl; + +#include +#include +#include +#include + +#include +#include +#include "AliAnalysisManager.h" +#include "AliAnalysisTaskSE.h" + +#include "AliReducedVarManager.h" +#include "AliReducedEventInfo.h" +#include "AliReducedBaseEvent.h" +#include "AliReducedBaseTrack.h" +#include "AliReducedTrackInfo.h" +#include "AliReducedPairInfo.h" +#include "AliReducedCaloClusterInfo.h" +#include "AliReducedCaloClusterTrackMatcher.h" +#include "AliHistogramManager.h" +#include "AliReducedTrackCut.h" + + +ClassImp(AliReducedAnalysisPsi2ee); + + +//___________________________________________________________________________ +AliReducedAnalysisPsi2ee::AliReducedAnalysisPsi2ee() : + AliReducedAnalysisTaskSE(), + fHistosManager(new AliHistogramManager("Histogram Manager", AliReducedVarManager::kNVars)), + fMixingHandler(new AliMixingHandler("ccbar signal extraction","", AliMixingHandler::kMixResonanceLegs)), + fClusterTrackMatcher(0x0), + fOptionRunMixing(kTRUE), + fOptionRunPairing(kTRUE), + fOptionRunOverMC(kFALSE), + fOptionRunLikeSignPairing(kTRUE), + fOptionLoopOverTracks(kTRUE), + fOptionRunPrefilter(kTRUE), + fOptionStoreccbarCandidates(kFALSE), + fFillCaloClusterHistograms(kFALSE), + fOptionStoreTree(kFALSE), + fEventCuts(), + fClusterCuts(), + fTrackCuts(), + fPreFilterTrackCuts(), + fPairCuts(), + fPreFilterPairCuts(), + fClusters(), + fPosTracks(), + fNegTracks(), + fPrefilterPosTracks(), + fPrefilterNegTracks(), + fccbarCandidates(), + fLegCandidatesMCcuts(), + fLegCandidatesMCcuts_RequestSameMother(), + fJpsiMotherMCcuts(), + fPsiMotherMCcuts(), + fJpsiElectronMCcuts(), + fPsiElectronMCcuts(), + fPairTreeOutput(0x0), + fLeg1TreeOutput(0x0), + fLeg2TreeOutput(0x0), + fMCTruthTreeOutput(0x0), + fTreeVariable(0x0), + fPairTreeVariable(0x0), + fLeg1TreeVariable(0x0), + fLeg2TreeVariable(0x0), + fMCTruthTreeVariable(0x0), + fClusterTrackMatcherHistograms(0x0), + fClusterTrackMatcherMultipleMatchesBefore(0x0), + fClusterTrackMatcherMultipleMatchesAfter(0x0), + fSkipMCEvent(kFALSE), + fMCJpsiPtWeights(0x0), + fMCPsiPtWeights(0x0) +{ + // + // default constructor + // +} + + +//___________________________________________________________________________ +AliReducedAnalysisPsi2ee::AliReducedAnalysisPsi2ee(const Char_t* name, const Char_t* title) : + AliReducedAnalysisTaskSE(name,title), + AliAnalysisTaskSE(name), + fHistosManager(new AliHistogramManager("Histogram Manager", AliReducedVarManager::kNVars)), + fMixingHandler(new AliMixingHandler("J/psi signal extraction","", AliMixingHandler::kMixResonanceLegs)), + fClusterTrackMatcher(0x0), + fOptionRunMixing(kTRUE), + fOptionRunPairing(kTRUE), + fOptionRunOverMC(kFALSE), + fOptionRunLikeSignPairing(kTRUE), + fOptionLoopOverTracks(kTRUE), + fOptionRunPrefilter(kTRUE), + fOptionStoreccbarCandidates(kFALSE), + fFillCaloClusterHistograms(kFALSE), + fOptionStoreTree(kFALSE), + fEventCuts(), + fClusterCuts(), + fTrackCuts(), + fPreFilterTrackCuts(), + fPairCuts(), + fPreFilterPairCuts(), + fClusters(), + fPosTracks(), + fNegTracks(), + fPrefilterPosTracks(), + fPrefilterNegTracks(), + fccbarCandidates(), + fLegCandidatesMCcuts(), + fLegCandidatesMCcuts_RequestSameMother(), + fJpsiMotherMCcuts(), + fPsiMotherMCcuts(), + fJpsiElectronMCcuts(), + fPsiElectronMCcuts(), + fPairTreeOutput(0x0), + fLeg1TreeOutput(0x0), + fLeg2TreeOutput(0x0), + fMCTruthTreeOutput(0x0), + fTreeVariable(0x0), + fPairTreeVariable(0x0), + fLeg1TreeVariable(0x0), + fLeg2TreeVariable(0x0), + fMCTruthTreeVariable(0x0), + fClusterTrackMatcherHistograms(0x0), + fClusterTrackMatcherMultipleMatchesBefore(0x0), + fClusterTrackMatcherMultipleMatchesAfter(0x0), + fSkipMCEvent(kFALSE), + fMCJpsiPtWeights(0x0), + fMCPsiPtWeights(0x0) +{ + // + // named constructor + // + fEventCuts.SetOwner(kTRUE); + fClusterCuts.SetOwner(kTRUE); + fTrackCuts.SetOwner(kTRUE); + fPreFilterTrackCuts.SetOwner(kTRUE); + fPairCuts.SetOwner(kTRUE); + fPreFilterPairCuts.SetOwner(kTRUE); + fClusters.SetOwner(kFALSE); + fPosTracks.SetOwner(kFALSE); + fNegTracks.SetOwner(kFALSE); + fPrefilterPosTracks.SetOwner(kFALSE); + fPrefilterNegTracks.SetOwner(kFALSE); + fccbarCandidates.SetOwner(kTRUE); + fLegCandidatesMCcuts.SetOwner(kTRUE); + fJpsiMotherMCcuts.SetOwner(kTRUE); + fPsiMotherMCcuts.SetOwner(kTRUE); + fJpsiElectronMCcuts.SetOwner(kTRUE); + fPsiElectronMCcuts.SetOwner(kTRUE); + for(Int_t i=0;i<32;++i) fLegCandidatesMCcuts_RequestSameMother[i] = kTRUE; + + DefineOutput(1, TTree::Class()); + DefineOutput(2, TTree::Class()); + DefineOutput(3, TTree::Class()); + DefineOutput(4, TTree::Class()); +} + + +//___________________________________________________________________________ +AliReducedAnalysisPsi2ee::~AliReducedAnalysisPsi2ee() +{ + // + // destructor + // + fEventCuts.Clear("C"); + fClusterCuts.Clear("C"); + fTrackCuts.Clear("C"); + fPreFilterTrackCuts.Clear("C"); + fPreFilterPairCuts.Clear("C"); + fPairCuts.Clear("C"); + fClusters.Clear("C"); + fPosTracks.Clear("C"); + fNegTracks.Clear("C"); + fPrefilterPosTracks.Clear("C"); + fPrefilterNegTracks.Clear("C"); + fccbarCandidates.Clear("C"); + if(fPairTreeOutput) delete fPairTreeOutput; + if(fLeg1TreeOutput) delete fLeg1TreeOutput; + if(fLeg2TreeOutput) delete fLeg2TreeOutput; + if(fMCTruthTreeOutput) delete fMCTruthTreeOutput; + if(fTreeVariable) delete fTreeVariable; + if(fPairTreeVariable) delete fPairTreeVariable; + if(fLeg1TreeVariable) delete fLeg1TreeVariable; + if(fLeg2TreeVariable) delete fLeg2TreeVariable; + if(fMCTruthTreeVariable) delete fMCTruthTreeVariable; + if(fHistosManager) delete fHistosManager; + if(fMixingHandler) delete fMixingHandler; + if (fClusterTrackMatcher) delete fClusterTrackMatcher; + if (fClusterTrackMatcherHistograms) delete fClusterTrackMatcherHistograms; + if (fClusterTrackMatcherMultipleMatchesBefore) delete fClusterTrackMatcherMultipleMatchesBefore; + if (fClusterTrackMatcherMultipleMatchesAfter) delete fClusterTrackMatcherMultipleMatchesAfter; +} + + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::AddTrackCut(AliReducedInfoCut* cut) { + // + // Add a new cut + // + fTrackCuts.Add(cut); + fMixingHandler->SetNParallelCuts(fMixingHandler->GetNParallelCuts()+1); + TString histClassNames = fMixingHandler->GetHistClassNames(); + if (fPairCuts.GetEntries()>1) { + histClassNames = ""; + for (Int_t iPairCut=0; iPairCutGetName(), fPairCuts.At(iPairCut)->GetName()); + histClassNames += Form("PairMEPM_%s_%s;", fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName()); + histClassNames += Form("PairMEMM_%s_%s;", fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName()); + } + } + } else { + histClassNames += Form("PairMEPP_%s;", cut->GetName()); + histClassNames += Form("PairMEPM_%s;", cut->GetName()); + histClassNames += Form("PairMEMM_%s;", cut->GetName()); + } + fMixingHandler->SetHistClassNames(histClassNames.Data()); +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::AddPairCut(AliReducedInfoCut* cut) { + // + // Add a new cut + // + fPairCuts.Add(cut); + fMixingHandler->SetNParallelPairCuts(fMixingHandler->GetNParallelPairCuts()+1); + if (fPairCuts.GetEntries()>1) { + TString histClassNamesNew = ""; + for (Int_t iPairCut=0; iPairCutGetName(), fPairCuts.At(iPairCut)->GetName()); + histClassNamesNew += Form("PairMEPM_%s_%s;", fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName()); + histClassNamesNew += Form("PairMEMM_%s_%s;", fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName()); + } + } + fMixingHandler->SetHistClassNames(histClassNamesNew.Data()); + } +} + +//___________________________________________________________________________ +Bool_t AliReducedAnalysisPsi2ee::IsEventSelected(AliReducedBaseEvent* event, Float_t* values/*=0x0*/) { + // + // apply event cuts + // + if(fEventCuts.GetEntries()==0) return kTRUE; + // loop over all the cuts and make a logical and between all cuts in the list + for(Int_t i=0; iIsSelected(event, values)) return kFALSE; } + else { if(!cut->IsSelected(event)) return kFALSE; } + } + return kTRUE; +} + +//___________________________________________________________________________ +Bool_t AliReducedAnalysisPsi2ee::IsClusterSelected(AliReducedCaloClusterInfo* cluster, Float_t* values/*=0x0*/) { + // + // apply cluster cuts + // + if (fClusterCuts.GetEntries()==0) return kTRUE; + cluster->ResetFlags(); + for (Int_t i=0; iIsSelected(cluster, values)) cluster->SetFlag(i); } + else { if (cut->IsSelected(cluster)) cluster->SetFlag(i); } + } + return (cluster->GetFlags()>0 ? kTRUE : kFALSE); +} + +//___________________________________________________________________________ +Bool_t AliReducedAnalysisPsi2ee::IsTrackSelected(AliReducedBaseTrack* track, Float_t* values/*=0x0*/) { + // + // apply event cuts + // + if(fTrackCuts.GetEntries()==0) return kTRUE; + track->ResetFlags(); + + for(Int_t i=0; iIsSelected(track, values)) track->SetFlag(i); } + else { if(cut->IsSelected(track)) track->SetFlag(i); } + } + return (track->GetFlags()>0 ? kTRUE : kFALSE); +} + +//___________________________________________________________________________ +Bool_t AliReducedAnalysisPsi2ee::IsTrackPrefilterSelected(AliReducedBaseTrack* track, Float_t* values/*=0x0*/) { + // + // apply track prefilter cuts + // + if(fPreFilterTrackCuts.GetEntries()==0) return kTRUE; + + for(Int_t i=0; iIsSelected(track, values)) return kFALSE; } + else { if(!cut->IsSelected(track)) return kFALSE; } + } + return kTRUE; +} + +//___________________________________________________________________________ +ULong_t AliReducedAnalysisPsi2ee::IsPairSelected(Float_t* values) { + // + // apply pair cuts + // + if(fPairCuts.GetEntries()==0) return 1; + + ULong_t mask = 0; + for (Int_t i=0; iIsSelected(values)) mask|=(ULong_t(1)<IsSelected(values)) return kTRUE; + } + return kFALSE; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::Init() { + // + // initialize stuff + // + AliReducedVarManager::SetDefaultVarNames(); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairOpeningAngle); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairPointingAngle); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairPointingAngle); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairChisquare); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPseudoProperDecayTime); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPseudoProperDecayTimeMC); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kITSlayerHit); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kITSncls); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kTPCcrossedRowsOverFindableClusters); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairLegPtMC); + // make sure variables needed to create jpsi candidate objects are filled + if(fOptionStoreccbarCandidates) { + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPt); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPhi); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kEta); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kMass); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPt_PsiPrime); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPhi_PsiPrime); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kEta_PsiPrime); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kMassPsiPrime); + AliReducedVarManager::SetUseVariable(AliReducedVarManager::kPairType); + } + + fHistosManager->SetUseDefaultVariableNames(kTRUE); + fHistosManager->SetDefaultVarNames(AliReducedVarManager::fgVariableNames, AliReducedVarManager::fgVariableUnits); + + fMixingHandler->SetHistogramManager(fHistosManager); + + if (fClusterTrackMatcher) { + fClusterTrackMatcherMultipleMatchesBefore = new TH1I("multipleCounts_beforeMatching", "mulitple counts of matched cluster IDs beofore matching", 50, 0.5, 50.5); + fClusterTrackMatcherMultipleMatchesAfter = new TH1I("multipleCounts_afterMatching", "mulitple counts of matched cluster IDs after matching", 50, 0.5, 50.5); + fClusterTrackMatcherHistograms = new TList(); + fClusterTrackMatcherHistograms->SetOwner(); + fClusterTrackMatcherHistograms->SetName("ClusterTrackMatcherHistograms"); + fClusterTrackMatcherHistograms->Add(fClusterTrackMatcherMultipleMatchesBefore); + fClusterTrackMatcherHistograms->Add(fClusterTrackMatcherMultipleMatchesAfter); + fHistosManager->AddToOutputList(fClusterTrackMatcherHistograms); + } + + DefineTree(); + PostData(1, fPairTreeOutput); + PostData(2, fLeg1TreeOutput); + PostData(3, fLeg2TreeOutput); + PostData(4, fMCTruthTreeOutput); +} + + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::Process() { + // + // process the current event + // + + if(!fEvent) return; + if(!(fEvent->IsA()==AliReducedEventInfo::Class())) { + cout << "ERROR: AliReducedAnalysisPsi2ee::Process() needs AliReducedEventInfo events" << endl; + return; + } + if(fOptionRunOverMC && fEventCounter%10000==0) cout << "Event no. " << fEventCounter << endl; + else if(fEventCounter%10000==0) cout << "Event no. " << fEventCounter << endl; + fEventCounter++; + + AliReducedVarManager::SetEvent(fEvent); + + // reset the values array, keep only the run wise data (LHC and ALICE GRP information) + // NOTE: the run wise data will be updated automatically in the VarManager in case a run change is detected + for(Int_t i=AliReducedVarManager::kNRunWiseVariables; iFillHistClass("Event_BeforeCuts", fValues); + for(UShort_t ibit=0; ibit<64; ++ibit) { + AliReducedVarManager::FillEventTagInput(fEvent, ibit, fValues); + fHistosManager->FillHistClass("EventTag_BeforeCuts", fValues); + } + for(UShort_t ibit=0; ibit<64; ++ibit) { + AliReducedVarManager::FillEventOnlineTrigger(ibit, fValues); + fHistosManager->FillHistClass("EventTriggers_BeforeCuts", fValues); + } + + // apply event selection + if(!IsEventSelected(fEvent, fValues)) return; + + // fill calorimeter info histograms + if(fFillCaloClusterHistograms) { + RunClusterSelection(); + FillClusterHistograms(); + } + + // fill MC truth histograms + if(fOptionRunOverMC) { + fSkipMCEvent = kFALSE; + FillMCTruthHistograms(); + if(fSkipMCEvent) return; + } + + // select tracks + if(fOptionLoopOverTracks) RunTrackSelection(); + + // Run the prefilter + // NOTE: Pair each track from the selected tracks list with all selected tracks in the prefilter track list + // If the created pair fails the pair prefilter criteria, then the selected trak is removed from the track list + // and further pairing + //FillTrackHistograms("Track_BeforePrefilter"); + //RunSameEventPairing("PairPrefilterSE"); + if(fOptionLoopOverTracks && fOptionRunPrefilter) RunPrefilter(); + + if(fOptionLoopOverTracks) { + fValues[AliReducedVarManager::kNtracksPosAnalyzed] = fPosTracks.GetEntries(); + fValues[AliReducedVarManager::kNtracksNegAnalyzed] = fNegTracks.GetEntries(); + fValues[AliReducedVarManager::kNtracksAnalyzed] = fValues[AliReducedVarManager::kNtracksNegAnalyzed]+fValues[AliReducedVarManager::kNtracksPosAnalyzed]; + fValues[AliReducedVarManager::kEvAverageTPCchi2] /= (fPosTracks.GetEntries()+fNegTracks.GetEntries()>0 ? fValues[AliReducedVarManager::kNtracksAnalyzed] : 1.0); + } + + // Fill track histograms + if(fOptionLoopOverTracks) FillTrackHistograms(); + + // Feed the selected tracks to the event mixing handler + if(fOptionRunMixing){ + fMixingHandler->FillEvent(&fPosTracks, &fNegTracks, fValues, AliReducedPairInfo::kJpsiToEE); + fMixingHandler->FillEvent(&fPosTracks, &fNegTracks, fValues, AliReducedPairInfo::kPsi2SToEE); + } + + // Do the same event pairing + if(fOptionRunPairing) RunSameEventPairing(); + + // fill event info histograms after cuts + fHistosManager->FillHistClass("Event_AfterCuts", fValues); + for(UShort_t ibit=0; ibit<64; ++ibit) { + AliReducedVarManager::FillEventTagInput(fEvent, ibit, fValues); + fHistosManager->FillHistClass("EventTag_AfterCuts", fValues); + } + for(UShort_t ibit=0; ibit<64; ++ibit) { + AliReducedVarManager::FillEventOnlineTrigger(ibit, fValues); + fHistosManager->FillHistClass("EventTriggers_AfterCuts", fValues); + } + for(UShort_t ich=0; ich<64; ++ich) { + AliReducedVarManager::FillV0Channel(ich, fValues); + fHistosManager->FillHistClass("V0Channels", fValues); + } + + PostData(1, fPairTreeOutput); + PostData(2, fLeg1TreeOutput); + PostData(3, fLeg2TreeOutput); + PostData(4, fMCTruthTreeOutput); +} + + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillTrackHistograms(TString trackClass /*= "Track"*/) { + // + // Fill all track histograms + // + for(Int_t i=0;i<36; ++i) fValues[AliReducedVarManager::kNtracksAnalyzedInPhiBins+i] = 0.; + AliReducedBaseTrack* track=0; + if (fClusterTrackMatcher) { + fClusterTrackMatcher->ClearMatchedClusterIDsBefore(); + fClusterTrackMatcher->ClearMatchedClusterIDsAfter(); + } + TIter nextPosTrack(&fPosTracks); + for(Int_t i=0;iEta()<0.0 ? 0 : 18) + TMath::FloorNint(18.*track->Phi()/TMath::TwoPi())] += 1; + // reset track variables + for(Int_t i=AliReducedVarManager::kNEventVars; iFillMultipleMatchesHistogram(fClusterTrackMatcherMultipleMatchesBefore, fClusterTrackMatcher->GetMatchedClusterIDsBefore()); + fClusterTrackMatcher->FillMultipleMatchesHistogram(fClusterTrackMatcherMultipleMatchesAfter, fClusterTrackMatcher->GetMatchedClusterIDsAfter()); + fClusterTrackMatcher->ClearMatchedClusterIDsBefore(); + fClusterTrackMatcher->ClearMatchedClusterIDsAfter(); + } + + TIter nextNegTrack(&fNegTracks); + for(Int_t i=0;iEta()<0.0 ? 0 : 18) + TMath::FloorNint(18.*track->Phi()/TMath::TwoPi())] += 1; + // reset track variables + for(Int_t i=AliReducedVarManager::kNEventVars; iFillMultipleMatchesHistogram(fClusterTrackMatcherMultipleMatchesBefore, fClusterTrackMatcher->GetMatchedClusterIDsBefore()); + fClusterTrackMatcher->FillMultipleMatchesHistogram(fClusterTrackMatcherMultipleMatchesAfter, fClusterTrackMatcher->GetMatchedClusterIDsAfter()); + } +} + + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillTrackHistograms(AliReducedBaseTrack* track, TString trackClass /*="Track"*/) { + // + // fill track level histograms + // + UInt_t mcDecisionMap = 0; + if(fOptionRunOverMC) mcDecisionMap = CheckReconstructedLegMCTruth(track); + + for(Int_t icut=0; icutTestFlag(icut)) { + fHistosManager->FillHistClass(Form("%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { // Fill histograms for tracks identified as MC truth + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%s_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + + if(track->IsA() != AliReducedTrackInfo::Class()) continue; + + AliReducedTrackInfo* trackInfo = dynamic_cast(track); + if(!trackInfo) continue; + + for(UInt_t iflag=0; iflagFillHistClass(Form("%sStatusFlags_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%sStatusFlags_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + for(UInt_t iflag=0; iflag<64; ++iflag) { + AliReducedVarManager::FillTrackQualityFlag(trackInfo, iflag, fValues); + fHistosManager->FillHistClass(Form("%sQualityFlags_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%sQualityFlags_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + for(Int_t iLayer=0; iLayer<6; ++iLayer) { + AliReducedVarManager::FillITSlayerFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass(Form("%sITSclusterMap_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%sITSclusterMap_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + AliReducedVarManager::FillITSsharedLayerFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass(Form("%sITSsharedClusterMap_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%sITSsharedClusterMap_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + for(Int_t iLayer=0; iLayer<8; ++iLayer) { + AliReducedVarManager::FillTPCclusterBitFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass(Form("%sTPCclusterMap_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName()), fValues); + if(mcDecisionMap) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisionMap & (UInt_t(1)<FillHistClass(Form("%sTPCclusterMap_%s_%s", trackClass.Data(), fTrackCuts.At(icut)->GetName(), + fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + } // end if(track->TestFlag(icut)) + } // end loop over cuts +} + + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillPairHistograms(ULong_t trackMask, ULong_t pairMask, Int_t pairType, TString pairClass /*="PairSE"*/, UInt_t mcDecisions /* = 0*/) { + // + // fill pair level histograms + // NOTE: pairType can be 0,1 or 2 corresponding to ++, +- or -- pairs + TString typeStr[3] = {"PP", "PM", "MM"}; + if (fPairCuts.GetEntries()>1) { + for(Int_t iTrackCut=0; iTrackCutFillHistClass(Form("%s%s_%s_%s", pairClass.Data(), typeStr[pairType].Data(), fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName()), fValues); + if(mcDecisions && pairType==1) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisions & (UInt_t(1)<FillHistClass(Form("%s%s_%s_%s_%s", pairClass.Data(), typeStr[pairType].Data(), fTrackCuts.At(iTrackCut)->GetName(), fPairCuts.At(iPairCut)->GetName(), fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + } + } + } else { + for(Int_t iTrackCut=0; iTrackCutFillHistClass(Form("%s%s_%s", pairClass.Data(), typeStr[pairType].Data(), fTrackCuts.At(iTrackCut)->GetName()), fValues); + if(mcDecisions && pairType==1) { + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisions & (UInt_t(1)<FillHistClass(Form("%s%s_%s_%s", pairClass.Data(), typeStr[pairType].Data(), fTrackCuts.At(iTrackCut)->GetName(), fLegCandidatesMCcuts.At(iMC)->GetName()), fValues); + } + } + } + } // end loop over cuts + } +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillClusterHistograms(TString clusterClass/*="CaloCluster"*/) { + // + // fill cluster histograms + // + AliReducedCaloClusterInfo* cluster = NULL; + TIter nextCluster(&fClusters); + for (Int_t i=0; iTestFlag(icut)) fHistosManager->FillHistClass(Form("%s_%s", clusterClass.Data(), fClusterCuts.At(icut)->GetName()), fValues); + } +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::RunClusterSelection() { + // + // select cluster + // + fClusters.Clear("C"); + + if (fEvent->IsA() == AliReducedBaseEvent::Class()) return; + Int_t nCaloCluster = ((AliReducedEventInfo*)fEvent)->GetNCaloClusters(); + if (!nCaloCluster) return; + + AliReducedCaloClusterInfo* cluster = NULL; + for (Int_t icl=0; iclGetCaloCluster(icl); + + for (Int_t i=AliReducedVarManager::kEMCALclusterEnergy; i<=AliReducedVarManager::kNEMCALvars; ++i) fValues[i] = -9999.; + + AliReducedVarManager::FillCaloClusterInfo(cluster, fValues); + fHistosManager->FillHistClass("CaloCluster_BeforeCuts", fValues); + + if (IsClusterSelected(cluster, fValues)) fClusters.Add(cluster); + } +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::RunTrackSelection() { + // + // select electron candidates and prefilter tracks + // + // clear the track arrays + fPosTracks.Clear("C"); fNegTracks.Clear("C"); fPrefilterPosTracks.Clear("C"); fPrefilterNegTracks.Clear("C"); + fValues[AliReducedVarManager::kEvAverageTPCchi2] = 0.0; + + // loop over the track list(s) and evaluate all the track cuts + LoopOverTracks(1); // first array + LoopOverTracks(2); // second array (if used) +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::LoopOverTracks(Int_t arrayOption /*=1*/) { + // + // Loop over a given track array, apply cuts and add selected tracks to arrays + // + AliReducedBaseTrack* track = 0x0; + TClonesArray* trackList = (arrayOption==1 ? fEvent->GetTracks() : fEvent->GetTracks2()); + if (!trackList) return; + + TIter nextTrack(trackList); + for(Int_t it=0; itGetEntries(); ++it) { + track = (AliReducedBaseTrack*)nextTrack(); + // do not loop over pure MC truth tracks + // NOTE: this can be also handled via AliReducedTrackCut::SetRejectPureMC() + if(fOptionRunOverMC && track->IsMCTruth()) continue; + // reset track variables + for(Int_t i=AliReducedVarManager::kNEventVars; iFillHistClass("Track_BeforeCuts", fValues); + + if(track->IsA() == AliReducedTrackInfo::Class()) { + AliReducedTrackInfo* trackInfo = dynamic_cast(track); + if(trackInfo) { + for(UInt_t iflag=0; iflagFillHistClass("TrackStatusFlags_BeforeCuts", fValues); + } + for(UInt_t iflag=0; iflag<64; ++iflag) { + AliReducedVarManager::FillTrackQualityFlag(trackInfo, iflag, fValues); + fHistosManager->FillHistClass("TrackQualityFlags_BeforeCuts", fValues); + } + for(Int_t iLayer=0; iLayer<6; ++iLayer) { + AliReducedVarManager::FillITSlayerFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass("TrackITSclusterMap_BeforeCuts", fValues); + AliReducedVarManager::FillITSsharedLayerFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass("TrackITSsharedClusterMap_BeforeCuts", fValues); + } + for(Int_t iLayer=0; iLayer<8; ++iLayer) { + AliReducedVarManager::FillTPCclusterBitFlag(trackInfo, iLayer, fValues); + fHistosManager->FillHistClass("TrackTPCclusterMap_BeforeCuts", fValues); + } + } + } + + if(IsTrackSelected(track, fValues)) { + if(track->Charge()>0) fPosTracks.Add(track); + if(track->Charge()<0) fNegTracks.Add(track); + + if(track->IsA() == AliReducedTrackInfo::Class()) + fValues[AliReducedVarManager::kEvAverageTPCchi2] += ((AliReducedTrackInfo*)track)->TPCchi2(); + } + if(IsTrackPrefilterSelected(track, fValues)) { + if(track->Charge()>0) fPrefilterPosTracks.Add(track); + if(track->Charge()<0) fPrefilterNegTracks.Add(track); + } + } // end loop over tracks +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::RunSameEventPairing(TString pairClass /*="PairSE"*/) { + // + // Run the same event pairing + // + if(fOptionStoreccbarCandidates) fccbarCandidates.Clear("C"); + fValues[AliReducedVarManager::kNpairsSelected] = 0; + + TIter nextPosTrack(&fPosTracks); + TIter nextNegTrack(&fNegTracks); + + AliReducedBaseTrack* pTrack=0; + AliReducedBaseTrack* pTrack2=0; + AliReducedBaseTrack* nTrack=0; + AliReducedBaseTrack* nTrack2=0; + + for(Int_t ip=0; ipGetFlags() & nTrack->GetFlags())) continue; + AliReducedVarManager::FillPairInfo(pTrack, nTrack, AliReducedPairInfo::kJpsiToEE, fValues); // kJpsiToEE + kPsi2SToEE + + ULong_t pairCutMask = IsPairSelected(fValues); + if(pairCutMask) { + FillPairHistograms(pTrack->GetFlags() & nTrack->GetFlags(), pairCutMask, 1, pairClass, (fOptionRunOverMC ? CheckReconstructedLegMCTruth(pTrack, nTrack) : 0)); // 1 is for +- pairs + fValues[AliReducedVarManager::kNpairsSelected] += 1.0; + + if(fOptionStoreccbarCandidates) { + AliReducedPairInfo* pair = new AliReducedPairInfo(); + pair->SetFlags(pTrack->GetFlags() & nTrack->GetFlags()); + pair->SetQualityFlags(pairCutMask); + pair->PtPhiEta(fValues[AliReducedVarManager::kPt], fValues[AliReducedVarManager::kPhi], fValues[AliReducedVarManager::kEta]); + pair->SetMass(fValues[AliReducedVarManager::kMass]); + pair->CandidateId(AliReducedPairInfo::kJpsiToEE); //dummy + pair->PairType(1); + pair->SetLegIds(pTrack->TrackId(), nTrack->TrackId()); + pair->SetPseudoProper(fValues[AliReducedVarManager::kPseudoProperDecayTime]); + pair->PairTypeSPD(fValues[AliReducedVarManager::kPairTypeSPD]); + fccbarCandidates.Add(pair); + } + + Int_t iTrackCut = 0; + Int_t iPairCut = 0; + if (fOptionStoreTree) { + for(TObject* iter1 : fTrackCuts) { + for(TObject* iter2 : fPairCuts) { + ULong_t trkCut = (pTrack->GetFlags() & nTrack->GetFlags()); + Bool_t pairCut = (fPairCuts.GetEntries()<=1? kTRUE: (pairCutMask & (ULong_t(1)<GetFlags() & pTrack2->GetFlags())) continue; + AliReducedVarManager::FillPairInfo(pTrack, pTrack2, AliReducedPairInfo::kJpsiToEE, fValues); // kJpsiToEE + kPsi2SToEE + + ULong_t pairCutMask = IsPairSelected(fValues); + if(pairCutMask) { + FillPairHistograms(pTrack->GetFlags() & pTrack2->GetFlags(), pairCutMask, 0, pairClass); // 0 is for ++ pairs + fValues[AliReducedVarManager::kNpairsSelected] += 1.0; + + if(fOptionStoreccbarCandidates) { + AliReducedPairInfo* pair = new AliReducedPairInfo(); + pair->SetFlags(pTrack->GetFlags() & pTrack2->GetFlags()); + pair->SetQualityFlags(pairCutMask); + pair->PtPhiEta(fValues[AliReducedVarManager::kPt], fValues[AliReducedVarManager::kPhi], fValues[AliReducedVarManager::kEta]); + pair->SetMass(fValues[AliReducedVarManager::kMass]); + pair->CandidateId(AliReducedPairInfo::kJpsiToEE); //dummy + pair->PairType(0); + pair->SetLegIds(pTrack->TrackId(), pTrack2->TrackId()); + pair->SetPseudoProper(fValues[AliReducedVarManager::kPseudoProperDecayTime]); + pair->PairTypeSPD(fValues[AliReducedVarManager::kPairTypeSPD]); + fccbarCandidates.Add(pair); + } + + Int_t iTrackCut = 0; + Int_t iPairCut = 0; + if (fOptionStoreTree) { + for(TObject* iter1 : fTrackCuts) { + for(TObject* iter2 : fPairCuts) { + ULong_t trkCut = (pTrack->GetFlags() & pTrack2->GetFlags()); + Bool_t pairCut = (fPairCuts.GetEntries()<=1? kTRUE: (pairCutMask & (ULong_t(1)<GetFlags() & nTrack2->GetFlags())) continue; + AliReducedVarManager::FillPairInfo(nTrack, nTrack2, AliReducedPairInfo::kJpsiToEE, fValues); + + ULong_t pairCutMask = IsPairSelected(fValues); + if(pairCutMask) { + FillPairHistograms(nTrack->GetFlags() & nTrack2->GetFlags(), pairCutMask, 2, pairClass); // 2 is for -- pairs + fValues[AliReducedVarManager::kNpairsSelected] += 1.0; + + if(fOptionStoreccbarCandidates) { + AliReducedPairInfo* pair = new AliReducedPairInfo(); + pair->SetFlags(nTrack->GetFlags() & nTrack2->GetFlags()); + pair->SetQualityFlags(pairCutMask); + pair->PtPhiEta(fValues[AliReducedVarManager::kPt], fValues[AliReducedVarManager::kPhi], fValues[AliReducedVarManager::kEta]); + pair->SetMass(fValues[AliReducedVarManager::kMass]); + pair->CandidateId(AliReducedPairInfo::kJpsiToEE); //dummy + pair->PairType(2); + pair->SetLegIds(nTrack->TrackId(), nTrack2->TrackId()); + pair->SetPseudoProper(fValues[AliReducedVarManager::kPseudoProperDecayTime]); + pair->PairTypeSPD(fValues[AliReducedVarManager::kPairTypeSPD]); + fccbarCandidates.Add(pair); + } + + Int_t iTrackCut = 0; + Int_t iPairCut = 0; + if (fOptionStoreTree) { + for(TObject* iter1 : fTrackCuts) { + for(TObject* iter2 : fPairCuts) { + ULong_t trkCut = (nTrack->GetFlags() & nTrack2->GetFlags()); + Bool_t pairCut = (fPairCuts.GetEntries()<=1? kTRUE: (pairCutMask & (ULong_t(1)<TrackId()==trackPref->TrackId()) continue; // avoid self-pairing + AliReducedVarManager::FillPairInfo(track, trackPref, AliReducedPairInfo::kJpsiToEE, fValues); + if(!IsPairPreFilterSelected(fValues)) { + track->ResetFlags(); + break; + } + } // end loop over positive prefilter tracks + + nextNegPrefilterTrack.Reset(); + for(Int_t ipn = 0; ipnResetFlags(); + break; + } + } // end loop over negative prefilter tracks + } // end loop over the positive tracks + + for(Int_t in = 0; inResetFlags(); + break; + } + } // end loop over positive prefilter tracks + + nextNegPrefilterTrack.Reset(); + for(Int_t ipn = 0; ipnTrackId()==trackPref->TrackId()) continue; // avoid self-pairing + AliReducedVarManager::FillPairInfo(track, trackPref, AliReducedPairInfo::kJpsiToEE, fValues); + if(!IsPairPreFilterSelected(fValues)) { + track->ResetFlags(); + break; + } + } // end loop over negative prefilter tracks + } // end loop over the negative tracks + + // remove tracks + nextPosTrack.Reset(); + for(Int_t ip = fPosTracks.GetEntries()-1 ; ip >= 0; --ip) { + track = (AliReducedBaseTrack*)nextPosTrack(); + if(!track->GetFlags()) { + fPosTracks.Remove(track); + } + } + nextNegTrack.Reset(); + for(Int_t ip = fNegTracks.GetEntries()-1 ; ip >= 0; --ip) { + track = (AliReducedBaseTrack*)nextNegTrack(); + if(!track->GetFlags()) { + fNegTracks.Remove(track); + } + } +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::Finish() { + // + // run stuff after the event loop + // + if(fOptionRunMixing && !fOptionRunOverMC){ + fMixingHandler->RunLeftoverMixing(AliReducedPairInfo::kJpsiToEE); + fMixingHandler->RunLeftoverMixing(AliReducedPairInfo::kPsi2SToEE); //TODO: CHECK + } +} + + +//___________________________________________________________________________ +UInt_t AliReducedAnalysisPsi2ee::CheckReconstructedLegMCTruth(AliReducedBaseTrack* track) { + // + // Check a reconstructed track against all the specified MC truth cuts + // + // TODO: In the fLegCandidatesMCcuts one can also add AliSignalMC objects which can then be tested + // using the AliReducedTrackInfo::fMCPdg[] + // + if(fLegCandidatesMCcuts.GetEntries()==0) return 0; + + UInt_t decisionMap = 0; + for(Int_t i=0; iIsSelected(track)) + decisionMap |= (UInt_t(1)<IsA() != AliReducedTrackInfo::Class()) return 0; + if(ntrack->IsA() != AliReducedTrackInfo::Class()) return 0; + + // check the MC requirements on each of the leg and their logical intersection + if(fLegCandidatesMCcuts.GetEntries()==0) return 0; + UInt_t pTrackDecisions = CheckReconstructedLegMCTruth(ptrack); + if(!pTrackDecisions) return 0; + UInt_t nTrackDecisions = CheckReconstructedLegMCTruth(ntrack); + + UInt_t decisions = 0; + for(Int_t i=0; iMCLabel(1)) == TMath::Abs(((AliReducedTrackInfo*)ntrack)->MCLabel(1))); + if(sameMotherDecision && pDecision && nDecision) + decisions |= (UInt_t(1)<GetTracks() : fEvent->GetTracks2()); + if(!trackList) return; + TIter nextTrack(trackList); + + // if the pt dependent weights were set, check the weight and reject randomly the event + if((fMCJpsiPtWeights && !fMCPsiPtWeights) || (!fMCJpsiPtWeights && fMCPsiPtWeights)) { + TH1F* fMCPtWeights = 0x0; + Int_t reducedPairInfo = 0; + + if(fMCJpsiPtWeights) { + reducedPairInfo = AliReducedPairInfo::kJpsiToEE; + fMCPtWeights = fMCJpsiPtWeights; + } + if(fMCPsiPtWeights) { + reducedPairInfo = AliReducedPairInfo::kPsi2SToEE; + fMCPtWeights = fMCPsiPtWeights; + } + + for(Int_t it=0; itGetEntries(); ++it) { + mother = (AliReducedTrackInfo*)nextTrack(); + if(!mother->IsMCKineParticle()) continue; + + // apply selections on the jpsi mother + UInt_t motherDecisions = CheckMotherMCTruth(mother,kTRUE,reducedPairInfo); + if(!motherDecisions) continue; + + Double_t pt = mother->Pt(); + if(pt>fMCPtWeights->GetXaxis()->GetXmax()) + pt = fMCPtWeights->GetXaxis()->GetXmax(); + Double_t weight = fMCPtWeights->GetBinContent(fMCPtWeights->FindBin(pt)); + if(weight>1.0) weight = 1.0; + Double_t rnd = gRandom->Rndm(); + if(weight mcMotherCuts = {&fJpsiMotherMCcuts, &fPsiMotherMCcuts}; + std::vector signalsWithoutMother = {0, 0}; // Jpsi, Psi + for(int i = 0; i < mcMotherCuts.size(); i++){ + // Loop through the MC signals and check whether there are required MC signals without a defined mother + for(Int_t j=0; jGetEntries(); ++j) { + AliReducedInfoCut* cut = (AliReducedInfoCut*)mcMotherCuts[i]->At(j); + if(!((AliReducedTrackCut*)cut)->GetMCFilterMap()) + signalsWithoutMother[i] |= (UInt_t(1)<GetEntries(); ++it) { + mother = (AliReducedTrackInfo*)nextTrack(); + if(!mother->IsMCKineParticle()) continue; + + // apply selections on the jpsi mother + UInt_t motherDecisions = CheckMotherMCTruth(mother, kFALSE, (i==0? AliReducedPairInfo::kJpsiToEE : AliReducedPairInfo::kPsi2SToEE)); + if(!motherDecisions) continue; + + // find the jpsi daughters (needed to compute 2-track properties like the polarization, etc.) + Int_t daughter1Label = 0; Int_t daughter2Label = 0; + FindJpsiTruthLegs(mother, daughter1Label, daughter2Label); //ccbar->e+e- + daughter1 = FindMCtruthTrackByLabel(daughter1Label); + daughter2 = FindMCtruthTrackByLabel(daughter2Label); + + // reset track variables and fill info + for(Int_t i=AliReducedVarManager::kNEventVars; iGetEntries(); ++iCut) { + if(!(motherDecisions & (UInt_t(1)<FillHistClass(Form("%s_PureMCTruth_BeforeSelection", mcMotherCuts[i]->At(iCut)->GetName()), fValues); + } + + if(!daughter1) continue; + if(!daughter2) continue; + + // apply selections on pure MC daughter electrons (kine cuts) + UInt_t daughter1Decisions = CheckDaughterMCTruth(daughter1, (i==0? AliReducedPairInfo::kJpsiToEE : AliReducedPairInfo::kPsi2SToEE)); + if(!daughter1Decisions) continue; + UInt_t daughtersDecisions = daughter1Decisions & CheckDaughterMCTruth(daughter2, (i==0? AliReducedPairInfo::kJpsiToEE : AliReducedPairInfo::kPsi2SToEE)); + if(!daughtersDecisions) continue; + + for(Int_t iCut = 0; iCutGetEntries(); ++iCut) { + if(!(motherDecisions & (UInt_t(1)<FillHistClass(Form("%s_PureMCTruth_AfterSelection", mcMotherCuts[i]->At(iCut)->GetName()), fValues); + } + } // end loop over tracks + + + // Loop through the list of pure MC particles and find those signals which do not require a mother (e.g. pairs of electrons without a mother) + // NOTE: At the moment, just signals with exactly 2 prongs per event are allowed + if(signalsWithoutMother[i]) { + nextTrack.Reset(); + daughter1 = 0x0; + daughter2 = 0x0; + UInt_t daughter1Decisions = 0; + UInt_t daughter2Decisions = 0; + AliReducedTrackInfo* tempTrack = 0x0; + for(Int_t it=0; itGetEntries(); ++it) { + tempTrack = (AliReducedTrackInfo*)nextTrack(); + if(!tempTrack->IsMCKineParticle()) continue; + + UInt_t daughterDecisions = CheckDaughterMCTruth(tempTrack, (i==0? AliReducedPairInfo::kJpsiToEE : AliReducedPairInfo::kPsi2SToEE)); + daughterDecisions &= signalsWithoutMother[i]; + if(!daughterDecisions) continue; + + if(!daughter1) { + daughter1 = tempTrack; + daughter1Decisions = daughterDecisions; + continue; + } + if(daughter1 && !daughter2) { + daughter2 = tempTrack; + daughter2Decisions = daughterDecisions; + } + + if(daughter1 && daughter2) { + daughterDecisions = daughter1Decisions & daughter2Decisions; + for(Int_t i=AliReducedVarManager::kNEventVars; iGetEntries(); ++iCut) { + if(!(daughterDecisions & (UInt_t(1)<FillHistClass(Form("%s_PureMCTruth_BeforeSelection", mcMotherCuts[i]->At(iCut)->GetName()), fValues); + fHistosManager->FillHistClass(Form("%s_PureMCTruth_AfterSelection", mcMotherCuts[i]->At(iCut)->GetName()), fValues); + } + } + } // end loop over tracks + } // end if(signalsWithoutMother) + } + + return; +} + +//___________________________________________________________________________ +UInt_t AliReducedAnalysisPsi2ee::CheckMotherMCTruth(AliReducedTrackInfo* mother, Bool_t checkReweight, Int_t type /*= AliReducedPairInfo::kJpsiToEE*/) { + // + // Check the mother pure MC truth against all defined selections and return a bit map with all decisions + // + UInt_t decisionMap = 0; + TList* mcMotherCuts; + if(type == AliReducedPairInfo::kJpsiToEE) mcMotherCuts = &fJpsiMotherMCcuts; + else if(type == AliReducedPairInfo::kPsi2SToEE) mcMotherCuts = &fPsiMotherMCcuts; + else return decisionMap; + + if(mcMotherCuts->GetEntries()==0) return 0; + for(Int_t i=0; iGetEntries(); ++i) { + AliReducedInfoCut* cut = (AliReducedInfoCut*)mcMotherCuts->At(i); + // If no MC bit was requested for the mother, skip this mother signal + // The MC cut will be applied just at the daughter level (this is likely an MC signal without a mother, e.g. electrons from gamma-gamma continuum from Starlight) + + //check if reweight is needed for this MC signal + if (checkReweight && (((AliReducedTrackCut*)cut)->GetApplyReweightMCpt())==kFALSE) continue; + if(!((AliReducedTrackCut*)cut)->GetMCFilterMap()) continue; + if(cut->IsSelected(mother)) + decisionMap |= (UInt_t(1)<GetEntries()==0) return 0; + for(Int_t i=0; iGetEntries(); ++i) { + AliReducedInfoCut* cut = (AliReducedInfoCut*)fElectronMCcuts->At(i); + if(cut->IsSelected(daughter)) + decisionMap |= (UInt_t(1)<GetTracks(); + TIter nextTrack(trackList); + for(Int_t it=0; itGetEntries(); ++it) { + track = (AliReducedTrackInfo*)nextTrack(); + if(!track->IsMCKineParticle()) continue; + if(track->MCLabel(0)==label) return track; + } + return 0x0; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FindJpsiTruthLegs(AliReducedTrackInfo* mother, Int_t& leg1Label, Int_t& leg2Label) { + // + // find the jpsi legs in the list of pure MC truth particles + // + Int_t mLabel = mother->MCLabel(0); + AliReducedTrackInfo* track=0x0; + + Int_t legsFound = 0; + + // loop over the first track array + TClonesArray* trackList = fEvent->GetTracks(); + TIter nextTrack(trackList); + for(Int_t it=0; itGetEntries(); ++it) { + if(legsFound==2) return; + track = (AliReducedTrackInfo*)nextTrack(); + if(!track->IsMCKineParticle()) continue; + if(track->MCLabel(1)==mLabel && TMath::Abs(track->MCPdg(0))==11) { + legsFound += 1; + if(legsFound==1) leg1Label = track->MCLabel(0); + if(legsFound==2) leg2Label = track->MCLabel(0); + } + } + return; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::DefineTree() +{ + fPairTreeOutput = new TTree("fPairTreeOutput","fPairTreeOutput"); + std::vector fPairTreeVariableName = + { + "PairPt", "PairMass", "PairEta", "PairRapidity", "PairPhi", "PairOpeningAngle", "PairPointingAngle", "PairCosPointingAngle", + "PairType", "PairTypeSPD", "PairChisquare", "PairLxy", "PairPseudoProperDecayTime", + "MCPt", "MCMass", "MCEta", "MCRapidity", "MCPhi", "MCPseudoProperDecayTime", "Tag" + }; + fPairTreeVariable = new Float_t [fPairTreeVariableName.size()]; + for (Int_t ivar=0; ivar<(Float_t)fPairTreeVariableName.size(); ivar++) + fPairTreeOutput->Branch(fPairTreeVariableName[ivar].Data(), &fPairTreeVariable[ivar], Form("%s/F",fPairTreeVariableName[ivar].Data())); + + fMCTruthTreeOutput = new TTree("fMCTruthTreeOutput","fMCTruthTreeOutput"); + std::vector fMCTruthTreeVariableName = + { + "Pt", "Mass", "Eta", "Rapidity", "Phi", "Leg1Pt", "Leg2Pt", "Pdg", "Tag" + }; + fMCTruthTreeVariable = new Float_t [fMCTruthTreeVariableName.size()]; + for (Int_t ivar=0; ivar<(Float_t)fMCTruthTreeVariableName.size(); ivar++) + fMCTruthTreeOutput->Branch(fMCTruthTreeVariableName[ivar].Data(), &fMCTruthTreeVariable[ivar], Form("%s/F",fMCTruthTreeVariableName[ivar].Data())); + + fLeg1TreeOutput = new TTree("fLeg1TreeOutput","fLeg1TreeOutput"); + fLeg2TreeOutput = new TTree("fLeg2TreeOutput","fLeg2TreeOutput"); + std::vector fLegTreeVariableName = + { + "LegPt", "LegMass", "LegEta", "LegRapidity", "LegPhi", "LegCharge", "LegPin", "LegDCAxy", "LegDCAz", + "LegTOFnSigma", "LegTPCnSigma", "LegITS", "LegTPCCrossedrows", "LegTPCFindable", "LegTPCcrossedRowsOverFindableClusters", + "LegITSnCls", "LegITSchi2", "LegTPCnCls", "LegTPCchi2", "LegTRDntracklets", "LegTRDntrackletsPID", + "MCPt", "MCMass", "MCEta", "MCRapidity", "MCPhi", "MCPseudoProperDecayTime", "Tag" + }; + fLeg1TreeVariable = new Float_t [fLegTreeVariableName.size()]; + fLeg2TreeVariable = new Float_t [fLegTreeVariableName.size()]; + fTreeVariable = new Float_t [fLegTreeVariableName.size()]; + for (Int_t ivar=0; ivar<(Float_t)fLegTreeVariableName.size(); ivar++) { + fLeg1TreeOutput->Branch(fLegTreeVariableName[ivar].Data(), &fLeg1TreeVariable[ivar], Form("%s/F",fLegTreeVariableName[ivar].Data())); + fLeg2TreeOutput->Branch(fLegTreeVariableName[ivar].Data(), &fLeg2TreeVariable[ivar], Form("%s/F",fLegTreeVariableName[ivar].Data())); + } + + return; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillMCTruthTree(Float_t* values, Int_t type){ + for (Int_t i=0; i<9; i++) fMCTruthTreeVariable[i] = -9999.; + + fMCTruthTreeVariable[0] = values[AliReducedVarManager::kPtMC]; + fMCTruthTreeVariable[1] = values[AliReducedVarManager::kMassMC]; + fMCTruthTreeVariable[2] = values[AliReducedVarManager::kEtaMC]; + fMCTruthTreeVariable[3] = values[AliReducedVarManager::kRapMC]; + fMCTruthTreeVariable[4] = values[AliReducedVarManager::kPhiMC]; + fMCTruthTreeVariable[5] = values[AliReducedVarManager::kPairLegPtMC+0]; + fMCTruthTreeVariable[6] = values[AliReducedVarManager::kPairLegPtMC+1]; + fMCTruthTreeVariable[7] = values[AliReducedVarManager::kPdgMC]; + fMCTruthTreeVariable[8] = type; + + fMCTruthTreeOutput->Fill(); + + return; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillPairTree(Float_t* values, UInt_t mcDecisions /*= 0*/){ + for (Int_t i=0; i<20; i++) fPairTreeVariable[i] = -9999.; + + // Pair info + fPairTreeVariable[0] = values[AliReducedVarManager::kPt]; + fPairTreeVariable[1] = values[AliReducedVarManager::kMass]; + fPairTreeVariable[2] = values[AliReducedVarManager::kEta]; + fPairTreeVariable[3] = values[AliReducedVarManager::kRap]; + fPairTreeVariable[4] = values[AliReducedVarManager::kPhi]; + fPairTreeVariable[5] = values[AliReducedVarManager::kPairOpeningAngle]; + fPairTreeVariable[6] = values[AliReducedVarManager::kPairPointingAngle]; + fPairTreeVariable[7] = values[AliReducedVarManager::kPairCosPointingAngle]; + fPairTreeVariable[8] = values[AliReducedVarManager::kPairType]; + fPairTreeVariable[9] = values[AliReducedVarManager::kPairTypeSPD]; + fPairTreeVariable[10] = values[AliReducedVarManager::kPairChisquare]; + fPairTreeVariable[11] = values[AliReducedVarManager::kPairLxy]; + fPairTreeVariable[12] = values[AliReducedVarManager::kPseudoProperDecayTime]; + + // MC rec info + if(fOptionRunOverMC){ + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisions & (UInt_t(1)<GetName()); + + fPairTreeVariable[13] = values[AliReducedVarManager::kPtMC]; + fPairTreeVariable[14] = values[AliReducedVarManager::kMassMC]; + fPairTreeVariable[15] = values[AliReducedVarManager::kEtaMC]; + fPairTreeVariable[16] = values[AliReducedVarManager::kRapMC]; + fPairTreeVariable[17] = values[AliReducedVarManager::kPhiMC]; + fPairTreeVariable[18] = values[AliReducedVarManager::kPseudoProperDecayTimeMC]; + + for(int i = 0; i < motherTags.size(); i++) + if(motherTags[i].Data() == motherTag) fPairTreeVariable[19] = i; + } + } + } + + fPairTreeOutput->Fill(); + + return; +} + +//___________________________________________________________________________ +void AliReducedAnalysisPsi2ee::FillLegTree(Float_t* values, Int_t trkTag /*= 1*/, UInt_t mcDecisions /*= 0*/){ + for (Int_t i=0; i<28; i++) fTreeVariable[i] = -9999.; + + // Leg1 info + fTreeVariable[0] = values[AliReducedVarManager::kPt]; + fTreeVariable[1] = values[AliReducedVarManager::kMass]; + fTreeVariable[2] = values[AliReducedVarManager::kEta]; + fTreeVariable[3] = values[AliReducedVarManager::kRap]; + fTreeVariable[4] = values[AliReducedVarManager::kPhi]; + fTreeVariable[5] = values[AliReducedVarManager::kCharge]; + fTreeVariable[6] = values[AliReducedVarManager::kPin]; + fTreeVariable[7] = values[AliReducedVarManager::kDcaXY]; + fTreeVariable[8] = values[AliReducedVarManager::kDcaZ]; + fTreeVariable[9] = values[AliReducedVarManager::kTOFnSig]; + fTreeVariable[10] = values[AliReducedVarManager::kTPCnSig]; + fTreeVariable[11] = values[AliReducedVarManager::kITSlayerHit]; + fTreeVariable[12] = values[AliReducedVarManager::kTPCcrossedRows]; + fTreeVariable[13] = values[AliReducedVarManager::kTPCnclsF]; + fTreeVariable[14] = values[AliReducedVarManager::kTPCcrossedRowsOverFindableClusters]; + fTreeVariable[15] = values[AliReducedVarManager::kITSncls]; + fTreeVariable[16] = values[AliReducedVarManager::kITSchi2]; + fTreeVariable[17] = values[AliReducedVarManager::kTPCncls]; + fTreeVariable[18] = values[AliReducedVarManager::kTPCchi2]; + fTreeVariable[19] = values[AliReducedVarManager::kTRDntracklets]; + fTreeVariable[20] = values[AliReducedVarManager::kTRDntrackletsPID]; + + // MC rec info + if(fOptionRunOverMC){ + for(Int_t iMC=0; iMC<=fLegCandidatesMCcuts.GetEntries(); ++iMC) { + if(mcDecisions & (UInt_t(1)<GetName()); + + fTreeVariable[21] = values[AliReducedVarManager::kPtMC]; + fTreeVariable[22] = values[AliReducedVarManager::kMassMC]; + fTreeVariable[23] = values[AliReducedVarManager::kEtaMC]; + fTreeVariable[24] = values[AliReducedVarManager::kRapMC]; + fTreeVariable[25] = values[AliReducedVarManager::kPhiMC]; + fTreeVariable[26] = values[AliReducedVarManager::kPseudoProperDecayTimeMC]; + + for(int i = 0; i < motherTags.size(); i++) + if(motherTags[i].Data() == motherTag) fTreeVariable[27] = i; + } + } + } + + if(trkTag == 1) { + std::copy_n(fTreeVariable, 28, fLeg1TreeVariable); + fLeg1TreeOutput->Fill(); + + return; + } + if(trkTag == 2) { + std::copy_n(fTreeVariable, 28, fLeg2TreeVariable); + fLeg2TreeOutput->Fill(); + + return; + } +} diff --git a/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.h b/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.h new file mode 100644 index 00000000000..33de9a22a1a --- /dev/null +++ b/PWGDQ/reducedTree/AliReducedAnalysisPsi2ee.h @@ -0,0 +1,212 @@ +// +// Creation date: 2016/09/06 +// Author: Ionut-Cristian Arsene, iarsene@cern.ch, i.c.arsene@fys.uio.no + +#ifndef ALIREDUCEDANALYSISPSI2EE_H +#define ALIREDUCEDANALYSISPSI2EE_H + +#include + +#include "AliReducedAnalysisTaskSE.h" +#include "AliAnalysisTaskSE.h" +#include "AliReducedInfoCut.h" +#include "AliReducedBaseEvent.h" +#include "AliReducedBaseTrack.h" +#include "AliReducedTrackInfo.h" +#include "AliReducedCaloClusterInfo.h" +#include "AliReducedCaloClusterTrackMatcher.h" +#include "AliHistogramManager.h" +#include "AliMixingHandler.h" + + +//________________________________________________________________ +class AliReducedAnalysisPsi2ee : public AliReducedAnalysisTaskSE, public AliAnalysisTaskSE { + +public: + AliReducedAnalysisPsi2ee(); + AliReducedAnalysisPsi2ee(const Char_t* name, const Char_t* title); + virtual ~AliReducedAnalysisPsi2ee(); + + // initialization (typically called in AliAnalysisTask::UserCreateOutputObjects()) + virtual void Init(); + // process a given event (typically called in AliAnalysisTask::UserExec()) + virtual void Process(); + // finish, to be executed after all events were processed + virtual void Finish(); + + // setters + void AddEventCut(AliReducedInfoCut* cut) {fEventCuts.Add(cut);} + void AddClusterCut(AliReducedInfoCut* cut) {fClusterCuts.Add(cut); fFillCaloClusterHistograms=kTRUE; } + void AddTrackCut(AliReducedInfoCut* cut); + void AddPrefilterTrackCut(AliReducedInfoCut* cut) {fPreFilterTrackCuts.Add(cut);} + void AddPairCut(AliReducedInfoCut* cut); + void AddPrefilterPairCut(AliReducedInfoCut* cut) {fPreFilterPairCuts.Add(cut);} + void SetRunEventMixing(Bool_t option) {fOptionRunMixing = option;}; + void SetRunPairing(Bool_t option) {fOptionRunPairing = option;}; + void SetRunOverMC(Bool_t option) {fOptionRunOverMC = option;}; + void SetRunLikeSignPairing(Bool_t option) {fOptionRunLikeSignPairing = option;} + void SetLoopOverTracks(Bool_t option) { + fOptionLoopOverTracks = option; + if(!fOptionLoopOverTracks) {fOptionRunPairing = kFALSE; fOptionRunMixing = kFALSE; fOptionRunLikeSignPairing = kFALSE;} + } + void SetRunPrefilter(Bool_t option) {fOptionRunPrefilter = option;} + void SetStoreccbarCandidates(Bool_t option) {fOptionStoreccbarCandidates = option;} + void SetMCJpsiPtWeights(TH1F* weights) {fMCJpsiPtWeights = weights;} + void SetMCPsiPtWeights(TH1F* weights) {fMCPsiPtWeights = weights;} + void SetFillCaloClusterHistograms(Bool_t option) {fFillCaloClusterHistograms = option;} + void SetClusterTrackMatcher(AliReducedCaloClusterTrackMatcher* matcher) {fClusterTrackMatcher = matcher;} + void SetStoreTree(Bool_t option) {fOptionStoreTree = option;} + + void AddLegCandidateMCcut(AliReducedInfoCut* cut, Bool_t sameMother=kTRUE) { + if(fLegCandidatesMCcuts.GetEntries()>=32) return; + fLegCandidatesMCcuts.Add(cut); + fLegCandidatesMCcuts_RequestSameMother[fLegCandidatesMCcuts.GetEntries()-1] = sameMother; + } + void AddJpsiMotherMCCut(AliReducedInfoCut* cutMother, AliReducedInfoCut* cutElectron) { + if(fJpsiMotherMCcuts.GetEntries()>=32) return; + fJpsiMotherMCcuts.Add(cutMother); + fJpsiElectronMCcuts.Add(cutElectron); + } + void AddPsiMotherMCCut(AliReducedInfoCut* cutMother, AliReducedInfoCut* cutElectron) { + if(fPsiMotherMCcuts.GetEntries()>=32) return; + fPsiMotherMCcuts.Add(cutMother); + fPsiElectronMCcuts.Add(cutElectron); + } + void DefineTree(); + + // getters + virtual AliHistogramManager* GetHistogramManager() const {return fHistosManager;} + virtual AliMixingHandler* GetMixingHandler() const {return fMixingHandler;} + virtual AliReducedCaloClusterTrackMatcher* GetClusterTrackMatcher() const {return fClusterTrackMatcher;} + Int_t GetNClusterCuts() const {return fClusterCuts.GetEntries();} + const Char_t* GetClusterCutName(Int_t i) const {return (iGetName() : "");} + AliReducedInfoCut* GetCaloClusterCut(Int_t i) const {return (iGetName() : "");} + AliReducedInfoCut* GetTrackCut(Int_t i) const {return (iGetName() : "");} + AliReducedInfoCut* GetPairCut(Int_t i) const {return (iGetName() : "");} + Int_t GetNJpsiMotherMCCuts() const {return fJpsiMotherMCcuts.GetEntries();} + Int_t GetNPsiMotherMCCuts() const {return fPsiMotherMCcuts.GetEntries();} + const Char_t* GetJpsiMotherMCcutName(Int_t i) const {return (iGetName() : "");} + const Char_t* GetPsiMotherMCcutName(Int_t i) const {return (iGetName() : "");} + + +protected: + AliHistogramManager* fHistosManager; // Histogram manager + AliMixingHandler* fMixingHandler; // mixing handler + AliReducedCaloClusterTrackMatcher* fClusterTrackMatcher; // cluster-track matcher + + Bool_t fOptionRunMixing; // true: run event mixing, false: no event mixing + Bool_t fOptionRunPairing; // true: run pairing, false: only apply the track cuts + Bool_t fOptionRunOverMC; // true: trees contain MC info -> fill histos to compute efficiencies, false: run normally as on data + Bool_t fOptionRunLikeSignPairing; // true (default): performs the like sign pairing in addition to the opposite pairing + Bool_t fOptionLoopOverTracks; // true (default); if false do not loop over tracks and consequently no pairing + Bool_t fOptionRunPrefilter; // true (default); if false do not run the prefilter + Bool_t fOptionStoreccbarCandidates; // false (default); if true, store the same event jpsi candidates in a TList + Bool_t fFillCaloClusterHistograms; // false (default); if true, fill calorimeter cluster histograms + Bool_t fOptionStoreTree; + + TList fEventCuts; // array of event cuts + TList fClusterCuts; // array of cluster cuts + TList fTrackCuts; // array of track cuts + TList fPreFilterTrackCuts; // track cuts to be used at the prefilter stage + TList fPairCuts; // array of pair cuts + TList fPreFilterPairCuts; // pair cuts to be used at the prefilter stage + + TList fClusters; // list of selected clusters + TList fPosTracks; // list of selected positive tracks in the current event + TList fNegTracks; // list of selected negative tracks in the current event + TList fPrefilterPosTracks; // list of prefilter selected positive tracks in the current event + TList fPrefilterNegTracks; // list of prefilter selected negative tracks in the current event + TList fccbarCandidates; // list of Jpsi candidates --> to be used in analyses inheriting from this + + // selection based on the MC truth information of the reconstructed leg candidates + // NOTE: The list is a list of AliReducedInfoCut objects which can be used to + // apply cuts on the MC flags of the tracks. + // NOTE: The names of the cuts are used in the naming of the histogram classes + TList fLegCandidatesMCcuts; + Bool_t fLegCandidatesMCcuts_RequestSameMother[32]; + + // selection cuts for the pure MC truth (select the J/psi from stack) + // the list should contains cuts which can be applied to a pure MC truth particle (no reconstructed information) + // e.g. cuts on the MC flags and on kinematics + // For each selection, a separate histogram directory will be created + TList fJpsiMotherMCcuts; + TList fPsiMotherMCcuts; + + // Selection on the MC truth of the electrons from the jpsi decay + // Tipically, here one can specify the kinematic selection on the electrons from jpsi decay + // so dividing the jpsi yield at this step by the yield of jpsi selected by the fJpsiMotherMCcuts, one can obtain the + // acceptance efficiency. + // NOTE: The number of selections on the jpsi electron needs to be the same and in sync with the number of fJpsiMotherMCcuts cuts + TList fJpsiElectronMCcuts; + TList fPsiElectronMCcuts; + + TTree* fPairTreeOutput; + TTree* fLeg1TreeOutput; + TTree* fLeg2TreeOutput; + TTree* fMCTruthTreeOutput; + + Float_t* fTreeVariable; + Float_t* fPairTreeVariable; + Float_t* fLeg1TreeVariable; + Float_t* fLeg2TreeVariable; + Float_t* fMCTruthTreeVariable; + std::vector motherTags = {"MCRecJpsiElectron", "MCRecJpsiElectronNonPrompt", "MCRecJpsiElectronPrompt", "MCRecPsiElectron", "MCRecPsiElectronNonPrompt", "MCRecPsiElectronPrompt"}; + + Float_t fValuesTrk1[AliReducedVarManager::kNVars] = {-9999.,}; + Float_t fValuesTrk2[AliReducedVarManager::kNVars] = {-9999.,}; + + Bool_t IsEventSelected(AliReducedBaseEvent* event, Float_t* values=0x0); + Bool_t IsClusterSelected(AliReducedCaloClusterInfo* cluster, Float_t* values=0x0); + Bool_t IsTrackSelected(AliReducedBaseTrack* track, Float_t* values=0x0); + Bool_t IsTrackPrefilterSelected(AliReducedBaseTrack* track, Float_t* values=0x0); + ULong_t IsPairSelected(Float_t* values); + Bool_t IsPairPreFilterSelected(Float_t* values); + UInt_t CheckReconstructedLegMCTruth(AliReducedBaseTrack* ptrack, AliReducedBaseTrack* ntrack); + UInt_t CheckReconstructedLegMCTruth(AliReducedBaseTrack* track); + void FindJpsiTruthLegs(AliReducedTrackInfo* mother, Int_t& leg1Label, Int_t& leg2Label); + AliReducedTrackInfo* FindMCtruthTrackByLabel(Int_t label); + void LoopOverMCTracks(Int_t trackArray =1); + UInt_t CheckMotherMCTruth(AliReducedTrackInfo* mother, Bool_t checkReweight=kFALSE, Int_t type = AliReducedPairInfo::kJpsiToEE); + UInt_t CheckDaughterMCTruth(AliReducedTrackInfo* daughter, Int_t type = AliReducedPairInfo::kJpsiToEE); + + void RunPrefilter(); + void RunSameEventPairing(TString pairClass = "PairSE"); + void RunTrackSelection(); + void RunClusterSelection(); + void LoopOverTracks(Int_t arrayOption=1); + void FillTrackHistograms(TString trackClass = "Track"); + void FillTrackHistograms(AliReducedBaseTrack* track, TString trackClass = "Track"); + void FillPairHistograms(ULong_t trackMask, ULong_t pairMask, Int_t pairType, TString pairClass = "PairSE", UInt_t mcDecisions = 0); + void FillClusterHistograms(TString clusterClass="CaloCluster"); + void FillClusterHistograms(AliReducedCaloClusterInfo* cluster, TString clusterClass="CaloCluster"); + void FillMCTruthHistograms(); + void FillMCTruthTree(Float_t* fValues, Int_t type); + void FillLegTree(Float_t* fValues, Int_t trkTag = 1, UInt_t mcDecisions = 0); + void FillPairTree(Float_t* fValues, UInt_t mcDecisions = 0); + + TList* fClusterTrackMatcherHistograms; // list of cluster-track matcher histograms + TH1I* fClusterTrackMatcherMultipleMatchesBefore; // multiple matches of tracks to same cluster before matching + TH1I* fClusterTrackMatcherMultipleMatchesAfter; // multiple matches of tracks to same cluster after matching + + Bool_t fSkipMCEvent; // decision to skip MC event + TH1F* fMCJpsiPtWeights; // weights vs pt to reject events depending on the jpsi true pt (needed to re-weights jpsi Pt distribution) + TH1F* fMCPsiPtWeights; // weights vs pt to reject events depending on the jpsi true pt (needed to re-weights psi Pt distribution) + + ClassDef(AliReducedAnalysisPsi2ee,13); +}; + +#endif diff --git a/PWGDQ/reducedTree/CMakeLists.txt b/PWGDQ/reducedTree/CMakeLists.txt index bde0163d0f0..cb55620e88b 100644 --- a/PWGDQ/reducedTree/CMakeLists.txt +++ b/PWGDQ/reducedTree/CMakeLists.txt @@ -45,6 +45,7 @@ set(SRCS AliReducedAnalysisJpsi2ee.cxx AliReducedAnalysisJpsi2eeCorrelations.cxx AliReducedAnalysisJpsi2eeMult.cxx + AliReducedAnalysisPsi2ee.cxx AliReducedAnalysisSingleTrack.cxx AliReducedAnalysisTaskSE.cxx AliReducedAnalysisTest.cxx diff --git a/PWGDQ/reducedTree/PWGDQreducedTreeLinkDef.h b/PWGDQ/reducedTree/PWGDQreducedTreeLinkDef.h index 9586542d9cf..63c35f16e03 100644 --- a/PWGDQ/reducedTree/PWGDQreducedTreeLinkDef.h +++ b/PWGDQ/reducedTree/PWGDQreducedTreeLinkDef.h @@ -17,6 +17,7 @@ #pragma link C++ class AliReducedAnalysisJpsi2ee+; #pragma link C++ class AliReducedAnalysisJpsi2eeCorrelations+; #pragma link C++ class AliReducedAnalysisJpsi2eeMult+; +#pragma link C++ class AliReducedAnalysisPsi2ee+; #pragma link C++ class AliReducedAnalysisSingleTrack+; #pragma link C++ class AliReducedAnalysisTaskSE+; #pragma link C++ class AliReducedAnalysisTest+; From a637aeb3f9e0d71ac15635616ff746e33c95d886 Mon Sep 17 00:00:00 2001 From: Jinjoo Seo Date: Wed, 14 Jun 2023 17:30:12 +0200 Subject: [PATCH 2/2] Fix the wrong ordering --- PWGDQ/reducedTree/AliReducedVarManager.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGDQ/reducedTree/AliReducedVarManager.cxx b/PWGDQ/reducedTree/AliReducedVarManager.cxx index 93fae2cee2e..1769ea2dc64 100644 --- a/PWGDQ/reducedTree/AliReducedVarManager.cxx +++ b/PWGDQ/reducedTree/AliReducedVarManager.cxx @@ -66,7 +66,6 @@ const Float_t AliReducedVarManager::fgkPairMass[AliReducedPairInfo::kNMaxCandida 1.11568, //ALambda 1.019455, // Phi 3.09691599, //Jpsi - 5.27925, // B+- 3.686097, // psi(2S) 9.460300, //Upsilon 1.86962, // D+- @@ -77,7 +76,8 @@ const Float_t AliReducedVarManager::fgkPairMass[AliReducedPairInfo::kNMaxCandida 1.86962, // D+- 1.86484, // D0 1.86962, // D+- - 1.96850 // Ds + 1.96850, // Ds + 5.27925 // B+- }; const Char_t* AliReducedVarManager::fgkTrackingStatusNames[AliReducedVarManager::kNTrackingStatus] = {