Skip to content

Commit

Permalink
add NEvents histogram for MC collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiara De Martin committed Oct 10, 2024
1 parent f45a061 commit aefe3ce
Showing 1 changed file with 35 additions and 12 deletions.
47 changes: 35 additions & 12 deletions PWGLF/TableProducer/Strangeness/cascadeflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ struct cascadeFlow {
Configurable<float> nsigmatpcPi{"nsigmatpcPi", 5, "nsigmatpcPi"};
Configurable<float> mintpccrrows{"mintpccrrows", 70, "mintpccrrows"};
Configurable<float> etaCascMCGen{"etaCascMCGen", 0.8, "etaCascMCGen"};
Configurable<float> yCascMCGen{"yCascMCGen", 0.5, "yCascMCGen"};

Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::vector<std::string>> modelPathsCCDBXi{"modelPathsCCDBXi", std::vector<std::string>{"Users/c/chdemart/CascadesFlow"}, "Paths of models on CCDB"};
Expand Down Expand Up @@ -258,9 +259,9 @@ struct cascadeFlow {
return phi;
}

HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry histosMCGen{"histosMCGen", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry resolution{"resolution", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
HistogramRegistry histosMCGen{"histosMCGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
HistogramRegistry resolution{"resolution", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};

// Tables to produce
Produces<aod::CascTraining> trainingSample;
Expand Down Expand Up @@ -353,6 +354,7 @@ struct cascadeFlow {
const AxisSpec v2Axis{200, -1., 1., "#it{v}_{2}"};
const AxisSpec CentAxis{18, 0., 90., "FT0C centrality percentile"};
TString hNEventsLabels[8] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kIsGoodEventEP"};
TString hNEventsLabelsMC[5] = {"All", "z vtx", ">=1RecoColl", "1Reco", "2Reco"};

resolution.add("QVectorsT0CTPCA", "QVectorsT0CTPCA", HistType::kTH2F, {axisQVs, CentAxis});
resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxis});
Expand Down Expand Up @@ -387,9 +389,16 @@ struct cascadeFlow {
histos.add("hv2CEPvsFT0C", "hv2CEPvsFT0C", HistType::kTH2F, {CentAxis, {100, -1, 1}});
histos.add("hv2CEPvsv2CSP", "hv2CEPvsV2CSP", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}});

histosMCGen.add("h2DGenXi", "h2DGenXi", HistType::kTH2F, {{100, 0, 00}, {200, 0, 20}});
histosMCGen.add("h2DGenOmega", "h2DGenOmega", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}});
histosMCGen.add("hGenEta", "hGenEta", HistType::kTH1F, {{100, -1, 1}});
histosMCGen.add("h2DGenXiEta08", "h2DGenXiEta08", HistType::kTH2F, {{100, 0, 00}, {200, 0, 20}});
histosMCGen.add("h2DGenOmegaEta08", "h2DGenOmegaEta08", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}});
histosMCGen.add("h2DGenXiY05", "h2DGenXiY05", HistType::kTH2F, {{100, 0, 00}, {200, 0, 20}});
histosMCGen.add("h2DGenOmegaY05", "h2DGenOmegaY05", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}});
histosMCGen.add("hGenXiY", "hGenXiY", HistType::kTH1F, {{100, -1, 1}});
histosMCGen.add("hGenOmegaY", "hGenOmegaY", HistType::kTH1F, {{100, -1, 1}});
histosMCGen.add("hNEventsMC", "hNEventsMC", {HistType::kTH1F, {{5, 0.f, 5.f}}});
for (Int_t n = 1; n <= histosMCGen.get<TH1>(HIST("hNEventsMC"))->GetNbinsX(); n++) {
histosMCGen.get<TH1>(HIST("hNEventsMC"))->GetXaxis()->SetBinLabel(n, hNEventsLabelsMC[n - 1]);
}

for (int iS{0}; iS < 2; ++iS) {
cascadev2::hMassBeforeSelVsPt[iS] = histos.add<TH2>(Form("hMassBeforeSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassBeforeSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxis});
Expand Down Expand Up @@ -859,11 +868,12 @@ struct cascadeFlow {
{

for (auto const& mcCollision : mcCollisions) {
histosMCGen.fill(HIST("hNEventsMC"), 0.5);
// Generated with accepted z vertex
if (TMath::Abs(mcCollision.posZ()) > cutzvertex) {
return;
}

histosMCGen.fill(HIST("hNEventsMC"), 1.5);
// Check if there is at least one of the reconstructed collisions associated to this MC collision

auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
Expand All @@ -887,6 +897,11 @@ struct cascadeFlow {
if (nCollisions < 1) {
return;
}
histosMCGen.fill(HIST("hNEventsMC"), 2.5);
if (nCollisions == 1)
histosMCGen.fill(HIST("hNEventsMC"), 3.5);
else if (nCollisions == 2)
histosMCGen.fill(HIST("hNEventsMC"), 4.5);
for (auto const& cascMC : CascMCCores) {
if (!cascMC.has_straMCCollision())
continue;
Expand All @@ -908,14 +923,22 @@ struct cascadeFlow {
theta1 = TMath::Pi() + theta; // pi/2 < theta1 < pi --> pi/4 < theta1/2 < pi/2 --> 1 < tan (theta1/2) --> negative eta

float cascMCeta = -log(std::tan(theta1 / 2));
if (TMath::Abs(cascMCeta) > etaCascMCGen)
continue;
histosMCGen.fill(HIST("hGenEta"), cascMCeta);
float cascMCy = 0;

if (TMath::Abs(cascMC.pdgCode()) == 3312) {
histosMCGen.fill(HIST("h2DGenXi"), centrality, ptmc);
cascMCy = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, constants::physics::MassXiMinus);
if (TMath::Abs(cascMCeta) < etaCascMCGen)
histosMCGen.fill(HIST("h2DGenXiEta08"), centrality, ptmc);
if (TMath::Abs(cascMCy) < yCascMCGen)
histosMCGen.fill(HIST("h2DGenXiY05"), centrality, ptmc);
histosMCGen.fill(HIST("hGenXiY"), cascMCy);
} else if (TMath::Abs(cascMC.pdgCode() == 3334)) {
histosMCGen.fill(HIST("h2DGenOmega"), centrality, ptmc);
cascMCy = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, constants::physics::MassOmegaMinus);
if (TMath::Abs(cascMCeta) < etaCascMCGen)
histosMCGen.fill(HIST("h2DGenOmegaEta08"), centrality, ptmc);
if (TMath::Abs(cascMCy) < yCascMCGen)
histosMCGen.fill(HIST("h2DGenOmegaY05"), centrality, ptmc);
histosMCGen.fill(HIST("hGenOmegaY"), cascMCy);
}
}
}
Expand Down

0 comments on commit aefe3ce

Please sign in to comment.