All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
89 #include "art/Framework/Core/EDProducer.h"
90 #include "art/Framework/Core/ModuleMacros.h"
91 #include "art/Framework/Principal/Event.h"
92 #include "art/Framework/Principal/Run.h"
93 #include "art/Framework/Services/Registry/ServiceHandle.h"
94 #include "art_root_io/TFileService.h"
95 #include "canvas/Utilities/Exception.h"
96 #include "cetlib/pow.h" // cet::square()
97 #include "cetlib_except/exception.h"
98 #include "fhiclcpp/ParameterSet.h"
99 #include "messagefacility/MessageLogger/MessageLogger.h"
100 
101 // art extensions
102 #include "nurandom/RandomUtils/NuRandomService.h"
103 
104 // nusimdata includes
105 #include "nusimdata/SimulationBase/MCParticle.h"
106 #include "nusimdata/SimulationBase/MCTruth.h"
107 
108 // lar includes
116 
117 #include "TGeoManager.h"
118 #include "TGeoMaterial.h"
119 #include "TGeoNavigator.h"
120 #include "TList.h"
121 #include "TLorentzVector.h"
122 #include "TTree.h"
123 #include "TVector3.h"
124 
125 #include "CLHEP/Random/RandFlat.h"
126 #include "CLHEP/Random/RandGaussQ.h"
127 
128 namespace evgen {
129 
130  /// A module for optical MC testing and library building
131  class LightSource : public art::EDProducer {
132  public:
133  explicit LightSource(fhicl::ParameterSet const& pset);
134 
135  void produce(art::Event& evt);
136  void beginRun(art::Run& run);
137 
138  private:
139  /// Filters a point according to the material at that point.
141  public:
142  /// Constructor: sets up the filter configuration.
144  std::set<std::string> const& materialNames);
145 
147 
148  // @{
149  /// Returns whether the specified `point` can be accepted.
150  bool accept(geo::Point_t const& point);
151  bool
152  operator()(geo::Point_t const& point)
153  {
154  return accept(point);
155  }
156  // @}
157 
158  private:
159  TGeoManager* fManager = nullptr; ///< ROOT geometry manager.
160  TGeoNavigator* fNavigator = nullptr; ///< Our own ROOT geometry navigator.
161 
162  /// Names of materials to select.
163  std::set<std::string> const& fMaterials;
164 
165  /// Returns a pointer to the material of the volume at specified `point`.
166  TGeoMaterial const* materialAt(geo::Point_t const& point);
167 
168  /// Returns a pointer to the material with the specified `name`.
169  TGeoMaterial const* findMaterial(std::string const& name) const;
170 
171  }; // MaterialPointFilter
172 
173  simb::MCTruth Sample();
174 
175  /// Throws an exception if any of the configured materials is not present.
176  void checkMaterials() const;
177 
178 
179  /// Reads from `fInputFile` all other parameters in one line.
180  /// @return whether all reading were successful (`ifstream::good()`).
182 
183  // for c2: fSeed is unused
184  //int fSeed; //random number seed
185  std::string fVersion; //version of the configuration
186 
187  // Flags to mark module modes
188  static const int kUNIF = 0;
189  static const int kGAUS = 1;
190  static const int kFILE = 0;
191  static const int kSCAN = 1;
192 
193  // File stream, filename and empty string for file processing
194  std::ifstream fInputFile;
195  std::string fFileName;
196  char fDummyString[256];
197 
198  // A ttree to keep track of where particles have been shot - ends up in histos.root
200  TLorentzVector fShotPos;
201  TLorentzVector fShotMom;
202  Int_t fEvID;
203 
204  // Parameters loaded from config - both modes
205  int fSourceMode; // Mode to run in - scan or file
206  bool fFillTree; // Do we want to create a TTree of shot particles?
207  int fPosDist; //
208  int fTDist; // Random distributions to use : 1= gauss, 0= uniform
209  int fPDist; //
210 
211  /// Names of materials to consider scintillation from.
212  std::set<std::string> const fSelectedMaterials;
213 
214  //Scan mode specific parameters
215  int fXSteps; //
216  int fYSteps; // Number of steps to take in each dimension
217  int fZSteps; //
218 
219  sim::PhotonVoxelDef fThePhotonVoxelDef; // The photon voxel definition object for scan mode
220 
221  int fVoxelCount; // Total number of voxels
222  int fCurrentVoxel; // Counter to keep track of vox ID
223 
224  // TPC Measurements
226  std::vector<double> fRegionMin;
227  std::vector<double> fRegionMax;
229 
230  // Parameters used to shoot in distributions
231  geo::Point_t fCenter; ///< Central position of source [cm]
232  bool fPointSource; // Point-like light source in fCenter
233  double fT; // central t position of source
234  double fSigmaX; // x width
235  double fSigmaY; // y width
236  double fSigmaZ; // z width
237  double fSigmaT; // t width
238  double fP; // central momentm of photon
239  double fSigmaP; // mom width;
240 
241  // Number of photons per event
242  int fN; // number of photons per event
243 
244  /// Maximum number of attempted samplings (factor on top of `fN`).
245  double const fNMaxF;
246 
249 
250  CLHEP::HepRandomEngine& fEngine;
251  geo::GeometryCore const& fGeom; ///< Geometry service provider (cached).
252  };
253 }
254 
255 namespace {
256 
257  /// Returns a STL set with copies of all the elements from `v`.
258  template <typename Coll>
259  std::set<typename Coll::value_type>
260  makeSet(Coll const& coll)
261  {
262  return {begin(coll), end(coll)};
263  }
264 
265 } // local namespace
266 
267 namespace evgen {
268 
269  //----------------------------------------------------------------
270  LightSource::LightSource(fhicl::ParameterSet const& pset)
271  : art::EDProducer{pset}
272  , fSourceMode{pset.get<int>("SourceMode")}
273  , fFillTree{pset.get<bool>("FillTree")}
274  , fPosDist{pset.get<int>("PosDist")}
275  , fTDist{pset.get<int>("TDist")}
276  , fPDist{pset.get<int>("PDist")}
277  , fSelectedMaterials{makeSet(pset.get<std::vector<std::string>>("SelectMaterials", {}))}
278  , fNMaxF{pset.get<double>("NMaxFactor", 100.0)}
279  // create a default random engine; obtain the random seed from NuRandomService,
280  // unless overridden in configuration with key "Seed"
281  , fEngine(art::ServiceHandle<rndm::NuRandomService> {}->createEngine(*this, pset, "Seed"))
282  , fGeom(*lar::providerFrom<geo::Geometry const>())
283  {
284 
285  checkMaterials();
286 
287  // load optional parameters in function
288  produces<sumdata::RunData, art::InRun>();
289  produces<std::vector<simb::MCTruth>>();
290 
291  if (fSourceMode == kFILE) {
292  fFileName = pset.get<std::string>("SteeringFile");
293  fInputFile.open(fFileName.c_str());
294  fInputFile.getline(fDummyString, 256);
295  }
296  else if (fSourceMode == kSCAN) {
297  fT = pset.get<double>("T0");
298  fSigmaT = pset.get<double>("SigmaT");
299  fN = pset.get<int>("N");
300 
301  fFirstVoxel = pset.get<int>("FirstVoxel");
302  fLastVoxel = pset.get<int>("LastVoxel");
303 
304  fP = pset.get<double>("P");
305  fSigmaP = pset.get<double>("SigmaP");
306 
307  fUseCustomRegion = pset.get<bool>("UseCustomRegion");
308  fPointSource = pset.get<bool>("PointSource", false);
309 
310  if (fUseCustomRegion) {
311  fRegionMin = pset.get<std::vector<double>>("RegionMin");
312  fRegionMax = pset.get<std::vector<double>>("RegionMax");
313  fXSteps = pset.get<int>("XSteps");
314  fYSteps = pset.get<int>("YSteps");
315  fZSteps = pset.get<int>("ZSteps");
316  }
317 
318  // get TPC dimensions removed. -TA
319 
320  fCurrentVoxel = 0;
321 
322  // define voxelization based on parameters read from config.
323  // There are two modes - either read the dimensions of the TPC from
324  // the geometry, or use values specified by the user.
325  if (!fUseCustomRegion) {
326  art::ServiceHandle<phot::PhotonVisibilityService const> vis;
327  fThePhotonVoxelDef = vis->GetVoxelDef();
328  }
329  else {
330  fThePhotonVoxelDef = sim::PhotonVoxelDef(fRegionMin[0],
331  fRegionMax[0],
332  fXSteps,
333  fRegionMin[1],
334  fRegionMax[1],
335  fYSteps,
336  fRegionMin[2],
337  fRegionMax[2],
338  fZSteps);
339  }
340 
341  // Set distribution widths to voxel size
342 
343  fSigmaX = fThePhotonVoxelDef.GetVoxelSize().X() / 2.0;
344  fSigmaY = fThePhotonVoxelDef.GetVoxelSize().Y() / 2.0;
345  fSigmaZ = fThePhotonVoxelDef.GetVoxelSize().Z() / 2.0;
346 
347  // Get number of voxels we will step through
348 
349  fVoxelCount = fThePhotonVoxelDef.GetNVoxels();
350 
351  if (fLastVoxel < 0) fLastVoxel = fVoxelCount;
352 
353  mf::LogVerbatim("LightSource") << "Light Source : Determining voxel params : " << fVoxelCount
354  << " " << fSigmaX << " " << fSigmaY << " " << fSigmaZ;
355  }
356  else {
357  throw cet::exception("LightSource")
358  << "EVGEN Light Source : Unrecognised light source mode\n";
359  }
360 
361  if (fFillTree) {
362  art::ServiceHandle<art::TFileService const> tfs;
363  fPhotonsGenerated = tfs->make<TTree>("PhotonsGenerated", "PhotonsGenerated");
364  fPhotonsGenerated->Branch("X", &(fShotPos[0]), "X/D");
365  fPhotonsGenerated->Branch("Y", &(fShotPos[1]), "Y/D");
366  fPhotonsGenerated->Branch("Z", &(fShotPos[2]), "Z/D");
367  fPhotonsGenerated->Branch("T", &(fShotPos[3]), "T/D");
368  fPhotonsGenerated->Branch("PX", &(fShotMom[0]), "PX/D");
369  fPhotonsGenerated->Branch("PY", &(fShotMom[1]), "PY/D");
370  fPhotonsGenerated->Branch("PZ", &(fShotMom[2]), "PZ/D");
371  fPhotonsGenerated->Branch("PT", &(fShotMom[3]), "PT/D");
372  fPhotonsGenerated->Branch("EventID", &fEvID, "EventID/I");
373  }
374  }
375 
376  //____________________________________________________________________________
377  void
378  LightSource::beginRun(art::Run& run)
379  {
380  run.put(std::make_unique<sumdata::RunData>(fGeom.DetectorName()));
381 
383  }
384 
385  //----------------------------------------------------------------
386  void
388  {
389  if(fSourceMode==kFILE) {
390  // Each event, read coordinates of gun and number of photons to shoot from file
391 
392  // read in one line
394  // Loop file if required
395  mf::LogWarning("LightSource") << "EVGEN Light Source : Warning, reached end of file,"
396  << " looping back to beginning";
397  fInputFile.clear();
398  fInputFile.seekg(0, std::ios::beg);
399  fInputFile.getline(fDummyString, 256);
400 
402  throw cet::exception("LightSource") << "EVGEN Light Source : File error in "
403  << fFileName << "\n";
404  }
405 
406  }
407 
409  fCenter.X() + fSigmaX,
410  1,
411  fCenter.Y() - fSigmaY,
412  fCenter.Y() + fSigmaY,
413  1,
414  fCenter.Z() - fSigmaZ,
415  fCenter.Z() + fSigmaZ,
416  1);
417 
418  fCurrentVoxel=0;
419  }
420  else if (fSourceMode == kSCAN) {
421  // Step through detector using a number of steps provided in the config file
422  // firing a constant number of photons from each point
424  }
425  else {
426  // Neither file or scan mode, probably a config file error
427  throw cet::exception("LightSource") << "EVGEN : Light Source, unrecognised source mode\n";
428  }
429 
430  auto truthcol = std::make_unique<std::vector<simb::MCTruth>>();
431 
432  truthcol->push_back(Sample());
433  int const nPhotons = truthcol->back().NParticles();
434 
435  evt.put(std::move(truthcol));
436 
437  phot::PhotonVisibilityService* vis = nullptr;
438  try {
439  vis = art::ServiceHandle<phot::PhotonVisibilityService>().get();
440  }
441  catch (art::Exception const& e) {
442  // if the service is not configured, then this is not a build job
443  // (it is a simple generation job instead)
444  if (e.categoryCode() != art::errors::ServiceNotFound) throw;
445  }
446 
447  if (vis && vis->IsBuildJob()) {
448  mf::LogVerbatim("LightSource") << "Light source : Stowing voxel params ";
449  vis->StoreLightProd(fCurrentVoxel, nPhotons);
450  }
451 
452  if (fCurrentVoxel != fLastVoxel) { ++fCurrentVoxel; }
453  else {
454  mf::LogVerbatim("LightSource")
455  << "EVGEN Light Source fully scanned detector. Starting over.";
457  }
458  }
459 
460  simb::MCTruth
462  {
463  mf::LogVerbatim("LightSource") << "Light source debug : Shooting at " << fCenter;
464 
465  CLHEP::RandFlat flat(fEngine, -1.0, 1.0);
466  CLHEP::RandGaussQ gauss(fEngine);
467 
469 
470  simb::MCTruth mct;
471  mct.SetOrigin(simb::kSingleParticle);
472 
473  unsigned long long int const nMax = static_cast<unsigned long long int>(double(fN) * fNMaxF);
474  unsigned long long int fired = 0ULL;
475  while (mct.NParticles() < fN) {
476  if (fired >= nMax) break;
477 
478  // Choose momentum (supplied in eV, convert to GeV)
479  double const p =
480  1e-9 * ((fPDist == kGAUS) ? gauss.fire(fP, fSigmaP) : fP + fSigmaP * flat.fire());
481 
482  // Choose position
483  ++fired;
484  geo::Point_t x;
485  if (fPointSource) { x = fCenter; }
486  else {
487  if (fPosDist == kGAUS) {
488  x = {gauss.fire(fCenter.X(), fSigmaX),
489  gauss.fire(fCenter.Y(), fSigmaY),
490  gauss.fire(fCenter.Z(), fSigmaZ)};
491  }
492  else {
493  x = {fCenter.X() + fSigmaX * flat.fire(),
494  fCenter.Y() + fSigmaY * flat.fire(),
495  fCenter.Z() + fSigmaZ * flat.fire()};
496  }
497 
498  if (!filter.accept(x)) continue;
499  }
500 
501  // Choose time
502  double t;
503  if (fTDist == kGAUS) { t = gauss.fire(fT, fSigmaT); }
504  else {
505  t = fT + fSigmaT * flat.fire();
506  }
507 
508  //assume the position is relative to the center of the TPC
509  //x += fTPCCenter;
510 
511  fShotPos = TLorentzVector(x.X(), x.Y(), x.Z(), t);
512 
513  // Choose angles
514  double costh = flat.fire();
515  double sinth = std::sqrt(1.0 - cet::square(costh));
516  double phi = 2 * M_PI * flat.fire();
517 
518  // Generate momentum 4-vector
519 
520  fShotMom = TLorentzVector(p * sinth * cos(phi), p * sinth * sin(phi), p * costh, p);
521 
522  int trackid = -(mct.NParticles() +
523  1); // set track id to -i as these are all primary particles and have id <= 0
524  std::string primary("primary");
525  int PDG = 0; //optical photons have PDG 0
526 
527  simb::MCParticle part(trackid, PDG, primary);
528  part.AddTrajectoryPoint(fShotPos, fShotMom);
529 
530  if (fFillTree) fPhotonsGenerated->Fill();
531 
532  mct.Add(part);
533  }
534 
535  mf::LogInfo("LightSource") << "Generated " << mct.NParticles() << " photons after " << fired
536  << " tries.";
537  if (mct.NParticles() < fN) {
538  // this may mean `NMaxFactor` is too small, or the volume is wrong;
539  // or it may be just expected
540  mf::LogWarning("LightSource")
541  << "Warning: " << mct.NParticles() << " photons generated after " << fired << " tries, but "
542  << fN << " were requested.";
543  }
544 
545  return mct;
546  } // LightSource::Sample()
547 
548  // ---------------------------------------------------------------------------
549  void
551  {
552 
553  TGeoManager const& manager = *(fGeom.ROOTGeoManager());
554 
555  { // start scope
556  mf::LogDebug log("LightSource");
557  auto const& matList = *(manager.GetListOfMaterials());
558  log << matList.GetSize() << " elements/materials in the geometry:";
559  for (auto const* obj : matList) {
560  auto const mat = dynamic_cast<TGeoMaterial const*>(obj);
561  log << "\n '" << mat->GetName() << "' (Z=" << mat->GetZ() << " A=" << mat->GetA() << ")";
562  } // for
563  } // end scope
564 
565  std::set<std::string> missingMaterials;
566  for (auto const& matName : fSelectedMaterials) {
567  if (!manager.GetMaterial(matName.c_str())) missingMaterials.insert(matName);
568  }
569  if (missingMaterials.empty()) return;
570 
571  art::Exception e(art::errors::Configuration);
572  e << "Requested filtering on " << missingMaterials.size()
573  << " materials which are not present in the geometry:";
574  for (auto const& matName : missingMaterials)
575  e << "\n '" << matName << "'";
576  throw e << "\n";
577 
578  } // LightSource::checkMaterials()
579 
580  // ---------------------------------------------------------------------------
581  // --- LightSource::MaterialPointFilter
582  // ---------------------------------------------------------------------------
584  std::set<std::string> const& materialNames)
585  : fManager(geom.ROOTGeoManager())
586  , fNavigator(fManager->AddNavigator())
587  , fMaterials(materialNames)
588  {
589  assert(fManager);
590  assert(fNavigator);
591  }
592 
593  // ---------------------------------------------------------------------------
595  {
596  fManager->RemoveNavigator(fNavigator); // this deletes the navigator
597  fNavigator = nullptr;
598  } // LightSource::MaterialPointFilter::~MaterialPointFilter()
599 
600  // ---------------------------------------------------------------------------
601  TGeoMaterial const*
603  {
604  TGeoNode const* node = fNavigator->FindNode(point.X(), point.Y(), point.Z());
605  return node ? node->GetVolume()->GetMaterial() : nullptr;
606  } // LightSource::MaterialPointFilter::materialAt()
607 
608  // ---------------------------------------------------------------------------
609  bool
611  {
612  if (fMaterials.empty()) return true;
613  TGeoMaterial const* material = materialAt(point);
614  MF_LOG_TRACE("LightSource") << "Material at " << point << ": "
615  << (material ? material->GetName() : "not found");
616  return material ? (fMaterials.count(material->GetName()) > 0) : false;
617  } // LightSource::MaterialPointFilter::accept()
618 
619 
620  //----------------------------------------------------------------------------
622  double x, y, z;
623  fInputFile >> x >> y >> z >> fT
624  >> fSigmaX >> fSigmaY >> fSigmaZ >> fSigmaT
625  >> fP >> fSigmaP >> fN;
626  fCenter = { x, y, z };
627  if (!fInputFile.good()) return false;
628 
629  std::string dummy;
630  std::getline(fInputFile, dummy); // this can fail for what I care
631  return true;
632  } // LightSource::readParametersFromInputFile()
633 
634 
635  // ---------------------------------------------------------------------------
636 
637 } // namespace evgen
638 
639 DEFINE_ART_MODULE(evgen::LightSource)
std::vector< double > fRegionMin
process_name opflash particleana ie ie ie z
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
MaterialPointFilter(geo::GeometryCore const &geom, std::set< std::string > const &materialNames)
Constructor: sets up the filter configuration.
process_name stream1 can override from command line with o or output services DetectorPropertiesService services DetectorPropertiesService services DetectorPropertiesService services DetectorPropertiesService physics analyzers pmtresponse NeutronTrackingCut services LArG4Parameters gaussian physics producers generator PDG
LightSource(fhicl::ParameterSet const &pset)
Utilities related to art service access.
process_name opflash particleana ie x
geo::GeometryCore const & fGeom
Geometry service provider (cached).
createEngine fTDist
static const int kSCAN
TGeoNavigator * fNavigator
Our own ROOT geometry navigator.
pdgs p
Definition: selectors.fcl:22
Representation of a region of space diced into voxels.
static const int kGAUS
std::vector< double > fRegionMax
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.
bool operator()(geo::Point_t const &point)
void produce(art::Event &evt)
CLHEP::HepRandomEngine & fEngine
void StoreLightProd(int VoxID, double N)
Access the description of detector geometry.
Definitions of voxel data structures.
process_name opflash particleana ie ie y
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Definitions of geometry vector data types.
std::set< std::string > const & fMaterials
Names of materials to select.
createEngine fSigmaT
simb::MCTruth Sample()
Point GetCenter() const
Returns the center of the voxel (type Point).
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
fEngine(art::ServiceHandle< rndm::NuRandomService >() ->createEngine(*this, pset,"Seed"))
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
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
static const int kUNIF
physics filters filter
geo::Point_t fCenter
Central position of source [cm].
TGeoManager * fManager
ROOT geometry manager.
static const int kFILE
do i e
then echo fcl name
art::ServiceHandle< art::TFileService > tfs
A module for optical MC testing and library building.
TCEvent evt
Definition: DataStructs.cxx:8
bool accept(geo::Point_t const &point)
Returns whether the specified point can be accepted.
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
art framework interface to geometry description
std::set< std::string > const fSelectedMaterials
Names of materials to consider scintillation from.