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 class CSCDetId;
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
00056 protected:
00057
00058 CSCBaseElectronicsSim(const edm::ParameterSet & p);
00059
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 = 0;
00097
00100 virtual void addLinks(int channelIndex);
00101
00103 virtual int channelIndex(int channel) const {return channel;}
00104
00106 CSCDetId layerId() const;
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
00118 CSCSignalMap theSignalMap;
00119 CSCAnalogSignal theAmpResponse;
00120
00121
00122 float theBunchSpacing;
00123
00124
00125
00126
00127 bool theNoiseWasAdded;
00128
00129
00130 int nElements;
00131
00132
00133 int theShapingTime;
00134 float thePeakTimeSigma;
00135
00136
00137 std::vector<double> theBunchTimingOffsets;
00138
00139
00140 float theSignalStartTime;
00141 float theSignalStopTime;
00142
00143
00144 float theSamplingTime;
00145
00146
00147 int theNumberOfSamples;
00148
00149
00150 int theOffsetOfBxZero;
00151
00152 bool doNoise_;
00153
00154
00155 typedef std::multimap<int, CSCDetectorHit, std::less<int> > DetectorHitMap;
00156 DetectorHitMap theDetectorHitMap;
00157 DigiSimLinks theDigiSimLinks;
00158
00159 CLHEP::RandGaussQ * theRandGaussQ;
00160 };
00161
00162 #endif