LDMX Software
Public Member Functions | Private Attributes | List of all members
recon::TriggerProcessor Class Reference

Provides a trigger decision for recon using a TriggerResult object. More...

#include <TriggerProcessor.h>

Public Member Functions

 TriggerProcessor (const std::string &name, framework::Process &process)
 Class constructor.
 
virtual ~TriggerProcessor ()
 Class 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 trigger algorithm and create a TriggerResult object to contain info about the trigger decision such as pass/fail, number of saved variables, etc.
 
- 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

std::vector< double > layerESumCuts_
 The energy sum to make cut on.
 
double beamEnergy_
 The Beam energy [MeV].
 
int mode_ {0}
 The trigger mode to run in.
 
int startLayer_ {0}
 The first layer of layer sum.
 
int endLayer_ {0}
 The endpoint layer of layer sum.
 
TString algoName_
 The name of the trigger algorithm used.
 
std::string inputColl_
 The name of the input collection (the Ecal hits).
 
std::string inputPass_
 The pass name of the input (the Ecal hits).
 
std::string outputColl_
 The name of the output collection (the trigger decision).
 

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

Provides a trigger decision for recon using a TriggerResult object.

Note
TriggerProcessor takes in a set of parameters to be used in defining the trigger algorithm. An event is passed to the processor and the relevant algorithms are then run on the event (ECAL layer sum). A trigger decision is executed and the decision along with the algorithm name and relevant variables are stored in a TriggerResult object which is added to the collection.

Definition at line 32 of file TriggerProcessor.h.

Constructor & Destructor Documentation

◆ TriggerProcessor()

recon::TriggerProcessor::TriggerProcessor ( const std::string &  name,
framework::Process process 
)
inline

Class constructor.

Definition at line 37 of file TriggerProcessor.h.

38 : framework::Producer(name, process) {}
Base class for a module which produces a data product.

◆ ~TriggerProcessor()

virtual recon::TriggerProcessor::~TriggerProcessor ( )
inlinevirtual

Class destructor.

Definition at line 43 of file TriggerProcessor.h.

43{}

Member Function Documentation

◆ configure()

void recon::TriggerProcessor::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 8 of file TriggerProcessor.cxx.

8 {
9 layerESumCuts_ = parameters.getParameter<std::vector<double>>("thresholds");
10 beamEnergy_ = parameters.getParameter<double>("beamEnergy");
11 mode_ = parameters.getParameter<int>("mode");
12 startLayer_ = parameters.getParameter<int>("start_layer");
13 endLayer_ = parameters.getParameter<int>("end_layer");
14 inputColl_ = parameters.getParameter<std::string>("input_collection");
15 inputPass_ = parameters.getParameter<std::string>("input_pass");
16 outputColl_ = parameters.getParameter<std::string>("trigger_collection");
17
18 if (mode_ == 0) {
19 algoName_ = "LayerSumTrig";
20 } else if (mode_ == 1) {
21 algoName_ = "CenterTower";
22 }
23}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
std::string inputPass_
The pass name of the input (the Ecal hits).
int startLayer_
The first layer of layer sum.
std::string outputColl_
The name of the output collection (the trigger decision).
int mode_
The trigger mode to run in.
std::string inputColl_
The name of the input collection (the Ecal hits).
std::vector< double > layerESumCuts_
The energy sum to make cut on.
TString algoName_
The name of the trigger algorithm used.
double beamEnergy_
The Beam energy [MeV].
int endLayer_
The endpoint layer of layer sum.

References algoName_, beamEnergy_, endLayer_, framework::config::Parameters::getParameter(), inputColl_, inputPass_, layerESumCuts_, mode_, outputColl_, and startLayer_.

◆ produce()

void recon::TriggerProcessor::produce ( framework::Event event)
overridevirtual

Run the trigger algorithm and create a TriggerResult object to contain info about the trigger decision such as pass/fail, number of saved variables, etc.

param event The event to run trigger algorithm on.

Grab the Ecal hit collection for the given event

There are three scenarios:

  1. No Incoming Electrons - If the electron count is 0 or negative (undetermined), then we set the sum-energy cut to zero so the event always fails.
  2. Num Electrons Listed in Thresholds - Pull cut from list
  3. More electrons than listed - Set threshold as 'threshold_for_1e + nExtraElectrons*beamEnergy' Note that the "overflow" formula here is too naive. It should be a fct( nElectrons, 1e_thr, beamE), taking how sigma evolves with multiplicity into account. a simple scaling might suffice there too assuming energy cuts are listed as [ Ecut_1e, Ecut_2e, ... ]

Loop over all ecal hits in the given event

Implements framework::Producer.

Definition at line 25 of file TriggerProcessor.cxx.

25 {
27 const std::vector<ldmx::EcalHit> ecalRecHits =
28 event.getCollection<ldmx::EcalHit>(inputColl_, inputPass_);
29
30 // number of electrons in this event
31 const int nElectrons{event.getElectronCount()};
32
48 double layerESumCut{0.};
49 if (nElectrons <= 0)
50 layerESumCut = 0.; // always fail if no electrons
51 else if (nElectrons <= layerESumCuts_.size())
52 layerESumCut = layerESumCuts_.at(nElectrons - 1);
53 else
54 layerESumCut = layerESumCuts_.at(0) + (nElectrons - 1) * beamEnergy_;
55
56 ldmx_log(debug) << "Got trigger energy cut " << layerESumCut << " for "
57 << nElectrons << " electrons counted in the event.";
58
59 std::vector<double> layerDigiE(100, 0.0); // big empty vector..
60
62 for (const ldmx::EcalHit& hit : ecalRecHits) {
63 ldmx::EcalID id(hit.getID());
64 if (id.layer() < layerDigiE.size()) { // just to be safe...
65 if (mode_ == 0) { // Sum over all cells in a given layer
66 layerDigiE[id.layer()] += hit.getEnergy();
67 } else if (mode_ == 1) { // Sum over cells in central tower only
68 // std::pair<float, float> xyPos =
69 // hit->getCellCentroidXYPair(hit->getID()); float cellRadius =
70 // sqrt(pow(xyPos.first, 2) + pow(xyPos.second, 2)); if (cellRadius <
71 // MAGICNUMBERHERE) {
72 // layerDigiE[hit->getLayer()] += hit->getEnergy();
73 //}
74 }
75 }
76 }
77
78 float layerSum = 0;
79 bool pass = false;
80
81 for (int iL = startLayer_; iL < endLayer_; ++iL) {
82 layerSum += layerDigiE[iL];
83 }
84
85 pass = (layerSum <= layerESumCut);
86 ldmx_log(debug) << "Got trigger energy sum " << layerSum
87 << "; and decision is pass = " << pass;
88
90 result.set(algoName_, pass, 4);
91 result.setAlgoVar(0, layerSum);
92 result.setAlgoVar(1, layerESumCut);
93 result.setAlgoVar(2, endLayer_ - startLayer_);
94 result.setAlgoVar(3, nElectrons);
95
96 event.add(outputColl_, result);
97
98 // mark the event
99 if (pass)
101 else
103}
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
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Represents the trigger decision (pass/fail) for reconstruction.
void set(const TString &name, bool pass, int nvar)
Set name and pass of trigger.
void setAlgoVar(int element, double value)
Set an algorithm variable.
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 algoName_, beamEnergy_, endLayer_, framework::hint_shouldDrop, framework::hint_shouldKeep, inputColl_, inputPass_, layerESumCuts_, mode_, outputColl_, ldmx::TriggerResult::set(), ldmx::TriggerResult::setAlgoVar(), framework::EventProcessor::setStorageHint(), and startLayer_.

Member Data Documentation

◆ algoName_

TString recon::TriggerProcessor::algoName_
private

The name of the trigger algorithm used.

Definition at line 87 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ beamEnergy_

double recon::TriggerProcessor::beamEnergy_
private

The Beam energy [MeV].

Definition at line 66 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ endLayer_

int recon::TriggerProcessor::endLayer_ {0}
private

The endpoint layer of layer sum.

not inclusive - i.e. this is the last layer that is included in the layer sum.

Definition at line 84 of file TriggerProcessor.h.

84{0};

Referenced by configure(), and produce().

◆ inputColl_

std::string recon::TriggerProcessor::inputColl_
private

The name of the input collection (the Ecal hits).

Definition at line 90 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ inputPass_

std::string recon::TriggerProcessor::inputPass_
private

The pass name of the input (the Ecal hits).

Definition at line 93 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ layerESumCuts_

std::vector<double> recon::TriggerProcessor::layerESumCuts_
private

The energy sum to make cut on.

Definition at line 63 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ mode_

int recon::TriggerProcessor::mode_ {0}
private

The trigger mode to run in.

Mode zero sums over all cells in layer, while in mode 1 only cells in center module are summed over. (TODO)

Definition at line 73 of file TriggerProcessor.h.

73{0};

Referenced by configure(), and produce().

◆ outputColl_

std::string recon::TriggerProcessor::outputColl_
private

The name of the output collection (the trigger decision).

Definition at line 96 of file TriggerProcessor.h.

Referenced by configure(), and produce().

◆ startLayer_

int recon::TriggerProcessor::startLayer_ {0}
private

The first layer of layer sum.

Definition at line 76 of file TriggerProcessor.h.

76{0};

Referenced by configure(), and produce().


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