10 : scaleByDose_(
false), NoiseMean_(0.0), NoiseStd_(1.0) {
23 .
template getParameter<std::vector<double>>(
"values");
78 const double NoiseMean,
79 const double NoiseStd) {
80 for (
size_t i = 0;
i < NoiseArrayLength_;
i++) {
81 for (
size_t j = 0;
j < samplesize_;
j++) {
82 GaussianNoiseArray_[
i][
j] = CLHEP::RandGaussQ::shoot(engine, NoiseMean, NoiseStd);
91 const std::unordered_set<DetId>& validIds,
93 CLHEP::HepRandomEngine* engine) {
98 if (NoiseGeneration_Method_ ==
true) {
99 if (RandNoiseGenerationFlag_ ==
false) {
100 GenerateGaussianNoise(engine, NoiseMean_, NoiseStd_);
101 RandNoiseGenerationFlag_ =
true;
105 runSimple(
digiColl, simData, theGeom, validIds, engine);
114 const std::unordered_set<DetId>& validIds,
115 CLHEP::HepRandomEngine* engine) {
123 std::array<double, samplesize_> cellNoiseArray;
124 for (
size_t i = 0;
i < samplesize_;
i++)
125 cellNoiseArray[
i] = 0.0;
127 for (
const auto&
id : validIds) {
128 chargeColl.fill(0.
f);
130 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
131 HGCCellInfo& cell = (simData.end() == it ? zeroData : it->second);
133 if (NoiseGeneration_Method_ ==
true) {
134 size_t hash_index = (CLHEP::RandFlat::shootInt(engine, (NoiseArrayLength_ - 1)) +
id) % NoiseArrayLength_;
136 cellNoiseArray = GaussianNoiseArray_[hash_index];
140 float cce(1.
f), noiseWidth(0.
f), lsbADC(-1.
f), maxADC(-1.
f);
142 uint32_t thrADC(std::floor(myFEelectronics_->getTargetMipValue() / 2));
143 uint32_t gainIdx = 0;
144 std::array<float, 6>&
adcPulse = myFEelectronics_->getDefaultADCPulse();
150 noiseWidth = siop.noise;
152 lsbADC = scalHFNose_.getLSBPerGain()[
gain];
153 maxADC = scalHFNose_.getMaxADCPerGain()[
gain];
156 if (thresholdFollowsMIP_)
157 thrADC = siop.thrADC;
161 noiseWidth = siop.noise;
163 lsbADC = scal_.getLSBPerGain()[
gain];
164 maxADC = scal_.getMaxADCPerGain()[
gain];
167 if (thresholdFollowsMIP_)
168 thrADC = siop.thrADC;
170 }
else if (noise_fC_[cell.
thickness - 1] != 0) {
174 cce = (cce_.empty() ? 1.f : cce_[cell.
thickness - 1]);
178 ? std::floor(cell.
thickness * cce * myFEelectronics_->getADCThreshold() / myFEelectronics_->getADClsb())
179 : std::floor(cell.
thickness * myFEelectronics_->getADCThreshold() / myFEelectronics_->getADClsb());
183 for (
size_t i = 0;
i < cell.
hit_info[0].size();
i++) {
193 if (NoiseGeneration_Method_ ==
true)
196 noise = CLHEP::RandGaussQ::shoot(engine, cellNoiseArray[
i], noiseWidth);
197 float totalCharge(rawCharge * cce +
noise);
198 if (totalCharge < 0.
f)
200 chargeColl[
i] = totalCharge;
204 DFr rawDataFrame(
id);
206 myFEelectronics_->runShaper(
207 rawDataFrame, chargeColl, toa,
adcPulse, engine, thrADC, lsbADC, gainIdx, maxADC,
thickness);
210 updateOutput(coll, rawDataFrame);
218 if (rawDataFrame.size() <= itIdx + 2)
221 DFr dataFrame(rawDataFrame.id());
226 if ((!rawDataFrame[itIdx].
threshold())) {
230 for (
int it = 0; it < 5; it++) {
231 dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
234 coll->push_back(dataFrame);