Skip to content

Commit 645abd8

Browse files
author
Youssef El Mard Bouziani
committed
Add optional PCM material-budget weights in PCMPCM
Add a V0 photon material-budget weight table (Omega MB weights) and join it in the PCMPCM pi0/eta workflow. The weights are applied only when the joined column is available, using compile-time guarded access. Introduce a configurable switch (runWithMBWeights) in MaterialBudgetWeights: - false: no CCDB query, write weight=1 - true: require CCDB histogram and abort if missing
1 parent acff8cf commit 645abd8

6 files changed

Lines changed: 154 additions & 3 deletions

File tree

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ struct Pi0EtaToGammaGamma {
227227
//---------------------------------------------------------------------------
228228
// Preslices and partitions
229229
o2::framework::SliceCache cache;
230-
o2::framework::PresliceOptional<o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>> perCollision_pcm = o2::aod::v0photonkf::emeventId;
230+
o2::framework::PresliceOptional<
231+
o2::soa::Filtered<
232+
o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived, o2::aod::V0PhotonOmegaMBWeights>>> perCollision_pcm = o2::aod::v0photonkf::emeventId;
231233
o2::framework::PresliceOptional<o2::soa::Join<o2::aod::EmEmcClusters, o2::aod::EMCEMEventIds>> perCollision_emc = o2::aod::emccluster::emeventId;
232234
o2::framework::PresliceOptional<o2::soa::Join<o2::aod::PHOSClusters, o2::aod::PHOSEMEventIds>> perCollision_phos = o2::aod::phoscluster::emeventId;
233235
o2::framework::PresliceOptional<o2::soa::Filtered<o2::soa::Join<o2::aod::EMPrimaryElectronsFromDalitz, o2::aod::EMPrimaryElectronEMEventIds, o2::aod::EMPrimaryElectronsPrefilterBitDerived>>> perCollision_electron = o2::aod::emprimaryelectron::emeventId;
@@ -878,7 +880,16 @@ struct Pi0EtaToGammaGamma {
878880
continue;
879881
}
880882

881-
fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight);
883+
float wpair = weight;
884+
885+
if constexpr (requires { g1.omegaMBWeight(); }) {
886+
wpair *= g1.omegaMBWeight();
887+
}
888+
if constexpr (requires { g2.omegaMBWeight(); }) {
889+
wpair *= g2.omegaMBWeight();
890+
}
891+
892+
fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), wpair);
882893

883894
if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) {
884895
emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g1.pt(), g1.eta(), g1.phi(), 0));

PWGEM/PhotonMeson/DataModel/gammaTables.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,17 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Cell, cell, int, Calos, ""); //! r
682682
DECLARE_SOA_TABLE(SkimEMCCells, "AOD", "SKIMEMCCELLS", //! table of link between skimmed EMCal clusters and their cells
683683
o2::soa::Index<>, caloextra::ClusterId, caloextra::CellId); //!
684684
using SkimEMCCell = SkimEMCCells::iterator;
685+
686+
namespace v0photonMBweights
687+
{
688+
DECLARE_SOA_COLUMN(OmegaMBWeight, omegaMBWeight, float);
689+
}
690+
691+
DECLARE_SOA_TABLE(V0PhotonOmegaMBWeights, "AOD", "V0PHOTONMBW", v0photonMBweights::OmegaMBWeight); // store MB weights. To be joined with V0PhotonsKF table at analysis level.
692+
693+
using V0PhotonOmegaMBWeight = V0PhotonOmegaMBWeights::iterator;
685694
} // namespace o2::aod
686695

696+
697+
687698
#endif // PWGEM_PHOTONMESON_DATAMODEL_GAMMATABLES_H_

PWGEM/PhotonMeson/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ o2physics_add_dpl_workflow(skimmer-dalitz-ee
6363
SOURCES skimmerDalitzEE.cxx
6464
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
6565
COMPONENT_NAME Analysis)
66+
67+
o2physics_add_dpl_workflow(material-budget-weights
68+
SOURCES materialBudgetWeights.cxx
69+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::CCDB ROOT::Hist ROOT::Core
70+
COMPONENT_NAME Analysis)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2019-2020 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 MaterialBudgetWeights.h
13+
///
14+
/// \brief This code produces a table to retrieve material budget weights. The table is to be join with V0PhotonKF
15+
///
16+
/// \author Youssef El Mard (youssef.el.mard.bouziani@cern.ch)
17+
18+
19+
#include "PWGEM/PhotonMeson/Utils/MaterialBudgetWeights.h"
20+
#include "Framework/runDataProcessing.h"
21+
22+
using namespace o2::framework;
23+
24+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
25+
{
26+
return WorkflowSpec{adaptAnalysisTask<MaterialBudgetWeights>(cfgc)};
27+
}

PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h"
1717
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
1818
#include "PWGEM/PhotonMeson/Utils/PairUtilities.h"
19+
#include "PWGEM/PhotonMeson/Utils/MaterialBudgetWeights.h"
1920

2021
#include <Framework/AnalysisDataModel.h>
2122
#include <Framework/AnalysisTask.h>
@@ -26,11 +27,12 @@ using namespace o2::aod;
2627
using namespace o2::framework;
2728
using namespace o2::aod::pwgem::photonmeson::photonpair;
2829

29-
using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>;
30+
using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived, o2::aod::V0PhotonOmegaMBWeights>>;
3031

3132
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
3233
{
3334
return WorkflowSpec{
35+
adaptAnalysisTask<MaterialBudgetWeights>(cfgc),
3436
adaptAnalysisTask<Pi0EtaToGammaGamma<PairType::kPCMPCM, MyV0Photons, aod::V0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}),
3537
};
3638
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// Copyright 2019-2020 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 materialBudgetWeights.cxx
13+
///
14+
/// \brief This code produces a table to retrieve material budget weights. The table is to be join with V0PhotonKF
15+
///
16+
/// \author Youssef El Mard (youssef.el.mard.bouziani@cern.ch)
17+
///
18+
19+
#ifndef PWGEM_PHOTONMESON_UTILS_MATERIALBUDGETWEIGHTS_H_
20+
#define PWGEM_PHOTONMESON_UTILS_MATERIALBUDGETWEIGHTS_H_
21+
22+
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
23+
#include <CCDB/BasicCCDBManager.h>
24+
25+
#include "Framework/ASoAHelpers.h"
26+
#include "Framework/AnalysisDataModel.h"
27+
#include "Framework/AnalysisTask.h"
28+
#include "Framework/Logger.h"
29+
#include <Framework/Configurable.h>
30+
#include <Framework/InitContext.h>
31+
32+
33+
using namespace o2;
34+
using namespace o2::soa;
35+
using namespace o2::framework;
36+
37+
using MyV0PhotonsMB = o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds>;
38+
using MyV0PhotonMB = MyV0PhotonsMB::iterator;
39+
40+
struct MaterialBudgetWeights {
41+
Produces<aod::V0PhotonOmegaMBWeights> omegaMBWeight;
42+
43+
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "CCDB url"};
44+
Configurable<std::string> mbWeightsPath{"mbWeightsPath", "Users/y/yelmard/MaterialBudget/OmegaMBWeights", "Path of the mb weights"};
45+
Configurable<bool> runWithMBWeights{"runWithMBWeights", false, "Run task using material-budget weights for PCM photons"};
46+
47+
o2::ccdb::CcdbApi ccdbApi;
48+
TH1F* hOmegaMBFromCCDB = nullptr;
49+
50+
void init(InitContext&)
51+
{
52+
if (!runWithMBWeights) {
53+
LOG(info) << "MaterialBudgetWeights: runWithMBWeights=false -> no CCDB query, will write weight=1";
54+
return;
55+
}
56+
57+
ccdbApi.init(ccdbUrl.value);
58+
std::map<std::string, std::string> metadata;
59+
LOG(info) << "MaterialBudgetWeights: loading Omega MB histogram from CCDB at path: " << mbWeightsPath.value;
60+
61+
hOmegaMBFromCCDB = ccdbApi.retrieveFromTFileAny<TH1F>(mbWeightsPath, metadata, -1);
62+
63+
if (!hOmegaMBFromCCDB) {
64+
LOG(fatal) << "MaterialBudgetWeights: runWithMBWeights=true but CCDB object is missing. Path=" << mbWeightsPath.value;
65+
}
66+
}
67+
68+
float computeMBWeight(float v0Rxy)
69+
{
70+
if (!hOmegaMBFromCCDB) {
71+
LOG(fatal) << "MaterialBudgetWeights: internal error: histogram nullptr while runWithMBWeights=true";
72+
}
73+
74+
int binMBWeight = hOmegaMBFromCCDB->FindBin(v0Rxy);
75+
if (binMBWeight < 1 || binMBWeight > hOmegaMBFromCCDB->GetNbinsX()) {
76+
LOG(debug) << "MaterialBudgetWeights: v0Rxy out of histogram range, returning 1";
77+
return 1.f;
78+
}
79+
80+
return hOmegaMBFromCCDB->GetBinContent(binMBWeight);
81+
}
82+
83+
void process(MyV0PhotonMB const& v0)
84+
{
85+
if (!runWithMBWeights) {
86+
omegaMBWeight(1.f);
87+
return;
88+
}
89+
90+
omegaMBWeight(computeMBWeight(v0.v0radius()));
91+
}
92+
};
93+
94+
95+
#endif // PWGEM_PHOTONMESON_UTILS_MATERIALBUDGETWEIGHTS_H_

0 commit comments

Comments
 (0)