15void TrigScintQIEDigiProducer::configure(
18 stripsPerArray_ = parameters.
getParameter<
int>(
"number_of_strips");
19 numberOfArrays_ = parameters.
getParameter<
int>(
"number_of_arrays");
20 meanNoise_ = parameters.
getParameter<
double>(
"mean_noise");
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");
30 toff_overall_ = parameters.
getParameter<
double>(
"toff_overall");
32 parameters.
getParameter<std::string>(
"input_pulse_shape");
35 elec_noise_ = parameters.
getParameter<
double>(
"elec_noise");
36 sipm_gain_ = parameters.
getParameter<
double>(
"sipm_gain");
38 zeroSuppCut_ = parameters.
getParameter<
double>(
"zeroSupp_in_pe");
40 if (input_pulse_shape_ ==
"Expo") {
41 pulse_params_.clear();
42 pulse_params_.push_back(parameters.
getParameter<
double>(
"expo_k"));
43 pulse_params_.push_back(parameters.
getParameter<
double>(
"expo_tmax"));
45 ldmx_log(debug) <<
"expo_k =" << pulse_params_[0];
46 ldmx_log(debug) <<
"expo_tmax =" << pulse_params_[1];
50 ldmx_log(debug) <<
"maxts_ =" << maxts_;
51 ldmx_log(debug) <<
"toff_overall_ =" << toff_overall_;
52 ldmx_log(debug) <<
"input_pulse_shape_ =" << input_pulse_shape_;
53 ldmx_log(debug) <<
"tdc_thr =" << tdc_thr_;
54 ldmx_log(debug) <<
"pedestal =" << pedestal_;
55 ldmx_log(debug) <<
"elec_noise =" << elec_noise_;
56 ldmx_log(debug) <<
"sipm_gain =" << sipm_gain_;
57 ldmx_log(debug) <<
"qie_sf =" << s_freq_;
58 ldmx_log(debug) <<
"zeroSupp_in_pe =" << zeroSuppCut_;
59 ldmx_log(debug) <<
"pe_per_mip =" << pePerMip_;
60 ldmx_log(debug) <<
"mev_per_mip =" << mevPerMip_;
65 if (random_.get() ==
nullptr) {
66 const auto& rseed = getCondition<framework::RandomNumberSeedService>(
68 const auto& rseed2 = getCondition<framework::RandomNumberSeedService>(
71 random_ = std::make_unique<TRandom3>(rseed.getSeed(outputCollection_));
75 smq_ =
new SimQIE(pedestal_, elec_noise_,
76 rseed2.getSeed(outputCollection_ +
"SimQIE"));
78 smq_->setGain(sipm_gain_);
79 smq_->setFreq(s_freq_);
80 smq_->setNTimeSamples(maxts_);
81 smq_->setTDCThreshold(tdc_thr_);
86 std::vector<float> TrueEdep(stripsPerArray_, 0.);
89 std::vector<Expo*> ex(stripsPerArray_,
nullptr);
90 for (
int i = 0; i < stripsPerArray_; i++) {
92 ex[i] =
new Expo(pulse_params_[0], pulse_params_[1]);
98 inputCollection_, inputPassName_)};
100 for (
const auto& simHit : simHits) {
103 ldmx_log(debug) <<
"Processing sim hit with bar ID: " <<
id.bar();
109 random_->Poisson(simHit.getEdep() / mevPerMip_ * pePerMip_);
113 ex[
id.bar()]->AddPulse(toff_overall_ + simHit.getTime(), PulseAmp);
116 TrueEdep[
id.bar()] += simHit.getEdep();
120 std::vector<trigscint::TrigScintQIEDigis> QDigis;
122 double TotalNoise = meanNoise_ * maxts_;
125 double SamplingTime = 1000 / s_freq_;
128 for (
int bar_id = 0; bar_id < stripsPerArray_; bar_id++) {
134 int n_noise_pulses = random_->Poisson(TotalNoise);
135 for (
int i = 0; i < n_noise_pulses; i++) {
136 ex[bar_id]->AddPulse(random_->Uniform(0, maxts_ * SamplingTime), 1);
140 if (smq_->PulseCut(ex[bar_id], zeroSuppCut_)) {
144 QIEInfo.
setADC(smq_->Out_ADC(ex[bar_id]));
145 QIEInfo.
setTDC(smq_->Out_TDC(ex[bar_id]));
146 QIEInfo.
setCID(smq_->CapID(ex[bar_id]));
148 QDigis.push_back(QIEInfo);
151 event.add(outputCollection_, QDigis);