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 
21  theHistoHcal(0), theHistoCastor(0) {
22 
23  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetHcal");
24  rMax = m_p.getUntrackedParameter<double>("RMax", 4.5)*m;
25  zMax = m_p.getUntrackedParameter<double>("ZMax", 13.0)*m;
26  bool doHcal = m_p.getUntrackedParameter<bool>("DoHCAL", true);
27  edm::LogInfo("MaterialBudget") << "MaterialBudgetHcal initialized with rMax "
28  << rMax << " mm and zMax " << zMax << " mm"
29  << " doHcal is set to " << doHcal;
30  if (doHcal) theHistoHcal = new MaterialBudgetHcalHistos(m_p);
32 }
33 
35  if (theHistoHcal) delete theHistoHcal;
36  if (theHistoCastor) delete theHistoCastor;
37 }
38 
40  //----- Check that selected volumes are indeed part of the geometry
41  // Numbering From DDD
43  (*job)()->get<IdealGeometryRecord>().get(pDD);
45 
46 }
47 
49 
50  const G4Track * aTrack = (*trk)(); // recover G4 pointer if wanted
53 }
54 
55 void MaterialBudgetHcal::update(const G4Step* aStep) {
56 
57  //---------- each step
60 
61  //----- Stop tracking after selected position
62  if (stopAfter(aStep)) {
63  G4Track* track = aStep->GetTrack();
64  track->SetTrackStatus( fStopAndKill );
65  }
66 }
67 
68 
70 
73 }
74 
75 bool MaterialBudgetHcal::stopAfter(const G4Step* aStep) {
76 
77  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
78  double rr = hitPoint.perp();
79  double zz = std::abs(hitPoint.z());
80 
81  if (rr > rMax || zz > zMax) {
82  LogDebug("MaterialBudget") << " MaterialBudgetHcal::StopAfter R = " << rr
83  << " and Z = " << zz;
84  return true;
85  } else {
86  return false;
87  }
88 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define abs(x)
Definition: mlp_lapack.h:159
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.
MaterialBudgetCastorHistos * theHistoCastor
MaterialBudgetHcal(const edm::ParameterSet &)
MaterialBudgetHcalHistos * theHistoHcal
tuple job
Definition: launcher.py:57