OverburdenCalculator_service.cc
Go to the documentation of this file.
1 #include "OverburdenCalculator.h"
2 #include "Geometry/Geometry.h"
4 
6 {
7  fExcludeVolume = p.get<std::string>("ExcludeVolume","vDetEnclosure");
9 }
10 
12  //init geoManager using geo service
14  auto geomngr = geo->ROOTGeoManager();
15  fGeoManager = geomngr;
16 }
17 double red::OverburdenCalculator::trace(double x, double y, double z, double px, double py, double pz) const {
18  fGeoManager->InitTrack(x,y,z,px,py,pz);
19  double step, dens, sum=0;
20  while(fGeoManager->FindNextBoundaryAndStep()){
21  step = fGeoManager->GetStep();
22  if (step>1E10) break;
23 
24  //check that we are not in the detector volume anymore
25  TString path=fGeoManager->GetPath();
26  if(!path.Contains(fExcludeVolume)){
27  TGeoVolume *vol;
28  vol = fGeoManager->GetCurrentVolume();
29  TGeoMaterial *mat;
30  mat = vol->GetMaterial();
31  dens = mat->GetDensity();
32  sum += step*dens;
33  }
34  }
35  return sum;
36 }
37 
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:88
const char * p
Definition: xmltok.h:285
TGeoManager * ROOTGeoManager() const
Definition: Run.h:21
T get(std::string const &key) const
Definition: ParameterSet.h:231
Float_t mat
Definition: plot.C:39
z
Definition: test.py:28
const std::string path
Definition: plot_BEN.C:43
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
OverburdenCalculator(const fhicl::ParameterSet &p, art::ActivityRegistry &reg)
TRandom3 r(0)
Double_t sum
Definition: plot.C:31
Helper for AttenCurve.
Definition: Path.h:10
double trace(double x, double y, double z, double px, double py, double pz) const
Encapsulate the geometry of one entire detector (near, far, ndos)
enum BeamMode string