diff --git a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt index 7d58cb0cb7c..ede83862a3f 100644 --- a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt +++ b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt @@ -31,7 +31,7 @@ o2physics_add_dpl_workflow(create-pcm o2physics_add_dpl_workflow(create-emevent-photon SOURCES createEMEventPhoton.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGJECore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(associate-mc-info-photon diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index cba68536ddb..f1d78bd76b6 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -30,6 +30,8 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGJE/DataModel/Jet.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -70,6 +72,8 @@ struct CreateEMEventPhoton { Configurable applyEveSelAtSkimming{"applyEveSel_at_skimming", false, "flag to apply minimal event selection at the skimming level"}; Configurable needEMCTrigger{"needEMCTrigger", false, "flag to only save events which have kTVXinEMC trigger bit. To reduce PbPb derived data size"}; Configurable needPHSTrigger{"needPHSTrigger", false, "flag to only save events which have kTVXinPHOS trigger bit. To reduce PbPb derived data size"}; + Configurable enableJJHistograms{"enableJJHistograms", false, "flag to fill JJ QA histograms for outlier rejection"}; + Configurable maxpTJetOverpTHard{"maxpTJetOverpTHard", 2., "set weight to 0 for JJ events with larger pTJet/pTHard"}; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) @@ -77,6 +81,10 @@ struct CreateEMEventPhoton { auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1I, {{7, 0.5f, 7.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); + + if (enableJJHistograms) { + auto hJJ_pTHardVsJetpT = registry.add("hJJ_pTHardVsJetpT", "hJJ_pTHardVsJetpT;#bf{#it{p}_{T}^{hard}};#bf{#it{p}_{T}^{leading jet}}", kTH2F, {{500, 0, 1000}, {500, 0, 1000}}); + } } int mRunNumber; @@ -132,7 +140,7 @@ struct CreateEMEventPhoton { } } - const auto& bc = collision.template foundBC_as(); + auto bc = collision.template foundBC_as(); initCCDB(bc); if (applyEveSelAtSkimming && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { @@ -192,7 +200,11 @@ struct CreateEMEventPhoton { } // end of skimEvent - void fillEventWeights(MyCollisionsMC const& collisions, aod::McCollisions const&, MyBCs const&) + Preslice perCollision_jet = aod::jet::mcCollisionId; + + using MyJJCollisions = soa::Join; + + void fillEventWeights(MyCollisionsMC const& collisions, MyJJCollisions const&, MyBCs const&, aod::FullMCParticleLevelJets const& jets) { for (const auto& collision : collisions) { if (!collision.has_mcCollision()) { @@ -205,8 +217,19 @@ struct CreateEMEventPhoton { if (applyEveSelAtSkimming && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { continue; } - auto mcCollision = collision.mcCollision(); - eventWeights(mcCollision.weight()); + auto mcCollision = collision.mcCollision_as(); + + // Outlier rejection: Set weight to 0 for events with large pTJet/pTHard + // ---------------------------------------------------------------------- + auto jetsInThisCollision = jets.sliceBy(perCollision_jet, mcCollision.globalIndex()); + float collisionWeight = mcCollision.weight(); + for (const auto& jet : jetsInThisCollision) { + if (jet.pt() > maxpTJetOverpTHard * mcCollision.ptHard()) + collisionWeight = 0.f; + registry.fill(HIST("hJJ_pTHardVsJetpT"), mcCollision.ptHard(), jet.pt()); + } + + eventWeights(collisionWeight); } } @@ -222,10 +245,10 @@ struct CreateEMEventPhoton { } PROCESS_SWITCH(CreateEMEventPhoton, processEventMC, "process event info", false); - void processEventJJMC(MyCollisionsMC const& collisions, aod::McCollisions const& mcCollisions, MyBCs const& bcs) + void processEventJJMC(MyCollisionsMC const& collisions, MyJJCollisions const& mcCollisions, MyBCs const& bcs, aod::FullMCParticleLevelJets const& jets) { skimEvent(collisions, bcs); - fillEventWeights(collisions, mcCollisions, bcs); + fillEventWeights(collisions, mcCollisions, bcs, jets); } PROCESS_SWITCH(CreateEMEventPhoton, processEventJJMC, "process event info", false);