Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions PWGCF/Femto/Core/cascadeHistManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class CascadeHistManager
mPosDauManager.template init<mode>(registry, PosDauSpecs, absCharge, signPlus, posDauPdgCodeAbs);
mNegDauManager.template init<mode>(registry, NegDauSpecs, absCharge, signMinus, negDauPdgCodeAbs);

if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (modes::isFlagSet(mode, modes::Mode::kReco)) {
initAnalysis(cascadeSpecs);
}
if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) {
Expand Down Expand Up @@ -397,7 +397,7 @@ class CascadeHistManager
mPosDauManager.template init<mode>(registry, PosDauSpecs, absCharge, signPlus, posDauPdgCodeAbs, ConfPosDauQaBinning);
mNegDauManager.template init<mode>(registry, NegDauSpecs, absCharge, signMinus, negDauPdgCodeAbs, ConfNegDauQaBinning);

if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (modes::isFlagSet(mode, modes::Mode::kReco)) {
initAnalysis(cascadeSpecs);
}
if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) {
Expand All @@ -418,7 +418,7 @@ class CascadeHistManager
auto bachelor = tracks.rawIteratorAt(cascadeCandidate.bachelorId() - tracks.offset());
mBachelorManager.template fill<mode>(bachelor, tracks);

if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (modes::isFlagSet(mode, modes::Mode::kReco)) {
fillAnalysis(cascadeCandidate);
}
if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) {
Expand All @@ -436,7 +436,7 @@ class CascadeHistManager
auto bachelor = tracks.rawIteratorAt(cascadeCandidate.bachelorId() - tracks.offset());
mBachelorManager.template fill<mode>(bachelor, tracks, mcParticles, mcMothers, mcPartonicMothers);

if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (modes::isFlagSet(mode, modes::Mode::kReco)) {
this->fillAnalysis(cascadeCandidate);
}
if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) {
Expand Down
29 changes: 28 additions & 1 deletion PWGCF/Femto/Core/closePairRejection.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ConfCpr : o2::framework::ConfigurableGroup {
o2::framework::ConfigurableAxis binningCorrelationPhi{"binningCorrelationPhi", {{720, 0, o2::constants::math::TwoPI}}, "Phi binning for correlation plot"};
o2::framework::ConfigurableAxis binningCorrelationEta{"binningCorrelationEta", {{160, -0.8, 0.8}}, "Eta binning for correlation plot"};
o2::framework::Configurable<int> seed{"seed", -1, "Seed to randomize particle 1 and particle 2. Set to negative value to deactivate. Set to 0 to generate unique seed in time."};
o2::framework::Configurable<float> magField{"magField", 5, "MC ONLY: In case of pure MC processing (no reconstruction), set magnetic field in kG"};
};

constexpr const char PrefixCprTrackTrack[] = "CprTrackTrack";
Expand Down Expand Up @@ -126,6 +127,8 @@ constexpr char PrefixTrackCascadeBachelorSe[] = "CPR_TrackCascadeBachelor/SE/";
constexpr char PrefixTrackCascadeBachelorMe[] = "CPR_TrackCascadeBachelor/ME/";
constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/";
constexpr char PrefixTrackKinkMe[] = "CPR_TrackKink/ME/";
constexpr char PrefixMcParticleMcParticleSe[] = "CPR_McParticleMcParticle/SE/";
constexpr char PrefixMcParticleMcParticleMe[] = "CPR_McParticleMcParticle/ME/";

// must be in sync with enum TrackVariables
// the enum gives the correct index in the array
Expand Down Expand Up @@ -434,7 +437,7 @@ class ClosePairRejectionTrackTrack

void setMagField(float magField) { mCtr.setMagField(magField); }
template <typename T1, typename T2, typename T3>
void setPair(T1 const& track1, T2 const& track2, T3 const& /*tracks*/)
void setPair(T1 const& track1, T2 const& track2, T3 const& /*tracks*/) // pass track table for compatibility with other classes
{
mCtr.compute(track1, track2);
}
Expand Down Expand Up @@ -612,6 +615,30 @@ class ClosePairRejectionTrackKink
CloseTrackRejection<prefix> mCtr;
};

template <const char* prefix>
class ClosePairRejectionMcParticleMcParticle
{
public:
template <typename T>
void init(o2::framework::HistogramRegistry* registry,
std::map<CprHist, std::vector<o2::framework::AxisSpec>> const& specs,
T const& confCpr)
{
mCtr.init(registry, specs, confCpr, 1, 1);
mCtr.setMagField(confCpr.magField.value);
}
template <typename T1, typename T2>
void setPair(T1 const& mcParticle1, T2 const& mcParticle2)
{
mCtr.compute(mcParticle1, mcParticle2);
}
bool isClosePair() const { return mCtr.isClosePair(); }
void fill(float kstar) { mCtr.fill(kstar); }

private:
CloseTrackRejection<prefix> mCtr;
};

}; // namespace closepairrejection
}; // namespace o2::analysis::femto
#endif // PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_
1 change: 0 additions & 1 deletion PWGCF/Femto/Core/closeTripletRejection.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>

#include <cmath>
#include <map>
#include <vector>

Expand Down
71 changes: 57 additions & 14 deletions PWGCF/Femto/Core/collisionHistManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ enum ColHist {
kCentVsSphericity,
kMultVsSphericity,
// mc
kTruePosZVsPosZ,
kTrueCentVsCent,
kTrueMultVsMult,
kTruePosZ, // pure mc-truth, no reco collision (kMc without kReco)
kTrueCent, // pure mc-truth, no reco collision (kMc without kReco)
kTrueMult, // pure mc-truth, no reco collision (kMc without kReco)
kTruePosZVsPosZ, // reco-vs-truth correlation (kReco and kMc both set)
kTrueCentVsCent, // reco-vs-truth correlation (kReco and kMc both set)
kTrueMultVsMult, // reco-vs-truth correlation (kReco and kMc both set)
kColHistLast
};

Expand All @@ -81,6 +84,9 @@ constexpr std::array<histmanager::HistInfo<ColHist>, kColHistLast> HistTable = {
{kMultVsSphericity, o2::framework::HistType::kTH2F, "hMultVsSphericity", "Multiplicity vs Sphericity; Multiplicity; Sphericity"},
{kCentVsSphericity, o2::framework::HistType::kTH2F, "hCentVsSphericity", "Centrality vs Sphericity; Centrality (%); Sphericity"},
// mc
{kTruePosZ, o2::framework::HistType::kTH1F, "hTruePosZ", "True vertex Z (mc-truth collision); V_{Z,True} (cm); Entries"},
{kTrueCent, o2::framework::HistType::kTH1F, "hTrueCent", "True centrality (mc-truth collision); Centrality_{True} (%); Entries"},
{kTrueMult, o2::framework::HistType::kTH1F, "hTrueMult", "True multiplicity (mc-truth collision); Multiplicity_{True}; Entries"},
{kTruePosZVsPosZ, o2::framework::HistType::kTH2F, "hTruePosZVsPosZ", "True Vertex Z vs Vertex Z; V_{Z,True} (cm); V_{Z} (cm)"},
{kTrueCentVsCent, o2::framework::HistType::kTH2F, "hTrueCentVsCent", "True centrality vs centrality; Centrality_{True} (%); Centrality (%)"},
{kTrueMultVsMult, o2::framework::HistType::kTH2F, "hTrueMultVsMult", "True multiplicity vs multiplicity; Multiplicity_{True}; Multiplicity"},
Expand All @@ -105,7 +111,10 @@ constexpr std::array<histmanager::HistInfo<ColHist>, kColHistLast> HistTable = {
{kCentVsSphericity, {confBinningAnalysis.cent, confQa.sphericity}},

#define COL_HIST_MC_MAP(conf) \
{kTruePosZVsPosZ, {conf.vtxZ, conf.vtxZ}}, \
{kTruePosZ, {conf.vtxZ}}, \
{kTrueCent, {conf.cent}}, \
{kTrueMult, {conf.mult}}, \
{kTruePosZVsPosZ, {conf.vtxZ, conf.vtxZ}}, \
{kTrueCentVsCent, {conf.cent, conf.cent}}, \
{kTrueMultVsMult, {conf.mult, conf.mult}},

Expand Down Expand Up @@ -141,6 +150,10 @@ auto makeColMcQaHistSpecMap(const T1& confBinningAnalysis, const T2& confBinning
COL_HIST_MC_MAP(confBinningAnalysis)};
}

// pure mc-truth collision (no reco counterpart) uses kTruePosZ/kTrueCent/kTrueMult,
// which are already included in makeColMcHistSpecMap()/makeColMcQaHistSpecMap() above —
// no separate spec-map builder needed; just don't pass a reco collision to fill().

#undef COL_HIST_ANALYSIS_MAP
#undef COL_HIST_QA_MAP
#undef COL_HIST_MC_MAP
Expand All @@ -158,8 +171,8 @@ struct ConfCollisionQaBinning : o2::framework::ConfigurableGroup {
o2::framework::Configurable<bool> plot2d{"plot2d", true, "Enable 2d QA histograms"};
o2::framework::ConfigurableAxis vtx{"vtx", {120, 0.f, 12.f}, "Vertex position binning"};
o2::framework::ConfigurableAxis vtxXY{"vtxXY", {100, -1.f, 1.f}, "Vertex X/Y binning"};
o2::framework::ConfigurableAxis sphericity{"sphericity", {100, 0.f, 1.f}, "Spericity Binning"};
o2::framework::ConfigurableAxis occupancy{"occupancy", {500, 0.f, 5000.f}, "Spericity Binning"};
o2::framework::ConfigurableAxis sphericity{"sphericity", {100, 0.f, 1.f}, "Sphericity Binning"};
o2::framework::ConfigurableAxis occupancy{"occupancy", {500, 0.f, 5000.f}, "Occupancy Binning"};
};

class CollisionHistManager
Expand All @@ -174,15 +187,20 @@ class CollisionHistManager
T const& /*ConfCollisionBinning*/)
{
mHistogramRegistry = registry;
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
initAnalysis(Specs);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
initQa(Specs);
}
if constexpr (isFlagSet(mode, modes::Mode::kMc)) {
// reco-vs-truth correlation: requires BOTH a reco collision and mc info
if constexpr (isFlagSet(mode, modes::Mode::kReco) && isFlagSet(mode, modes::Mode::kMc)) {
initMc(Specs);
}
// pure mc-truth collision: requires mc info WITHOUT a reco collision
if constexpr (isFlagSet(mode, modes::Mode::kMc) && !isFlagSet(mode, modes::Mode::kReco)) {
initMcTruth(Specs);
}
}

template <typename T>
Expand All @@ -201,27 +219,32 @@ class CollisionHistManager
init<mode>(registry, Specs, ConfCollisionBinning);
}

// single-collision fill: reco-only, qa-only, or pure mc-truth (kMc without kReco)
template <modes::Mode mode, typename T>
void fill(T const& col)
{
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
fillAnalysis(col);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
fillQa(col);
}
if constexpr (isFlagSet(mode, modes::Mode::kMc) && !isFlagSet(mode, modes::Mode::kReco)) {
fillMc(col);
}
}

// two-argument fill: reco collision + its matched mc collision, for True-vs-Reco correlation
template <modes::Mode mode, typename T1, typename T2>
void fill(T1 const& col, T2 const& mcCols)
{
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
fillAnalysis(col);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
fillQa(col);
}
if constexpr (isFlagSet(mode, modes::Mode::kMc)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco) && isFlagSet(mode, modes::Mode::kMc)) {
fillMc(col, mcCols);
}
}
Expand Down Expand Up @@ -253,6 +276,7 @@ class CollisionHistManager
}
}

// reco-vs-truth correlation histograms (kReco and kMc both set)
void initMc(std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs)
{
std::string mcDir = std::string(McDir);
Expand All @@ -261,6 +285,15 @@ class CollisionHistManager
mHistogramRegistry->add(mcDir + getHistNameV2(kTrueMultVsMult, HistTable), getHistDesc(kTrueMultVsMult, HistTable), getHistType(kTrueMultVsMult, HistTable), {Specs.at(kTrueMultVsMult)});
}

// pure mc-truth collision: 1D only, no reco collision exists (kMc without kReco)
void initMcTruth(std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs)
{
std::string mcDir = std::string(McDir);
mHistogramRegistry->add(mcDir + getHistNameV2(kTruePosZ, HistTable), getHistDesc(kTruePosZ, HistTable), getHistType(kTruePosZ, HistTable), {Specs.at(kTruePosZ)});
mHistogramRegistry->add(mcDir + getHistNameV2(kTrueCent, HistTable), getHistDesc(kTrueCent, HistTable), getHistType(kTrueCent, HistTable), {Specs.at(kTrueCent)});
mHistogramRegistry->add(mcDir + getHistNameV2(kTrueMult, HistTable), getHistDesc(kTrueMult, HistTable), getHistType(kTrueMult, HistTable), {Specs.at(kTrueMult)});
}

template <typename T>
void fillAnalysis(T const& col)
{
Expand All @@ -287,6 +320,7 @@ class CollisionHistManager
}
}

// reco collision + matched mc collision: fill reco-vs-truth 2D correlations
template <typename T1, typename T2>
void fillMc(T1 const& col, T2 const& /*mcCols*/)
{
Expand All @@ -299,9 +333,18 @@ class CollisionHistManager
mHistogramRegistry->fill(HIST(McDir) + HIST(getHistName(kTrueMultVsMult, HistTable)), mcCol.mult(), col.mult());
}

// pure mc-truth collision: 'col' here IS the truth collision, no reco object exists
template <typename T>
void fillMc(T const& col)
{
mHistogramRegistry->fill(HIST(McDir) + HIST(getHistName(kTruePosZ, HistTable)), col.posZ());
mHistogramRegistry->fill(HIST(McDir) + HIST(getHistName(kTrueCent, HistTable)), col.cent());
mHistogramRegistry->fill(HIST(McDir) + HIST(getHistName(kTrueMult, HistTable)), col.mult());
}

o2::framework::HistogramRegistry* mHistogramRegistry = nullptr;
bool mPlot2d = false;
}; // namespace femtounitedcolhistmanager
}; // namespace colhistmanager
}; // namespace o2::analysis::femto
};
} // namespace colhistmanager
} // namespace o2::analysis::femto
#endif // PWGCF_FEMTO_CORE_COLLISIONHISTMANAGER_H_
8 changes: 4 additions & 4 deletions PWGCF/Femto/Core/kinkHistManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class KinkHistManager
}

mChaDauManager.template init<mode>(registry, ChaDauSpecs, absCharge, chaDauCharge, chaDauPdgCodeAbs);
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
this->initAnalysis(KinkSpecs);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
Expand Down Expand Up @@ -356,7 +356,7 @@ class KinkHistManager
}

mChaDauManager.template init<mode>(registry, ChaDauSpecs, absCharge, chaDauCharge, chaDauPdgCodeAbs, ConfChaDauBinningQa);
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
this->initAnalysis(KinkSpecs);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
Expand All @@ -374,7 +374,7 @@ class KinkHistManager
// auto chaDaughter = kinkcandidate.template chaDau_as<T2>();
auto chaDaughter = tracks.rawIteratorAt(kinkCandidate.chaDauId() - tracks.offset());
mChaDauManager.template fill<mode>(chaDaughter, tracks);
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (isFlagSet(mode, modes::Mode::kReco)) {
this->fillAnalysis(kinkCandidate);
}
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
Expand All @@ -387,7 +387,7 @@ class KinkHistManager
{
auto chaDaughter = tracks.rawIteratorAt(kinkCandidate.chaDauId() - tracks.offset());
mChaDauManager.template fill<mode>(chaDaughter, tracks, mcParticles, mcMothers, mcPartonicMothers);
if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) {
if constexpr (modes::isFlagSet(mode, modes::Mode::kReco)) {
this->fillAnalysis(kinkCandidate);
}
if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) {
Expand Down
3 changes: 1 addition & 2 deletions PWGCF/Femto/Core/mcBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
#include "PWGCF/Femto/Core/modes.h"
#include "PWGCF/Femto/DataModel/FemtoTables.h"

#include <CommonConstants/MathConstants.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/Configurable.h>
#include <Framework/Logger.h>

#include <TPDGCode.h>

#include <Rtypes.h>

#include <cmath>
#include <cstdint>
#include <string>
Expand Down
Loading
Loading