CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <vector>
19 #include <map>
20 
23 #include "CLHEP/Random/RandGaussQ.h"
24 
25 // declarations
26 class CSCLayer;
27 class CSCChamberSpecs;
28 class CSCDetectorHit;
29 class CSCLayerGeometry;
31 class DetId;
32 class PSimHit;
33 
35 {
36 public:
37 
38  typedef std::map<int, CSCAnalogSignal, std::less<int> > CSCSignalMap;
40 
41  void setRandomEngine(CLHEP::HepRandomEngine& engine);
42 
43  // takes the input detector hits, turns them into DIGIs, and
44  // stores them in the layer
45  void simulate(const CSCLayer * layer,
46  const std::vector<CSCDetectorHit> & inputHits);
47 
48  const DigiSimLinks & digiSimLinks() const {return theDigiSimLinks;}
49 
50  virtual ~CSCBaseElectronicsSim();
51 
53  void setLayerId(const CSCDetId & id) {theLayerId = id;}
54 
55 protected:
56  // constructor protected, so this class must be a base class
58 
59  void setLayer(const CSCLayer * layer);
60  // initialize things that change from layer to layer
61  virtual void initParameters() = 0;
62 
63  void fillAmpResponse();
64  virtual float calculateAmpResponse(float t) const = 0;
65 
66  // this one turns CSCDetectorHits into CSCAnalogSignals
68 
69  // returns readout element. So wire 20 might be part of wire group 2.
70  virtual int readoutElement(int element) const = 0;
71 
72  // fills the member map of signals on strips, superimposing any duplicates
73  void combineAnalogSignals(const std::vector<CSCAnalogSignal> &);
74 
75  void setNoise(float rmsNoise, float noiseSigmaThreshold);
76 
79  void setSignalTimeRange(double startTime, double stopTime) {
80  theSignalStartTime = startTime;
81  theSignalStopTime = stopTime;
82  }
83 
84  void addNoise();
85 
86  CSCAnalogSignal & find(int element);
87  // the returned signal will be the one stored in the
88  // signal, not the original. If another signal
89  // is found on this element, they will be superimposed.
91  virtual CSCAnalogSignal makeNoiseSignal(int element);
92 
96  virtual float signalDelay(int element, float pos) const;
97 
100  virtual void addLinks(int channelIndex);
101 
103  virtual int channelIndex(int channel) const {return channel;}
104 
106  CSCDetId layerId() const {return theLayerId;}
107 
109  double averageTimeOfFlight(const DetId & detId) const;
110 
111  // member data
113 
116  const CSCLayer * theLayer; // the one currently being digitized
118 
121 
122  // Useful parameters
124 
125  // lets routines know whether new signals should
126  // have noise added, or just be empty. If the
127  // noise hasn't been added yet, just make empty.
129 
130  // the numbers of wire groups or strips in this layer
132 
133  // amplifier parameters
136  // used to correct the bunch timing so that the signal event
137  // comes at BX zero.
138  std::vector<double> theBunchTimingOffsets;
139 
140  // when the signal is to be simulated
143 
144  // size of time bins for signal shape, in ns
146 
147  // time bins for pulse shape
149 
150  // Which bit in the 16-bit time word corresponds to the zeroth beam crossing?
151  int theOffsetOfBxZero; // bit corresponding to bx 0 (counting from 0-15)
154  std::vector<double> theSignalPropagationSpeed;
155  std::vector<double> theTimingCalibrationError;
156  bool doNoise_;
157 
158  // keeps track of which hits contribute to which channels
159  typedef std::multimap<int, CSCDetectorHit, std::less<int> > DetectorHitMap;
162 
163  CLHEP::RandGaussQ * theRandGaussQ;
164 };
165 
166 #endif
std::vector< double > theBunchTimingOffsets
CSCBaseElectronicsSim(const edm::ParameterSet &p)
virtual float signalDelay(int element, float pos) const
const CSCChamberSpecs * theSpecs
virtual CSCAnalogSignal makeNoiseSignal(int element)
const CSCLayerGeometry * theLayerGeometry
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)
void setRandomEngine(CLHEP::HepRandomEngine &engine)
void setLayer(const CSCLayer *layer)
CLHEP::RandGaussQ * theRandGaussQ
const DigiSimLinks & digiSimLinks() const
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:18
void setSignalTimeRange(double startTime, double stopTime)
CSCAnalogSignal & add(const CSCAnalogSignal &)
void simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits)
CSCDetId layerId() const
the CSCDetId corresponding to the current layer
CSCAnalogSignal & find(int element)
virtual int channelIndex(int channel) const
lets users map channels to different indices for links
virtual void initParameters()=0
double averageTimeOfFlight(const DetId &detId) const
the average time-of-flight from the interaction point to the given detector
std::vector< double > theTimingCalibrationError