CMS 3D CMS Logo

DreamSD.h
Go to the documentation of this file.
1 #ifndef SimG4CMS_DreamSD_h
2 #define SimG4CMS_DreamSD_h
3 
7 
11 
12 #include "G4PhysicsFreeVector.hh"
13 
14 #include <DD4hep/DD4hepUnits.h>
15 
16 #include <map>
17 
18 const int MAXPHOTONS = 500; // Maximum number of photons we can store
19 
20 class G4LogicalVolume;
21 
22 class DreamSD : public CaloSD {
23 public:
24  DreamSD(const std::string &,
25  const DDCompactView *,
26  const cms::DDCompactView *,
28  edm::ParameterSet const &,
29  const SimTrackManager *);
30  ~DreamSD() override {}
31 
32  uint32_t setDetUnitId(const G4Step *) override;
33 
34 protected:
35  double getEnergyDeposit(const G4Step *) override;
36  void initRun() override;
37 
38 private:
39  typedef std::pair<double, double> Doubles;
40  typedef std::map<G4LogicalVolume *, Doubles> DimensionMap;
41 
42  void initMap(const std::string &);
43  void fillMap(const std::string &, double, double);
44  double curve_LY(const G4Step *, int);
45  double crystalLength(G4LogicalVolume *) const;
46  double crystalWidth(G4LogicalVolume *) const;
47 
49  double cherenkovDeposit_(const G4Step *aStep);
51  double getAverageNumberOfPhotons_(const double charge,
52  const double beta,
53  const G4Material *aMaterial,
54  const G4MaterialPropertyVector *rIndex);
56  double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep);
58  bool setPbWO2MaterialProperties_(G4Material *aMaterial);
59 
60  static constexpr double k_ScaleFromDDDToG4 = 1.0;
61  static constexpr double k_ScaleFromDD4hepToG4 = 1.0 / dd4hep::mm;
62 
65 
67  double birk1_, birk2_, birk3_;
68  double slopeLY_;
69  DimensionMap xtalLMap_; // Store length and width
70 
71  int side_;
72 
74  std::unique_ptr<G4PhysicsFreeVector> chAngleIntegrals_;
75  G4MaterialPropertiesTable *materialPropertiesTable_;
76 
77  int nphotons_;
78 };
79 
80 #endif // DreamSD_h
const DDCompactView * cpvDDD_
Definition: DreamSD.h:63
double crystalLength(G4LogicalVolume *) const
Definition: DreamSD.cc:222
static constexpr double k_ScaleFromDD4hepToG4
Definition: DreamSD.h:61
bool readBothSide_
Definition: DreamSD.h:66
double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep)
Returns energy deposit for a given photon.
Definition: DreamSD.cc:503
Definition: CaloSD.h:40
DimensionMap xtalLMap_
Definition: DreamSD.h:69
void fillMap(const std::string &, double, double)
Definition: DreamSD.cc:175
uint32_t setDetUnitId(const G4Step *) override
Definition: DreamSD.cc:106
bool setPbWO2MaterialProperties_(G4Material *aMaterial)
Sets material properties at run-time...
Definition: DreamSD.cc:421
static constexpr double k_ScaleFromDDDToG4
Definition: DreamSD.h:60
double birk3_
Definition: DreamSD.h:67
bool useBirk_
Definition: DreamSD.h:66
void initRun() override
Definition: DreamSD.cc:87
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
double crystalWidth(G4LogicalVolume *) const
Definition: DreamSD.cc:231
double cherenkovDeposit_(const G4Step *aStep)
Returns the total energy due to Cherenkov radiation.
Definition: DreamSD.cc:242
bool dd4hep_
Definition: DreamSD.h:66
int nphotons_
Definition: DreamSD.h:77
std::unique_ptr< G4PhysicsFreeVector > chAngleIntegrals_
Table of Cherenkov angle integrals vs photon momentum.
Definition: DreamSD.h:74
double getAverageNumberOfPhotons_(const double charge, const double beta, const G4Material *aMaterial, const G4MaterialPropertyVector *rIndex)
Returns average number of photons created by track.
Definition: DreamSD.cc:358
~DreamSD() override
Definition: DreamSD.h:30
int side_
Definition: DreamSD.h:71
G4MaterialPropertiesTable * materialPropertiesTable_
Definition: DreamSD.h:75
std::pair< double, double > Doubles
Definition: DreamSD.h:39
const int MAXPHOTONS
Definition: DreamSD.h:18
std::map< G4LogicalVolume *, Doubles > DimensionMap
Definition: DreamSD.h:40
double curve_LY(const G4Step *, int)
Definition: DreamSD.cc:195
double birk2_
Definition: DreamSD.h:67
DreamSD(const std::string &, const DDCompactView *, const cms::DDCompactView *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: DreamSD.cc:31
const cms::DDCompactView * cpvDD4hep_
Definition: DreamSD.h:64
double getEnergyDeposit(const G4Step *) override
Definition: DreamSD.cc:67
bool doCherenkov_
Definition: DreamSD.h:66
double birk1_
Definition: DreamSD.h:67
double slopeLY_
Definition: DreamSD.h:68
void initMap(const std::string &)
Definition: DreamSD.cc:120