LDMX Software
ecal::EcalRecProducer Class Reference

Performs basic ECal reconstruction. More...

#include <EcalRecProducer.h>

Public Member Functions

 EcalRecProducer (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~EcalRecProducer ()=default
 Destructor.
 
virtual void configure (framework::config::Parameters &)
 Grabs configure parameters from the python config file.
 
virtual void produce (framework::Event &event)
 Produce EcalHits and put them into the event bus using the EcalDigis as input.
 
- 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 digi_coll_name_
 Digi Collection Name to use as input.
 
std::string digi_pass_name_
 Digi Pass Name to use as input.
 
std::string sim_hit_coll_name_
 simhit collection name
 
std::string sim_hit_pass_name_
 simhit pass name
 
std::string rec_hit_coll_name_
 output hit collection name
 
double mip_si_energy_
 Energy [MeV] deposited by a MIP in Si 0.5mm thick.
 
double clock_cycle_
 Length of clock cycle [ns].
 
double charge_per_mip_
 Number of electrons generated by average MIP in Si 0.5mm thick.
 
std::vector< double > layer_weights_
 Layer Weights to use for this reconstruction.
 
double second_order_energy_correction_
 Second Order Energy Correction to use for this reconstruction.
 

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

Performs basic ECal reconstruction.

Reconstruction is done from the EcalDigi samples. Some hard-coded parameters are used for position and energy calculation.

Definition at line 33 of file EcalRecProducer.h.

Constructor & Destructor Documentation

◆ EcalRecProducer()

ecal::EcalRecProducer::EcalRecProducer ( const std::string & name,
framework::Process & process )

Constructor.

Definition at line 17 of file EcalRecProducer.cxx.

19 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void ecal::EcalRecProducer::configure ( framework::config::Parameters & ps)
virtual

Grabs configure parameters from the python config file.

Reimplemented from framework::EventProcessor.

Definition at line 21 of file EcalRecProducer.cxx.

21 {
22 // collection names
23 digi_coll_name_ = ps.get<std::string>("digiCollName");
24 digi_pass_name_ = ps.get<std::string>("digiPassName");
25 sim_hit_coll_name_ = ps.get<std::string>("simHitCollName");
26 sim_hit_pass_name_ = ps.get<std::string>("simHitPassName");
27 rec_hit_coll_name_ = ps.get<std::string>("recHitCollName");
28
29 layer_weights_ = ps.get<std::vector<double>>("layerWeights");
31 ps.get<double>("secondOrderEnergyCorrection");
32
33 mip_si_energy_ = ps.get<double>("mip_si_energy");
34 clock_cycle_ = ps.get<double>("clock_cycle");
35 charge_per_mip_ = ps.get<double>("charge_per_mip");
36}
double mip_si_energy_
Energy [MeV] deposited by a MIP in Si 0.5mm thick.
std::string sim_hit_coll_name_
simhit collection name
std::vector< double > layer_weights_
Layer Weights to use for this reconstruction.
double second_order_energy_correction_
Second Order Energy Correction to use for this reconstruction.
double charge_per_mip_
Number of electrons generated by average MIP in Si 0.5mm thick.
std::string rec_hit_coll_name_
output hit collection name
std::string digi_pass_name_
Digi Pass Name to use as input.
double clock_cycle_
Length of clock cycle [ns].
std::string sim_hit_pass_name_
simhit pass name
std::string digi_coll_name_
Digi Collection Name to use as input.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References charge_per_mip_, clock_cycle_, digi_coll_name_, digi_pass_name_, framework::config::Parameters::get(), layer_weights_, mip_si_energy_, rec_hit_coll_name_, second_order_energy_correction_, sim_hit_coll_name_, and sim_hit_pass_name_.

◆ produce()

void ecal::EcalRecProducer::produce ( framework::Event & event)
virtual

Produce EcalHits and put them into the event bus using the EcalDigis as input.

This function unfolds the digi samples taken by the HGC ROC and reconstructs their energy using knowledge of how the chip operates and the position using EcalGeometry.

Negative Electron (charge) count This reconstruction error occurs when the ADC value is below the ADC pedestal for that channel. In the normal running mode, this will never happen because our front-end (the digi emulator or the digitizer itself) will suppress any signals that are below the readout threshold. Nevertheless, in some running modes, we don't have this zero suppression, so we need to check that the reconstruction charge (count of electrons) is non-negative.

Implements framework::Producer.

Definition at line 38 of file EcalRecProducer.cxx.

38 {
39 // Get the Ecal Geometry
40 const auto& geometry = getCondition<ldmx::EcalGeometry>(
41 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
42
43 // Get the reconstruction parameters
44 EcalReconConditions the_conditions(
47
48 std::vector<ldmx::EcalHit> ecal_rec_hits;
49 auto ecal_digis = event.getObject<ldmx::HgcrocDigiCollection>(
51 // loop through digis
52 for (auto digi : ecal_digis) {
53 // ID from first digi sample
54 // assuming rest of samples have same ID
55 ldmx::EcalID id(digi.id());
56
57 // ID to real space position
58 auto [x_, y_, z_] = geometry.getPosition(id);
59
60 // TOA is the time of arrival with respect to the 25ns clock window
61 // TODO what to do if hit NOT in first clock cycle?
62 double time_rel_clock25 = digi.soi().toa() * (clock_cycle_ / 1024); // ns
63 double hit_time = time_rel_clock25;
64
65 // get the estimated charge deposited from digi samples
66 double charge(0.);
67
68 ldmx_log(trace) << "Recon { "
69 // << "ID: " << id.raw() << ", "
70 << "TOA: " << hit_time << " ns } ";
71 if (digi.isTOT()) {
72 // TOT - number of clock ticks that pulse was over threshold
73 // this is related to the amplitude of the pulse approximately through a
74 // linear drain rate the amplitude of the pulse is related to the energy
75 // deposited
76
77 // convert the time over threshold into a total energy deposited in the
78 // silicon
79 // (time over threshold [ns] - pedestal) * gain
80 charge = (digi.tot() - the_conditions.totPedestal(id)) *
81 the_conditions.totGain(id);
82
83 ldmx_log(trace) << "TOT Mode -> " << digi.tot() << "TDC -> " << charge
84 << " fC";
85 } else {
86 // ADC mode of readout
87 // ADC - voltage measurement at a specific time of the pulse
88 // Pulse Shape:
89 // p[0]/(1.0+exp(p[1](t-p[2]+p[3]-p[4])))/(1.0+exp(p[5]*(t-p[6]+p[3]-p[4])))
90 // p[0] = amplitude to be fit (TBD)
91 // p[1] = -0.345 shape parameter - rate of up slope
92 // p[2] = 70.6547 shape parameter - time of up slope relative to shape
93 // fit p[3] = 77.732 shape parameter - time of peak relative to shape fit
94 // p[4] = peak time to be fit (TBD)
95 // p[5] = 0.140068 shape parameter - rate of down slope
96 // p[6] = 87.7649 shape paramter - time of down slope relative to shape
97 // fit
98 // These measurements can be used to fit the pulse shape if TOT is not
99 // available. For now, we simply take the measurement of the SOI as the
100 // peak amplitude.
101
102 charge = (digi.soi().adcT() - the_conditions.adcPedestal(id)) *
103 the_conditions.adcGain(id);
104
105 ldmx_log(trace) << "ADC Mode -> " << charge << " fC";
106 }
107
119 if (charge < 0) continue;
120
121 double num_mips_equivalent = charge / charge_per_mip_;
122 double energy_deposited_in_si = num_mips_equivalent * mip_si_energy_;
123
124 ldmx_log(trace) << " -> " << num_mips_equivalent << " equiv MIPs -> "
125 << energy_deposited_in_si << " MeV";
126
127 // incorporate layer_ weights
128 double reconstructed_energy =
129 (num_mips_equivalent *
131 id.layer()) // energy lost in non-sensitive layers
132 + energy_deposited_in_si // energy deposited in Si itself
133 ) *
135
136 // copy over information to rec hit structure in new collection
137 ldmx::EcalHit rec_hit;
138 rec_hit.setID(id.raw());
139 rec_hit.setXPos(x_);
140 rec_hit.setYPos(y_);
141 rec_hit.setZPos(z_);
142 rec_hit.setAmplitude(energy_deposited_in_si);
143 rec_hit.setEnergy(reconstructed_energy);
144 rec_hit.setTime(hit_time);
145
146 ecal_rec_hits.push_back(rec_hit);
147 }
148
150 // ecal sim hits_ exist ==> label which hits_ are real and which are pure
151 // noise
152 auto ecal_sim_hits{event.getCollection<ldmx::SimCalorimeterHit>(
154 std::set<int> real_hits;
155 for (auto const& sim_hit : ecal_sim_hits) real_hits.insert(sim_hit.getID());
156 for (auto& hit : ecal_rec_hits)
157 hit.setNoise(real_hits.find(hit.getID()) == real_hits.end());
158 }
159
160 // add collection to event bus
161 event.add(rec_hit_coll_name_, ecal_rec_hits);
162}
static const std::string CONDITIONS_NAME
the name of the EcalReconConditions table (must match python registration name)
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
void setYPos(float ypos)
Set the Y position of the hit [mm].
void setID(int id)
Set the detector ID.
void setZPos(float zpos)
Set the Z position of the hit [mm].
void setXPos(float xpos)
Set the X position of the hit [mm].
void setTime(float time)
Set the time of the hit [ns].
void setAmplitude(float amplitude)
Set the amplitude of the hit, which is proportional to the signal in the calorimeter cell without sam...
void setEnergy(float energy)
Set the calorimetric energy of the hit, corrected for sampling factors [MeV].
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 a collection of the digi hits readout by an HGCROC.
Stores simulated calorimeter hit information.

References ecal::EcalReconConditions::adcGain(), ecal::EcalReconConditions::adcPedestal(), charge_per_mip_, clock_cycle_, ecal::EcalReconConditions::CONDITIONS_NAME, digi_coll_name_, digi_pass_name_, framework::Event::exists(), framework::EventProcessor::getCondition(), layer_weights_, mip_si_energy_, rec_hit_coll_name_, second_order_energy_correction_, ldmx::CalorimeterHit::setAmplitude(), ldmx::CalorimeterHit::setEnergy(), ldmx::CalorimeterHit::setID(), ldmx::CalorimeterHit::setTime(), ldmx::CalorimeterHit::setXPos(), ldmx::CalorimeterHit::setYPos(), ldmx::CalorimeterHit::setZPos(), sim_hit_coll_name_, sim_hit_pass_name_, ecal::EcalReconConditions::totGain(), and ecal::EcalReconConditions::totPedestal().

Member Data Documentation

◆ charge_per_mip_

double ecal::EcalRecProducer::charge_per_mip_
private

Number of electrons generated by average MIP in Si 0.5mm thick.

Definition at line 83 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ clock_cycle_

double ecal::EcalRecProducer::clock_cycle_
private

Length of clock cycle [ns].

Definition at line 80 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ digi_coll_name_

std::string ecal::EcalRecProducer::digi_coll_name_
private

Digi Collection Name to use as input.

Definition at line 62 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ digi_pass_name_

std::string ecal::EcalRecProducer::digi_pass_name_
private

Digi Pass Name to use as input.

Definition at line 65 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ layer_weights_

std::vector<double> ecal::EcalRecProducer::layer_weights_
private

Layer Weights to use for this reconstruction.

Layer weights account for the energy lost in the absorber directly in front of the Silicon layer where the measured energy was deposited. These are determined by calculating the average amount of energy lost by a MIP passing through the extra material between sensitive layers.

Definition at line 93 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ mip_si_energy_

double ecal::EcalRecProducer::mip_si_energy_
private

Energy [MeV] deposited by a MIP in Si 0.5mm thick.

Definition at line 77 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ rec_hit_coll_name_

std::string ecal::EcalRecProducer::rec_hit_coll_name_
private

output hit collection name

Definition at line 74 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ second_order_energy_correction_

double ecal::EcalRecProducer::second_order_energy_correction_
private

Second Order Energy Correction to use for this reconstruction.

This is a shift applied to all of the energies in order to have the mean of the total energy deposited in the ECal be accurate. This is less physically motivated than the layer weights and is more of a calibration number.

Definition at line 103 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ sim_hit_coll_name_

std::string ecal::EcalRecProducer::sim_hit_coll_name_
private

simhit collection name

Definition at line 68 of file EcalRecProducer.h.

Referenced by configure(), and produce().

◆ sim_hit_pass_name_

std::string ecal::EcalRecProducer::sim_hit_pass_name_
private

simhit pass name

Definition at line 71 of file EcalRecProducer.h.

Referenced by configure(), and produce().


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