File indexing completed on 2023-10-25 10:03:30
0001 #ifndef CaloSimAlgos_CaloHitResponse_h
0002 #define CaloSimAlgos_CaloHitResponse_h
0003
0004 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0007 #include "SimCalorimetry/CaloSimAlgos/interface/CaloVPECorrection.h"
0008 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0009 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0010
0011 #include <map>
0012 #include <vector>
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 namespace CLHEP {
0023 class HepRandomEngine;
0024 }
0025
0026 class CaloVShape;
0027 class CaloShapes;
0028 class CaloVSimParameterMap;
0029 class CaloVHitCorrection;
0030 class CaloVHitFilter;
0031 class CaloSimParameters;
0032
0033 class CaloHitResponse {
0034 public:
0035 typedef std::map<DetId, CaloSamples> AnalogSignalMap;
0036
0037 enum { BUNCHSPACE = 25 };
0038 static constexpr double dt = 0.5;
0039 static constexpr int invdt = 2;
0040
0041 CaloHitResponse(const CaloVSimParameterMap *parameterMap,
0042 const CaloVShape *shape,
0043 bool PreMix1 = false,
0044 bool HighFidelity = false);
0045 CaloHitResponse(const CaloVSimParameterMap *parameterMap,
0046 const CaloShapes *shapes,
0047 bool PreMix1 = false,
0048 bool HighFidelity = false);
0049
0050
0051 virtual ~CaloHitResponse();
0052
0053
0054 void setBunchRange(int minBunch, int maxBunch);
0055
0056
0057 void setGeometry(const CaloGeometry *geometry) { theGeometry = geometry; }
0058
0059 virtual bool keepBlank() const { return true; }
0060
0061
0062 virtual void initializeHits() {}
0063
0064
0065 virtual void finalizeHits(CLHEP::HepRandomEngine *);
0066
0067
0068 virtual void run(const MixCollection<PCaloHit> &hits, CLHEP::HepRandomEngine *);
0069
0070
0071 virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *);
0072
0073
0074 virtual void add(const CaloSamples &signal);
0075
0076
0077
0078 void setHitFilter(const CaloVHitFilter *filter) { theHitFilter = filter; }
0079
0080
0081 void setHitCorrection(const CaloVHitCorrection *hitCorrection) { theHitCorrection = hitCorrection; }
0082
0083
0084 void setPECorrection(const CaloVPECorrection *peCorrection) { thePECorrection = peCorrection; }
0085
0086
0087 void clear() { theAnalogSignalMap.clear(); }
0088
0089
0090 void addHit(const PCaloHit *hit, CaloSamples &frame) const;
0091
0092
0093 virtual CaloSamples makeAnalogSignal(const PCaloHit &inputHit, CLHEP::HepRandomEngine *) const;
0094
0095
0096
0097 double analogSignalAmplitude(const DetId &id,
0098 float energy,
0099 const CaloSimParameters ¶meters,
0100 CLHEP::HepRandomEngine *) const;
0101
0102
0103 CaloSamples *findSignal(const DetId &detId);
0104
0105
0106 int nSignals() const { return theAnalogSignalMap.size(); }
0107
0108 int getReadoutFrameSize(const DetId &id) const;
0109
0110
0111 CaloSamples makeBlankSignal(const DetId &detId) const;
0112
0113
0114
0115 double timeOfFlight(const DetId &detId) const;
0116
0117
0118 void setPhaseShift(const double &thePhaseShift) { thePhaseShift_ = thePhaseShift; }
0119
0120
0121
0122 bool withinBunchRange(int bunchCrossing) const {
0123 return (bunchCrossing >= theMinBunch && bunchCrossing <= theMaxBunch);
0124 }
0125
0126 void setStorePrecise(bool sp) { storePrecise = sp; }
0127
0128 void setIgnoreGeantTime(bool gt) { ignoreTime = gt; }
0129
0130 protected:
0131 AnalogSignalMap theAnalogSignalMap;
0132
0133 const CaloVSimParameterMap *theParameterMap;
0134 const CaloShapes *theShapes;
0135 const CaloVShape *theShape;
0136 const CaloVHitCorrection *theHitCorrection;
0137 const CaloVPECorrection *thePECorrection;
0138 const CaloVHitFilter *theHitFilter;
0139
0140 const CaloGeometry *theGeometry;
0141
0142 int theMinBunch;
0143 int theMaxBunch;
0144
0145 double thePhaseShift_;
0146 bool storePrecise;
0147 bool preMixDigis;
0148 bool highFidelityPreMix;
0149 bool ignoreTime;
0150 };
0151
0152 #endif