10#include "Ecal/EcalReconConditions.h"
11#include "Ecal/Event/EcalHit.h"
19 : Producer(name, process) {}
42 const auto& geometry = getCondition<ldmx::EcalGeometry>(
43 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
47 getCondition<conditions::DoubleTableCondition>(
50 std::vector<ldmx::EcalHit> ecalRecHits;
54 for (
auto digi : ecalDigis) {
60 auto [x, y, z] = geometry.getPosition(
id);
64 double timeRelClock25 = digi.soi().toa() * (
clock_cycle_ / 1024);
65 double hitTime = timeRelClock25;
84 charge = (digi.tot() - the_conditions.
totPedestal(
id)) *
107 charge = (digi.soi().adc_t() - the_conditions.
adcPedestal(
id)) *
126 if (charge < 0)
continue;
129 double energy_deposited_in_Si = num_mips_equivalent *
mip_si_energy_;
138 double reconstructed_energy =
139 (num_mips_equivalent *
142 + energy_deposited_in_Si
148 recHit.
setID(
id.raw());
156 ecalRecHits.push_back(recHit);
164 std::set<int> real_hits;
165 for (
auto const& sim_hit : ecalSimHits) real_hits.insert(sim_hit.getID());
166 for (
auto& hit : ecalRecHits)
167 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_NS(NS, 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.
std::string digiPassName_
Digi Pass Name to use as input.
std::vector< double > layerWeights_
Layer Weights to use for this reconstruction.
double mip_si_energy_
Energy [MeV] deposited by a MIP in Si 0.5mm thick.
virtual ~EcalRecProducer()
Destructor.
std::string digiCollName_
Digi Collection Name to use as input.
double charge_per_mip_
Number of electrons generated by average MIP in Si 0.5mm thick.
std::string recHitCollName_
output hit collection name
std::string simHitPassName_
simhit pass 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.
virtual void configure(framework::config::Parameters &)
Grabs configure parameters from the python config file.
double clock_cycle_
Length of clock cycle [ns].
std::string simHitCollName_
simhit collection name
double secondOrderEnergyCorrection_
Second Order Energy Correction to use for this reconstruction.
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
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.
T getParameter(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.