CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h

Go to the documentation of this file.
00001 #ifndef CaloSimAlgos_CaloHitResponse_h
00002 #define CaloSimAlgos_CaloHitResponse_h
00003 
00004 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00007 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00008 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
00009 #include "CLHEP/Random/RandPoissonQ.h"
00010 #include "SimCalorimetry/CaloSimAlgos/interface/CaloVPECorrection.h"
00011 
00012 #include<map>
00013 #include<vector>
00014 
00022 #define ChangeHcalEnergyScale
00023 
00024 class CaloVShape;
00025 class CaloShapes;
00026 class CaloVSimParameterMap;
00027 class CaloVHitCorrection;
00028 class CaloVHitFilter;
00029 class CaloSimParameters;
00030 
00031 class CaloHitResponse 
00032 {
00033 public:
00034   typedef std::map<DetId, CaloSamples> AnalogSignalMap;
00035   // get this from somewhere external
00036   enum {BUNCHSPACE=25};
00037 
00038   CaloHitResponse(const CaloVSimParameterMap * parameterMap, const CaloVShape * shape);
00039   CaloHitResponse(const CaloVSimParameterMap * parameterMap, const CaloShapes * shapes);
00040 
00042   virtual ~CaloHitResponse();
00043 
00044   // change HBHE scale
00045   void initHBHEScale();
00046   void setHBHEScale(std::string &); //GMA
00047 
00049   void setBunchRange(int minBunch, int maxBunch);
00050 
00052   void setGeometry(const CaloGeometry * geometry) { theGeometry = geometry; }
00053 
00054   virtual bool keepBlank() const { return true ; }
00055 
00057   virtual void initializeHits() {}
00058 
00060   virtual void finalizeHits() {}
00061 
00063   virtual void run(MixCollection<PCaloHit> & hits);
00064 
00066   virtual void add(const PCaloHit & hit);
00067 
00069   void add(const CaloSamples & signal);
00070 
00072   void setHitFilter(const CaloVHitFilter * filter) {
00073     theHitFilter = filter;
00074   }
00075 
00077   void setHitCorrection(const CaloVHitCorrection * hitCorrection) {
00078     theHitCorrection = hitCorrection;
00079   }
00080 
00082   void setPECorrection(const CaloVPECorrection * peCorrection) {
00083     thePECorrection = peCorrection;
00084   }
00085 
00086   virtual void setRandomEngine(CLHEP::HepRandomEngine & engine);
00087 
00089   void clear() {theAnalogSignalMap.clear();}
00090  
00092   void addHit(const PCaloHit * hit, CaloSamples & frame) const;
00093 
00095   virtual CaloSamples makeAnalogSignal(const PCaloHit & inputHit) const;
00096 
00099   double analogSignalAmplitude(const DetId & id, float energy, const CaloSimParameters & parameters) const;
00100 
00102   CaloSamples * findSignal(const DetId & detId);
00103 
00105   int nSignals() const {return theAnalogSignalMap.size();}
00106 
00108   CaloSamples makeBlankSignal(const DetId & detId) const;
00109 
00110 
00113   double timeOfFlight(const DetId & detId) const;
00114 
00116   void setPhaseShift(const double & thePhaseShift) { thePhaseShift_ = thePhaseShift; }
00117 
00119 
00120   bool withinBunchRange(int bunchCrossing) const {
00121     return(bunchCrossing >= theMinBunch && bunchCrossing <= theMaxBunch);
00122   }
00123 
00124 protected:
00125 
00126   AnalogSignalMap theAnalogSignalMap;
00127 
00128   const CaloVSimParameterMap * theParameterMap;
00129   const CaloShapes * theShapes;
00130   const CaloVShape * theShape;
00131   const CaloVHitCorrection * theHitCorrection;
00132   const CaloVPECorrection * thePECorrection;
00133   const CaloVHitFilter * theHitFilter;
00134 
00135   const CaloGeometry * theGeometry;
00136 
00137   mutable CLHEP::RandPoissonQ * theRandPoisson;
00138 
00139   int theMinBunch;
00140   int theMaxBunch;
00141 
00142   double thePhaseShift_;
00143 
00144   // private : 
00145   bool  changeScale;
00146 #ifdef ChangeHcalEnergyScale
00147   float hcal_en_scale[100][72][4];
00148 #endif  
00149 };
00150 
00151 #endif
00152 
00153