Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:03:34

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