3 #include "CLHEP/Units/GlobalPhysicalConstants.h"
10 #include "CLHEP/Random/RandGaussQ.h"
17 theLayerGeometry(nullptr),
22 theNoiseWasAdded(
false),
24 theShapingTime(
p.getParameter<
int>(
"shapingTime")),
25 thePeakTimeSigma(
p.getParameter<double>(
"peakTimeSigma")),
26 theBunchTimingOffsets(
p.getParameter<
std::vector<double>>(
"bunchTimingOffsets")),
27 theSignalStartTime(
p.getParameter<double>(
"signalStartTime")),
28 theSignalStopTime(
p.getParameter<double>(
"signalStopTime")),
29 theSamplingTime(
p.getParameter<double>(
"samplingTime")),
30 theNumberOfSamples(static_cast<
int>((theSignalStopTime - theSignalStartTime) / theSamplingTime)),
31 theOffsetOfBxZero(
p.getParameter<
int>(
"timeBitForBxZero")),
32 theSignalPropagationSpeed(
p.getParameter<
std::vector<double>>(
"signalSpeed")),
33 theTimingCalibrationError(
p.getParameter<
std::vector<double>>(
"timingCalibrationError")),
34 doNoise_(
p.getParameter<
bool>(
"doNoise")) {
41 const std::vector<CSCDetectorHit> &detectorHits,
42 CLHEP::HepRandomEngine *engine) {
54 size_t nHits = detectorHits.size();
56 for (
size_t i = 0;
i < nHits; ++
i) {
89 if (
i > 5 && ampBinValues[
i] < 0.000001)
92 ampBinValues.resize(
i);
95 LogTrace(
"CSCBaseElectronicsSim") <<
"CSCBaseElectronicsSim: dump of theAmpResponse follows...\n" <<
theAmpResponse;
106 thisSignal.setTimeOffset(readoutTime);
107 thisSignal.setElement(element);
132 if (element <= 0 || element >
nElements) {
133 LogTrace(
"CSCBaseElectronicsSim") <<
"CSCBaseElectronicsSim: bad element = " << element <<
". There are "
135 edm::LogError(
"Error in CSCBaseElectronicsSim: element out of bounds");
137 CSCSignalMap::iterator signalMapItr =
theSignalMap.find(element);
146 signalMapItr =
theSignalMap.insert(std::pair<int, CSCAnalogSignal>(element, newSignal)).first;
148 return (*signalMapItr).second;
168 std::pair<DetectorHitMap::iterator, DetectorHitMap::iterator> channelHitItr =
172 std::map<int, float> simTrackChargeMap;
173 std::map<int, EncodedEventId> eventIdMap;
174 float totalCharge = 0;
175 for (DetectorHitMap::iterator hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr) {
176 const PSimHit *
hit = hitItr->second.getSimHit();
178 if (
hit !=
nullptr) {
179 int simTrackId = hitItr->second.getSimHit()->trackId();
180 float charge = hitItr->second.getCharge();
181 std::map<int, float>::iterator chargeItr = simTrackChargeMap.find(simTrackId);
182 if (chargeItr == simTrackChargeMap.end()) {
183 simTrackChargeMap[simTrackId] =
charge;
184 eventIdMap[simTrackId] =
hit->eventId();
186 chargeItr->second +=
charge;
192 for (std::map<int, float>::iterator chargeItr = simTrackChargeMap.begin(); chargeItr != simTrackChargeMap.end();
194 int simTrackId = chargeItr->first;