Skip to content

Commit 2cea0f0

Browse files
committed
Update optional ML-based photon cuts in Pi0EtaToGammaGammaPCM task to also be able to use psipair and phiv as parameters for the models.
1 parent cf548f3 commit 2cea0f0

File tree

5 files changed

+91
-6
lines changed

5 files changed

+91
-6
lines changed

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ struct Pi0EtaToGammaGamma {
147147
o2::framework::Configurable<bool> cfg_load_ml_models_from_ccdb{"cfg_load_ml_models_from_ccdb", true, "flag to load ML models from CCDB"};
148148
o2::framework::Configurable<int> cfg_timestamp_ccdb{"cfg_timestamp_ccdb", -1, "timestamp for CCDB"};
149149
o2::framework::Configurable<int> cfg_nclasses_ml{"cfg_nclasses_ml", static_cast<int>(o2::analysis::em_cuts_ml::NCutScores), "number of classes for ML"};
150-
o2::framework::Configurable<std::string> cfg_cent_type_ml{"cfg_cent_type_ml", "CentFT0C", "centrality type for 2D ML application: CentFT0C, CentFT0M, or CentFT0A"};
151150
o2::framework::Configurable<std::vector<int>> cfg_cut_dir_ml{"cfg_cut_dir_ml", std::vector<int>{o2::analysis::em_cuts_ml::vecCutDir}, "cut direction for ML"};
152151
o2::framework::Configurable<std::vector<std::string>> cfg_input_feature_names{"cfg_input_feature_names", std::vector<std::string>{"feature1", "feature2"}, "input feature names for ML models"};
153152
o2::framework::Configurable<std::vector<std::string>> cfg_model_paths_ccdb{"cfg_model_paths_ccdb", std::vector<std::string>{"path_ccdb/BDT_PCM/"}, "CCDB paths for ML models"};
@@ -508,7 +507,9 @@ struct Pi0EtaToGammaGamma {
508507
fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml);
509508
fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb);
510509
fV0PhotonCut.SetCcdbUrl(ccdburl);
511-
fV0PhotonCut.SetCentralityTypeMl(pcmcuts.cfg_cent_type_ml);
510+
CentType mCentralityTypeMlEnum;
511+
mCentralityTypeMlEnum = static_cast<CentType>(cfgCentEstimator.value);
512+
fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum);
512513
fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml);
513514
fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb);
514515
fV0PhotonCut.SetMlOnnxFileNames(pcmcuts.cfg_onnx_file_names);
@@ -702,7 +703,6 @@ struct Pi0EtaToGammaGamma {
702703
{
703704
for (const auto& collision : collisions) {
704705
initCCDB(collision);
705-
fV0PhotonCut.SetCentrality(collision.centFT0A(), collision.centFT0C(), collision.centFT0M());
706706
int ndiphoton = 0;
707707
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
708708
continue;
@@ -718,6 +718,7 @@ struct Pi0EtaToGammaGamma {
718718
}
719719

720720
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
721+
fV0PhotonCut.SetCentrality(centralities[cfgCentEstimator]);
721722
if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
722723
continue;
723724
}

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ struct Pi0EtaToGammaGammaMC {
136136
o2::framework::Configurable<bool> cfg_load_ml_models_from_ccdb{"cfg_load_ml_models_from_ccdb", true, "flag to load ML models from CCDB"};
137137
o2::framework::Configurable<int> cfg_timestamp_ccdb{"cfg_timestamp_ccdb", -1, "timestamp for CCDB"};
138138
o2::framework::Configurable<int> cfg_nclasses_ml{"cfg_nclasses_ml", static_cast<int>(o2::analysis::em_cuts_ml::NCutScores), "number of classes for ML"};
139-
o2::framework::Configurable<std::string> cfg_cent_type_ml{"cfg_cent_type_ml", "CentFT0C", "centrality type for 2D ML application: CentFT0C, CentFT0M, or CentFT0A"};
140139
o2::framework::Configurable<std::vector<int>> cfg_cut_dir_ml{"cfg_cut_dir_ml", std::vector<int>{o2::analysis::em_cuts_ml::vecCutDir}, "cut direction for ML"};
141140
o2::framework::Configurable<std::vector<std::string>> cfg_input_feature_names{"cfg_input_feature_names", std::vector<std::string>{"feature1", "feature2"}, "input feature names for ML models"};
142141
o2::framework::Configurable<std::vector<std::string>> cfg_model_paths_ccdb{"cfg_model_paths_ccdb", std::vector<std::string>{"path_ccdb/BDT_PCM/"}, "CCDB paths for ML models"};
@@ -348,7 +347,9 @@ struct Pi0EtaToGammaGammaMC {
348347
fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml);
349348
fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb);
350349
fV0PhotonCut.SetCcdbUrl(ccdburl);
351-
fV0PhotonCut.SetCentralityTypeMl(pcmcuts.cfg_cent_type_ml);
350+
CentType mCentralityTypeMlEnum;
351+
mCentralityTypeMlEnum = static_cast<CentType>(cfgCentEstimator.value);
352+
fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum);
352353
fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml);
353354
fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb);
354355
fV0PhotonCut.SetMlOnnxFileNames(pcmcuts.cfg_onnx_file_names);
@@ -560,7 +561,6 @@ struct Pi0EtaToGammaGammaMC {
560561
{
561562
for (auto& collision : collisions) {
562563
initCCDB(collision);
563-
fV0PhotonCut.SetCentrality(collision.centFT0A(), collision.centFT0C(), collision.centFT0M());
564564
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
565565
continue;
566566
}
@@ -575,6 +575,7 @@ struct Pi0EtaToGammaGammaMC {
575575
}
576576

577577
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
578+
fV0PhotonCut.SetCentrality(centralities[cfgCentEstimator]);
578579
if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
579580
continue;
580581
}

PWGEM/PhotonMeson/Tasks/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ o2physics_add_dpl_workflow(pi0eta-to-gammagamma-pcmpcm
9191
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
9292
COMPONENT_NAME Analysis)
9393

94+
o2physics_add_dpl_workflow(pi0eta-to-gammagamma-pcmpcm-ml
95+
SOURCES Pi0EtaToGammaGammaPCMPCMML.cxx
96+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
97+
COMPONENT_NAME Analysis)
98+
9499
o2physics_add_dpl_workflow(pi0eta-to-gammagamma-pcmdalitzee
95100
SOURCES Pi0EtaToGammaGammaPCMDalitzEE.cxx
96101
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
@@ -111,6 +116,11 @@ o2physics_add_dpl_workflow(pi0eta-to-gammagamma-mc-pcmpcm
111116
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
112117
COMPONENT_NAME Analysis)
113118

119+
o2physics_add_dpl_workflow(pi0eta-to-gammagamma-mc-pcmpcm-ml
120+
SOURCES Pi0EtaToGammaGammaMCPCMPCMML.cxx
121+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
122+
COMPONENT_NAME Analysis)
123+
114124
o2physics_add_dpl_workflow(pi0eta-to-gammagamma-mc-pcmdalitzee
115125
SOURCES Pi0EtaToGammaGammaMCPCMDalitzEE.cxx
116126
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 Pi0EtaToGammaGammaMCPCMPCMML.cxx
13+
/// \brief This code loops over photons and makes pairs for neutral mesons analyses in MC for PCM-PCM with additional ML-based photon cuts.
14+
/// \author Isabel Kantak, isabel.kantak@cern.ch
15+
16+
#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h"
17+
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
18+
#include "PWGEM/PhotonMeson/Utils/PairUtilities.h"
19+
20+
#include <Framework/ASoA.h>
21+
#include <Framework/AnalysisTask.h>
22+
#include <Framework/runDataProcessing.h>
23+
24+
using namespace o2;
25+
using namespace o2::aod;
26+
using namespace o2::framework;
27+
using namespace o2::aod::pwgem::photonmeson::photonpair;
28+
29+
using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0PhotonsPhiVPsi, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>;
30+
using MyMCV0Legs = soa::Join<aod::V0Legs, aod::V0LegMCLabels>;
31+
32+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
33+
{
34+
return WorkflowSpec{
35+
adaptAnalysisTask<Pi0EtaToGammaGammaMC<PairType::kPCMPCM, MyV0Photons, MyMCV0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}),
36+
};
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 Pi0EtaToGammaGammaPCMPCMML.cxx
13+
/// \brief This code loops over photons and makes pairs for neutral mesons analyses for PCM-PCM with additional ML cuts to photons.
14+
/// \author Isabel Kantak, isabel.kantak@cern.ch
15+
16+
#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h"
17+
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
18+
#include "PWGEM/PhotonMeson/Utils/PairUtilities.h"
19+
20+
#include <Framework/AnalysisDataModel.h>
21+
#include <Framework/AnalysisTask.h>
22+
#include <Framework/runDataProcessing.h>
23+
24+
using namespace o2;
25+
using namespace o2::aod;
26+
using namespace o2::framework;
27+
using namespace o2::aod::pwgem::photonmeson::photonpair;
28+
29+
using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0PhotonsPhiVPsi, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>;
30+
31+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
32+
{
33+
return WorkflowSpec{
34+
adaptAnalysisTask<Pi0EtaToGammaGamma<PairType::kPCMPCM, MyV0Photons, aod::V0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}),
35+
};
36+
}

0 commit comments

Comments
 (0)