|
| 1 | +// Copyright 2019-2026 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// \file femtoPairD0D0.cxx |
| 13 | +/// \brief Tasks that computes correlation between two D0 mesons |
| 14 | +/// \author Igor Ptak, WUT, igor.tomasz.ptak@cern.ch |
| 15 | + |
| 16 | +#include "PWGCF/Femto/Core/charmHadronBuilder.h" |
| 17 | +#include "PWGCF/Femto/Core/charmHadronHistManager.h" |
| 18 | +#include "PWGCF/Femto/Core/closePairRejection.h" |
| 19 | +#include "PWGCF/Femto/Core/collisionBuilder.h" |
| 20 | +#include "PWGCF/Femto/Core/collisionHistManager.h" |
| 21 | +#include "PWGCF/Femto/Core/modes.h" |
| 22 | +#include "PWGCF/Femto/Core/pairBuilder.h" |
| 23 | +#include "PWGCF/Femto/Core/pairHistManager.h" |
| 24 | +#include "PWGCF/Femto/Core/particleCleaner.h" |
| 25 | +#include "PWGCF/Femto/Core/partitions.h" |
| 26 | +#include "PWGCF/Femto/Core/trackHistManager.h" |
| 27 | +#include "PWGCF/Femto/DataModel/FemtoTables.h" |
| 28 | + |
| 29 | +#include <Framework/ASoA.h> |
| 30 | +#include <Framework/AnalysisHelpers.h> |
| 31 | +#include <Framework/AnalysisTask.h> |
| 32 | +#include <Framework/BinningPolicy.h> |
| 33 | +#include <Framework/Configurable.h> |
| 34 | +#include <Framework/Expressions.h> |
| 35 | +#include <Framework/HistogramRegistry.h> |
| 36 | +#include <Framework/HistogramSpec.h> |
| 37 | +#include <Framework/InitContext.h> |
| 38 | +#include <Framework/OutputObjHeader.h> |
| 39 | +#include <Framework/runDataProcessing.h> |
| 40 | + |
| 41 | +#include <map> |
| 42 | +#include <vector> |
| 43 | + |
| 44 | +using namespace o2::analysis::femto; |
| 45 | + |
| 46 | +// Each pair slot (1 and 2) has its own selection, cleaner, binning and partition. |
| 47 | +// The sign of the selection picks the decay hypothesis: |
| 48 | +// d0-d0 : D0Selection1.sign = +1, D0Selection2.sign = +1, Mixing.sameSpecies = true |
| 49 | +// d0bar-d0bar : D0Selection1.sign = -1, D0Selection2.sign = -1, Mixing.sameSpecies = true |
| 50 | +// d0-d0bar : D0Selection1.sign = +1, D0Selection2.sign = -1, Mixing.sameSpecies = false |
| 51 | +struct FemtoPairD0D0 { |
| 52 | + |
| 53 | + // setup tables |
| 54 | + using FemtoCollisions = o2::soa::Join<o2::aod::FCols, o2::aod::FColMasks>; |
| 55 | + using FilteredFemtoCollisions = o2::soa::Filtered<FemtoCollisions>; |
| 56 | + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; |
| 57 | + |
| 58 | + using FemtoCollisionsWithLabel = o2::soa::Join<FemtoCollisions, o2::aod::FColLabels>; |
| 59 | + using FilteredFemtoCollisionsWithLabel = o2::soa::Filtered<FemtoCollisionsWithLabel>; |
| 60 | + using FilteredFemtoCollisionWithLabel = FilteredFemtoCollisionsWithLabel::iterator; |
| 61 | + |
| 62 | + using FemtoTracks = o2::aod::FTracks; |
| 63 | + using FemtoD0s = o2::soa::Join<o2::aod::FD0s, o2::aod::FD0Masks>; |
| 64 | + |
| 65 | + using FemtoTracksWithLabel = o2::soa::Join<FemtoTracks, o2::aod::FTrackLabels>; |
| 66 | + using FemtoD0sWithLabel = o2::soa::Join<FemtoD0s, o2::aod::FD0Labels>; |
| 67 | + |
| 68 | + using FemtoMcParticlesWithLabel = o2::soa::Join<o2::aod::FMcParticles, o2::aod::FMcMotherLabels>; |
| 69 | + |
| 70 | + o2::framework::SliceCache cache; |
| 71 | + |
| 72 | + // setup collisions |
| 73 | + collisionbuilder::ConfCollisionSelection collisionSelection; |
| 74 | + o2::framework::expressions::Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); |
| 75 | + colhistmanager::ConfCollisionBinning confCollisionBinning; |
| 76 | + |
| 77 | + // setup for daughters |
| 78 | + // separate binning per d0 slot, so that both hypotheses can be binned independently |
| 79 | + trackhistmanager::ConfD01PosDauBinning confD01PosDauBinning; |
| 80 | + trackhistmanager::ConfD01NegDauBinning confD01NegDauBinning; |
| 81 | + trackhistmanager::ConfD02PosDauBinning confD02PosDauBinning; |
| 82 | + trackhistmanager::ConfD02NegDauBinning confD02NegDauBinning; |
| 83 | + |
| 84 | + // setup d0s |
| 85 | + charmhadronbuilder::ConfD0Selection1 confD0Selection1; |
| 86 | + charmhadronbuilder::ConfD0Selection2 confD0Selection2; |
| 87 | + particlecleaner::ConfD0Cleaner1 confD0Cleaner1; |
| 88 | + particlecleaner::ConfD0Cleaner2 confD0Cleaner2; |
| 89 | + charmhadronhistmanager::ConfD0Binning1 confD0Binning1; |
| 90 | + charmhadronhistmanager::ConfD0Binning2 confD0Binning2; |
| 91 | + |
| 92 | + o2::framework::Partition<FemtoD0s> d0Partition1 = MAKE_D0_PARTITION(confD0Selection1); |
| 93 | + o2::framework::Partition<FemtoD0s> d0Partition2 = MAKE_D0_PARTITION(confD0Selection2); |
| 94 | + o2::framework::Preslice<FemtoD0s> perColD0s = o2::aod::femtobase::stored::fColId; |
| 95 | + |
| 96 | + o2::framework::Partition<FemtoD0sWithLabel> d0WithLabelPartition1 = MAKE_D0_PARTITION(confD0Selection1); |
| 97 | + o2::framework::Partition<FemtoD0sWithLabel> d0WithLabelPartition2 = MAKE_D0_PARTITION(confD0Selection2); |
| 98 | + o2::framework::Preslice<FemtoD0sWithLabel> perColD0sWithLabel = o2::aod::femtobase::stored::fColId; |
| 99 | + |
| 100 | + // setup pairs |
| 101 | + pairhistmanager::ConfPairBinning confPairBinning; |
| 102 | + pairhistmanager::ConfPairCuts confPairCuts; |
| 103 | + |
| 104 | + pairbuilder::PairD0D0Builder< |
| 105 | + charmhadronhistmanager::PrefixD01, |
| 106 | + trackhistmanager::PrefixD01PosDaughter, |
| 107 | + trackhistmanager::PrefixD01NegDaughter, |
| 108 | + charmhadronhistmanager::PrefixD02, |
| 109 | + trackhistmanager::PrefixD02PosDaughter, |
| 110 | + trackhistmanager::PrefixD02NegDaughter, |
| 111 | + pairhistmanager::PrefixD0D0Se, |
| 112 | + pairhistmanager::PrefixD0D0Me, |
| 113 | + closepairrejection::PrefixD0D0PosSe, |
| 114 | + closepairrejection::PrefixD0D0NegSe, |
| 115 | + closepairrejection::PrefixD0D0PosMe, |
| 116 | + closepairrejection::PrefixD0D0NegMe, |
| 117 | + modes::CharmHadron::kD0, |
| 118 | + modes::CharmHadron::kD0> |
| 119 | + pairD0D0Builder; |
| 120 | + |
| 121 | + // setup mixing |
| 122 | + std::vector<double> defaultVtxBins{10, -10, 10}; |
| 123 | + std::vector<double> defaultMultBins{50, 0, 200}; |
| 124 | + std::vector<double> defaultCentBins{10, 0, 100}; |
| 125 | + o2::framework::ColumnBinningPolicy<o2::aod::femtocollisions::PosZ, o2::aod::femtocollisions::Mult> mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; |
| 126 | + o2::framework::ColumnBinningPolicy<o2::aod::femtocollisions::PosZ, o2::aod::femtocollisions::Cent> mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; |
| 127 | + o2::framework::ColumnBinningPolicy<o2::aod::femtocollisions::PosZ, o2::aod::femtocollisions::Mult, o2::aod::femtocollisions::Cent> mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; |
| 128 | + pairhistmanager::ConfMixing confMixing; |
| 129 | + |
| 130 | + o2::framework::HistogramRegistry hRegistry{"FemtoD0D0", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject}; |
| 131 | + |
| 132 | + // setup cpr |
| 133 | + closepairrejection::ConfCprD0DaugherD0DaughterPos confCprPos; |
| 134 | + closepairrejection::ConfCprD0DaugherD0DaughterNeg confCprNeg; |
| 135 | + |
| 136 | + void init(o2::framework::InitContext&) |
| 137 | + { |
| 138 | + bool processData = doprocessSameEvent || doprocessMixedEvent; |
| 139 | + bool processMc = doprocessSameEventMc || doprocessMixedEventMc; |
| 140 | + |
| 141 | + if (processData && processMc) { |
| 142 | + LOG(fatal) << "Both data and mc processing is enabled. Breaking..."; |
| 143 | + } |
| 144 | + if (!processData && !processMc) { |
| 145 | + LOG(fatal) << "Neither data nor mc processing is enabled. Breaking..."; |
| 146 | + } |
| 147 | + |
| 148 | + // setup columnpolicy for binning |
| 149 | + // default values are used during instantiation, so we need to explicity update them here |
| 150 | + mixBinsVtxMult = {{confMixing.vtxBins.value, confMixing.multBins.value}, true}; |
| 151 | + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; |
| 152 | + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; |
| 153 | + |
| 154 | + // setup histograms |
| 155 | + std::map<colhistmanager::ColHist, std::vector<o2::framework::AxisSpec>> colHistSpec; |
| 156 | + std::map<trackhistmanager::TrackHist, std::vector<o2::framework::AxisSpec>> posDauSpec1; |
| 157 | + std::map<trackhistmanager::TrackHist, std::vector<o2::framework::AxisSpec>> negDauSpec1; |
| 158 | + std::map<trackhistmanager::TrackHist, std::vector<o2::framework::AxisSpec>> posDauSpec2; |
| 159 | + std::map<trackhistmanager::TrackHist, std::vector<o2::framework::AxisSpec>> negDauSpec2; |
| 160 | + std::map<charmhadronhistmanager::CharmHadronHist, std::vector<o2::framework::AxisSpec>> d0HistSpec1; |
| 161 | + std::map<charmhadronhistmanager::CharmHadronHist, std::vector<o2::framework::AxisSpec>> d0HistSpec2; |
| 162 | + std::map<pairhistmanager::PairHist, std::vector<o2::framework::AxisSpec>> pairD0D0HistSpec; |
| 163 | + std::map<closepairrejection::CprHist, std::vector<o2::framework::AxisSpec>> cprHistSpecPos = closepairrejection::makeCprHistSpecMap(confCprPos); |
| 164 | + std::map<closepairrejection::CprHist, std::vector<o2::framework::AxisSpec>> cprHistSpecNeg = closepairrejection::makeCprHistSpecMap(confCprNeg); |
| 165 | + |
| 166 | + if (processData) { |
| 167 | + colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); |
| 168 | + posDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confD01PosDauBinning); |
| 169 | + negDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confD01NegDauBinning); |
| 170 | + posDauSpec2 = trackhistmanager::makeTrackHistSpecMap(confD02PosDauBinning); |
| 171 | + negDauSpec2 = trackhistmanager::makeTrackHistSpecMap(confD02NegDauBinning); |
| 172 | + d0HistSpec1 = charmhadronhistmanager::makeD0HistSpecMap(confD0Binning1); |
| 173 | + d0HistSpec2 = charmhadronhistmanager::makeD0HistSpecMap(confD0Binning2); |
| 174 | + pairD0D0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confMixing); |
| 175 | + pairD0D0Builder.init<modes::Mode::kSe_Reco, modes::Mode::kMe_Reco>(&hRegistry, confCollisionBinning, confD0Selection1, confD0Selection2, confD0Cleaner1, confD0Cleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, d0HistSpec1, d0HistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairD0D0HistSpec, cprHistSpecPos, cprHistSpecNeg); |
| 176 | + } else { |
| 177 | + colHistSpec = colhistmanager::makeColMcHistSpecMap(confCollisionBinning); |
| 178 | + posDauSpec1 = trackhistmanager::makeTrackMcHistSpecMap(confD01PosDauBinning); |
| 179 | + negDauSpec1 = trackhistmanager::makeTrackMcHistSpecMap(confD01NegDauBinning); |
| 180 | + posDauSpec2 = trackhistmanager::makeTrackMcHistSpecMap(confD02PosDauBinning); |
| 181 | + negDauSpec2 = trackhistmanager::makeTrackMcHistSpecMap(confD02NegDauBinning); |
| 182 | + d0HistSpec1 = charmhadronhistmanager::makeD0McHistSpecMap(confD0Binning1); |
| 183 | + d0HistSpec2 = charmhadronhistmanager::makeD0McHistSpecMap(confD0Binning2); |
| 184 | + pairD0D0HistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning, confMixing); |
| 185 | + pairD0D0Builder.init<modes::Mode::kSe_Reco_Mc, modes::Mode::kMe_Reco_Mc>(&hRegistry, confCollisionBinning, confD0Selection1, confD0Selection2, confD0Cleaner1, confD0Cleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, d0HistSpec1, d0HistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairD0D0HistSpec, cprHistSpecPos, cprHistSpecNeg); |
| 186 | + } |
| 187 | + } |
| 188 | + |
| 189 | + void processSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoD0s const& d0s) |
| 190 | + { |
| 191 | + pairD0D0Builder.processSameEvent<modes::Mode::kSe_Reco>(col, tracks, d0s, d0Partition1, d0Partition2, cache); |
| 192 | + } |
| 193 | + PROCESS_SWITCH(FemtoPairD0D0, processSameEvent, "Enable processing same event processing for d0-d0", true); |
| 194 | + |
| 195 | + void processSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoD0sWithLabel const& d0s, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) |
| 196 | + { |
| 197 | + pairD0D0Builder.processSameEvent<modes::Mode::kSe_Reco_Mc>(col, mcCols, tracks, d0s, d0WithLabelPartition1, d0WithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); |
| 198 | + } |
| 199 | + PROCESS_SWITCH(FemtoPairD0D0, processSameEventMc, "Enable processing same event processing for d0-d0 with mc information", false); |
| 200 | + |
| 201 | + void processMixedEvent(FilteredFemtoCollisions const& cols, FemtoTracks const& tracks, FemtoD0s const& /*d0s*/) |
| 202 | + { |
| 203 | + pairD0D0Builder.processMixedEvent<modes::Mode::kMe_Reco>(cols, tracks, d0Partition1, d0Partition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); |
| 204 | + } |
| 205 | + PROCESS_SWITCH(FemtoPairD0D0, processMixedEvent, "Enable processing mixed event processing for d0-d0", true); |
| 206 | + |
| 207 | + void processMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoD0sWithLabel const& /*d0s*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) |
| 208 | + { |
| 209 | + pairD0D0Builder.processMixedEvent<modes::Mode::kMe_Reco_Mc>(cols, mcCols, tracks, d0WithLabelPartition1, d0WithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); |
| 210 | + } |
| 211 | + PROCESS_SWITCH(FemtoPairD0D0, processMixedEventMc, "Enable processing mixed event processing for d0-d0 with mc information", false); |
| 212 | +}; |
| 213 | + |
| 214 | +o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) |
| 215 | +{ |
| 216 | + o2::framework::WorkflowSpec workflow{ |
| 217 | + adaptAnalysisTask<FemtoPairD0D0>(context), |
| 218 | + }; |
| 219 | + return workflow; |
| 220 | +} |
0 commit comments