From d0c1e055d0540525eeb922916072ebceb364e433 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Mon, 29 Apr 2024 17:10:25 +0200 Subject: [PATCH 1/9] Added h-MFT mixed event process function, trying to artificially fill multiplicity bins --- PWGHF/HFC/Tasks/taskFlow.cxx | 81 ++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 6cb685f25ca..47a5e8228a7 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -17,6 +17,8 @@ #include #include +#include // Alexian : To debug with std::cout ? + #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPObject.h" #include "Framework/AnalysisDataModel.h" @@ -49,6 +51,7 @@ using namespace o2::framework::expressions; struct HfTaskFlow { // configurables for processing options Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; + // Will we ever use Run 2 data ? Otherwise remove this line ? Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; Configurable processMc{"processMc", false, "Flag to run on MC"}; Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; @@ -70,6 +73,7 @@ struct HfTaskFlow { using MyTracks = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; + // Collision filters // FIXME: The filter is applied also on the candidates! Beware! Filter collisionVtxZFilter = nabs(aod::collision::posZ) < zVertexMax; @@ -81,6 +85,15 @@ struct HfTaskFlow { // TODO: use Partition instead of filter Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + // First try to use Partition instead + // This would be if we want to partition between D0 and D0 bar, but maybe we when to partition between selected and non-selected ? + Partition selectedD0 = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0; + Partition selectedD0bar = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + + // Partition between selected and non-selected + Partition selectedCandidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition NotSelectedcandidates = aod::hf_sel_candidate_d0::isSelD0 <= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar <= selectionFlagD0bar; + Preslice perCol = aod::track::collisionId; // configurables for containers @@ -96,7 +109,7 @@ struct HfTaskFlow { // TODO: flow of HF will need to be done vs. invariant mass, in the signal and side-band regions // either 1) add invariant mass axis or 2) define several containers for different inv. mass regions // Note: don't forget to check inv. mass separately for D0 and D0bar candidate - ConfigurableAxis axisMass{"axisMass", {30, 1.7, 2.0}, "axis of invariant mass of HF candidates"}; + ConfigurableAxis axisMass{"axisMass", {2, 1.7, 2.0}, "axis of invariant mass of HF candidates"}; HistogramRegistry registry{"registry"}; @@ -105,6 +118,7 @@ struct HfTaskFlow { OutputObj sameHF{"sameEventHFHadrons"}; OutputObj mixedTPCTPCCh{"mixedEventTPCTPCChHadrons"}; OutputObj mixedHF{"mixedEventHFHadrons"}; + OutputObj mixedMFT{"mixedEventTPCMFTChHadrons"}; // ========================= // init() @@ -199,6 +213,7 @@ struct HfTaskFlow { sameHF.setObject(new CorrelationContainer("sameEventHFHadrons", "sameEventHFHadrons", corrAxis, effAxis, userAxis)); mixedTPCTPCCh.setObject(new CorrelationContainer("mixedEventTPCTPCChHadrons", "mixedEventTPCTPCChHadrons", corrAxis, effAxis, {})); mixedHF.setObject(new CorrelationContainer("mixedEventHFHadrons", "mixedEventHFHadrons", corrAxis, effAxis, userAxis)); + mixedMFT.setObject(new CorrelationContainer("mixedEventTPCMFTChHadrons", "mixedEventTPCMFTChHadrons", corrAxis, effAxis, {})); } // --------------- @@ -301,6 +316,7 @@ struct HfTaskFlow { template bool isAcceptedCandidate(TTrack const& candidate) { + // Alexian : Why is it only one "&" just beneath ? if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { return false; } @@ -374,11 +390,23 @@ struct HfTaskFlow { invmass = hfHelper.invMassD0ToPiK(track1); } + int i = 0; + i++; + // fill single-track distributions if (!fillingHFcontainer) { target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, triggerWeight); } else { target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, invmass, triggerWeight); + + // To fill multiplicity bins artificially just to check + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 50, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 60, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 70, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 80, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 90, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 100, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 130, posZ, invmass, triggerWeight); } for (const auto& track2 : tracks2) { @@ -412,6 +440,9 @@ struct HfTaskFlow { // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + int j = 0; + j++; + if (!fillingHFcontainer) { // fill pair correlations target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, @@ -421,6 +452,29 @@ struct HfTaskFlow { target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); + + // To fill multiplicity bins artificially just to check + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 55, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 65, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 75, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 85, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 95, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 105, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + eta1 - eta2, pt2, pt1, 140, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); } } } @@ -487,6 +541,7 @@ struct HfTaskFlow { registry.fill(HIST("hEventCountSame"), bin); sameTPCTPCCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillQA(multiplicity, tracks); fillCorrelations(sameTPCTPCCh, tracks, tracks, multiplicity, collision.posZ()); } @@ -499,13 +554,13 @@ struct HfTaskFlow { MyTracks const& tracks, HfCandidatesSel const& candidates) { - if (!(isCollisionSelected(collision, false))) { + if (!(isCollisionSelected(collision, true))) { return; } - const auto multiplicity = tracks.size(); sameHF->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCandidateQA(candidates); fillCorrelations(sameHF, candidates, tracks, multiplicity, collision.posZ()); } @@ -518,7 +573,7 @@ struct HfTaskFlow { MyTracks const& tracks, aod::MFTTracks const& mfttracks) { - if (!(isCollisionSelected(collision, false))) { + if (!(isCollisionSelected(collision, true))) { return; } @@ -565,6 +620,24 @@ struct HfTaskFlow { mixCollisions(collisions, candidates, tracks, getTracksSize, mixedHF); } PROCESS_SWITCH(HfTaskFlow, processMixedHfHadrons, "Process mixed-event correlations for HF-h case", true); + + // ===================================== + // process mixed event correlations: h-MFT case + // ===================================== + void processMixedTpcMftHH(MyCollisions const& collisions, + MyTracks const& tracks, + aod::MFTTracks const& mfttracks) + { + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&tracks, this](MyCollisions::iterator const& col) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); + auto size = associatedTracks.size(); + return size; + }; + + mixCollisions(collisions, mfttracks, tracks, getTracksSize, mixedMFT); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHH, "Process mixed-event correlations for h-MFT case", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From fba910bb3975443dc5c35efe3b8c1c9dca9285c7 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Tue, 14 May 2024 14:48:41 +0200 Subject: [PATCH 2/9] taskFlow.cxx : adding mixed-event process function for h-MFT case --- PWGHF/HFC/Tasks/taskFlow.cxx | 131 ++++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 57 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 47a5e8228a7..4036f805bcb 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -17,7 +17,6 @@ #include #include -#include // Alexian : To debug with std::cout ? #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPObject.h" @@ -51,7 +50,6 @@ using namespace o2::framework::expressions; struct HfTaskFlow { // configurables for processing options Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; - // Will we ever use Run 2 data ? Otherwise remove this line ? Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; Configurable processMc{"processMc", false, "Flag to run on MC"}; Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; @@ -73,6 +71,9 @@ struct HfTaskFlow { using MyTracks = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; + using MyTracksMC = soa::Filtered>; + using MyCollisionsMC = soa::Filtered>; + // Collision filters // FIXME: The filter is applied also on the candidates! Beware! @@ -85,15 +86,7 @@ struct HfTaskFlow { // TODO: use Partition instead of filter Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - // First try to use Partition instead - // This would be if we want to partition between D0 and D0 bar, but maybe we when to partition between selected and non-selected ? - Partition selectedD0 = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0; - Partition selectedD0bar = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - - // Partition between selected and non-selected - Partition selectedCandidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Partition NotSelectedcandidates = aod::hf_sel_candidate_d0::isSelD0 <= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar <= selectionFlagD0bar; - + Preslice perCol = aod::track::collisionId; // configurables for containers @@ -119,6 +112,8 @@ struct HfTaskFlow { OutputObj mixedTPCTPCCh{"mixedEventTPCTPCChHadrons"}; OutputObj mixedHF{"mixedEventHFHadrons"}; OutputObj mixedMFT{"mixedEventTPCMFTChHadrons"}; + OutputObj sameTPCTPCChmc{"sameEventTPCTPCChHadronsMC"}; + OutputObj mixedTPCTPCChmc{"mixedEventTPCTPCChHadronsMC"}; // ========================= // init() @@ -214,6 +209,8 @@ struct HfTaskFlow { mixedTPCTPCCh.setObject(new CorrelationContainer("mixedEventTPCTPCChHadrons", "mixedEventTPCTPCChHadrons", corrAxis, effAxis, {})); mixedHF.setObject(new CorrelationContainer("mixedEventHFHadrons", "mixedEventHFHadrons", corrAxis, effAxis, userAxis)); mixedMFT.setObject(new CorrelationContainer("mixedEventTPCMFTChHadrons", "mixedEventTPCMFTChHadrons", corrAxis, effAxis, {})); + sameTPCTPCChmc.setObject(new CorrelationContainer("sameEventTPCTPCChHadronsMC", "sameEventTPCTPCChHadronsMC", corrAxis, effAxis, {})); + mixedTPCTPCChmc.setObject(new CorrelationContainer("mixedEventTPCTPCChHadronsMC", "mixedEventTPCTPCChHadronsMC", corrAxis, effAxis, {})); } // --------------- @@ -316,7 +313,6 @@ struct HfTaskFlow { template bool isAcceptedCandidate(TTrack const& candidate) { - // Alexian : Why is it only one "&" just beneath ? if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { return false; } @@ -390,23 +386,11 @@ struct HfTaskFlow { invmass = hfHelper.invMassD0ToPiK(track1); } - int i = 0; - i++; - // fill single-track distributions if (!fillingHFcontainer) { target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, triggerWeight); } else { target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, invmass, triggerWeight); - - // To fill multiplicity bins artificially just to check - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 50, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 60, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 70, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 80, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 90, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 100, posZ, invmass, triggerWeight); - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, 130, posZ, invmass, triggerWeight); } for (const auto& track2 : tracks2) { @@ -440,54 +424,30 @@ struct HfTaskFlow { // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); - int j = 0; - j++; - if (!fillingHFcontainer) { // fill pair correlations target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); } else { + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); - - // To fill multiplicity bins artificially just to check - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 55, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 65, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 75, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 85, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 95, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 105, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, 140, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); } } } } - template - void mixCollisions(MyCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + template + void mixCollisions(TMyCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) { + // STUCK HERE, HOW TO DECLARE aod::collision::PosZ for both normal particles and MC ? using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; - auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -585,7 +545,6 @@ struct HfTaskFlow { } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftHH, "Process same-event correlations for h-MFT case", true); - // TODO: add also MFT option // ===================================== // process mixed event correlations: h-h case // ===================================== @@ -604,7 +563,7 @@ struct HfTaskFlow { PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHH, "Process mixed-event correlations for h-h case", true); // ===================================== - // process mixed event correlations: h-h case + // process mixed event correlations: h-HF case // ===================================== void processMixedHfHadrons(MyCollisions const& collisions, MyTracks const& tracks, @@ -638,7 +597,65 @@ struct HfTaskFlow { mixCollisions(collisions, mfttracks, tracks, getTracksSize, mixedMFT); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHH, "Process mixed-event correlations for h-MFT case", true); -}; + + +// ================================================================== + +// MONTE CARLO + +// =================================================================== + +/* + + // ===================================== + // process same event correlations: h-h (MC) case + // ===================================== + void processSameTpcTpcHHmc(MyCollisionsMC::iterator const& collision, + MyTracksMC const& tracks) + { + if (!(isCollisionSelected(collision, true))) { + return; + } + + // the event histograms below are only filled for h-h case + // because there is a possibility of double-filling if more correlation + // options are ran at the same time + // temporary solution, since other correlation options always have to be ran with h-h, too + // TODO: rewrite it in a more intelligent way + const auto multiplicity = tracks.size(); + registry.fill(HIST("hMultiplicity"), multiplicity); + registry.fill(HIST("hVtxZ"), collision.posZ()); + + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("hEventCountSame"), bin); + + sameTPCTPCChmc->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillQA(multiplicity, tracks); + fillCorrelations(sameTPCTPCChmc, tracks, tracks, multiplicity, collision.posZ()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHHmc, "Process same-event correlations for h-h case for MC", true); + + // ===================================== + // process mixed event correlations: h-h (MC) case + // ===================================== + void processMixedTpcTpcHHmc(MyCollisionsMC const& collisions, + MyTracksMC const& tracks) + { + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&tracks, this](MyCollisionsMC::iterator const& col) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + auto size = associatedTracks.size(); + return size; + }; + + mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChmc); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHHmc, "Process mixed-event correlations for h-h case for MC", true); + */ + +}; // End of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 43c9924cef6fc839c50b0a8051635b5ad84a9a06 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Tue, 14 May 2024 14:54:47 +0200 Subject: [PATCH 3/9] taskFlow.cxx : adding mixed-event process function for h-MFT case --- PWGHF/HFC/Tasks/taskFlow.cxx | 58 ------------------------------------ 1 file changed, 58 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 4036f805bcb..7f3e815a322 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -597,64 +597,6 @@ struct HfTaskFlow { mixCollisions(collisions, mfttracks, tracks, getTracksSize, mixedMFT); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHH, "Process mixed-event correlations for h-MFT case", true); - - -// ================================================================== - -// MONTE CARLO - -// =================================================================== - -/* - - // ===================================== - // process same event correlations: h-h (MC) case - // ===================================== - void processSameTpcTpcHHmc(MyCollisionsMC::iterator const& collision, - MyTracksMC const& tracks) - { - if (!(isCollisionSelected(collision, true))) { - return; - } - - // the event histograms below are only filled for h-h case - // because there is a possibility of double-filling if more correlation - // options are ran at the same time - // temporary solution, since other correlation options always have to be ran with h-h, too - // TODO: rewrite it in a more intelligent way - const auto multiplicity = tracks.size(); - registry.fill(HIST("hMultiplicity"), multiplicity); - registry.fill(HIST("hVtxZ"), collision.posZ()); - - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("hEventCountSame"), bin); - - sameTPCTPCChmc->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - - fillQA(multiplicity, tracks); - fillCorrelations(sameTPCTPCChmc, tracks, tracks, multiplicity, collision.posZ()); - } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHHmc, "Process same-event correlations for h-h case for MC", true); - - // ===================================== - // process mixed event correlations: h-h (MC) case - // ===================================== - void processMixedTpcTpcHHmc(MyCollisionsMC const& collisions, - MyTracksMC const& tracks) - { - // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](MyCollisionsMC::iterator const& col) { - auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once - auto size = associatedTracks.size(); - return size; - }; - - mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChmc); - } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHHmc, "Process mixed-event correlations for h-h case for MC", true); - */ - }; // End of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 532d11634cae6d883aa9590c776b116bbe4adfee Mon Sep 17 00:00:00 2001 From: AlexianL Date: Tue, 14 May 2024 15:00:35 +0200 Subject: [PATCH 4/9] PWGHF : taskFlow.cxx -> adding mixed-event process function for h-MFT case --- PWGHF/HFC/Tasks/taskFlow.cxx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 7f3e815a322..8f4f5c153b2 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -71,9 +71,6 @@ struct HfTaskFlow { using MyTracks = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; - using MyTracksMC = soa::Filtered>; - using MyCollisionsMC = soa::Filtered>; - // Collision filters // FIXME: The filter is applied also on the candidates! Beware! @@ -112,8 +109,6 @@ struct HfTaskFlow { OutputObj mixedTPCTPCCh{"mixedEventTPCTPCChHadrons"}; OutputObj mixedHF{"mixedEventHFHadrons"}; OutputObj mixedMFT{"mixedEventTPCMFTChHadrons"}; - OutputObj sameTPCTPCChmc{"sameEventTPCTPCChHadronsMC"}; - OutputObj mixedTPCTPCChmc{"mixedEventTPCTPCChHadronsMC"}; // ========================= // init() @@ -209,9 +204,7 @@ struct HfTaskFlow { mixedTPCTPCCh.setObject(new CorrelationContainer("mixedEventTPCTPCChHadrons", "mixedEventTPCTPCChHadrons", corrAxis, effAxis, {})); mixedHF.setObject(new CorrelationContainer("mixedEventHFHadrons", "mixedEventHFHadrons", corrAxis, effAxis, userAxis)); mixedMFT.setObject(new CorrelationContainer("mixedEventTPCMFTChHadrons", "mixedEventTPCMFTChHadrons", corrAxis, effAxis, {})); - sameTPCTPCChmc.setObject(new CorrelationContainer("sameEventTPCTPCChHadronsMC", "sameEventTPCTPCChHadronsMC", corrAxis, effAxis, {})); - mixedTPCTPCChmc.setObject(new CorrelationContainer("mixedEventTPCTPCChHadronsMC", "mixedEventTPCTPCChHadronsMC", corrAxis, effAxis, {})); - } + } // --------------- // templates @@ -394,7 +387,7 @@ struct HfTaskFlow { } for (const auto& track2 : tracks2) { - +f // case of h-h correlations where the two types of tracks are the same // this avoids autocorrelations and double counting of particle pairs if constexpr (std::is_same_v) { @@ -439,14 +432,13 @@ struct HfTaskFlow { } } - template - void mixCollisions(TMyCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + template + void mixCollisions(MyCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) { - // STUCK HERE, HOW TO DECLARE aod::collision::PosZ for both normal particles and MC ? using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { From b43e177d991d4918184ef60c0eac77c149d9112f Mon Sep 17 00:00:00 2001 From: AlexianL Date: Tue, 14 May 2024 15:17:56 +0200 Subject: [PATCH 5/9] PWGHF : taskFlow.cxx -> adding mixed-event process function for h-MFT case --- PWGHF/HFC/Tasks/taskFlow.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 8f4f5c153b2..d402f8f45c9 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -204,7 +204,7 @@ struct HfTaskFlow { mixedTPCTPCCh.setObject(new CorrelationContainer("mixedEventTPCTPCChHadrons", "mixedEventTPCTPCChHadrons", corrAxis, effAxis, {})); mixedHF.setObject(new CorrelationContainer("mixedEventHFHadrons", "mixedEventHFHadrons", corrAxis, effAxis, userAxis)); mixedMFT.setObject(new CorrelationContainer("mixedEventTPCMFTChHadrons", "mixedEventTPCMFTChHadrons", corrAxis, effAxis, {})); - } + } // --------------- // templates @@ -387,7 +387,7 @@ struct HfTaskFlow { } for (const auto& track2 : tracks2) { -f + // case of h-h correlations where the two types of tracks are the same // this avoids autocorrelations and double counting of particle pairs if constexpr (std::is_same_v) { From 2a23c6be3088d42f2488be8c35feb3047a4d1162 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Thu, 16 May 2024 10:44:00 +0200 Subject: [PATCH 6/9] PWGHF : taskFlow.cxx -> adding mixed-event process function for h-MFT case --- PWGHF/HFC/Tasks/taskFlow.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index d402f8f45c9..2091e595303 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -17,7 +17,6 @@ #include #include - #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPObject.h" #include "Framework/AnalysisDataModel.h" @@ -71,7 +70,6 @@ struct HfTaskFlow { using MyTracks = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; - // Collision filters // FIXME: The filter is applied also on the candidates! Beware! Filter collisionVtxZFilter = nabs(aod::collision::posZ) < zVertexMax; @@ -83,7 +81,6 @@ struct HfTaskFlow { // TODO: use Partition instead of filter Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Preslice perCol = aod::track::collisionId; // configurables for containers @@ -423,7 +420,7 @@ struct HfTaskFlow { eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); } else { - + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); @@ -439,7 +436,6 @@ struct HfTaskFlow { BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; - for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -576,8 +572,8 @@ struct HfTaskFlow { // process mixed event correlations: h-MFT case // ===================================== void processMixedTpcMftHH(MyCollisions const& collisions, - MyTracks const& tracks, - aod::MFTTracks const& mfttracks) + MyTracks const& tracks, + aod::MFTTracks const& mfttracks) { // we want to group collisions based on charged-track multiplicity auto getTracksSize = [&tracks, this](MyCollisions::iterator const& col) { From 4456cdf6cf28798b2e20e7da865f771917170166 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Thu, 23 May 2024 10:23:17 +0200 Subject: [PATCH 7/9] Correct a mistake in the Mixed Event process function for h-MFT, also changed the organization of the AnalysisResults root file --- PWGHF/HFC/Tasks/taskFlow.cxx | 192 +++++++++++++++++------------------ 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 2091e595303..d3c0a9a3c24 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -114,74 +114,74 @@ struct HfTaskFlow { { // EVENT HISTOGRAMS constexpr int kNBinsEvents = 3; - registry.add("hEventCounter", "hEventCounter", {HistType::kTH1F, {{kNBinsEvents, 0.5, 0.5 + kNBinsEvents}}}); + registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1F, {{kNBinsEvents, 0.5, 0.5 + kNBinsEvents}}}); // set axes of the event counter histogram std::string labels[kNBinsEvents]; labels[0] = "all"; labels[1] = "after trigger selection (Run 2)"; labels[2] = "after Physics selection"; for (int iBin = 0; iBin < kNBinsEvents; iBin++) { - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - registry.add("hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); - registry.add("hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); + registry.add("Data/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); // histograms for event mixing const int maxMixBin = axisMultiplicity->size() * 14; // 14 bins for z-vertex - registry.add("hEventCountMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("hEventCountHFMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("hEventCountSame", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); - registry.add("hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("hMultiplicityHFMixing", "hMultiplicityHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("hVtxZHFMixing", "hVtxZHFMixing", {HistType::kTH1F, {{100, -10, 10}}}); - registry.add("hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); + registry.add("Data/HadronHf/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); + registry.add("Data/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); + registry.add("Data/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHf/MixedEvent/hMultiplicityHFMixing", "hMultiplicityHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/HadronHf/MixedEvent/hVtxZHFMixing", "hVtxZHFMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/HadronHf/MixedEvent/hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); // TRACK HISTOGRAMS // histograms for associated particles - registry.add("hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); // histograms for particles in event mixing - registry.add("hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); // histograms for MFT tracks - registry.add("hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronMft/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronMft/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/HadronMft/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); // histograms for candidates auto vbins = (std::vector)binsPt; - registry.add("hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/HadronHf/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/HadronHf/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/HadronHf/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/HadronHf/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); // histograms for candidates in event mixing - registry.add("hPtHFMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("hEtaHFMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("hPhiHFMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/HadronHf/MixedEvent/hPtHFMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/HadronHf/MixedEvent/hEtaHFMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/HadronHf/MixedEvent/hPhiHFMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); // set axes of the correlation container std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, @@ -213,7 +213,7 @@ struct HfTaskFlow { if (processRun2 == true) { // Run 2: trigger selection for data case if (fillHistograms) - registry.fill(HIST("hEventCounter"), 1); + registry.fill(HIST("Data/hEventCounter"), 1); if (!processMc) { if (!collision.alias_bit(kINT7)) { return false; @@ -221,21 +221,21 @@ struct HfTaskFlow { } // Run 2: further offline selection if (fillHistograms) - registry.fill(HIST("hEventCounter"), 2); + registry.fill(HIST("Data/hEventCounter"), 2); if (!collision.sel7()) { return false; } if (fillHistograms) - registry.fill(HIST("hEventCounter"), 3); + registry.fill(HIST("Data/hEventCounter"), 3); } else { // Run 3: selection if (fillHistograms) - registry.fill(HIST("hEventCounter"), 1); + registry.fill(HIST("Data/hEventCounter"), 1); if (!collision.sel8()) { return false; } if (fillHistograms) - registry.fill(HIST("hEventCounter"), 3); + registry.fill(HIST("Data/hEventCounter"), 3); } return true; } @@ -246,56 +246,56 @@ struct HfTaskFlow { int Ntracks = 0; for (const auto& track1 : tracks) { Ntracks++; - registry.fill(HIST("hPt"), track1.pt()); - registry.fill(HIST("hEta"), track1.eta()); - registry.fill(HIST("hPhi"), track1.phi()); - registry.fill(HIST("hYields"), multiplicity, track1.pt(), track1.eta()); - registry.fill(HIST("hEtaPhi"), multiplicity, track1.eta(), track1.phi()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hPt"), track1.pt()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hEta"), track1.eta()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hPhi"), track1.phi()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); } - registry.fill(HIST("hNtracks"), Ntracks); + registry.fill(HIST("Data/HadronHadron/SameEvent/hNtracks"), Ntracks); } template void fillMixingQA(float multiplicity, float vz, TTracks const& tracks) { - registry.fill(HIST("hMultiplicityMixing"), multiplicity); - registry.fill(HIST("hVtxZMixing"), vz); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hVtxZMixing"), vz); int Ntracks = 0; for (const auto& track1 : tracks) { Ntracks++; - registry.fill(HIST("hPtMixing"), track1.pt()); - registry.fill(HIST("hEtaMixing"), track1.eta()); - registry.fill(HIST("hPhiMixing"), track1.phi()); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); } - registry.fill(HIST("hNtracksMixing"), Ntracks); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hNtracksMixing"), Ntracks); } template void fillHFMixingQA(float multiplicity, float vz, TTracks const& tracks) { - registry.fill(HIST("hMultiplicityHFMixing"), multiplicity); - registry.fill(HIST("hVtxZHFMixing"), vz); + registry.fill(HIST("Data/HadronHf/MixedEvent/hMultiplicityHFMixing"), multiplicity); + registry.fill(HIST("Data/HadronHf/MixedEvent/hVtxZHFMixing"), vz); int Ntracks = 0; for (const auto& track1 : tracks) { Ntracks++; - registry.fill(HIST("hPtHFMixing"), track1.pt()); - registry.fill(HIST("hEtaHFMixing"), track1.eta()); - registry.fill(HIST("hPhiHFMixing"), track1.phi()); + registry.fill(HIST("Data/HadronHf/MixedEvent/hPtHFMixing"), track1.pt()); + registry.fill(HIST("Data/HadronHf/MixedEvent/hEtaHFMixing"), track1.eta()); + registry.fill(HIST("Data/HadronHf/MixedEvent/hPhiHFMixing"), track1.phi()); } - registry.fill(HIST("hNtracksHFMixing"), Ntracks); + registry.fill(HIST("Data/HadronHf/MixedEvent/hNtracksHFMixing"), Ntracks); } template void fillMFTQA(float multiplicity, TTracks const& tracks) { for (const auto& track1 : tracks) { - registry.fill(HIST("hEtaMFT"), track1.eta()); + registry.fill(HIST("Data/HadronMft/hEtaMFT"), track1.eta()); float phi = track1.phi(); o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("hPhiMFT"), phi); - registry.fill(HIST("hEtaPhiMFT"), multiplicity, track1.eta(), phi); + registry.fill(HIST("Data/HadronMft/hPhiMFT"), phi); + registry.fill(HIST("Data/HadronMft/hEtaPhiMFT"), multiplicity, track1.eta(), phi); } } @@ -322,29 +322,29 @@ struct HfTaskFlow { } if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); } - registry.fill(HIST("hPtCand"), candidate.pt()); - registry.fill(HIST("hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("hDecLength"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("hd0Prong0"), candidate.impactParameter0(), candidate.pt()); - registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("hd0d0"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); - registry.fill(HIST("hCt"), hfHelper.ctD0(candidate), candidate.pt()); - registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt()); - registry.fill(HIST("hEtaCand"), candidate.eta(), candidate.pt()); - registry.fill(HIST("hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); - registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); - registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); - registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); - registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hPtCand"), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("Data/HadronHf/hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("Data/HadronHf/hDecLength"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hCt"), hfHelper.ctD0(candidate), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hEtaCand"), candidate.eta(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("Data/HadronHf/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); } } @@ -453,10 +453,10 @@ struct HfTaskFlow { const auto vz = collision1.posZ(); if constexpr (std::is_same_v) { - registry.fill(HIST("hEventCountHFMixing"), bin); + registry.fill(HIST("Data/HadronHf/MixedEvent/hEventCountHFMixing"), bin); fillHFMixingQA(multiplicity, vz, tracks1); } else { - registry.fill(HIST("hEventCountMixing"), bin); + registry.fill(HIST("Data/HadronHadron/MixedEvent/hEventCountMixing"), bin); fillMixingQA(multiplicity, vz, tracks1); } @@ -481,12 +481,12 @@ struct HfTaskFlow { // temporary solution, since other correlation options always have to be ran with h-h, too // TODO: rewrite it in a more intelligent way const auto multiplicity = tracks.size(); - registry.fill(HIST("hMultiplicity"), multiplicity); - registry.fill(HIST("hVtxZ"), collision.posZ()); + registry.fill(HIST("Data/HadronHadron/SameEvent/hMultiplicity"), multiplicity); + registry.fill(HIST("Data/HadronHadron/SameEvent/hVtxZ"), collision.posZ()); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("hEventCountSame"), bin); + registry.fill(HIST("Data/HadronHadron/SameEvent/hEventCountSame"), bin); sameTPCTPCCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); @@ -582,7 +582,7 @@ struct HfTaskFlow { return size; }; - mixCollisions(collisions, mfttracks, tracks, getTracksSize, mixedMFT); + mixCollisions(collisions, tracks, mfttracks, getTracksSize, mixedMFT); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHH, "Process mixed-event correlations for h-MFT case", true); }; // End of struct From adbc73b26faaa2ae9f0572632b5395ec55f18527 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Thu, 30 May 2024 13:21:14 +0200 Subject: [PATCH 8/9] Replaced MyCollisions and MyTracks by more comprehensive variable names --- PWGHF/HFC/Tasks/taskFlow.cxx | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index d3c0a9a3c24..72063f28d09 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -66,8 +66,8 @@ struct HfTaskFlow { HfHelper hfHelper; SliceCache cache; - using MyCollisions = soa::Filtered>; - using MyTracks = soa::Filtered>; + using FilteredCollisionsWSelMult = soa::Filtered>; + using TracksWDcaSel = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; // Collision filters @@ -430,12 +430,12 @@ struct HfTaskFlow { } template - void mixCollisions(MyCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) { using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -468,8 +468,8 @@ struct HfTaskFlow { // ===================================== // process same event correlations: h-h case // ===================================== - void processSameTpcTpcHH(MyCollisions::iterator const& collision, - MyTracks const& tracks) + void processSameTpcTpcHH(FilteredCollisionsWSelMult::iterator const& collision, + TracksWDcaSel const& tracks) { if (!(isCollisionSelected(collision, true))) { return; @@ -498,8 +498,8 @@ struct HfTaskFlow { // ===================================== // process same event correlations: HF-h case // ===================================== - void processSameHfHadrons(MyCollisions::iterator const& collision, - MyTracks const& tracks, + void processSameHfHadrons(FilteredCollisionsWSelMult::iterator const& collision, + TracksWDcaSel const& tracks, HfCandidatesSel const& candidates) { if (!(isCollisionSelected(collision, true))) { @@ -517,8 +517,8 @@ struct HfTaskFlow { // ===================================== // process same event correlations: h-MFT case // ===================================== - void processSameTpcMftHH(MyCollisions::iterator const& collision, - MyTracks const& tracks, + void processSameTpcMftHH(FilteredCollisionsWSelMult::iterator const& collision, + TracksWDcaSel const& tracks, aod::MFTTracks const& mfttracks) { if (!(isCollisionSelected(collision, true))) { @@ -536,11 +536,11 @@ struct HfTaskFlow { // ===================================== // process mixed event correlations: h-h case // ===================================== - void processMixedTpcTpcHH(MyCollisions const& collisions, - MyTracks const& tracks) + void processMixedTpcTpcHH(FilteredCollisionsWSelMult const& collisions, + TracksWDcaSel const& tracks) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](MyCollisions::iterator const& col) { + auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once auto size = associatedTracks.size(); return size; @@ -553,12 +553,12 @@ struct HfTaskFlow { // ===================================== // process mixed event correlations: h-HF case // ===================================== - void processMixedHfHadrons(MyCollisions const& collisions, - MyTracks const& tracks, + void processMixedHfHadrons(FilteredCollisionsWSelMult const& collisions, + TracksWDcaSel const& tracks, HfCandidatesSel const& candidates) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](MyCollisions::iterator const& col) { + auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); auto size = associatedTracks.size(); return size; @@ -571,12 +571,12 @@ struct HfTaskFlow { // ===================================== // process mixed event correlations: h-MFT case // ===================================== - void processMixedTpcMftHH(MyCollisions const& collisions, - MyTracks const& tracks, + void processMixedTpcMftHH(FilteredCollisionsWSelMult const& collisions, + TracksWDcaSel const& tracks, aod::MFTTracks const& mfttracks) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](MyCollisions::iterator const& col) { + auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); auto size = associatedTracks.size(); return size; @@ -590,4 +590,4 @@ struct HfTaskFlow { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} +} \ No newline at end of file From 6fd4d70b5b3c8c20bbd33502bb544ecd792e4db9 Mon Sep 17 00:00:00 2001 From: AlexianL Date: Fri, 31 May 2024 08:41:04 +0200 Subject: [PATCH 9/9] Attempt to fix megalinter issue by adding an empty line at the end of the file --- PWGHF/HFC/Tasks/taskFlow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 72063f28d09..2053295e740 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -590,4 +590,4 @@ struct HfTaskFlow { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +}