LDMX Software
Public Member Functions | Private Attributes | List of all members
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 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::string hitCollName_
 
std::string clusterCollName_
 

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 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.

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

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 hitCollName_ = ps.getParameter<std::string>("hitCollName");
14 clusterCollName_ = ps.getParameter<std::string>("clusterCollName");
15}

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

◆ 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 17 of file TrigEcalClusterProducer.cxx.

17 {
18 const ecal::EcalTriggerGeometry& geom =
19 getCondition<ecal::EcalTriggerGeometry>(
20 ecal::EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
21
22 if (!event.exists(hitCollName_)) return;
23 auto ecalTrigDigis{
24 event.getObject<ldmx::HgcrocTrigDigiCollection>(hitCollName_)};
25
26 std::vector<Hit> hits{};
27 ecalTpToE cvt;
28 for (const auto& trigDigi : ecalTrigDigis) {
29 ldmx::EcalTriggerID tid(trigDigi.getId());
30 float e = cvt.calc(trigDigi.linearPrimitive(), tid.layer());
31
32 // float sie = hgc_compression_factor_ * trigDigi.linearPrimitive() *
33 // gain_ * mVtoMeV_; // in MeV, before layer corrections
34 // float e = (sie / mipSiEnergy_ * layerWeights.at(tid.layer()) + sie) *
35 // secondOrderEnergyCorrection_;
36
37 double x, y, z;
38 // const auto center_ecalID = geom.centerInTriggerCell(tid);
39 // const ldmx::EcalGeometry& hexReadout = getCondition<ldmx::EcalGeometry>(
40 // ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
41 // hexReadout.getCellAbsolutePosition(center_ecalID,x,y,z);
42 // std::tie(x,y) = geom.globalPosition( tid );
43 std::tie(x, y, z) = geom.globalPosition(tid);
44
45 // produce Hit object for clustering class
46 Hit hit;
47 hit.e = e;
48 hit.x = x;
49 hit.y = y;
50 hit.z = z;
51 hit.layer = tid.layer();
52 hit.cell_id = tid.getTriggerCellID();
53 hit.module_id = tid.module();
54 hit.idx = hits.size();
55 hits.push_back(hit);
56 }
57
58 // move to once per run
59 ClusterGeometry myGeo;
60 if (!myGeo.is_initialized) {
61 for (int imod = 0; imod < 7; imod++) {
62 for (int icell = 0; icell < 48; icell++) {
63 ldmx::EcalTriggerID id(0, imod, icell);
64 auto [xx, yy, zz] = geom.globalPosition(id);
65 myGeo.AddTP(id.raw(), icell, imod, xx, yy);
66 }
67 }
68 myGeo.Initialize();
69 }
70 IdealClusterBuilder builder;
71 builder.SetClusterGeo(&myGeo);
72 for (const auto& h : hits) builder.AddHit(h);
73 // TODO: add options to configure the builder here
74 builder.BuildClusters();
75 auto clusters = builder.GetClusters();
76
77 TrigCaloClusterCollection trigClusters;
78 for (const auto& c : clusters) {
79 TrigCaloCluster t(c.x, c.y, c.z, c.e);
80 t.setXYZerr(c.xx, c.yy, c.zz);
81 t.setdxdz(c.dxdz);
82 t.setdydz(c.dydz);
83 t.setdxdze(c.dxdze);
84 t.setdydze(c.dydze);
85 t.set3D(!c.is2D);
86 t.setLayer(c.layer);
87 t.setFirstLayer(c.first_layer);
88 t.setLastLayer(c.last_layer);
89 t.setDepth(c.depth);
90 int nTP = 0;
91 if (c.is2D) {
92 nTP = c.hits.size();
93 } else {
94 for (const auto& c2d : c.clusters2d) nTP += c2d.hits.size();
95 }
96 t.setNTP(nTP);
97 trigClusters.push_back(t);
98 }
99
100 event.add(clusterCollName_, trigClusters);
101}
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.
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(), ldmx::EcalTriggerID::getTriggerCellID(), ecal::EcalTriggerGeometry::globalPosition(), ldmx::EcalTriggerID::layer(), and ldmx::EcalTriggerID::module().

Member Data Documentation

◆ clusterCollName_

std::string trigger::TrigEcalClusterProducer::clusterCollName_
private

Definition at line 38 of file TrigEcalClusterProducer.h.

◆ hitCollName_

std::string trigger::TrigEcalClusterProducer::hitCollName_
private

Definition at line 36 of file TrigEcalClusterProducer.h.


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