CMS 3D CMS Logo

CSCBaseElectronicsSim.h

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 // declarations
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   // takes the input detector hits, turns them into DIGIs, and
00044   // stores them in the layer
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   // constructor protected, so this class must be a base class
00058   CSCBaseElectronicsSim(const edm::ParameterSet & p);
00059 
00060   // initialize things that change from layer to layer
00061   virtual void initParameters() = 0;
00062 
00063   void fillAmpResponse();
00064   virtual float calculateAmpResponse(float t) const = 0;
00065 
00066   // this one turns CSCDetectorHits into CSCAnalogSignals
00067   CSCAnalogSignal amplifySignal(const CSCDetectorHit &);
00068 
00069   // returns readout element.  So wire 20 might be part of wire group 2.
00070   virtual int readoutElement(int element) const = 0; 
00071 
00072   //  fills the member map of signals on strips, superimposing any duplicates
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   // the returned signal will be the one stored in the
00088   // signal, not the original.  If another signal
00089   // is found on this element, they will be superimposed.
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   // member data
00112   enum {NONE, CONSERVATIVE, RADICAL}; 
00113 
00114   const CSCChamberSpecs * theSpecs;
00115   const CSCLayerGeometry * theLayerGeometry;
00116   const CSCLayer * theLayer;  // the one currently being digitized
00117 
00118   CSCSignalMap theSignalMap;
00119   CSCAnalogSignal theAmpResponse;
00120 
00121   // Useful parameters
00122   float theBunchSpacing;
00123 
00124   // lets routines know whether new signals should
00125   //  have noise added, or just be empty.  If the
00126   //  noise hasn't been added yet, just make empty.
00127   bool theNoiseWasAdded;
00128 
00129   // the numbers of wire groups or strips in this layer
00130   int nElements;
00131 
00132   // amplifier parameters
00133   int theShapingTime;
00134   float thePeakTimeSigma;
00135   // used to correct the bunch timing so that the signal event 
00136   // comes at BX zero.
00137   std::vector<double> theBunchTimingOffsets;
00138 
00139   // when the signal is to be simulated
00140   float theSignalStartTime;
00141   float theSignalStopTime;
00142 
00143   // size of time bins for signal shape, in ns
00144   float theSamplingTime;
00145 
00146   // time bins for pulse shape
00147   int theNumberOfSamples;
00148 
00149   // Which bit in the 16-bit time word corresponds to the zeroth beam crossing?
00150   int theOffsetOfBxZero; // bit corresponding to bx 0 (counting from 0-15)
00151 
00152   bool doNoise_;
00153 
00154   // keeps track of which hits contribute to which channels
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

Generated on Tue Jun 9 17:47:31 2009 for CMSSW by  doxygen 1.5.4