diff --git a/Recon/include/Recon/Skims/EcalPreselectionSkimmer.h b/Recon/include/Recon/Skims/EcalPreselectionSkimmer.h index 31e5d55d0..534700d70 100644 --- a/Recon/include/Recon/Skims/EcalPreselectionSkimmer.h +++ b/Recon/include/Recon/Skims/EcalPreselectionSkimmer.h @@ -12,27 +12,26 @@ //----------// #include "Ecal/Event/EcalVetoResult.h" #include "Framework/EventProcessor.h" -#include "Tools/AnalysisUtils.h" namespace recon { class EcalPreselectionSkimmer : public framework::Producer { public: - // @param parameters Set of parameters used to configure this processor. - virtual void configure(framework::config::Parameters &); - /** Constructor */ EcalPreselectionSkimmer(const std::string &name, framework::Process &process); /** Destructor */ ~EcalPreselectionSkimmer() = default; + // Configure this processor with a set of parameters passed + virtual void configure(framework::config::Parameters &) final; + /** * Run the processor and select events that pass pre-selection in ECAL * * @param event The event to process. */ - void produce(framework::Event &event); + virtual void produce(framework::Event &event) final; private: /// Collection Name for veto object diff --git a/Recon/python/ecalPreselectionSkimmer.py b/Recon/python/ecalPreselectionSkimmer.py index 0c1806443..1d5ccb6b9 100644 --- a/Recon/python/ecalPreselectionSkimmer.py +++ b/Recon/python/ecalPreselectionSkimmer.py @@ -33,8 +33,9 @@ Examples -------- - from LDMX.Recon.ecalPreselectionSkimmer import ecalPreselectionSkimmer - p.sequence.append( ecalPreselectionSkimmer ) + from LDMX.Recon.ecalPreselectionSkimmer import EcalPreselectionSkimmer + ecal_pres_skimmer = EcalPreselectionSkimmer() + p.sequence.append( ecal_pres_skimmer ) """ from LDMX.Framework import ldmxcfg @@ -42,7 +43,7 @@ class EcalPreselectionSkimmer(ldmxcfg.Producer) : """Configuration for an ECAL-based pre-selection skimmer""" - def __init__(self, name) : + def __init__(self, name = "ecalPreselectionSkimmer") : super().__init__(name,'recon::EcalPreselectionSkimmer','Recon') self.ecal_veto_name = "EcalVeto" @@ -57,7 +58,3 @@ def __init__(self, name) : self.max_cell_dep_max = 9999. self.std_layer_hit_max = 9999 self.n_straight_tracks_max = 9999 - - -ecalPreselectionSkimmer = EcalPreselectionSkimmer("ecalPreselectionSkimmer") - diff --git a/Recon/src/Recon/Skims/EcalPreselectionSkimmer.cxx b/Recon/src/Recon/Skims/EcalPreselectionSkimmer.cxx index 9250d3d81..8b51868f6 100644 --- a/Recon/src/Recon/Skims/EcalPreselectionSkimmer.cxx +++ b/Recon/src/Recon/Skims/EcalPreselectionSkimmer.cxx @@ -33,7 +33,7 @@ void EcalPreselectionSkimmer::configure(framework::config::Parameters &ps) { void EcalPreselectionSkimmer::produce(framework::Event &event) { bool passedPreselection{false}; - auto ecalVeto{ + const auto &ecalVeto{ event.getObject(ecal_veto_name_, ecal_veto_pass_)}; // Boolean to check if we pass preselection @@ -56,6 +56,8 @@ void EcalPreselectionSkimmer::produce(framework::Event &event) { } else { setStorageHint(framework::hint_shouldDrop); } + // Add the boolean to the event + event.add("EcalPreselectionDecision", passedPreselection); } } // namespace recon diff --git a/Recon/test/ecal_preselection_skim.py b/Recon/test/ecal_preselection_skim.py index e204488ce..e9fd8fe9a 100644 --- a/Recon/test/ecal_preselection_skim.py +++ b/Recon/test/ecal_preselection_skim.py @@ -1,17 +1,34 @@ -import os import sys +import os +import sys - thisPassName = "presel" inputName = sys.argv[1] +thisPassName = "presel" +inputName = sys.argv[1] - from LDMX.Framework import ldmxcfg p = ldmxcfg.Process(thisPassName) +from LDMX.Framework import ldmxcfg +p = ldmxcfg.Process(thisPassName) - p.termLogLevel = 0 +p.termLogLevel = 0 +p.inputFiles =[inputName] +p.outputFiles =["eventsPreskimmed.root"] - p.inputFiles =[inputName] p.histogramFile = "histosPreskimmed.root" p.outputFiles =["eventsPreskimmed.root"] - - from LDMX.Recon.ecalPreselectionSkimmer import ecalPreselectionSkimmer ecalPreselectionSkimmer.summed_tight_iso_max = 1100. ecalPreselectionSkimmer.n_readout_hits_max = 90 -''' ## #Reminder for the possible things to cut on - - ecalPreselectionSkimmer.summed_det_max = 9999. ecalPreselectionSkimmer.summed_tight_iso_max = 9999. ecalPreselectionSkimmer.ecal_back_energy_max = 9999. ecalPreselectionSkimmer.n_readout_hits_max = 9999 ecalPreselectionSkimmer.shower_rms_max = 9999 ecalPreselectionSkimmer.shower_y_std_max = 9999 ecalPreselectionSkimmer.shower_x_std_max = 9999 ecalPreselectionSkimmer.max_cell_dep_max = 9999. ecalPreselectionSkimmer.std_layer_hit_max = 9999 ecalPreselectionSkimmer.n_straight_tracks_max = 9999 +from LDMX.Recon.ecalPreselectionSkimmer import EcalPreselectionSkimmer +ecal_pres_skimmer = EcalPreselectionSkimmer() +ecal_pres_skimmer.summed_tight_iso_max = 1100. +ecal_pres_skimmer.n_readout_hits_max = 90 +''' +## Reminder for the possible things to cut on +ecal_pres_skimmer.summed_det_max = 9999. +ecal_pres_skimmer.summed_tight_iso_max = 9999. +ecal_pres_skimmer.ecal_back_energy_max = 9999. +ecal_pres_skimmer.n_readout_hits_max = 9999 +ecal_pres_skimmer.shower_rms_max = 9999 +ecal_pres_skimmer.shower_y_std_max = 9999 +ecal_pres_skimmer.shower_x_std_max = 9999 +ecal_pres_skimmer.max_cell_dep_max = 9999. +ecal_pres_skimmer.std_layer_hit_max = 9999 +ecal_pres_skimmer.n_straight_tracks_max = 9999 ''' - p.sequence =[ecalPreselectionSkimmer] p.skimDefaultIsDrop() p.skimConsider(p.sequence[0].instanceName) +p.sequence =[ecal_pres_skimmer] +p.skimDefaultIsDrop() +p.skimConsider(p.sequence[0].instanceName)