CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FastSimulation/Calorimetry/interface/CalorimetryManager.h

Go to the documentation of this file.
00001 #ifndef CALORIMETRYMANAGER_H
00002 #define CALORIMETRYMANAGER_H
00003 
00004 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
00005 
00006 // FastSimulation headers
00007 #include "FastSimulation/Particle/interface/RawParticle.h"
00008 #include "FastSimulation/Calorimetry/interface/HCALResponse.h"
00009 #include "DataFormats/DetId/interface/DetId.h"
00010 #include "FastSimulation/Utilities/interface/FamosDebug.h"
00011 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00012 
00013 // For the uint32_t
00014 //#include <boost/cstdint.hpp>
00015 #include <map>
00016 #include <algorithm>
00017 
00018 class FSimEvent;
00019 class FSimTrack;
00020 class RawParticle;
00021 class CaloGeometryHelper;
00022 class Histos;
00023 class HSParameters;
00024 class RandomEngine;
00025 class LandauFluctuationGenerator;
00026 class GammaFunctionGenerator;
00027 class MaterialEffects;
00028 //Gflash
00029 class GflashHadronShowerProfile;
00030 class GflashPiKShowerProfile;
00031 class GflashProtonShowerProfile;
00032 class GflashAntiProtonShowerProfile;
00033 
00034 namespace edm { 
00035   class ParameterSet;
00036 }
00037 
00038 class CalorimetryManager{
00039 
00040  public:
00041   CalorimetryManager();
00042   CalorimetryManager(FSimEvent* aSimEvent, 
00043                      const edm::ParameterSet& fastCalo,
00044                      const edm::ParameterSet& MuonECALPars,
00045                      const edm::ParameterSet& MuonHCALPars,
00046                      const edm::ParameterSet& fastGflash,
00047                      const RandomEngine* engine);
00048   ~CalorimetryManager();
00049 
00050   // Does the real job
00051   void reconstruct();
00052 
00053     // Return the address of the Calorimeter 
00054   CaloGeometryHelper * getCalorimeter() const {return myCalorimeter_;}
00055 
00056   // load container from edm::Event
00057   void loadFromEcalBarrel(edm::PCaloHitContainer & c) const;
00058 
00059   void loadFromEcalEndcap(edm::PCaloHitContainer & c) const;
00060 
00061   void loadFromHcal(edm::PCaloHitContainer & c) const;
00062 
00063   void loadFromPreshower(edm::PCaloHitContainer & c) const;
00064 
00065   void loadMuonSimTracks(edm::SimTrackContainer & m) const;
00066 
00067  private:
00068   // Simulation of electromagnetic showers in PS, ECAL, HCAL
00069   void EMShowerSimulation(const FSimTrack& myTrack);
00070   
00071   // Simulation of electromagnetic showers in VFCAL
00072   void reconstructECAL(const FSimTrack& track) ;
00073 
00074   void reconstructHCAL(const FSimTrack& myTrack);
00075 
00076   void MuonMipSimulation(const FSimTrack & myTrack);
00077  
00079   void HDShowerSimulation(const FSimTrack& myTrack);
00080 
00081   // Read the parameters 
00082   void readParameters(const edm::ParameterSet& fastCalo);
00083 
00084   void updateMap(uint32_t cellid,float energy,int id,std::map<uint32_t,std::vector<std::pair<int,float> > >& mymap);
00085 
00086   void updateMap(int hi,float energy,int id,std::vector<std::vector<std::pair<int,float> > > & mymap,std::vector<int> & firedCells);
00087 
00088   void respCorr(double);
00089 
00090   void clean(); 
00091 
00092  private:
00093 
00094   FSimEvent* mySimEvent;
00095   CaloGeometryHelper* myCalorimeter_;
00096 
00097   Histos * myHistos;
00098 
00099   HCALResponse* myHDResponse_;
00100   HSParameters * myHSParameters_;
00101 
00102   // In the not unfolded case (standard) the most inner vector will be of size = 1 
00103   // the preshower does not have hashed_indices, hence the map 
00104   std::vector<std::vector<std::pair<int,float> > > EBMapping_;
00105   std::vector<std::vector<std::pair<int,float> > > EEMapping_;
00106   std::vector<std::vector<std::pair<int,float> > > HMapping_;
00107   std::map<uint32_t,std::vector<std::pair<int,float> > > ESMapping_;
00108 
00109   std::vector<int> firedCellsEB_;
00110   std::vector<int> firedCellsEE_;
00111   std::vector<int> firedCellsHCAL_;
00112 
00113   // this is bad, the same information already exists in CaloRecHitsProducers
00114   // should make a es_producer of CaloGeometryTools 
00115   std::vector<DetId> theDetIds_;
00116   bool debug_;
00117   std::vector<unsigned int> evtsToDebug_;
00118 
00119   bool unfoldedMode_;
00120 
00122   RawParticle myElec;
00123   RawParticle myPosi;
00124   RawParticle myPart;
00125 
00126   // Parameters 
00127   double pulledPadSurvivalProbability_;
00128   double crackPadSurvivalProbability_;
00129   double spotFraction_;
00130   double radiusFactor_;
00131   std::vector<double> radiusPreshowerCorrections_;
00132   std::vector<double> mipValues_;
00133   int gridSize_;
00134   std::vector<double> theCoreIntervals_,theTailIntervals_;
00135   double RCFactor_,RTFactor_;
00136   //FR
00137   int optionHDSim_, hdGridSize_, hdSimMethod_;
00138   bool simulatePreshower_;
00139   //RF 
00140 
00141   // Famos Random Engine
00142   const RandomEngine* random;
00143   const LandauFluctuationGenerator* aLandauGenerator;
00144   GammaFunctionGenerator* aGammaGenerator;
00145 
00146   static std::vector<std::pair<int, float> > myZero_;
00147   bool initialized_;
00148 
00149   // RespCorrP p, k_e(p), k_h(p) vectors  and evaluated for each p
00150   // ecorr and hcorr  
00151   std::vector<double> rsp;
00152   std::vector<double> p_knots;
00153   std::vector<double> k_e;
00154   std::vector<double> k_h;
00155   double ecorr;
00156   double hcorr;
00157 
00158   std::vector<FSimTrack> muonSimTracks;
00159   MaterialEffects* theMuonEcalEffects; // material effects for muons in ECAL
00160   MaterialEffects* theMuonHcalEffects; // material effects for muons in HCAL
00161 
00162   //Gflash
00163   GflashHadronShowerProfile *theProfile;
00164   GflashPiKShowerProfile *thePiKProfile;
00165   GflashProtonShowerProfile *theProtonProfile;
00166   GflashAntiProtonShowerProfile *theAntiProtonProfile;
00167 };
00168 #endif