CMS 3D CMS Logo

CSCBaseElectronicsSim.h
Go to the documentation of this file.
1 #ifndef MU_END_BASE_ELECTRONICS_SIM_H
2 #define MU_END_BASE_ELECTRONICS_SIM_H
3 
18 #include <map>
19 #include <vector>
20 
23 
24 // declarations
25 class CSCLayer;
26 class CSCChamberSpecs;
27 class CSCDetectorHit;
28 class CSCLayerGeometry;
30 class DetId;
31 class PSimHit;
32 
33 namespace CLHEP {
34  class HepRandomEngine;
35 }
36 
38 public:
39  typedef std::map<int, CSCAnalogSignal, std::less<int>> CSCSignalMap;
41 
42  // takes the input detector hits, turns them into DIGIs, and
43  // stores them in the layer
44  void simulate(const CSCLayer *layer, const std::vector<CSCDetectorHit> &inputHits, CLHEP::HepRandomEngine *);
45 
46  const DigiSimLinks &digiSimLinks() const { return theDigiSimLinks; }
47 
48  virtual ~CSCBaseElectronicsSim();
49 
51  void setLayerId(const CSCDetId &id) { theLayerId = id; }
52 
53 protected:
54  // constructor protected, so this class must be a base class
56 
57  void setLayer(const CSCLayer *layer);
58  // initialize things that change from layer to layer
59  virtual void initParameters() = 0;
60 
61  void fillAmpResponse();
62  virtual float calculateAmpResponse(float t) const = 0;
63 
64  // this one turns CSCDetectorHits into CSCAnalogSignals
66 
67  // returns readout element. So wire 20 might be part of wire group 2.
68  virtual int readoutElement(int element) const = 0;
69 
70  // fills the member map of signals on strips, superimposing any duplicates
71  void combineAnalogSignals(const std::vector<CSCAnalogSignal> &);
72 
73  void setNoise(float rmsNoise, float noiseSigmaThreshold);
74 
77  void setSignalTimeRange(double startTime, double stopTime) {
79  theSignalStopTime = stopTime;
80  }
81 
82  void addNoise(CLHEP::HepRandomEngine *);
83 
84  CSCAnalogSignal &find(int element, CLHEP::HepRandomEngine *);
85  // the returned signal will be the one stored in the
86  // signal, not the original. If another signal
87  // is found on this element, they will be superimposed.
88  CSCAnalogSignal &add(const CSCAnalogSignal &, CLHEP::HepRandomEngine *);
89  virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine *);
90 
94  virtual float signalDelay(int element, float pos) const;
95 
98  virtual void addLinks(int channelIndex);
99 
101  virtual int channelIndex(int channel) const { return channel; }
102 
104  CSCDetId layerId() const { return theLayerId; }
105 
108  double averageTimeOfFlight(const DetId &detId) const;
109 
110  // member data
112 
115  const CSCLayer *theLayer; // the one currently being digitized
117 
120 
121  // Useful parameters
123 
124  // lets routines know whether new signals should
125  // have noise added, or just be empty. If the
126  // noise hasn't been added yet, just make empty.
128 
129  // the numbers of wire groups or strips in this layer
131 
132  // amplifier parameters
135  // used to correct the bunch timing so that the signal event
136  // comes at BX zero.
137  std::vector<double> theBunchTimingOffsets;
138 
139  // when the signal is to be simulated
142 
143  // size of time bins for signal shape, in ns
145 
146  // time bins for pulse shape
148 
149  // Which bit in the 16-bit time word corresponds to the zeroth beam crossing?
150  int theOffsetOfBxZero; // bit corresponding to bx 0 (counting from 0-15)
153  std::vector<double> theSignalPropagationSpeed;
154  std::vector<double> theTimingCalibrationError;
155  bool doNoise_;
156 
157  // keeps track of which hits contribute to which channels
158  typedef std::multimap<int, CSCDetectorHit, std::less<int>> DetectorHitMap;
161 };
162 
163 #endif
std::vector< double > theBunchTimingOffsets
double averageTimeOfFlight(const DetId &detId) const
CSCBaseElectronicsSim(const edm::ParameterSet &p)
const CSCChamberSpecs * theSpecs
const CSCLayerGeometry * theLayerGeometry
const DigiSimLinks & digiSimLinks() const
CSCDetId layerId() const
the CSCDetId corresponding to the current layer
std::multimap< int, CSCDetectorHit, std::less< int > > DetectorHitMap
void combineAnalogSignals(const std::vector< CSCAnalogSignal > &)
std::map< int, CSCAnalogSignal, std::less< int > > CSCSignalMap
virtual float calculateAmpResponse(float t) const =0
CSCAnalogSignal amplifySignal(const CSCDetectorHit &)
void setNoise(float rmsNoise, float noiseSigmaThreshold)
virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine *)
void setLayer(const CSCLayer *layer)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void setLayerId(const CSCDetId &id)
for standalone apps who don&#39;t calculate it from the geometry
std::vector< double > theSignalPropagationSpeed
edm::DetSet< StripDigiSimLink > DigiSimLinks
virtual int readoutElement(int element) const =0
virtual void addLinks(int channelIndex)
Definition: DetId.h:17
void setSignalTimeRange(double startTime, double stopTime)
CSCAnalogSignal & find(int element, CLHEP::HepRandomEngine *)
void addNoise(CLHEP::HepRandomEngine *)
void simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits, CLHEP::HepRandomEngine *)
virtual void initParameters()=0
virtual float signalDelay(int element, float pos) const
CSCAnalogSignal & add(const CSCAnalogSignal &, CLHEP::HepRandomEngine *)
std::vector< double > theTimingCalibrationError
virtual int channelIndex(int channel) const
lets users map channels to different indices for links