LDMX Software
trigger::TrigEcalClusterProducer Class Reference

Public Member Functions

 TrigEcalClusterProducer (const std::string &name, framework::Process &process)
 
virtual void configure (framework::config::Parameters &ps)
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
virtual void produce (framework::Event &event)
 Process the event and put new data products into it.
 
- 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

std::string hit_coll_name_
 
std::string cluster_coll_name_
 
std::string hit_coll_passname_
 
std::string hit_coll_name_events_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 25 of file TrigEcalClusterProducer.h.

Constructor & Destructor Documentation

◆ TrigEcalClusterProducer()

trigger::TrigEcalClusterProducer::TrigEcalClusterProducer ( const std::string & name,
framework::Process & process )
inline

Definition at line 27 of file TrigEcalClusterProducer.h.

Base class for a module which produces a data product.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void trigger::TrigEcalClusterProducer::configure ( framework::config::Parameters & parameters)
virtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 12 of file TrigEcalClusterProducer.cxx.

12 {
13 hit_coll_name_ = ps.get<std::string>("hitCollName");
14 cluster_coll_name_ = ps.get<std::string>("clusterCollName");
15 hit_coll_passname_ = ps.get<std::string>("hit_coll_passname");
16 hit_coll_name_events_passname_ =
17 ps.get<std::string>("hit_coll_name_events_passname");
18}

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

◆ produce()

void trigger::TrigEcalClusterProducer::produce ( framework::Event & event)
virtual

Process the event and put new data products into it.

Parameters
eventThe Event to process.

Implements framework::Producer.

Definition at line 20 of file TrigEcalClusterProducer.cxx.

20 {
21 const ecal::EcalTriggerGeometry& geom =
23 ecal::EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
24
25 if (!event.exists(hit_coll_name_, hit_coll_name_events_passname_)) return;
26 auto ecal_trig_digis{event.getObject<ldmx::HgcrocTrigDigiCollection>(
27 hit_coll_name_, hit_coll_passname_)};
28
29 std::vector<Hit> hits{};
30 EcalTpToE cvt;
31 for (const auto& trig_digi : ecal_trig_digis) {
32 ldmx::EcalTriggerID tid(trig_digi.getId());
33 float e = cvt.calc(trig_digi.linearPrimitive(), tid.layer());
34
35 // float sie = hgc_compression_factor_ * trigDigi.linearPrimitive() *
36 // gain_ * m_vto_me_v_; // in MeV, before layer corrections
37 // float e = (sie / mip_si_energy_ * layerWeights.at(tid.layer()) + sie) *
38 // second_order_energy_correction_;
39
40 double x, y, z;
41 // const auto center_ecalID = geom.centerInTriggerCell(tid);
42 // const ldmx::EcalGeometry& hexReadout = getCondition<ldmx::EcalGeometry>(
43 // ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
44 // hexReadout.getCellAbsolutePosition(center_ecalID,x,y,z);
45 // std::tie(x,y) = geom.globalPosition( tid );
46 std::tie(x, y, z) = geom.globalPosition(tid);
47
48 // produce Hit object for clustering class
49 Hit hit;
50 hit.e_ = e;
51 hit.x_ = x;
52 hit.y_ = y;
53 hit.z_ = z;
54 hit.layer_ = tid.layer();
55 hit.cell_id_ = tid.getTriggerCellID();
56 hit.module_id_ = tid.module();
57 hit.idx_ = hits.size();
58 hits.push_back(hit);
59 }
60
61 // move to once per run
62 ClusterGeometry my_geo;
63 if (!my_geo.is_initialized_) {
64 for (int imod = 0; imod < 7; imod++) {
65 for (int icell = 0; icell < 48; icell++) {
66 ldmx::EcalTriggerID id(0, imod, icell);
67 auto [xx, yy, zz] = geom.globalPosition(id);
68 my_geo.addTp(id.raw(), icell, imod, xx, yy);
69 }
70 }
71 my_geo.initialize();
72 }
73 IdealClusterBuilder builder;
74 builder.setClusterGeo(&my_geo);
75 for (const auto& h : hits) builder.addHit(h);
76 // TODO: add options to configure the builder here
77 builder.buildClusters();
78 auto clusters = builder.getClusters();
79
80 TrigCaloClusterCollection trig_clusters;
81 for (const auto& c : clusters) {
82 TrigCaloCluster t(c.x_, c.y_, c.z_, c.e_);
83 t.setXYZerr(c.xx_, c.yy_, c.zz_);
84 t.setdxdz(c.dxdz_);
85 t.setdydz(c.dydz_);
86 t.setdxdze(c.dxdze_);
87 t.setdydze(c.dydze_);
88 t.set3D(!c.is_2d_);
89 t.setLayer(c.layer_);
90 t.setFirstLayer(c.first_layer_);
91 t.setLastLayer(c.last_layer_);
92 t.setDepth(c.depth_);
93 int n_tp = 0;
94 if (c.is_2d_) {
95 n_tp = c.hits_.size();
96 } else {
97 for (const auto& c2d : c.clusters2d_) n_tp += c2d.hits_.size();
98 }
99 t.setNTP(n_tp);
100 trig_clusters.push_back(t);
101 }
102
103 event.add(cluster_coll_name_, trig_clusters);
104}
defines the relationship between precision cells and trigger cells and provides geometry information ...
std::tuple< double, double, double > globalPosition(ldmx::EcalTriggerID triggerCell) const
Returns the center of the given trigger cell in world coordinates.
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:92
Extension of DetectorID providing access to ECal trigger cell information.
Definition objdef.h:49

References framework::Event::exists(), framework::EventProcessor::getCondition(), ldmx::EcalTriggerID::getTriggerCellID(), ecal::EcalTriggerGeometry::globalPosition(), ldmx::EcalTriggerID::layer(), and ldmx::EcalTriggerID::module().

Member Data Documentation

◆ cluster_coll_name_

std::string trigger::TrigEcalClusterProducer::cluster_coll_name_
private

Definition at line 38 of file TrigEcalClusterProducer.h.

◆ hit_coll_name_

std::string trigger::TrigEcalClusterProducer::hit_coll_name_
private

Definition at line 36 of file TrigEcalClusterProducer.h.

◆ hit_coll_name_events_passname_

std::string trigger::TrigEcalClusterProducer::hit_coll_name_events_passname_
private

Definition at line 41 of file TrigEcalClusterProducer.h.

◆ hit_coll_passname_

std::string trigger::TrigEcalClusterProducer::hit_coll_passname_
private

Definition at line 40 of file TrigEcalClusterProducer.h.


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