Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:58

0001 #ifndef SimG4CMS_DreamSD_h
0002 #define SimG4CMS_DreamSD_h
0003 
0004 #include "SimG4CMS/Calo/interface/CaloSD.h"
0005 #include "DetectorDescription/Core/interface/DDCompactView.h"
0006 #include "DetectorDescription/DDCMS/interface/DDCompactView.h"
0007 
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0011 
0012 #include "G4PhysicsFreeVector.hh"
0013 
0014 #include <map>
0015 
0016 const int MAXPHOTONS = 500;  // Maximum number of photons we can store
0017 
0018 class G4LogicalVolume;
0019 
0020 class DreamSD : public CaloSD {
0021 public:
0022   DreamSD(const std::string &,
0023           const DDCompactView *,
0024           const cms::DDCompactView *,
0025           const SensitiveDetectorCatalog &,
0026           edm::ParameterSet const &,
0027           const SimTrackManager *);
0028   ~DreamSD() override {}
0029 
0030   uint32_t setDetUnitId(const G4Step *) override;
0031 
0032 protected:
0033   double getEnergyDeposit(const G4Step *) override;
0034   void initRun() override;
0035 
0036 private:
0037   typedef std::pair<double, double> Doubles;
0038   typedef std::map<G4LogicalVolume *, Doubles> DimensionMap;
0039 
0040   void initMap(const std::string &);
0041   void fillMap(const std::string &, double, double);
0042   double curve_LY(const G4Step *, int);
0043   double crystalLength(G4LogicalVolume *) const;
0044   double crystalWidth(G4LogicalVolume *) const;
0045 
0046   /// Returns the total energy due to Cherenkov radiation
0047   double cherenkovDeposit_(const G4Step *aStep);
0048   /// Returns average number of photons created by track
0049   double getAverageNumberOfPhotons_(const double charge,
0050                                     const double beta,
0051                                     const G4Material *aMaterial,
0052                                     const G4MaterialPropertyVector *rIndex);
0053   /// Returns energy deposit for a given photon
0054   double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep);
0055   /// Sets material properties at run-time...
0056   bool setPbWO2MaterialProperties_(G4Material *aMaterial);
0057 
0058   static constexpr double k_ScaleFromDDDToG4 = 1.0;
0059   static constexpr double k_ScaleFromDD4hepToG4 = 1.0 / dd4hep::mm;
0060 
0061   const DDCompactView *cpvDDD_;
0062   const cms::DDCompactView *cpvDD4hep_;
0063 
0064   bool useBirk_, doCherenkov_, readBothSide_, dd4hep_;
0065   double birk1_, birk2_, birk3_;
0066   double slopeLY_;
0067   DimensionMap xtalLMap_;  // Store length and width
0068 
0069   int side_;
0070 
0071   /// Table of Cherenkov angle integrals vs photon momentum
0072   std::unique_ptr<G4PhysicsFreeVector> chAngleIntegrals_;
0073   G4MaterialPropertiesTable *materialPropertiesTable_;
0074 
0075   int nphotons_;
0076 };
0077 
0078 #endif  // DreamSD_h