20 : Producer(name, process) {}
24 maxtotalEnergyCompare_ =
25 parameters.
getParameter<
double>(
"max_total_energy_compare");
26 mintotalEnergyCompare_ =
27 parameters.
getParameter<
double>(
"min_total_energy_compare");
28 maxnClusters_ = parameters.
getParameter<
double>(
"n_clusters");
29 maxMeanHitsPerCluster_ =
30 parameters.
getParameter<
double>(
"mean_hits_per_cluster");
31 maxMeanEnergyPerCluster_ =
32 parameters.
getParameter<
double>(
"mean_energy_per_cluster");
33 outputCollName_ = parameters.
getParameter<std::string>(
"outputCollName");
34 inputHCALClusterCollName_ =
35 parameters.
getParameter<std::string>(
"inputHCALClusterCollName");
36 inputHCALHitCollName_ =
37 parameters.
getParameter<std::string>(
"inputHCALHitCollName");
38 inputECALHitCollName_ =
39 parameters.
getParameter<std::string>(
"inputECALHitCollName");
45 const std::vector<ldmx::HcalHit> hcalRecHits =
48 const std::vector<ldmx::EcalHit> ecalRecHits =
51 const std::vector<ldmx::HcalCluster> hcalClusters =
56 float totalHCALEnergy{0};
57 float totalECALEnergy{0};
61 if (hcalHit.isNoise() == 0) {
62 totalHCALEnergy += hcalHit.
getPE();
66 if (maxPE < hcalHit.getPE()) {
67 maxPE = hcalHit.getPE();
73 if (ecalHit.isNoise() == 0) {
77 std::vector<double> nhits;
78 std::vector<double> energies;
79 unsigned int nClusters = 0;
82 energies.push_back(hcalCluster.getEnergy());
83 nhits.push_back(hcalCluster.getNHits());
87 std::accumulate(energies.begin(), energies.end(), 0.0) / energies.size();
89 std::accumulate(nhits.begin(), nhits.end(), 0.0) / nhits.size();
90 bool passesEnergyCombo =
91 (((totalECALEnergy + totalHCALEnergy) < maxtotalEnergyCompare_));
92 bool passesnClusters = (nClusters < maxnClusters_);
93 bool passesNHits = ((meanNhits < maxMeanHitsPerCluster_) or isnan(meanNhits));
95 ((meanEnergy < maxMeanEnergyPerCluster_) or isnan(meanEnergy));
99 (passesEnergyCombo and passesnClusters and passesNHits and passesEnergy);
111 event.add(outputCollName_, result);
#define DECLARE_PRODUCER_NS(NS, CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that defines an HCal sensitive detector.
Processor that determines if an event is vetoed by the Hcal.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module.
Implements an event buffer system for storing event data.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
void configure(framework::config::Parameters ¶meters) 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 Hca...
HcalWABVetoProcessor(const std::string &name, framework::Process &process)
Constructor.
float getEnergy() const
Get the calorimetric energy of the hit, corrected for sampling factors [MeV].
Stores reconstructed hit information from the ECAL.
Stores cluster information from the HCal.
Stores reconstructed hit information from the HCAL.
float getPE() const
Get the number of photoelectrons estimated for this hit.
void setVetoResult(const bool &passesVeto=true)
Sets whether the Hcal veto was passed or not.
void setMaxPEHit(const ldmx::HcalHit maxPEHit)
Set the maximum PE hit.
constexpr StorageControl::Hint hint_shouldKeep
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint hint_shouldDrop
storage control hint alias for backwards compatibility