CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/SimMuon/CSCDigitizer/src/CSCStripElectronicsSim.h

Go to the documentation of this file.
00001 #ifndef MU_END_STRIP_ELECTRONICS_SIM_H
00002 #define MU_END_STRIP_ELECTRONICS_SIM_H
00003 
00011 #include "SimMuon/CSCDigitizer/src/CSCBaseElectronicsSim.h"
00012 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00013 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
00014 #include "SimMuon/CSCDigitizer/src/CSCStripAmpResponse.h"
00015 
00016 class CSCDetectorHit;
00017 class CSCComparatorDigi;
00018 class CSCCrosstalkGenerator;
00019 class CSCStripConditions;
00020 #include <vector>
00021 #include <string>
00022 
00023 class CSCStripElectronicsSim : public CSCBaseElectronicsSim
00024 {
00025 public:
00027   explicit CSCStripElectronicsSim(const edm::ParameterSet & p);
00028 
00029   virtual ~CSCStripElectronicsSim();
00030 
00031   void fillDigis(CSCStripDigiCollection & digis,
00032                  CSCComparatorDigiCollection & comparators);
00033 
00034   void fillMissingLayer(const CSCLayer * layer, const CSCComparatorDigiCollection & comparators, 
00035                         CSCStripDigiCollection & digis);
00036 
00037   void setStripConditions(CSCStripConditions * cond) {theStripConditions = cond;}
00038 
00039   CSCAnalogSignal makeNoiseSignal(int element);
00040 
00041   void createDigi(int istrip, const CSCAnalogSignal & signal, std::vector<CSCStripDigi> & result);
00042  
00043 private:
00045   void initParameters();
00046 
00047   virtual int readoutElement(int strip) const;
00048 
00049   float calculateAmpResponse(float t) const;
00050   CSCStripAmpResponse theAmpResponse;
00051 
00052   void runComparator(std::vector<CSCComparatorDigi> & result);
00053 
00055   float comparatorReading(const CSCAnalogSignal & signal, float time) const;
00056 
00057   // tells which strips to read out around the input strip
00058   void getReadoutRange(int inputStrip, 
00059                        int & minStrip, int & maxStrip);
00060 
00062   std::list<int>
00063   getKeyStrips(const std::vector<CSCComparatorDigi> & comparators) const;
00064 
00066   std::list<int>
00067   getKeyStripsFromMC() const;
00070   std::list<int>
00071   channelsToRead(const std::list<int> & keyStrips, int window) const;
00072 
00073   void fillStripDigis(const std::list<int> & keyStrips,
00074                       CSCStripDigiCollection & digis);
00075 
00076   void addCrosstalk();
00077   void addCrosstalk(const CSCAnalogSignal & signal,
00078                     int thisStrip, int otherStrip);
00079 
00080 
00081   void selfTest() const;
00082 
00083   // saturation of the 12-bit ADC.  Max reading is 4095
00084   void doSaturation(CSCStripDigi & digi);
00085 
00086   // useful constants
00087   float theComparatorThreshold;      // in fC
00088   float theComparatorNoise;
00089   float theComparatorRMSOffset;
00090   // note that we don't implement the effect of the x3.5 amplifier
00091   float theComparatorSaturation;
00092   // all of these times are in nanoseconds
00093   float theComparatorWait;
00094   float theComparatorDeadTime;
00095   float theDaqDeadTime;
00096   // save the calculation of time-of-flight+drift+shaping
00097   float theTimingOffset;
00098 
00099   int nScaBins_;
00100   bool doSuppression_;
00101   bool doCrosstalk_;
00102   CSCStripConditions * theStripConditions;
00103   CSCCrosstalkGenerator * theCrosstalkGenerator;
00104 
00105   int theComparatorClockJump;
00106   // the length of each SCA time bin, in ns.  50 by default
00107   float sca_time_bin_size;
00108   // the SCA bin which holds the peak signal.  4, by default.
00109   // that's really the 5th, since We start counting at 0
00110   int   sca_peak_bin;
00111   // which time bin the trigger crossing goes in
00112   double theComparatorTimeBinOffset;
00113   // to center comparator signals
00114   double theComparatorTimeOffset;
00115   double theComparatorSamplingTime;
00116   // tweaks the timing of the SCA
00117   std::vector<double> theSCATimingOffsets;
00118   // remeber toe TOF correction in comparators,
00119   // so we can undo it for SCA
00120   float theAverageTimeOfFlight;
00121 };
00122 
00123 #endif
00124