CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 using namespace CLHEP;
21 
23  theHistoHcal(0), theHistoCastor(0) {
24 
25  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetHcal");
26  rMax = m_p.getUntrackedParameter<double>("RMax", 4.5)*m;
27  zMax = m_p.getUntrackedParameter<double>("ZMax", 13.0)*m;
28  bool doHcal = m_p.getUntrackedParameter<bool>("DoHCAL", true);
29  edm::LogInfo("MaterialBudget") << "MaterialBudgetHcal initialized with rMax "
30  << rMax << " mm and zMax " << zMax << " mm"
31  << " doHcal is set to " << doHcal;
32  if (doHcal) theHistoHcal = new MaterialBudgetHcalHistos(m_p);
34 }
35 
37  if (theHistoHcal) delete theHistoHcal;
38  if (theHistoCastor) delete theHistoCastor;
39 }
40 
42  //----- Check that selected volumes are indeed part of the geometry
43  // Numbering From DDD
45  (*job)()->get<IdealGeometryRecord>().get(pDD);
47 
48 }
49 
51 
52  const G4Track * aTrack = (*trk)(); // recover G4 pointer if wanted
55 }
56 
57 void MaterialBudgetHcal::update(const G4Step* aStep) {
58 
59  //---------- each step
62 
63  //----- Stop tracking after selected position
64  if (stopAfter(aStep)) {
65  G4Track* track = aStep->GetTrack();
66  track->SetTrackStatus( fStopAndKill );
67  }
68 }
69 
70 
72 
75 }
76 
77 bool MaterialBudgetHcal::stopAfter(const G4Step* aStep) {
78 
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  LogDebug("MaterialBudget") << " MaterialBudgetHcal::StopAfter R = " << rr
85  << " and Z = " << zz;
86  return true;
87  } else {
88  return false;
89  }
90 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void fillBeginJob(const DDCompactView &)
bool stopAfter(const G4Step *)
void fillStartTrack(const G4Track *)
void update(const BeginOfJob *)
This routine will be called when the appropriate signal arrives.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MaterialBudgetCastorHistos * theHistoCastor
MaterialBudgetHcal(const edm::ParameterSet &)
MaterialBudgetHcalHistos * theHistoHcal