LDMX Software
Public Member Functions | Private Attributes | List of all members
hcal::HcalVetoProcessor Class Reference

Public Member Functions

 HcalVetoProcessor (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~HcalVetoProcessor ()=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 beforeNewRun (ldmx::RunHeader &header)
 Handle allowing producers to modify run headers before the run begins.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 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 totalPEThreshold_ {5}
 Total PE threshold.
 
float maxTime_ {50}
 Maximum hit time that should be considered by the veto.
 
float backMinPE_ {1}
 The minimum number of PE in both bars needed for a hit to be considered in double ended readout mode.
 
ldmx::HcalHit defaultMaxHit_
 
std::string outputCollName_
 
std::string inputHitCollName_
 
std::string inputHitPassName_
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Producer
static const int CLASSTYPE {1}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 25 of file HcalVetoProcessor.h.

Constructor & Destructor Documentation

◆ HcalVetoProcessor()

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

Constructor.

Definition at line 16 of file HcalVetoProcessor.cxx.

18 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.

Member Function Documentation

◆ configure()

void hcal::HcalVetoProcessor::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 20 of file HcalVetoProcessor.cxx.

20 {
21 totalPEThreshold_ = parameters.getParameter<double>("pe_threshold");
22 maxTime_ = parameters.getParameter<double>("max_time");
23 outputCollName_ = parameters.getParameter<std::string>("output_coll_name");
24 inputHitCollName_ =
25 parameters.getParameter<std::string>("input_hit_coll_name");
26 inputHitPassName_ =
27 parameters.getParameter<std::string>("input_hit_pass_name");
28 // A fake-hit that gets added for the rare case where no hit actually reaches
29 // the maxPE < pe check to avoid producing uninitialized memory
30 //
31 // Default constructed hits have nonsense-but predictable values and are
32 // harder to mistake for real hits
33 defaultMaxHit_.Clear();
34 defaultMaxHit_.setPE(-9999);
35 defaultMaxHit_.setMinPE(-9999);
36 defaultMaxHit_.setSection(-9999);
37 defaultMaxHit_.setLayer(-9999);
38 defaultMaxHit_.setStrip(-9999);
39 defaultMaxHit_.setEnd(-999);
40 defaultMaxHit_.setTimeDiff(-9999);
41 defaultMaxHit_.setToaPos(-9999);
42 defaultMaxHit_.setToaNeg(-9999);
43 defaultMaxHit_.setAmplitudePos(-9999);
44 defaultMaxHit_.setAmplitudeNeg(-9999);
45
46 double maxDepth_ = parameters.getParameter<double>("max_depth", 0.);
47 if (maxDepth_ != 0.) {
48 EXCEPTION_RAISE(
49 "InvalidParam",
50 "Earlier versions of the Hcal veto defined a max depth for "
51 "positions which is no longer implemented. Remove the "
52 "parameter (max_depth) from your configuration. See "
53 "https://github.com/LDMX-Software/Hcal/issues/61 for details");
54 }
55 backMinPE_ = parameters.getParameter<double>("back_min_pe");
56}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
float maxTime_
Maximum hit time that should be considered by the veto.
float backMinPE_
The minimum number of PE in both bars needed for a hit to be considered in double ended readout mode.
double totalPEThreshold_
Total PE threshold.
void setSection(int section)
Set the section for this hit.
Definition HcalHit.h:132
void Clear()
Clear the data in the object.
Definition HcalHit.cxx:9
void setEnd(int end)
Set the end (0 neg, 1 pos side).
Definition HcalHit.h:150
void setToaNeg(double toaNeg)
Set toa of the negative end.
Definition HcalHit.h:174
void setTimeDiff(double timeDiff)
Set time difference (uncorrected)
Definition HcalHit.h:162
void setMinPE(float minpe)
Set the minimum number of photoelectrons estimated for this hit.
Definition HcalHit.h:126
void setToaPos(double toaPos)
Set toa of the positive end.
Definition HcalHit.h:168
void setAmplitudeNeg(double amplitudeNeg)
Set amplitude of the negative end.
Definition HcalHit.h:186
void setStrip(int strip)
Set the strip for this hit.
Definition HcalHit.h:144
void setAmplitudePos(double amplitudePos)
Set amplitude of the positive end.
Definition HcalHit.h:180
void setLayer(int layer)
Set the layer for this hit.
Definition HcalHit.h:138
void setPE(float pe)
Set the number of photoelectrons estimated for this hit.
Definition HcalHit.h:119

References backMinPE_, ldmx::HcalHit::Clear(), framework::config::Parameters::getParameter(), maxTime_, ldmx::HcalHit::setAmplitudeNeg(), ldmx::HcalHit::setAmplitudePos(), ldmx::HcalHit::setEnd(), ldmx::HcalHit::setLayer(), ldmx::HcalHit::setMinPE(), ldmx::HcalHit::setPE(), ldmx::HcalHit::setSection(), ldmx::HcalHit::setStrip(), ldmx::HcalHit::setTimeDiff(), ldmx::HcalHit::setToaNeg(), ldmx::HcalHit::setToaPos(), and totalPEThreshold_.

◆ produce()

void hcal::HcalVetoProcessor::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 58 of file HcalVetoProcessor.cxx.

58 {
59 // Get the collection of sim particles from the event
60 const std::vector<ldmx::HcalHit> hcalRecHits =
61 event.getCollection<ldmx::HcalHit>(inputHitCollName_, inputHitPassName_);
62
63 // Loop over all of the Hcal hits and calculate to total photoelectrons
64 // in the event.
65 [[maybe_unused]] float totalPe{0};
66 float maxPE{-1000};
67
68 const ldmx::HcalHit *maxPEHit{&defaultMaxHit_};
69 for (const ldmx::HcalHit &hcalHit : hcalRecHits) {
70 // If the hit time is outside the readout window, don't consider it.
71 if (hcalHit.getTime() >= maxTime_) {
72 continue;
73 }
74
75 // Get the total PE in the bar
76 float pe = hcalHit.getPE();
77
78 // Keep track of the total PE
79 // TODO: This is currently not used anywhere
80 totalPe += pe;
81
82 // Check that both sides of the bar have a PE value above threshold.
83 // If not, don't consider the hit. Double sided readout is only
84 // being used for the back HCal bars. For the side HCal, just
85 // use the maximum PE as before.
86 ldmx::HcalID id(hcalHit.getID());
87 if ((id.section() == ldmx::HcalID::BACK) &&
88 (hcalHit.getMinPE() < backMinPE_))
89 continue;
90
91 // Find the maximum PE in the list
92 if (maxPE < pe) {
93 maxPE = pe;
94 maxPEHit = &hcalHit;
95 }
96 }
97
98 // If the maximum PE found is below threshold, it passes the veto.
99 bool passesVeto = (maxPE < totalPEThreshold_);
100
102 result.setVetoResult(passesVeto);
103 result.setMaxPEHit(*maxPEHit);
104
105 if (passesVeto) {
107 } else {
109 }
110
111 event.add(outputCollName_, result);
112}
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 HCAL.
Definition HcalHit.h:23
float getPE() const
Get the number of photoelectrons estimated for this hit.
Definition HcalHit.h:50
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
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

References backMinPE_, ldmx::HcalHit::getPE(), framework::hint_shouldDrop, framework::hint_shouldKeep, maxTime_, ldmx::HcalVetoResult::setMaxPEHit(), framework::EventProcessor::setStorageHint(), ldmx::HcalVetoResult::setVetoResult(), and totalPEThreshold_.

Member Data Documentation

◆ backMinPE_

float hcal::HcalVetoProcessor::backMinPE_ {1}
private

The minimum number of PE in both bars needed for a hit to be considered in double ended readout mode.

Definition at line 57 of file HcalVetoProcessor.h.

57{1};

Referenced by configure(), and produce().

◆ defaultMaxHit_

ldmx::HcalHit hcal::HcalVetoProcessor::defaultMaxHit_
private

Definition at line 74 of file HcalVetoProcessor.h.

◆ inputHitCollName_

std::string hcal::HcalVetoProcessor::inputHitCollName_
private

Definition at line 77 of file HcalVetoProcessor.h.

◆ inputHitPassName_

std::string hcal::HcalVetoProcessor::inputHitPassName_
private

Definition at line 78 of file HcalVetoProcessor.h.

◆ maxTime_

float hcal::HcalVetoProcessor::maxTime_ {50}
private

Maximum hit time that should be considered by the veto.

Definition at line 53 of file HcalVetoProcessor.h.

53{50}; // ns

Referenced by configure(), and produce().

◆ outputCollName_

std::string hcal::HcalVetoProcessor::outputCollName_
private

Definition at line 76 of file HcalVetoProcessor.h.

◆ totalPEThreshold_

double hcal::HcalVetoProcessor::totalPEThreshold_ {5}
private

Total PE threshold.

Definition at line 50 of file HcalVetoProcessor.h.

50{5};

Referenced by configure(), and produce().


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