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();
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;
std::vector< double > theBunchTimingOffsets
CSCBaseElectronicsSim(const edm::ParameterSet &p)
const CSCLayer * theLayer
const CSCChamberSpecs * theSpecs
CSCSignalMap theSignalMap
const CSCLayerGeometry * theLayerGeometry
void push_back(const T &t)
CSCDetId layerId() const
the CSCDetId corresponding to the current layer
float getPosition() const
__host__ __device__ std::uint32_t channelIndex(fedId_t fed, fedCh_t channel)
virtual float calculateAmpResponse(float t) const =0
Log< level::Error, false > LogError
CSCAnalogSignal amplifySignal(const CSCDetectorHit &)
virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine *)
void setLayer(const CSCLayer *layer)
CSCAnalogSignal theAmpResponse
Container::value_type value_type
std::vector< double > theSignalPropagationSpeed
edm::DetSet< StripDigiSimLink > DigiSimLinks
void superimpose(const CSCAnalogSignal &signal2)
virtual int readoutElement(int element) const =0
DetId geographicalId() const
The label of this GeomDet.
virtual void addLinks(int channelIndex)
DetectorHitMap theDetectorHitMap
constexpr uint32_t rawId() const
get the raw id
CSCAnalogSignal & find(int element, CLHEP::HepRandomEngine *)
DigiSimLinks theDigiSimLinks
void addNoise(CLHEP::HepRandomEngine *)
void simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits, CLHEP::HepRandomEngine *)
virtual void initParameters()=0
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
virtual float signalDelay(int element, float pos) const
def getElement(obj, name)
int getElement() const
constructor from time and amp shape
CSCAnalogSignal & add(const CSCAnalogSignal &, CLHEP::HepRandomEngine *)
virtual ~CSCBaseElectronicsSim()
virtual int channelIndex(int channel) const
lets users map channels to different indices for links