CMS 3D CMS Logo

HcalTB06BeamSD.cc
Go to the documentation of this file.
1 // File: HcalTB06BeamSD.cc
3 // Description: Sensitive Detector class for beam counters in TB06 setup
5 
12 
13 #include "G4Step.hh"
14 #include "G4Track.hh"
15 #include "G4Material.hh"
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
18 //#define EDM_ML_DEBUG
19 
21  const HcalTB06BeamParameters* es,
22  const SensitiveDetectorCatalog& clg,
23  edm::ParameterSet const& p,
24  const SimTrackManager* manager)
25  : CaloSD(name, clg, p, manager), hcalBeamPar_(es) {
26  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
27  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HcalTB06BeamSD");
28  useBirk_ = m_HC.getParameter<bool>("UseBirkLaw");
29  birk1_ = m_HC.getParameter<double>("BirkC1") * (CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
30  birk2_ = m_HC.getParameter<double>("BirkC2");
31  birk3_ = m_HC.getParameter<double>("BirkC3");
32 
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HcalTBSim") << "HcalTB06BeamSD:: Use of Birks law is set to " << useBirk_
35  << " with three constants kB = " << birk1_ << ", C1 = " << birk2_
36  << ", C2 = " << birk3_;
37 #endif
38 }
39 
41 
42 double HcalTB06BeamSD::getEnergyDeposit(const G4Step* aStep) {
43  double destep = aStep->GetTotalEnergyDeposit();
44  double weight = 1;
45  if (useBirk_ && aStep->GetPreStepPoint()->GetMaterial()->GetName() == static_cast<G4String>(hcalBeamPar_->material_))
47 #ifdef EDM_ML_DEBUG
48  edm::LogVerbatim("HcalTBSim") << "HcalTB06BeamSD: Detector "
49  << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName() << " weight "
50  << weight;
51 #endif
52  return weight * destep;
53 }
54 
55 uint32_t HcalTB06BeamSD::setDetUnitId(const G4Step* aStep) {
56  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
57  const G4VTouchable* touch = preStepPoint->GetTouchable();
58  std::string name = static_cast<std::string>(preStepPoint->GetPhysicalVolume()->GetName());
59 
60  int det = 1;
61  int lay = 0, x = 0, y = 0;
62  if (!isItWireChamber(name)) {
63  lay = (touch->GetReplicaNumber(0));
64  } else {
65  det = 2;
66  lay = (touch->GetReplicaNumber(1));
67  G4ThreeVector localPoint = setToLocal(preStepPoint->GetPosition(), touch);
68  x = (int)(localPoint.x() / (0.2 * mm));
69  y = (int)(localPoint.y() / (0.2 * mm));
70  }
71 
72  return HcalTestBeamNumbering::packIndex(det, lay, x, y);
73 }
74 
76  std::vector<std::string>::const_iterator it = hcalBeamPar_->wchambers_.begin();
77  for (; it != hcalBeamPar_->wchambers_.end(); it++)
78  if (name == *it)
79  return true;
80  return false;
81 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const HcalTB06BeamParameters * hcalBeamPar_
Definition: CaloSD.h:40
double getEnergyDeposit(const G4Step *) override
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:403
Definition: weight.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
static uint32_t packIndex(int det, int lay, int x, int y)
bool isItWireChamber(const std::string &)
HcalTB06BeamSD(const std::string &, const HcalTB06BeamParameters *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
uint32_t setDetUnitId(const G4Step *step) override
~HcalTB06BeamSD() override
std::vector< std::string > wchambers_
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:666