5#include "Framework/Exception/Exception.h"
10TrigScintRecHitProducer::TrigScintRecHitProducer(
const std::string &name,
12 : Producer(name, process) {}
14TrigScintRecHitProducer::~TrigScintRecHitProducer() {}
16void TrigScintRecHitProducer::configure(
21 mevPerMip_ = parameters.
getParameter<
double>(
"mev_per_mip");
22 pePerMip_ = parameters.
getParameter<
double>(
"pe_per_mip");
23 inputCollection_ = parameters.
getParameter<std::string>(
"input_collection");
24 inputPassName_ = parameters.
getParameter<std::string>(
"input_pass_name");
25 outputCollection_ = parameters.
getParameter<std::string>(
"output_collection");
27 sample_of_interest_ = parameters.
getParameter<
int>(
"sample_of_interest");
47 inputCollection_, inputPassName_)};
49 std::vector<ldmx::TrigScintHit> trigScintHits;
50 for (
const auto &digi : digis) {
52 auto adc{digi.getADC()};
53 auto tdc{digi.getTDC()};
61 qie.
ADC2Q(adc[sample_of_interest_]) +
62 qie.
ADC2Q(adc[sample_of_interest_ + 1]));
64 if (tdc[sample_of_interest_] > 49)
67 hit.
setTime(tdc[sample_of_interest_] * 0.5);
69 float integratedCharge = 0;
71 for (
const auto &adcVal : adc) {
72 integratedCharge += qie.
ADC2Q(adcVal);
74 uint nSamp = adc.size();
75 float pedSubtrQ = integratedCharge - nSamp * pedestal_;
76 hit.
setEnergy(pedSubtrQ * 6250. / gain_ * mevPerMip_ / pePerMip_);
77 hit.
setPE(pedSubtrQ * 6250. / gain_);
78 trigScintHits.push_back(hit);
83 event.add(outputCollection_, trigScintHits);
#define DECLARE_PRODUCER_NS(NS, CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Conditions object for random number seeds.
Class that builds recHits.
Implements an event buffer system for storing event data.
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 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].
void setPE(const float PE)
Set hit pe.
void setBarID(const int barID)
Set hit bar ID.
void setBeamEfrac(const float beamEfrac)
Set beam energy fraction of hit.
void setModuleID(const int moduleID)
Set hit module ID.
class for simulating QIE chip output
float ADC2Q(int ADC)
Converting ADC back to charge.
class for storing QIE output