20 hgcroc_ = std::make_unique<ldmx::HgcrocEmulator>(hgcrocParams);
21 clockCycle_ = hgcrocParams.getParameter<
double>(
"clockCycle");
22 nADCs_ = hgcrocParams.getParameter<
int>(
"nADCs");
23 iSOI_ = hgcrocParams.getParameter<
int>(
"iSOI");
24 noise_ = hgcrocParams.getParameter<
bool>(
"noise");
35 MeV_ = ps.getParameter<
double>(
"MeV");
42 pedestal_ = ps.getParameter<
double>(
"avgPedestal");
43 noiseRMS_ = ps.getParameter<
double>(
"avgNoiseRMS");
80 std::set<unsigned int> filledDetIDs;
99 for (
auto const& simHit : ecalSimHits) {
100 std::vector<std::pair<double, double>> pulses_at_chip;
101 for (
int iContrib = 0; iContrib < simHit.getNumberOfContribs();
112 pulses_at_chip.emplace_back(
113 simHit.getContrib(iContrib).edep *
MeV_,
114 simHit.getContrib(iContrib).time
115 - simHit.getPosition().at(2) /
120 unsigned int hitID = simHit.getID();
121 filledDetIDs.insert(hitID);
123 ldmx_log(debug) <<
" Emulation of hitID = " << hitID
124 <<
" with energy = " << simHit.getEdep()
126 << simHit.getTime() -
127 simHit.getPosition().at(2) / 299.702547;
131 std::vector<ldmx::HgcrocDigiCollection::Sample> digiToAdd;
132 if (
hgcroc_->digitize(hitID, pulses_at_chip, digiToAdd)) {
133 ldmx_log(debug) <<
" --> The HGCROC will read-out this hit!";
134 ecalDigis.
addDigi(hitID, digiToAdd);
148 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
149 int nEcalLayers = geom.getNumLayers();
150 int nModulesPerLayer = geom.getNumModulesPerLayer();
151 int nCellsPerModule = geom.getNumCellsPerModule();
152 int numEmptyChannels = nEcalLayers * nModulesPerLayer * nCellsPerModule -
156 std::uniform_int_distribution<int> layer_dist(0, nEcalLayers - 1);
157 std::uniform_int_distribution<int> module_dist(0, nModulesPerLayer - 1);
158 std::uniform_int_distribution<int> cell_dist(0, nCellsPerModule - 1);
163 auto noiseHitAmplitudes{
165 std::vector<std::pair<double, double>> fake_pulse(1, {0., 0.});
166 for (
double noiseHit : noiseHitAmplitudes) {
169 unsigned int noiseID;
171 int layerID = layer_dist(
rng_);
172 int moduleID = module_dist(
rng_);
173 int cellID = cell_dist(
rng_);
175 noiseID = detID.raw();
176 }
while (filledDetIDs.find(noiseID) != filledDetIDs.end());
177 filledDetIDs.insert(noiseID);
183 (
hgcroc_->readoutThreshold(noiseID) -
hgcroc_->pedestal(noiseID));
186 ecalDigis.
addDigi(noiseID,
hgcroc_->noiseDigi(noiseID, noiseHit));
191 for (
int layer{0}; layer < nEcalLayers; layer++) {
192 for (
int module{0};
module < nModulesPerLayer;
module++) {
193 for (int cell{0}; cell < nCellsPerModule; cell++) {
196 if (filledDetIDs.find(channel) != filledDetIDs.end())
continue;
205 event.add(digiCollName_, ecalDigis);