LDMX Software
hcal::HcalWABVetoProcessor Class Reference

Public Member Functions

 HcalWABVetoProcessor (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~HcalWABVetoProcessor ()=default
 Destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void produce (framework::Event &event) override
 Run the processor and create a collection of results which indicate if the event passes/fails the Hcal veto.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

double maxtotal_energy_compare_ {1000.}
 
double mintotal_energy_compare_ {0.}
 
double maxn_clusters_ {0.}
 
double max_mean_hits_per_cluster_ {0.}
 
double max_mean_energy_per_cluster_ {0.}
 
std::string output_coll_name_
 
std::string input_hcal_cluster_coll_name_
 
std::string input_hcal_hit_coll_name_
 
std::string input_ecal_hit_coll_name_
 
std::string hcal_hit_passname_
 
std::string ecal_hit_passname_
 
std::string hcal_cluster_passname_
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 27 of file HcalWABVetoProcessor.h.

Constructor & Destructor Documentation

◆ HcalWABVetoProcessor()

hcal::HcalWABVetoProcessor::HcalWABVetoProcessor ( const std::string & name,
framework::Process & process )

Constructor.

Definition at line 18 of file HcalWABVetoProcessor.cxx.

20 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void hcal::HcalWABVetoProcessor::configure ( framework::config::Parameters & parameters)
overridevirtual

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 22 of file HcalWABVetoProcessor.cxx.

23 {
24 maxtotal_energy_compare_ = parameters.get<double>("max_total_energy_compare");
25 mintotal_energy_compare_ = parameters.get<double>("min_total_energy_compare");
26 maxn_clusters_ = parameters.get<double>("n_clusters");
27 max_mean_hits_per_cluster_ = parameters.get<double>("mean_hits_per_cluster");
28 max_mean_energy_per_cluster_ =
29 parameters.get<double>("mean_energy_per_cluster");
30 output_coll_name_ = parameters.get<std::string>("outputCollName");
31 input_hcal_cluster_coll_name_ =
32 parameters.get<std::string>("inputHCALClusterCollName");
33 input_hcal_hit_coll_name_ =
34 parameters.get<std::string>("inputHCALHitCollName");
35 input_ecal_hit_coll_name_ =
36 parameters.get<std::string>("inputECALHitCollName");
37 hcal_hit_passname_ = parameters.get<std::string>("hcal_hit_passname");
38 ecal_hit_passname_ = parameters.get<std::string>("ecal_hit_passname");
39 hcal_cluster_passname_ = parameters.get<std::string>("hcal_cluster_passname");
40}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References framework::config::Parameters::get().

◆ produce()

void hcal::HcalWABVetoProcessor::produce ( framework::Event & event)
overridevirtual

Run the processor and create a collection of results which indicate if the event passes/fails the Hcal veto.

Parameters
eventThe event to process.

Implements framework::Producer.

Definition at line 42 of file HcalWABVetoProcessor.cxx.

42 {
43 // Get the collection of sim particles from the event
44 // HCAL:
45 const std::vector<ldmx::HcalHit> hcal_rec_hits =
46 event.getCollection<ldmx::HcalHit>(input_hcal_hit_coll_name_,
47 hcal_hit_passname_);
48 // ECAL:
49 const std::vector<ldmx::EcalHit> ecal_rec_hits =
50 event.getCollection<ldmx::EcalHit>(input_ecal_hit_coll_name_,
51 ecal_hit_passname_);
52
53 // Clusters:
54 const std::vector<ldmx::HcalCluster> hcal_clusters =
55 event.getCollection<ldmx::HcalCluster>(input_hcal_cluster_coll_name_,
56 hcal_cluster_passname_);
57
58 // Loop over all of the Hcal hits_ and calculate to total photoelectrons
59 // in the event.
60 float total_hcal_energy{0};
61 float total_ecal_energy{0};
62 float max_pe{-1000};
63 const ldmx::HcalHit *max_pe_hit = nullptr;
64 for (const ldmx::HcalHit &hcal_hit : hcal_rec_hits) {
65 if (hcal_hit.isNoise() == 0) {
66 total_hcal_energy += hcal_hit.getPE();
67 }
68
69 // Find the maximum PE in the list
70 if (max_pe < hcal_hit.getPE()) {
71 max_pe = hcal_hit.getPE();
72 max_pe_hit = const_cast<ldmx::HcalHit *>(&hcal_hit);
73 }
74 }
75
76 for (const ldmx::EcalHit &ecal_hit : ecal_rec_hits) {
77 if (ecal_hit.isNoise() == 0) {
78 total_ecal_energy += ecal_hit.getEnergy();
79 }
80 }
81 std::vector<double> nhits;
82 std::vector<double> energies;
83 unsigned int n_clusters = 0;
84 for (const ldmx::HcalCluster &hcal_cluster : hcal_clusters) {
85 n_clusters += 1;
86 energies.push_back(hcal_cluster.getEnergy());
87 nhits.push_back(hcal_cluster.getNHits());
88 }
89
90 double mean_energy =
91 std::accumulate(energies.begin(), energies.end(), 0.0) / energies.size();
92 double mean_nhits =
93 std::accumulate(nhits.begin(), nhits.end(), 0.0) / nhits.size();
94 bool passes_energy_combo =
95 (((total_ecal_energy + total_hcal_energy) < maxtotal_energy_compare_));
96 bool passesn_clusters = (n_clusters < maxn_clusters_);
97 bool passes_n_hits =
98 ((mean_nhits < max_mean_hits_per_cluster_) or isnan(mean_nhits));
99 bool passes_energy =
100 ((mean_energy < max_mean_energy_per_cluster_) or isnan(mean_energy));
101
102 // total veto:
103 bool passes_veto = (passes_energy_combo and passesn_clusters and
104 passes_n_hits and passes_energy);
105 // set result:
107 result.setVetoResult(passes_veto);
108 result.setMaxPEHit(*max_pe_hit);
109 if (passes_veto) {
111
112 } else {
114 }
115
116 event.add(output_coll_name_, result);
117}
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module_.
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Stores cluster information from the HCal.
Definition HcalCluster.h:21
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24
void setVetoResult(const bool &passes_veto=true)
Sets whether the Hcal veto was passed or not.
void setMaxPEHit(const ldmx::HcalHit max_PE_hit)
Set the maximum PE hit.
constexpr StorageControl::Hint HINT_SHOULD_DROP
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint HINT_SHOULD_KEEP
storage control hint alias for backwards compatibility

References framework::HINT_SHOULD_DROP, framework::HINT_SHOULD_KEEP, ldmx::HcalVetoResult::setMaxPEHit(), framework::EventProcessor::setStorageHint(), and ldmx::HcalVetoResult::setVetoResult().

Member Data Documentation

◆ ecal_hit_passname_

std::string hcal::HcalWABVetoProcessor::ecal_hit_passname_
private

Definition at line 66 of file HcalWABVetoProcessor.h.

◆ hcal_cluster_passname_

std::string hcal::HcalWABVetoProcessor::hcal_cluster_passname_
private

Definition at line 67 of file HcalWABVetoProcessor.h.

◆ hcal_hit_passname_

std::string hcal::HcalWABVetoProcessor::hcal_hit_passname_
private

Definition at line 65 of file HcalWABVetoProcessor.h.

◆ input_ecal_hit_coll_name_

std::string hcal::HcalWABVetoProcessor::input_ecal_hit_coll_name_
private

Definition at line 64 of file HcalWABVetoProcessor.h.

◆ input_hcal_cluster_coll_name_

std::string hcal::HcalWABVetoProcessor::input_hcal_cluster_coll_name_
private

Definition at line 62 of file HcalWABVetoProcessor.h.

◆ input_hcal_hit_coll_name_

std::string hcal::HcalWABVetoProcessor::input_hcal_hit_coll_name_
private

Definition at line 63 of file HcalWABVetoProcessor.h.

◆ max_mean_energy_per_cluster_

double hcal::HcalWABVetoProcessor::max_mean_energy_per_cluster_ {0.}
private

Definition at line 60 of file HcalWABVetoProcessor.h.

60{0.};

◆ max_mean_hits_per_cluster_

double hcal::HcalWABVetoProcessor::max_mean_hits_per_cluster_ {0.}
private

Definition at line 58 of file HcalWABVetoProcessor.h.

58{0.};

◆ maxn_clusters_

double hcal::HcalWABVetoProcessor::maxn_clusters_ {0.}
private

Definition at line 56 of file HcalWABVetoProcessor.h.

56{0.};

◆ maxtotal_energy_compare_

double hcal::HcalWABVetoProcessor::maxtotal_energy_compare_ {1000.}
private

Definition at line 52 of file HcalWABVetoProcessor.h.

52{1000.};

◆ mintotal_energy_compare_

double hcal::HcalWABVetoProcessor::mintotal_energy_compare_ {0.}
private

Definition at line 54 of file HcalWABVetoProcessor.h.

54{0.};

◆ output_coll_name_

std::string hcal::HcalWABVetoProcessor::output_coll_name_
private

Definition at line 61 of file HcalWABVetoProcessor.h.


The documentation for this class was generated from the following files: