Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:31

0001 #ifndef HcalSimAlgos_HcalElectronicsSim_h
0002 #define HcalSimAlgos_HcalElectronicsSim_h
0003 
0004 /** This class turns a CaloSamples, representing the analog
0005       signal input to the readout electronics, into a
0006       digitized data frame
0007    */
0008 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
0009 #include "SimCalorimetry/HcalSimAlgos/interface/HcalTDC.h"
0010 #include "SimCalorimetry/HcalSimAlgos/interface/HcalAmplifier.h"
0011 #include "SimCalorimetry/HcalSimAlgos/interface/HcalCoderFactory.h"
0012 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameterMap.h"
0013 
0014 class HBHEDataFrame;
0015 class HODataFrame;
0016 class HFDataFrame;
0017 class ZDCDataFrame;
0018 class QIE10DataFrame;
0019 class QIE11DataFrame;
0020 
0021 namespace CLHEP {
0022   class HepRandomEngine;
0023 }
0024 
0025 class HcalElectronicsSim {
0026 public:
0027   HcalElectronicsSim(const HcalSimParameterMap* parameterMap,
0028                      HcalAmplifier* amplifier,
0029                      const HcalCoderFactory* coderFactory,
0030                      bool PreMix);
0031   ~HcalElectronicsSim();
0032 
0033   void setDbService(const HcalDbService* service);
0034 
0035   //these need to be overloads instead of templates to avoid linking issues when calling private member function templates
0036   void analogToDigital(CLHEP::HepRandomEngine*,
0037                        CaloSamples& linearFrame,
0038                        HBHEDataFrame& result,
0039                        double preMixFactor = 10.0,
0040                        unsigned preMixBits = 126);
0041   void analogToDigital(CLHEP::HepRandomEngine*,
0042                        CaloSamples& linearFrame,
0043                        HODataFrame& result,
0044                        double preMixFactor = 10.0,
0045                        unsigned preMixBits = 126);
0046   void analogToDigital(CLHEP::HepRandomEngine*,
0047                        CaloSamples& linearFrame,
0048                        HFDataFrame& result,
0049                        double preMixFactor = 10.0,
0050                        unsigned preMixBits = 126);
0051   void analogToDigital(CLHEP::HepRandomEngine*,
0052                        CaloSamples& linearFrame,
0053                        ZDCDataFrame& result,
0054                        double preMixFactor = 10.0,
0055                        unsigned preMixBits = 126);
0056   void analogToDigital(CLHEP::HepRandomEngine*,
0057                        CaloSamples& linearFrame,
0058                        QIE10DataFrame& result,
0059                        double preMixFactor = 10.0,
0060                        unsigned preMixBits = 126);
0061   void analogToDigital(CLHEP::HepRandomEngine*,
0062                        CaloSamples& linearFrame,
0063                        QIE11DataFrame& result,
0064                        double preMixFactor = 10.0,
0065                        unsigned preMixBits = 126);
0066   /// Things that need to be initialized every event
0067   /// sets starting CapID randomly
0068   void newEvent(CLHEP::HepRandomEngine*);
0069   void setStartingCapId(int startingCapId);
0070 
0071 private:
0072   template <class Digi>
0073   void analogToDigitalImpl(
0074       CLHEP::HepRandomEngine*, CaloSamples& linearFrame, Digi& result, double preMixFactor, unsigned preMixBits);
0075   template <class Digi>
0076   void convert(CaloSamples& frame, Digi& result, CLHEP::HepRandomEngine*);
0077   template <class Digi>
0078   void premix(CaloSamples& frame, Digi& result, double preMixFactor, unsigned preMixBits);
0079 
0080   const HcalSimParameterMap* theParameterMap;
0081   HcalAmplifier* theAmplifier;
0082   const HcalCoderFactory* theCoderFactory;
0083   HcalTDC theTDC;
0084 
0085   int theStartingCapId;
0086   bool theStartingCapIdIsRandom;
0087   bool PreMixDigis;
0088 };
0089 
0090 #endif