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 
11 #include "HcalTB06BeamSD.h"
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 }
HcalTB06BeamSD::hcalBeamPar_
const HcalTB06BeamParameters * hcalBeamPar_
Definition: HcalTB06BeamSD.h:38
DDAxes::y
HcalTestBeamNumbering::packIndex
static uint32_t packIndex(int det, int lay, int x, int y)
Definition: HcalTestBeamNumbering.cc:6
SimTrackManager
Definition: SimTrackManager.h:35
HcalTB06BeamParameters::wchambers_
std::vector< std::string > wchambers_
Definition: HcalTB06BeamParameters.h:13
MessageLogger.h
mps_merge.weight
weight
Definition: mps_merge.py:88
HcalTB06BeamSD::isItWireChamber
bool isItWireChamber(const std::string &)
Definition: HcalTB06BeamSD.cc:75
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:683
HcalTB06BeamSD::birk3_
double birk3_
Definition: HcalTB06BeamSD.h:37
MeV
const double MeV
DDAxes::x
HcalTB06BeamSD::getEnergyDeposit
double getEnergyDeposit(const G4Step *) override
Definition: HcalTB06BeamSD.cc:42
HcalTB06BeamParameters::material_
std::string material_
Definition: HcalTB06BeamParameters.h:14
HcalTB06BeamParameters
Definition: HcalTB06BeamParameters.h:9
CaloSD::setToLocal
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:385
HcalTestBeamNumbering.h
HcalTB06BeamSD.h
HcalTB06BeamSD::useBirk_
bool useBirk_
Definition: HcalTB06BeamSD.h:36
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
HcalTB06BeamSD::HcalTB06BeamSD
HcalTB06BeamSD(const std::string &, const HcalTB06BeamParameters *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: HcalTB06BeamSD.cc:20
HcalTB06BeamSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override
Definition: HcalTB06BeamSD.cc:55
HcalTB06BeamSD::birk1_
double birk1_
Definition: HcalTB06BeamSD.h:37
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
createfilelist.int
int
Definition: createfilelist.py:10
HcalTB06BeamSD::~HcalTB06BeamSD
~HcalTB06BeamSD() override
Definition: HcalTB06BeamSD.cc:40
TrackInformation.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalTB06BeamSD::birk2_
double birk2_
Definition: HcalTB06BeamSD.h:37
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
ParameterSet.h
weight
Definition: weight.py:1
CaloSD
Definition: CaloSD.h:39
g
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