10#include "Ecal/EcalReconConditions.h"
11#include "Ecal/Event/EcalHit.h"
19 : Producer(name, process) {}
31 ps.
get<
double>(
"secondOrderEnergyCorrection");
41 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
48 std::vector<ldmx::EcalHit> ecal_rec_hits;
52 for (
auto digi : ecal_digis) {
58 auto [x_, y_, z_] = geometry.getPosition(
id);
62 double time_rel_clock25 = digi.soi().toa() * (
clock_cycle_ / 1024);
63 double hit_time = time_rel_clock25;
68 ldmx_log(trace) <<
"Recon { "
70 <<
"TOA: " << hit_time <<
" ns } ";
80 charge = (digi.tot() - the_conditions.
totPedestal(
id)) *
83 ldmx_log(trace) <<
"TOT Mode -> " << digi.tot() <<
"TDC -> " << charge
102 charge = (digi.soi().adcT() - the_conditions.
adcPedestal(
id)) *
105 ldmx_log(trace) <<
"ADC Mode -> " << charge <<
" fC";
119 if (charge < 0)
continue;
122 double energy_deposited_in_si = num_mips_equivalent *
mip_si_energy_;
124 ldmx_log(trace) <<
" -> " << num_mips_equivalent <<
" equiv MIPs -> "
125 << energy_deposited_in_si <<
" MeV";
128 double reconstructed_energy =
129 (num_mips_equivalent *
132 + energy_deposited_in_si
138 rec_hit.
setID(
id.raw());
146 ecal_rec_hits.push_back(rec_hit);
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());
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
Class that performs basic ECal digitization.
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
Class which stores simulated calorimeter hit information.
Performs basic ECal reconstruction.
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
EcalRecProducer(const std::string &name, framework::Process &process)
Constructor.
virtual void produce(framework::Event &event)
Produce EcalHits and put them into the event bus using the EcalDigis as input.
std::string digi_pass_name_
Digi Pass Name to use as input.
virtual void configure(framework::config::Parameters &)
Grabs configure parameters from the python config file.
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.
Class to wrap around an double table of conditions.
double adcPedestal(const ldmx::EcalID &id) const
get the ADC pedestal
double adcGain(const ldmx::EcalID &id) const
get the ADC gain
double totPedestal(const ldmx::EcalID &id) const
get the TOT pedestal
static const std::string CONDITIONS_NAME
the name of the EcalReconConditions table (must match python registration name)
double totGain(const ldmx::EcalID &id) const
get the TOT gain
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
Implements an event buffer system for storing event data.
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.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
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.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Represents a collection of the digi hits readout by an HGCROC.
Stores simulated calorimeter hit information.