Go to the documentation of this file.00001 #ifndef MU_END_BASE_ELECTRONICS_SIM_H
00002 #define MU_END_BASE_ELECTRONICS_SIM_H
00003
00016 #include "SimMuon/CSCDigitizer/src/CSCAnalogSignal.h"
00017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00018 #include <vector>
00019 #include <map>
00020
00021 #include "DataFormats/Common/interface/DetSet.h"
00022 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
00023 #include "CLHEP/Random/RandGaussQ.h"
00024
00025
00026 class CSCLayer;
00027 class CSCChamberSpecs;
00028 class CSCDetectorHit;
00029 class CSCLayerGeometry;
00030 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00031 class DetId;
00032 class PSimHit;
00033
00034 class CSCBaseElectronicsSim
00035 {
00036 public:
00037
00038 typedef std::map<int, CSCAnalogSignal, std::less<int> > CSCSignalMap;
00039 typedef edm::DetSet<StripDigiSimLink> DigiSimLinks;
00040
00041 void setRandomEngine(CLHEP::HepRandomEngine& engine);
00042
00043
00044
00045 void simulate(const CSCLayer * layer,
00046 const std::vector<CSCDetectorHit> & inputHits);
00047
00048 const DigiSimLinks & digiSimLinks() const {return theDigiSimLinks;}
00049
00050 virtual ~CSCBaseElectronicsSim();
00051
00053 void setLayerId(const CSCDetId & id) {theLayerId = id;}
00054
00055 protected:
00056
00057 CSCBaseElectronicsSim(const edm::ParameterSet & p);
00058
00059 void setLayer(const CSCLayer * layer);
00060
00061 virtual void initParameters() = 0;
00062
00063 void fillAmpResponse();
00064 virtual float calculateAmpResponse(float t) const = 0;
00065
00066
00067 CSCAnalogSignal amplifySignal(const CSCDetectorHit &);
00068
00069
00070 virtual int readoutElement(int element) const = 0;
00071
00072
00073 void combineAnalogSignals(const std::vector<CSCAnalogSignal> &);
00074
00075 void setNoise(float rmsNoise, float noiseSigmaThreshold);
00076
00079 void setSignalTimeRange(double startTime, double stopTime) {
00080 theSignalStartTime = startTime;
00081 theSignalStopTime = stopTime;
00082 }
00083
00084 void addNoise();
00085
00086 CSCAnalogSignal & find(int element);
00087
00088
00089
00090 CSCAnalogSignal & add(const CSCAnalogSignal &);
00091 virtual CSCAnalogSignal makeNoiseSignal(int element);
00092
00096 virtual float signalDelay(int element, float pos) const;
00097
00100 virtual void addLinks(int channelIndex);
00101
00103 virtual int channelIndex(int channel) const {return channel;}
00104
00106 CSCDetId layerId() const {return theLayerId;}
00107
00109 double averageTimeOfFlight(const DetId & detId) const;
00110
00111
00112 enum {NONE, CONSERVATIVE, RADICAL};
00113
00114 const CSCChamberSpecs * theSpecs;
00115 const CSCLayerGeometry * theLayerGeometry;
00116 const CSCLayer * theLayer;
00117 CSCDetId theLayerId;
00118
00119 CSCSignalMap theSignalMap;
00120 CSCAnalogSignal theAmpResponse;
00121
00122
00123 float theBunchSpacing;
00124
00125
00126
00127
00128 bool theNoiseWasAdded;
00129
00130
00131 int nElements;
00132
00133
00134 int theShapingTime;
00135 float thePeakTimeSigma;
00136
00137
00138 std::vector<double> theBunchTimingOffsets;
00139
00140
00141 float theSignalStartTime;
00142 float theSignalStopTime;
00143
00144
00145 float theSamplingTime;
00146
00147
00148 int theNumberOfSamples;
00149
00150
00151 int theOffsetOfBxZero;
00154 std::vector<double> theSignalPropagationSpeed;
00155 std::vector<double> theTimingCalibrationError;
00156 bool doNoise_;
00157
00158
00159 typedef std::multimap<int, CSCDetectorHit, std::less<int> > DetectorHitMap;
00160 DetectorHitMap theDetectorHitMap;
00161 DigiSimLinks theDigiSimLinks;
00162
00163 CLHEP::RandGaussQ * theRandGaussQ;
00164 };
00165
00166 #endif