File indexing completed on 2024-04-06 12:30:41
0001 #ifndef MU_END_BASE_ELECTRONICS_SIM_H
0002 #define MU_END_BASE_ELECTRONICS_SIM_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "SimMuon/CSCDigitizer/src/CSCAnalogSignal.h"
0018 #include <map>
0019 #include <vector>
0020
0021 #include "DataFormats/Common/interface/DetSet.h"
0022 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
0023
0024
0025 class CSCLayer;
0026 class CSCChamberSpecs;
0027 class CSCDetectorHit;
0028 class CSCLayerGeometry;
0029 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0030 class DetId;
0031 class PSimHit;
0032
0033 namespace CLHEP {
0034 class HepRandomEngine;
0035 }
0036
0037 class CSCBaseElectronicsSim {
0038 public:
0039 typedef std::map<int, CSCAnalogSignal, std::less<int>> CSCSignalMap;
0040 typedef edm::DetSet<StripDigiSimLink> DigiSimLinks;
0041
0042
0043
0044 void simulate(const CSCLayer *layer, const std::vector<CSCDetectorHit> &inputHits, CLHEP::HepRandomEngine *);
0045
0046 const DigiSimLinks &digiSimLinks() const { return theDigiSimLinks; }
0047
0048 virtual ~CSCBaseElectronicsSim();
0049
0050
0051 void setLayerId(const CSCDetId &id) { theLayerId = id; }
0052
0053 protected:
0054
0055 CSCBaseElectronicsSim(const edm::ParameterSet &p);
0056
0057 void setLayer(const CSCLayer *layer);
0058
0059 virtual void initParameters() = 0;
0060
0061 void fillAmpResponse();
0062 virtual float calculateAmpResponse(float t) const = 0;
0063
0064
0065 CSCAnalogSignal amplifySignal(const CSCDetectorHit &);
0066
0067
0068 virtual int readoutElement(int element) const = 0;
0069
0070
0071 void combineAnalogSignals(const std::vector<CSCAnalogSignal> &);
0072
0073 void setNoise(float rmsNoise, float noiseSigmaThreshold);
0074
0075
0076
0077 void setSignalTimeRange(double startTime, double stopTime) {
0078 theSignalStartTime = startTime;
0079 theSignalStopTime = stopTime;
0080 }
0081
0082 void addNoise(CLHEP::HepRandomEngine *);
0083
0084 CSCAnalogSignal &find(int element, CLHEP::HepRandomEngine *);
0085
0086
0087
0088 CSCAnalogSignal &add(const CSCAnalogSignal &, CLHEP::HepRandomEngine *);
0089 virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine *);
0090
0091
0092
0093
0094 virtual float signalDelay(int element, float pos) const;
0095
0096
0097
0098 virtual void addLinks(int channelIndex);
0099
0100
0101 virtual int channelIndex(int channel) const { return channel; }
0102
0103
0104 CSCDetId layerId() const { return theLayerId; }
0105
0106
0107
0108 double averageTimeOfFlight(const DetId &detId) const;
0109
0110
0111 enum { NONE, CONSERVATIVE, RADICAL };
0112
0113 const CSCChamberSpecs *theSpecs;
0114 const CSCLayerGeometry *theLayerGeometry;
0115 const CSCLayer *theLayer;
0116 CSCDetId theLayerId;
0117
0118 CSCSignalMap theSignalMap;
0119 CSCAnalogSignal theAmpResponse;
0120
0121
0122 float theBunchSpacing;
0123
0124
0125
0126
0127 bool theNoiseWasAdded;
0128
0129
0130 int nElements;
0131
0132
0133 int theShapingTime;
0134 float thePeakTimeSigma;
0135
0136
0137 std::vector<double> theBunchTimingOffsets;
0138
0139
0140 float theSignalStartTime;
0141 float theSignalStopTime;
0142
0143
0144 float theSamplingTime;
0145
0146
0147 int theNumberOfSamples;
0148
0149
0150 int theOffsetOfBxZero;
0151
0152
0153 std::vector<double> theSignalPropagationSpeed;
0154 std::vector<double> theTimingCalibrationError;
0155 bool doNoise_;
0156
0157
0158 typedef std::multimap<int, CSCDetectorHit, std::less<int>> DetectorHitMap;
0159 DetectorHitMap theDetectorHitMap;
0160 DigiSimLinks theDigiSimLinks;
0161 };
0162
0163 #endif