CMS 3D CMS Logo

MaterialBudgetHcal.cc
Go to the documentation of this file.
2 
7 
11 
14 
15 #include "G4Step.hh"
16 #include "G4Track.hh"
17 
18 #include <iostream>
19 
20 MaterialBudgetHcal::MaterialBudgetHcal(const edm::ParameterSet& p) : theHistoHcal(nullptr), theHistoCastor(nullptr) {
21  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetHcal");
22  rMax = m_p.getUntrackedParameter<double>("RMax", 4.5) * CLHEP::m;
23  zMax = m_p.getUntrackedParameter<double>("ZMax", 13.0) * CLHEP::m;
24  bool doHcal = m_p.getUntrackedParameter<bool>("DoHCAL", true);
25  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcal initialized with rMax " << rMax << " mm and zMax " << zMax
26  << " mm doHcal is set to " << doHcal;
27  if (doHcal)
29  else
31 }
32 
34  if (theHistoHcal)
35  delete theHistoHcal;
36  if (theHistoCastor)
37  delete theHistoCastor;
38 }
39 
41  //----- Check that selected volumes are indeed part of the geometry
42  // Numbering From DDD
44  (*job)()->get<IdealGeometryRecord>().get(pDD);
45  if (theHistoHcal)
46  theHistoHcal->fillBeginJob((*pDD));
47 }
48 
50  const G4Track* aTrack = (*trk)(); // recover G4 pointer if wanted
51  if (theHistoHcal)
53  if (theHistoCastor)
55 }
56 
57 void MaterialBudgetHcal::update(const G4Step* aStep) {
58  //---------- each step
59  if (theHistoHcal)
60  theHistoHcal->fillPerStep(aStep);
61  if (theHistoCastor)
63 
64  //----- Stop tracking after selected position
65  if (stopAfter(aStep)) {
66  G4Track* track = aStep->GetTrack();
67  track->SetTrackStatus(fStopAndKill);
68  }
69 }
70 
72  if (theHistoHcal)
74  if (theHistoCastor)
76 }
77 
78 bool MaterialBudgetHcal::stopAfter(const G4Step* aStep) {
79  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
80  double rr = hitPoint.perp();
81  double zz = std::abs(hitPoint.z());
82 
83  if (rr > rMax || zz > zMax) {
84  edm::LogVerbatim("MaterialBudget") << " MaterialBudgetHcal::StopAfter R = " << rr << " and Z = " << zz;
85  return true;
86  } else {
87  return false;
88  }
89 }
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ESTransientHandle.h
MessageLogger.h
BeginOfJob.h
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MaterialBudgetHcalHistos::fillPerStep
void fillPerStep(const G4Step *)
Definition: MaterialBudgetHcalHistos.cc:108
EndOfTrack.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDCompactView.h
MaterialBudgetCastorHistos::fillPerStep
void fillPerStep(const G4Step *)
Definition: MaterialBudgetCastorHistos.cc:64
EndOfTrack
Definition: EndOfTrack.h:6
BeginOfTrack.h
MaterialBudgetHcal.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
MaterialBudgetHcal::~MaterialBudgetHcal
~MaterialBudgetHcal() override
Definition: MaterialBudgetHcal.cc:33
BeginOfTrack
Definition: BeginOfTrack.h:6
BeginOfJob
Definition: BeginOfJob.h:8
MaterialBudgetHcal::zMax
double zMax
Definition: MaterialBudgetHcal.h:40
MaterialBudgetHcal::theHistoCastor
MaterialBudgetCastorHistos * theHistoCastor
Definition: MaterialBudgetHcal.h:39
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
MaterialBudgetCastorHistos::fillEndTrack
void fillEndTrack()
Definition: MaterialBudgetCastorHistos.cc:151
MaterialBudgetHcal::MaterialBudgetHcal
MaterialBudgetHcal(const edm::ParameterSet &)
Definition: MaterialBudgetHcal.cc:20
edm::LogVerbatim
Definition: MessageLogger.h:297
IdealGeometryRecord.h
MaterialBudgetHcal::theHistoHcal
MaterialBudgetHcalHistos * theHistoHcal
Definition: MaterialBudgetHcal.h:38
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
MaterialBudgetCastorHistos::fillStartTrack
void fillStartTrack(const G4Track *)
Definition: MaterialBudgetCastorHistos.cc:38
MaterialBudgetHcal::update
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
Definition: MaterialBudgetHcal.cc:40
MaterialBudgetHcal::rMax
double rMax
Definition: MaterialBudgetHcal.h:40
MaterialBudgetCastorHistos
Definition: MaterialBudgetCastorHistos.h:17
MaterialBudgetHcalHistos::fillEndTrack
void fillEndTrack()
Definition: MaterialBudgetHcalHistos.cc:231
EventSetup.h
MaterialBudgetHcalHistos::fillStartTrack
void fillStartTrack(const G4Track *)
Definition: MaterialBudgetHcalHistos.cc:81
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
MaterialBudgetHcal::stopAfter
bool stopAfter(const G4Step *)
Definition: MaterialBudgetHcal.cc:78
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MaterialBudgetHcalHistos
Definition: MaterialBudgetHcalHistos.h:19
MaterialBudgetHcalHistos::fillBeginJob
void fillBeginJob(const DDCompactView &)
Definition: MaterialBudgetHcalHistos.cc:35