Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:31

0001 #ifndef EcalSimAlgos_EcalHitResponse_h
0002 #define EcalSimAlgos_EcalHitResponse_h
0003 
0004 #include "CalibFormats/CaloObjects/interface/CaloTSamplesBase.h"
0005 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0008 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0009 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
0010 #include "DataFormats/Provenance/interface/Timestamp.h"
0011 #include "DataFormats/EcalDigi/interface/EcalConstants.h"
0012 
0013 #include <unordered_map>
0014 #include <vector>
0015 
0016 typedef unsigned long long TimeValue_t;
0017 
0018 class CaloVShape;
0019 class CaloVSimParameterMap;
0020 class CaloVHitCorrection;
0021 class CaloVHitFilter;
0022 class CaloSimParameters;
0023 class CaloSubdetectorGeometry;
0024 class CaloVPECorrection;
0025 namespace CLHEP {
0026   class HepRandomEngine;
0027 }
0028 
0029 class EcalHitResponse {
0030 public:
0031   typedef CaloTSamplesBase<float> EcalSamples;
0032 
0033   typedef std::vector<unsigned int> VecInd;
0034 
0035   typedef std::unordered_map<uint32_t, double> CalibCache;
0036 
0037   EcalHitResponse(const CaloVSimParameterMap* parameterMap, const CaloVShape* shape);
0038 
0039   virtual ~EcalHitResponse();
0040 
0041   const float kSamplePeriod = ecalPh1::Samp_Period;
0042 
0043   void setBunchRange(int minBunch, int maxBunch);
0044 
0045   void setGeometry(const CaloSubdetectorGeometry* geometry);
0046 
0047   void setPhaseShift(double phaseShift);
0048 
0049   void setHitFilter(const CaloVHitFilter* filter);
0050 
0051   void setHitCorrection(const CaloVHitCorrection* hitCorrection);
0052 
0053   void setPECorrection(const CaloVPECorrection* peCorrection);
0054 
0055   void setEventTime(const edm::TimeValue_t& iTime);
0056 
0057   void setLaserConstants(const EcalLaserDbService* laser, bool& useLCcorrection);
0058 
0059   void add(const EcalSamples* pSam);
0060 
0061   virtual void add(const PCaloHit& hit, CLHEP::HepRandomEngine*);
0062 
0063   virtual void add(const CaloSamples& hit);
0064 
0065   virtual void initializeHits();
0066 
0067   virtual void finalizeHits();
0068 
0069   virtual void run(MixCollection<PCaloHit>& hits, CLHEP::HepRandomEngine*);
0070 
0071   virtual unsigned int samplesSize() const = 0;
0072 
0073   virtual EcalSamples* operator[](unsigned int i) = 0;
0074 
0075   virtual const EcalSamples* operator[](unsigned int i) const = 0;
0076 
0077   const EcalSamples* findDetId(const DetId& detId) const;
0078 
0079   bool withinBunchRange(int bunchCrossing) const;
0080 
0081 protected:
0082   virtual unsigned int samplesSizeAll() const = 0;
0083 
0084   virtual EcalSamples* vSam(unsigned int i) = 0;
0085 
0086   virtual EcalSamples* vSamAll(unsigned int i) = 0;
0087 
0088   virtual const EcalSamples* vSamAll(unsigned int i) const = 0;
0089 
0090   virtual void putAnalogSignal(const PCaloHit& inputHit, CLHEP::HepRandomEngine*);
0091 
0092   double findLaserConstant(const DetId& detId) const;
0093 
0094   EcalSamples* findSignal(const DetId& detId);
0095 
0096   double analogSignalAmplitude(const DetId& id, double energy, CLHEP::HepRandomEngine*);
0097 
0098   double timeOfFlight(const DetId& detId) const;
0099 
0100   double phaseShift() const;
0101 
0102   void blankOutUsedSamples();
0103 
0104   const CaloSimParameters* params(const DetId& detId) const;
0105 
0106   const CaloVShape* shape() const;
0107 
0108   const CaloSubdetectorGeometry* geometry() const;
0109 
0110   int minBunch() const;
0111 
0112   int maxBunch() const;
0113 
0114   VecInd& index();
0115 
0116   const VecInd& index() const;
0117 
0118   const CaloVHitFilter* hitFilter() const;
0119 
0120   const CaloVSimParameterMap* m_parameterMap;
0121   const CaloVShape* m_shape;
0122   const CaloVHitCorrection* m_hitCorrection;
0123   const CaloVPECorrection* m_PECorrection;
0124   const CaloVHitFilter* m_hitFilter;
0125   const CaloSubdetectorGeometry* m_geometry;
0126   const EcalLaserDbService* m_lasercals;
0127 
0128 private:
0129   int m_minBunch;
0130   int m_maxBunch;
0131   double m_phaseShift;
0132 
0133   edm::TimeValue_t m_iTime;
0134   bool m_useLCcorrection;
0135   CalibCache m_laserCalibCache;
0136 
0137   VecInd m_index;
0138 };
0139 
0140 #endif