test
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 
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 {
39 public:
40 
41  typedef std::map<int, CSCAnalogSignal, std::less<int> > CSCSignalMap;
43 
44  // takes the input detector hits, turns them into DIGIs, and
45  // stores them in the layer
46  void simulate(const CSCLayer * layer,
47  const std::vector<CSCDetectorHit> & inputHits,
48  CLHEP::HepRandomEngine*);
49 
50  const DigiSimLinks & digiSimLinks() const {return theDigiSimLinks;}
51 
52  virtual ~CSCBaseElectronicsSim();
53 
55  void setLayerId(const CSCDetId & id) {theLayerId = id;}
56 
57 protected:
58  // constructor protected, so this class must be a base class
60 
61  void setLayer(const CSCLayer * layer);
62  // initialize things that change from layer to layer
63  virtual void initParameters() = 0;
64 
65  void fillAmpResponse();
66  virtual float calculateAmpResponse(float t) const = 0;
67 
68  // this one turns CSCDetectorHits into CSCAnalogSignals
70 
71  // returns readout element. So wire 20 might be part of wire group 2.
72  virtual int readoutElement(int element) const = 0;
73 
74  // fills the member map of signals on strips, superimposing any duplicates
75  void combineAnalogSignals(const std::vector<CSCAnalogSignal> &);
76 
77  void setNoise(float rmsNoise, float noiseSigmaThreshold);
78 
81  void setSignalTimeRange(double startTime, double stopTime) {
83  theSignalStopTime = stopTime;
84  }
85 
86  void addNoise(CLHEP::HepRandomEngine*);
87 
88  CSCAnalogSignal & find(int element, CLHEP::HepRandomEngine*);
89  // the returned signal will be the one stored in the
90  // signal, not the original. If another signal
91  // is found on this element, they will be superimposed.
92  CSCAnalogSignal & add(const CSCAnalogSignal &, CLHEP::HepRandomEngine*);
93  virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine*);
94 
98  virtual float signalDelay(int element, float pos) const;
99 
102  virtual void addLinks(int channelIndex);
103 
105  virtual int channelIndex(int channel) const {return channel;}
106 
108  CSCDetId layerId() const {return theLayerId;}
109 
111  double averageTimeOfFlight(const DetId & detId) const;
112 
113  // member data
115 
118  const CSCLayer * theLayer; // the one currently being digitized
120 
123 
124  // Useful parameters
126 
127  // lets routines know whether new signals should
128  // have noise added, or just be empty. If the
129  // noise hasn't been added yet, just make empty.
131 
132  // the numbers of wire groups or strips in this layer
134 
135  // amplifier parameters
138  // used to correct the bunch timing so that the signal event
139  // comes at BX zero.
140  std::vector<double> theBunchTimingOffsets;
141 
142  // when the signal is to be simulated
145 
146  // size of time bins for signal shape, in ns
148 
149  // time bins for pulse shape
151 
152  // Which bit in the 16-bit time word corresponds to the zeroth beam crossing?
153  int theOffsetOfBxZero; // bit corresponding to bx 0 (counting from 0-15)
156  std::vector<double> theSignalPropagationSpeed;
157  std::vector<double> theTimingCalibrationError;
158  bool doNoise_;
159 
160  // keeps track of which hits contribute to which channels
161  typedef std::multimap<int, CSCDetectorHit, std::less<int> > DetectorHitMap;
164 };
165 
166 #endif
std::vector< double > theBunchTimingOffsets
CSCBaseElectronicsSim(const edm::ParameterSet &p)
virtual float signalDelay(int element, float pos) const
const CSCChamberSpecs * theSpecs
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)
virtual CSCAnalogSignal makeNoiseSignal(int element, CLHEP::HepRandomEngine *)
void setLayer(const CSCLayer *layer)
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)
CSCDetId layerId() const
the CSCDetId corresponding to the current layer
CSCAnalogSignal & find(int element, CLHEP::HepRandomEngine *)
void addNoise(CLHEP::HepRandomEngine *)
virtual int channelIndex(int channel) const
lets users map channels to different indices for links
void simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits, CLHEP::HepRandomEngine *)
virtual void initParameters()=0
double averageTimeOfFlight(const DetId &detId) const
the average time-of-flight from the interaction point to the given detector
CSCAnalogSignal & add(const CSCAnalogSignal &, CLHEP::HepRandomEngine *)
std::vector< double > theTimingCalibrationError