LightSource_module.cc
Go to the documentation of this file.
1 /**
2  * @file larsim/EventGenerator/LightSource_module.cc
3  * @author Ben Jones, MIT 2010
4  */
5 
6 /**
7  * @class evgen::LightSource
8  * @brief Light source event generator which simulate an extended isotropic photon source
9  *
10  * The light source can be run in two modes, file mode or scan mode. Each requires
11  * the specification of a different set of parameters.
12  *
13  * File mode
14  * ----------
15  *
16  * Light source position, intensity and shape are supplied on an event by event basis
17  * in a text file. See the example provided for the format. Pararmeters required:
18  *
19  * int32 SourceMode = 0 - sets light source to file mode
20  * string FileName - file of per event light source specifications
21  * int32 PosDist - how to distribute production points sampled in momentum, position
22  * int32 PDist and time ranges specified. For all of these :
23  * int32 TDist 0 = uniform and 1 = gauss
24  * bool FillTree - whether to write a tree of photon production points to fileservice
25  *
26  * Upon reaching the end of the file, the light source will loop back to the first point.
27  * hence a one line text file will give a constant light source size, position and intensity.
28  *
29  * Scan mode
30  * ----------
31  *
32  * Divide volume into cuboidal regions and produce an isotropic light source in each,
33  * using one region per event. User can specify either to use the full detector volume
34  * or some custom specified volume.
35  *
36  * This mode is used when building a fast photon sim library, and performing volume
37  * scan sensitivity studies.
38  *
39  * int32 SourceMode = 1 - sets light source to scan mode
40  * int32 N - number of photons to shoot from each point
41  * double P - peak photon momentum (or energy) in eV
42  * double SigmaP - momentum distribution width
43  * double XSteps - Number of regions to divide volume into in each direction
44  * double YSteps
45  * double ZSteps
46  * double T0 - Peak time of photon production
47  * double SigmaT - time distribution width
48  * int32 PosDist - how to distribute production points sampled in momentum, position
49  * int32 PDist and time ranges specified. For all of these :
50  * int32 TDist 0 = uniform and 1 = gaussian
51  * bool FillTree - whether to write a tree of photon production points to fileservice
52  * bool UseCustomRegion - supply our own volume specification or use the full detector volume?
53  * vdouble[3] RegionMin - bounding corners of the custom volume specification
54  * vdouble[3] RegionMax (only used if UseCustomRegion=true)
55  *
56  *
57  * Configuration parameters
58  * -------------------------
59  *
60  * This is a partial list of the supported configuration parameters:
61  *
62  * * `SelectMaterials` (list of strings, default: empty): if specified,
63  * generation points are required to be in a volume with any of the materials
64  * included in this list; a useful value is `SelectMaterials: [ "LAr" ]`,
65  * which generates photons only in liquid argon; the rest of the constraints
66  * are also respected (that means that if the configured generation volume
67  * has none of the selected materials, generation can go on forever: see
68  * `NMaxFactor` configuration parameter)
69  * * `NMaxFactor` (real value, default: 100 times `N`): as a safety valve, do
70  * not attempt more than this times the requested number of photons: for
71  * example, in an event where 500 photons are required, with `NMax: 20` no
72  * more than 10000 generations will be attempted; this is useful if the
73  * generation volume efficiency can't be guaranteed to be high (e.g. if only
74  * generation in liquid argon is requested in a generation volume that is
75  * entirely made of steel).
76  *
77  */
78 
79 // C++ includes.
80 #include <cassert>
81 #include <cmath>
82 #include <fstream>
83 #include <memory>
84 #include <set>
85 #include <string>
86 #include <vector>
87 
88 // ART includes
93 #include "art_root_io/TFileService.h"
95 #include "cetlib/pow.h" // cet::square()
96 #include "cetlib_except/exception.h"
97 #include "fhiclcpp/ParameterSet.h"
99 
100 // art extensions
101 #include "nurandom/RandomUtils/NuRandomService.h"
102 
103 // nusimdata includes
106 
107 // lar includes
114 
115 #include "TGeoManager.h"
116 #include "TGeoMaterial.h"
117 #include "TGeoNavigator.h"
118 #include "TList.h"
119 #include "TLorentzVector.h"
120 #include "TTree.h"
121 #include "TVector3.h"
122 
123 #include "CLHEP/Random/RandFlat.h"
124 #include "CLHEP/Random/RandGaussQ.h"
125 
126 namespace evgen {
127 
128  /// A module for optical MC testing and library building
129  class LightSource : public art::EDProducer {
130  public:
131  explicit LightSource(fhicl::ParameterSet const& pset);
132 
133  void produce(art::Event& evt);
134  void beginRun(art::Run& run);
135 
136  private:
137  /// Filters a point according to the material at that point.
139  public:
140  /// Constructor: sets up the filter configuration.
142  std::set<std::string> const& materialNames);
143 
145 
146  // @{
147  /// Returns whether the specified `point` can be accepted.
148  bool accept(geo::Point_t const& point);
149  bool
150  operator()(geo::Point_t const& point)
151  {
152  return accept(point);
153  }
154  // @}
155 
156  private:
157  TGeoManager* fManager = nullptr; ///< ROOT geometry manager.
158  TGeoNavigator* fNavigator = nullptr; ///< Our own ROOT geometry navigator.
159 
160  /// Names of materials to select.
161  std::set<std::string> const& fMaterials;
162 
163  /// Returns a pointer to the material of the volume at specified `point`.
164  TGeoMaterial const* materialAt(geo::Point_t const& point);
165 
166  /// Returns a pointer to the material with the specified `name`.
167  TGeoMaterial const* findMaterial(std::string const& name) const;
168 
169  }; // MaterialPointFilter
170 
172 
173  /// Throws an exception if any of the configured materials is not present.
174  void checkMaterials() const;
175 
176 
177  /// Reads from `fInputFile` all other parameters in one line.
178  /// @return whether all reading were successful (`ifstream::good()`).
180 
181  // for c2: fSeed is unused
182  //int fSeed; //random number seed
183  std::string fVersion; //version of the configuration
184 
185  // Flags to mark module modes
186  static const int kUNIF = 0;
187  static const int kGAUS = 1;
188  static const int kFILE = 0;
189  static const int kSCAN = 1;
190 
191  // File stream, filename and empty string for file processing
192  std::ifstream fInputFile;
194  char fDummyString[256];
195 
196  // A ttree to keep track of where particles have been shot - ends up in histos.root
198  TLorentzVector fShotPos;
199  TLorentzVector fShotMom;
200  Int_t fEvID;
201 
202  // Parameters loaded from config - both modes
203  int fSourceMode; // Mode to run in - scan or file
204  bool fFillTree; // Do we want to create a TTree of shot particles?
205  int fPosDist; //
206  int fTDist; // Random distributions to use : 1= gauss, 0= uniform
207  int fPDist; //
208 
209  /// Names of materials to consider scintillation from.
210  std::set<std::string> const fSelectedMaterials;
211 
212  //Scan mode specific parameters
213  int fXSteps; //
214  int fYSteps; // Number of steps to take in each dimension
215  int fZSteps; //
216 
217  sim::PhotonVoxelDef fThePhotonVoxelDef; // The photon voxel definition object for scan mode
218 
219  int fVoxelCount; // Total number of voxels
220  int fCurrentVoxel; // Counter to keep track of vox ID
221 
222  // TPC Measurements
224  std::vector<double> fRegionMin;
225  std::vector<double> fRegionMax;
227 
228  // Parameters used to shoot in distributions
229  geo::Point_t fCenter; ///< Central position of source [cm]
230  bool fPointSource; // Point-like light source in fCenter
231  double fT; // central t position of source
232  double fSigmaX; // x width
233  double fSigmaY; // y width
234  double fSigmaZ; // z width
235  double fSigmaT; // t width
236  double fP; // central momentm of photon
237  double fSigmaP; // mom width;
238 
239  // Number of photons per event
240  int fN; // number of photons per event
241 
242  /// Maximum number of attempted samplings (factor on top of `fN`).
243  double const fNMaxF;
244 
247 
248  CLHEP::HepRandomEngine& fEngine;
249  geo::GeometryCore const& fGeom; ///< Geometry service provider (cached).
250  };
251 }
252 
253 namespace {
254 
255  /// Returns a STL set with copies of all the elements from `v`.
256  template <typename Coll>
257  std::set<typename Coll::value_type>
258  makeSet(Coll const& coll)
259  {
260  return {begin(coll), end(coll)};
261  }
262 
263 } // local namespace
264 
265 namespace evgen {
266 
267  //----------------------------------------------------------------
269  : art::EDProducer{pset}
270  , fSourceMode{pset.get<int>("SourceMode")}
271  , fFillTree{pset.get<bool>("FillTree")}
272  , fPosDist{pset.get<int>("PosDist")}
273  , fTDist{pset.get<int>("TDist")}
274  , fPDist{pset.get<int>("PDist")}
275  , fSelectedMaterials{makeSet(pset.get<std::vector<std::string>>("SelectMaterials", {}))}
276  , fNMaxF{pset.get<double>("NMaxFactor", 100.0)}
277  // create a default random engine; obtain the random seed from NuRandomService,
278  // unless overridden in configuration with key "Seed"
279  , fEngine(art::ServiceHandle<rndm::NuRandomService> {}->createEngine(*this, pset, "Seed"))
280  , fGeom(*lar::providerFrom<geo::Geometry const>())
281  {
282 
283  checkMaterials();
284 
285  // load optional parameters in function
286  produces<sumdata::RunData, art::InRun>();
287  produces<std::vector<simb::MCTruth>>();
288 
289  if (fSourceMode == kFILE) {
290  fFileName = pset.get<std::string>("SteeringFile");
291  fInputFile.open(fFileName.c_str());
292  fInputFile.getline(fDummyString, 256);
293  }
294  else if (fSourceMode == kSCAN) {
295  fT = pset.get<double>("T0");
296  fSigmaT = pset.get<double>("SigmaT");
297  fN = pset.get<int>("N");
298 
299  fFirstVoxel = pset.get<int>("FirstVoxel");
300  fLastVoxel = pset.get<int>("LastVoxel");
301 
302  fP = pset.get<double>("P");
303  fSigmaP = pset.get<double>("SigmaP");
304 
305  fUseCustomRegion = pset.get<bool>("UseCustomRegion");
306  fPointSource = pset.get<bool>("PointSource", false);
307 
308  if (fUseCustomRegion) {
309  fRegionMin = pset.get<std::vector<double>>("RegionMin");
310  fRegionMax = pset.get<std::vector<double>>("RegionMax");
311  fXSteps = pset.get<int>("XSteps");
312  fYSteps = pset.get<int>("YSteps");
313  fZSteps = pset.get<int>("ZSteps");
314  }
315 
316  // get TPC dimensions removed. -TA
317 
318  fCurrentVoxel = 0;
319 
320  // define voxelization based on parameters read from config.
321  // There are two modes - either read the dimensions of the TPC from
322  // the geometry, or use values specified by the user.
323  if (!fUseCustomRegion) {
326  }
327  else {
329  fRegionMax[0],
330  fXSteps,
331  fRegionMin[1],
332  fRegionMax[1],
333  fYSteps,
334  fRegionMin[2],
335  fRegionMax[2],
336  fZSteps);
337  }
338 
339  // Set distribution widths to voxel size
340 
344 
345  // Get number of voxels we will step through
346 
348 
349  if (fLastVoxel < 0) fLastVoxel = fVoxelCount;
350 
351  mf::LogVerbatim("LightSource") << "Light Source : Determining voxel params : " << fVoxelCount
352  << " " << fSigmaX << " " << fSigmaY << " " << fSigmaZ;
353  }
354  else {
355  throw cet::exception("LightSource")
356  << "EVGEN Light Source : Unrecognised light source mode\n";
357  }
358 
359  if (fFillTree) {
361  fPhotonsGenerated = tfs->make<TTree>("PhotonsGenerated", "PhotonsGenerated");
362  fPhotonsGenerated->Branch("X", &(fShotPos[0]), "X/D");
363  fPhotonsGenerated->Branch("Y", &(fShotPos[1]), "Y/D");
364  fPhotonsGenerated->Branch("Z", &(fShotPos[2]), "Z/D");
365  fPhotonsGenerated->Branch("T", &(fShotPos[3]), "T/D");
366  fPhotonsGenerated->Branch("PX", &(fShotMom[0]), "PX/D");
367  fPhotonsGenerated->Branch("PY", &(fShotMom[1]), "PY/D");
368  fPhotonsGenerated->Branch("PZ", &(fShotMom[2]), "PZ/D");
369  fPhotonsGenerated->Branch("PT", &(fShotMom[3]), "PT/D");
370  fPhotonsGenerated->Branch("EventID", &fEvID, "EventID/I");
371  }
372  }
373 
374  //____________________________________________________________________________
375  void
377  {
378  run.put(std::make_unique<sumdata::RunData>(fGeom.DetectorName()));
379 
381  }
382 
383  //----------------------------------------------------------------
384  void
386  {
387  if(fSourceMode==kFILE) {
388  // Each event, read coordinates of gun and number of photons to shoot from file
389 
390  // read in one line
392  // Loop file if required
393  mf::LogWarning("LightSource") << "EVGEN Light Source : Warning, reached end of file,"
394  << " looping back to beginning";
395  fInputFile.clear();
396  fInputFile.seekg(0, std::ios::beg);
397  fInputFile.getline(fDummyString, 256);
398 
400  throw cet::exception("LightSource") << "EVGEN Light Source : File error in "
401  << fFileName << "\n";
402  }
403 
404  }
405 
407  fCenter.X() + fSigmaX,
408  1,
409  fCenter.Y() - fSigmaY,
410  fCenter.Y() + fSigmaY,
411  1,
412  fCenter.Z() - fSigmaZ,
413  fCenter.Z() + fSigmaZ,
414  1);
415 
416  fCurrentVoxel=0;
417  }
418  else if (fSourceMode == kSCAN) {
419  // Step through detector using a number of steps provided in the config file
420  // firing a constant number of photons from each point
422  }
423  else {
424  // Neither file or scan mode, probably a config file error
425  throw cet::exception("LightSource") << "EVGEN : Light Source, unrecognised source mode\n";
426  }
427 
428  auto truthcol = std::make_unique<std::vector<simb::MCTruth>>();
429 
430  truthcol->push_back(Sample());
431  int const nPhotons = truthcol->back().NParticles();
432 
433  evt.put(std::move(truthcol));
434 
435  phot::PhotonVisibilityService* vis = nullptr;
436  try {
438  }
439  catch (art::Exception const& e) {
440  // if the service is not configured, then this is not a build job
441  // (it is a simple generation job instead)
442  if (e.categoryCode() != art::errors::ServiceNotFound) throw;
443  }
444 
445  if (vis && vis->IsBuildJob()) {
446  mf::LogVerbatim("LightSource") << "Light source : Stowing voxel params ";
447  vis->StoreLightProd(fCurrentVoxel, nPhotons);
448  }
449 
450  if (fCurrentVoxel != fLastVoxel) { ++fCurrentVoxel; }
451  else {
452  mf::LogVerbatim("LightSource")
453  << "EVGEN Light Source fully scanned detector. Starting over.";
455  }
456  }
457 
460  {
461  mf::LogVerbatim("LightSource") << "Light source debug : Shooting at " << fCenter;
462 
463  CLHEP::RandFlat flat(fEngine, -1.0, 1.0);
464  CLHEP::RandGaussQ gauss(fEngine);
465 
467 
468  simb::MCTruth mct;
470 
471  unsigned long long int const nMax = static_cast<unsigned long long int>(double(fN) * fNMaxF);
472  unsigned long long int fired = 0ULL;
473  while (mct.NParticles() < fN) {
474  if (fired >= nMax) break;
475 
476  // Choose momentum (supplied in eV, convert to GeV)
477  double const p =
478  1e-9 * ((fPDist == kGAUS) ? gauss.fire(fP, fSigmaP) : fP + fSigmaP * flat.fire());
479 
480  // Choose position
481  ++fired;
482  geo::Point_t x;
483  if (fPointSource) { x = fCenter; }
484  else {
485  if (fPosDist == kGAUS) {
486  x = {gauss.fire(fCenter.X(), fSigmaX),
487  gauss.fire(fCenter.Y(), fSigmaY),
488  gauss.fire(fCenter.Z(), fSigmaZ)};
489  }
490  else {
491  x = {fCenter.X() + fSigmaX * flat.fire(),
492  fCenter.Y() + fSigmaY * flat.fire(),
493  fCenter.Z() + fSigmaZ * flat.fire()};
494  }
495 
496  if (!filter.accept(x)) continue;
497  }
498 
499  // Choose time
500  double t;
501  if (fTDist == kGAUS) { t = gauss.fire(fT, fSigmaT); }
502  else {
503  t = fT + fSigmaT * flat.fire();
504  }
505 
506  //assume the position is relative to the center of the TPC
507  //x += fTPCCenter;
508 
509  fShotPos = TLorentzVector(x.X(), x.Y(), x.Z(), t);
510 
511  // Choose angles
512  double costh = flat.fire();
513  double sinth = std::sqrt(1.0 - cet::square(costh));
514  double phi = 2 * M_PI * flat.fire();
515 
516  // Generate momentum 4-vector
517 
518  fShotMom = TLorentzVector(p * sinth * cos(phi), p * sinth * sin(phi), p * costh, p);
519 
520  int trackid = -(mct.NParticles() +
521  1); // set track id to -i as these are all primary particles and have id <= 0
522  std::string primary("primary");
523  int PDG = 0; //optical photons have PDG 0
524 
525  simb::MCParticle part(trackid, PDG, primary);
527 
528  if (fFillTree) fPhotonsGenerated->Fill();
529 
530  mct.Add(part);
531  }
532 
533  mf::LogInfo("LightSource") << "Generated " << mct.NParticles() << " photons after " << fired
534  << " tries.";
535  if (mct.NParticles() < fN) {
536  // this may mean `NMaxFactor` is too small, or the volume is wrong;
537  // or it may be just expected
538  mf::LogWarning("LightSource")
539  << "Warning: " << mct.NParticles() << " photons generated after " << fired << " tries, but "
540  << fN << " were requested.";
541  }
542 
543  return mct;
544  } // LightSource::Sample()
545 
546  // ---------------------------------------------------------------------------
547  void
549  {
550 
551  TGeoManager const& manager = *(fGeom.ROOTGeoManager());
552 
553  { // start scope
554  mf::LogDebug log("LightSource");
555  auto const& matList = *(manager.GetListOfMaterials());
556  log << matList.GetSize() << " elements/materials in the geometry:";
557  for (auto const* obj : matList) {
558  auto const mat = dynamic_cast<TGeoMaterial const*>(obj);
559  log << "\n '" << mat->GetName() << "' (Z=" << mat->GetZ() << " A=" << mat->GetA() << ")";
560  } // for
561  } // end scope
562 
563  std::set<std::string> missingMaterials;
564  for (auto const& matName : fSelectedMaterials) {
565  if (!manager.GetMaterial(matName.c_str())) missingMaterials.insert(matName);
566  }
567  if (missingMaterials.empty()) return;
568 
570  e << "Requested filtering on " << missingMaterials.size()
571  << " materials which are not present in the geometry:";
572  for (auto const& matName : missingMaterials)
573  e << "\n '" << matName << "'";
574  throw e << "\n";
575 
576  } // LightSource::checkMaterials()
577 
578  // ---------------------------------------------------------------------------
579  // --- LightSource::MaterialPointFilter
580  // ---------------------------------------------------------------------------
582  std::set<std::string> const& materialNames)
583  : fManager(geom.ROOTGeoManager())
584  , fNavigator(fManager->AddNavigator())
585  , fMaterials(materialNames)
586  {
587  assert(fManager);
588  assert(fNavigator);
589  }
590 
591  // ---------------------------------------------------------------------------
593  {
594  fManager->RemoveNavigator(fNavigator); // this deletes the navigator
595  fNavigator = nullptr;
596  } // LightSource::MaterialPointFilter::~MaterialPointFilter()
597 
598  // ---------------------------------------------------------------------------
599  TGeoMaterial const*
601  {
602  TGeoNode const* node = fNavigator->FindNode(point.X(), point.Y(), point.Z());
603  return node ? node->GetVolume()->GetMaterial() : nullptr;
604  } // LightSource::MaterialPointFilter::materialAt()
605 
606  // ---------------------------------------------------------------------------
607  bool
609  {
610  if (fMaterials.empty()) return true;
611  TGeoMaterial const* material = materialAt(point);
612  MF_LOG_TRACE("LightSource") << "Material at " << point << ": "
613  << (material ? material->GetName() : "not found");
614  return material ? (fMaterials.count(material->GetName()) > 0) : false;
615  } // LightSource::MaterialPointFilter::accept()
616 
617 
618  //----------------------------------------------------------------------------
620  double x, y, z;
621  fInputFile >> x >> y >> z >> fT
622  >> fSigmaX >> fSigmaY >> fSigmaZ >> fSigmaT
623  >> fP >> fSigmaP >> fN;
624  fCenter = { x, y, z };
625  if (!fInputFile.good()) return false;
626 
628  std::getline(fInputFile, dummy); // this can fail for what I care
629  return true;
630  } // LightSource::readParametersFromInputFile()
631 
632 
633  // ---------------------------------------------------------------------------
634 
635 } // namespace evgen
636 
Definitions of voxel data structures.
static QCString name
Definition: declinfo.cpp:673
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< double > fRegionMin
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
MaterialPointFilter(geo::GeometryCore const &geom, std::set< std::string > const &materialNames)
Constructor: sets up the filter configuration.
LightSource(fhicl::ParameterSet const &pset)
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
Definition: MCParticle.h:257
geo::GeometryCore const & fGeom
Geometry service provider (cached).
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:82
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Vector GetVoxelSize() const
Returns a vector describing the span of a single voxel in x, y an z [cm].
Definition: PhotonVoxels.h:224
static const int kSCAN
TGeoNavigator * fNavigator
Our own ROOT geometry navigator.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
Representation of a region of space diced into voxels.
Definition: PhotonVoxels.h:58
static const int kGAUS
std::vector< double > fRegionMax
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
int NParticles() const
Definition: MCTruth.h:75
Particle class.
constexpr T square(T x)
Definition: pow.h:21
double const fNMaxF
Maximum number of attempted samplings (factor on top of fN).
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
void checkMaterials() const
Throws an exception if any of the configured materials is not present.
art framework interface to geometry description
Definition: Run.h:17
bool operator()(geo::Point_t const &point)
void produce(art::Event &evt)
CLHEP::HepRandomEngine & fEngine
const uint PDG
Definition: qregexp.cpp:140
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
std::set< std::string > const & fMaterials
Names of materials to select.
single particles thrown at the detector
Definition: MCTruth.h:26
def move(depos, offset)
Definition: depos.py:107
simb::MCTruth Sample()
#define MF_LOG_TRACE(id)
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
Filters a point according to the material at that point.
Description of geometry of one entire detector.
TGeoMaterial const * materialAt(geo::Point_t const &point)
Returns a pointer to the material of the volume at specified point.
TGeoMaterial const * findMaterial(std::string const &name) const
Returns a pointer to the material with the specified name.
void beginRun(art::Run &run)
sim::PhotonVoxelDef fThePhotonVoxelDef
#define M_PI
Definition: includeROOT.h:54
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
static const int kUNIF
const sim::PhotonVoxelDef & GetVoxelDef() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
geo::Point_t fCenter
Central position of source [cm].
TGeoManager * fManager
ROOT geometry manager.
Point GetCenter() const
Returns the center of the voxel (type Point).
Definition: PhotonVoxels.h:199
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
static const int kFILE
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
cet::LibraryManager dummy("noplugin")
Definitions of geometry vector data types.
Access the description of detector geometry.
list x
Definition: train.py:276
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
A module for optical MC testing and library building.
TCEvent evt
Definition: DataStructs.cxx:7
bool accept(geo::Point_t const &point)
Returns whether the specified point can be accepted.
Event generator information.
Definition: MCTruth.h:32
Event Generation using GENIE, cosmics or single particles.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::set< std::string > const fSelectedMaterials
Names of materials to consider scintillation from.
PhotonVoxel GetPhotonVoxel(int ID) const