LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
phot::PDFastSimPAR Class Reference
Inheritance diagram for phot::PDFastSimPAR:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 
using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 PDFastSimPAR (Parameters const &config)
 
void produce (art::Event &) override
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void detectedNumPhotons (std::vector< int > &DetectedNumPhotons, const std::vector< double > &OpDetVisibilities, const int NumPhotons) const
 
void AddOpDetBTR (std::vector< sim::OpDetBacktrackerRecord > &opbtr, std::vector< int > &ChannelMap, const sim::OpDetBacktrackerRecord &btr) const
 
bool isOpDetInSameTPC (geo::Point_t const &ScintPoint, geo::Point_t const &OpDetPoint) const
 
std::vector< geo::Point_topDetCenters () const
 

Private Attributes

std::unique_ptr< SemiAnalyticalModelfVisibilityModel
 
std::unique_ptr< PropagationTimeModelfPropTimeModel
 
CLHEP::HepRandomEngine & fPhotonEngine
 
std::unique_ptr< CLHEP::RandPoissonQ > fRandPoissPhot
 
CLHEP::HepRandomEngine & fScintTimeEngine
 
std::unique_ptr< ScintTimefScintTime
 
geo::GeometryCore const & fGeom
 
larg4::ISTPC fISTPC
 
const size_t fNOpChannels
 
const std::vector< geo::BoxBoundedGeofActiveVolumes
 
const int fNTPC
 
const std::vector< geo::Point_tfOpDetCenter
 
const art::InputTag fSimTag
 
const bool fDoFastComponent
 
const bool fDoSlowComponent
 
const bool fDoReflectedLight
 
const bool fIncludeAnodeReflections
 
const bool fIncludePropTime
 
const bool fGeoPropTimeOnly
 
const bool fUseLitePhotons
 
const bool fOpaqueCathode
 
const bool fOnlyActiveVolume
 
const bool fOnlyOneCryostat
 
const bool fUseXeAbsorption
 

Detailed Description

Definition at line 77 of file PDFastSimPAR_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

phot::PDFastSimPAR::PDFastSimPAR ( Parameters const &  config)
explicit

Definition at line 182 of file PDFastSimPAR_module.cc.

References art::errors::Configuration, art::detail::EngineCreator::createEngine(), util::enumerate(), larg4::ISTPC::extractActiveLArVolume(), fActiveVolumes, fDoFastComponent, fDoReflectedLight, fDoSlowComponent, fGeom, fGeoPropTimeOnly, fIncludeAnodeReflections, fIncludePropTime, fISTPC, fNOpChannels, fNTPC, fOnlyActiveVolume, fOnlyOneCryostat, fOpaqueCathode, fOpDetCenter, fPhotonEngine, fPropTimeModel, fRandPoissPhot, fScintTime, fScintTimeEngine, fSimTag, fUseLitePhotons, fUseXeAbsorption, fVisibilityModel, fhicl::ParameterSet::get(), geo::GeometryCore::Ncryostats(), geo::GeometryCore::NOpDets(), geo::GeometryCore::NTPC(), and opDetCenters().

183  : art::EDProducer{config}
184  , fPhotonEngine(art::ServiceHandle<rndm::NuRandomService>()->registerAndSeedEngine(
185  createEngine(0, "HepJamesRandom", "photon"),
186  "HepJamesRandom",
187  "photon",
188  config.get_PSet(),
189  "SeedPhoton"))
190  , fRandPoissPhot(std::make_unique<CLHEP::RandPoissonQ>(fPhotonEngine))
192  createEngine(0, "HepJamesRandom", "scinttime"),
193  "HepJamesRandom",
194  "scinttime",
195  config.get_PSet(),
196  "SeedScintTime"))
197  , fScintTime{art::make_tool<phot::ScintTime>(config().ScintTimeTool.get<fhicl::ParameterSet>())}
198  , fGeom(*(lar::providerFrom<geo::Geometry>()))
199  , fISTPC{fGeom}
202  , fNTPC(fGeom.NTPC())
204  , fSimTag(config().SimulationLabel())
205  , fDoFastComponent(config().DoFastComponent())
206  , fDoSlowComponent(config().DoSlowComponent())
207  , fDoReflectedLight(config().DoReflectedLight())
208  , fIncludeAnodeReflections(config().IncludeAnodeReflections())
209  , fIncludePropTime(config().IncludePropTime())
210  , fGeoPropTimeOnly(config().GeoPropTimeOnly())
211  , fUseLitePhotons(config().UseLitePhotons())
212  , fOpaqueCathode(config().OpaqueCathode())
213  , fOnlyActiveVolume(config().OnlyActiveVolume())
214  , fOnlyOneCryostat(config().OnlyOneCryostat())
215  , fUseXeAbsorption(config().UseXeAbsorption())
216  {
217  mf::LogInfo("PDFastSimPAR") << "Initializing PDFastSimPAR." << std::endl;
218 
219  // Parameterized Simulation
220  fhicl::ParameterSet VUVHitsParams = config().VUVHits.get<fhicl::ParameterSet>();
221  fhicl::ParameterSet VUVTimingParams;
222  fhicl::ParameterSet VISHitsParams;
223  fhicl::ParameterSet VISTimingParams;
224 
225  // Validate configuration options
226  if (fIncludePropTime &&
227  !config().VUVTiming.get_if_present<fhicl::ParameterSet>(VUVTimingParams)) {
229  << "Propagation time simulation requested, but VUVTiming not specified."
230  << "\n";
231  }
233  !config().VISHits.get_if_present<fhicl::ParameterSet>(VISHitsParams)) {
235  << "Reflected light or anode reflections simulation requested, but VisHits not specified."
236  << "\n";
237  }
239  !config().VISTiming.get_if_present<fhicl::ParameterSet>(VISTimingParams)) {
241  << "Reflected light propagation time simulation requested, but VISTiming not specified."
242  << "\n";
243  }
244  if (fGeom.Ncryostats() > 1U) {
245  if (fOnlyOneCryostat) {
246  mf::LogWarning("PDFastSimPAR")
247  << std::string(80, '=') << "\nA detector with " << fGeom.Ncryostats()
248  << " cryostats is configured"
249  << " , and semi-analytic model is requested for scintillation photon propagation."
250  << " THIS CONFIGURATION IS NOT SUPPORTED and it is open to bugs"
251  << " (e.g. scintillation may be detected only in cryostat #0)."
252  << "\nThis would be normally a fatal error, but it has been forcibly overridden."
253  << "\n"
254  << std::string(80, '=');
255  }
256  else {
258  << "Photon propagation via semi-analytic model is not supported yet"
259  << " on detectors with more than one cryostat.";
260  }
261  }
262 
263  // Initialise the Scintillation Time
264  fScintTime->initRand(fScintTimeEngine);
265 
266  // photo-detector visibility model (semi-analytical model)
267  fVisibilityModel = std::make_unique<SemiAnalyticalModel>(
268  VUVHitsParams, VISHitsParams, fDoReflectedLight, fIncludeAnodeReflections, fUseXeAbsorption);
269 
270  // propagation time model
271  if (fIncludePropTime)
272  fPropTimeModel = std::make_unique<PropagationTimeModel>(
273  VUVTimingParams, VISTimingParams, fScintTimeEngine, fDoReflectedLight, fGeoPropTimeOnly);
274 
275  {
276  auto log = mf::LogTrace("PDFastSimPAR") << "PDFastSimPAR: active volume boundaries from "
277  << fActiveVolumes.size() << " volumes:";
278  for (auto const& [iCryo, box] : util::enumerate(fActiveVolumes)) {
279  log << "\n - C:" << iCryo << ": " << box.Min() << " -- " << box.Max() << " cm";
280  }
281  }
282 
283  if (fUseLitePhotons) {
284  mf::LogInfo("PDFastSimPAR") << "Using Lite Photons";
285  produces<std::vector<sim::SimPhotonsLite>>();
286  produces<std::vector<sim::OpDetBacktrackerRecord>>();
287  if (fDoReflectedLight) {
288  mf::LogInfo("PDFastSimPAR") << "Storing Reflected Photons";
289  produces<std::vector<sim::SimPhotonsLite>>("Reflected");
290  produces<std::vector<sim::OpDetBacktrackerRecord>>("Reflected");
291  }
292  }
293  else {
294  mf::LogInfo("PDFastSimPAR") << "Using Sim Photons";
295  produces<std::vector<sim::SimPhotons>>();
296  if (fDoReflectedLight) {
297  mf::LogInfo("PDFastSimPAR") << "Storing Reflected Photons";
298  produces<std::vector<sim::SimPhotons>>("Reflected");
299  }
300  }
301  mf::LogInfo("PDFastSimPAR") << "PDFastSimPAR Initialization finish.\n"
302  << "Simulate using semi-analytic model for number of hits."
303  << std::endl;
304  }
const std::vector< geo::BoxBoundedGeo > fActiveVolumes
base_engine_t & createEngine(seed_t seed)
unsigned int NTPC(CryostatID const &cryoid=cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Definition: GeometryCore.h:686
static std::vector< geo::BoxBoundedGeo > extractActiveLArVolume(geo::GeometryCore const &geom)
Definition: ISTPC.cxx:45
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::unique_ptr< PropagationTimeModel > fPropTimeModel
std::unique_ptr< ScintTime > fScintTime
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:430
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:65
std::unique_ptr< CLHEP::RandPoissonQ > fRandPoissPhot
CLHEP::HepRandomEngine & fScintTimeEngine
const std::vector< geo::Point_t > fOpDetCenter
std::unique_ptr< SemiAnalyticalModel > fVisibilityModel
T get(std::string const &key) const
Definition: ParameterSet.h:314
const art::InputTag fSimTag
unsigned int NOpDets() const
Number of OpDets in the whole detector.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
CLHEP::HepRandomEngine & fPhotonEngine
std::vector< geo::Point_t > opDetCenters() const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
MaybeLogger_< ELseverityLevel::ELsev_success, true > LogTrace
const bool fIncludeAnodeReflections
geo::GeometryCore const & fGeom

Member Function Documentation

void phot::PDFastSimPAR::AddOpDetBTR ( std::vector< sim::OpDetBacktrackerRecord > &  opbtr,
std::vector< int > &  ChannelMap,
const sim::OpDetBacktrackerRecord btr 
) const
private

Definition at line 543 of file PDFastSimPAR_module.cc.

References sim::OpDetBacktrackerRecord::OpDetNum(), and sim::OpDetBacktrackerRecord::timePDclockSDPsMap().

Referenced by produce().

546  {
547  int iChan = btr.OpDetNum();
548  if (ChannelMap[iChan] < 0) {
549  ChannelMap[iChan] = opbtr.size();
550  opbtr.emplace_back(std::move(btr));
551  }
552  else {
553  size_t idtest = ChannelMap[iChan];
554  auto const& timePDclockSDPsMap = btr.timePDclockSDPsMap();
555  for (auto const& timePDclockSDP : timePDclockSDPsMap) {
556  for (auto const& sdp : timePDclockSDP.second) {
557  double xyz[3] = {sdp.x, sdp.y, sdp.z};
558  opbtr.at(idtest).AddScintillationPhotons(
559  sdp.trackID, timePDclockSDP.first, sdp.numPhotons, xyz, sdp.energy);
560  }
561  }
562  }
563  }
int OpDetNum() const
Returns the readout Optical Detector this object describes.
timePDclockSDPs_t const & timePDclockSDPsMap() const
Returns all the deposited energy information as stored.
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void phot::PDFastSimPAR::detectedNumPhotons ( std::vector< int > &  DetectedNumPhotons,
const std::vector< double > &  OpDetVisibilities,
const int  NumPhotons 
) const
private

Definition at line 567 of file PDFastSimPAR_module.cc.

References fRandPoissPhot.

Referenced by produce().

570  {
571  for (size_t i = 0; i < OpDetVisibilities.size(); ++i) {
572  DetectedNumPhotons[i] = fRandPoissPhot->fire(OpDetVisibilities[i] * NumPhotons);
573  }
574  }
std::unique_ptr< CLHEP::RandPoissonQ > fRandPoissPhot
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
bool phot::PDFastSimPAR::isOpDetInSameTPC ( geo::Point_t const &  ScintPoint,
geo::Point_t const &  OpDetPoint 
) const
private

Definition at line 578 of file PDFastSimPAR_module.cc.

References util::abs(), and fNTPC.

Referenced by produce().

580  {
581  // check optical channel is in same TPC as scintillation light, if not doesn't see light
582  // temporary method working for SBND, uBooNE, DUNE 1x2x6; to be replaced to work in full DUNE geometry
583  // check x coordinate has same sign or is close to zero
584  if (((ScintPoint.X() < 0.) != (OpDetPoint.X() < 0.)) && std::abs(OpDetPoint.X()) > 10. &&
585  fNTPC == 2) { // TODO: replace with geometry service method
586  return false;
587  }
588  return true;
589  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
std::vector< geo::Point_t > phot::PDFastSimPAR::opDetCenters ( ) const
private

Definition at line 591 of file PDFastSimPAR_module.cc.

References util::counter(), DEFINE_ART_MODULE, fGeom, fNOpChannels, geo::OpDetGeo::GetCenter(), and geo::GeometryCore::OpDetGeoFromOpDet().

Referenced by PDFastSimPAR().

592  {
593  std::vector<geo::Point_t> opDetCenter;
594  for (size_t const i : util::counter(fNOpChannels)) {
595  geo::OpDetGeo const& opDet = fGeom.OpDetGeoFromOpDet(i);
596  opDetCenter.push_back(opDet.GetCenter());
597  }
598  return opDetCenter;
599  }
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:295
geo::Point_t const & GetCenter() const
Definition: OpDetGeo.h:72
geo::GeometryCore const & fGeom
void phot::PDFastSimPAR::produce ( art::Event event)
overridevirtual

Implements art::EDProducer.

Definition at line 307 of file PDFastSimPAR_module.cc.

References AddOpDetBTR(), sim::OpDetBacktrackerRecord::AddScintillationPhotons(), detectedNumPhotons(), util::end(), sim::OnePhoton::Energy, fDoFastComponent, fDoReflectedLight, fDoSlowComponent, fIncludeAnodeReflections, fIncludePropTime, fISTPC, fNOpChannels, fOnlyActiveVolume, fOpaqueCathode, fOpDetCenter, fPropTimeModel, fScintTime, fSimTag, fUseLitePhotons, fVisibilityModel, art::ProductRetriever::getByLabel(), sim::OnePhoton::InitialPosition, isOpDetInSameTPC(), larg4::ISTPC::isScintInActiveVolume(), sim::OnePhoton::MotherTrackID, n, sim::OnePhoton::SetInSD, and sim::OnePhoton::Time.

308  {
309  mf::LogTrace("PDFastSimPAR") << "PDFastSimPAR Module Producer"
310  << "EventID: " << event.event();
311 
312  std::vector<int> PDChannelToSOCMapDirect(fNOpChannels, -1); // Where each OpChan is.
313  std::vector<int> PDChannelToSOCMapReflect(fNOpChannels, -1); // Where each OpChan is.
314 
315  // SimPhotonsLite
316  auto phlit = std::make_unique<std::vector<sim::SimPhotonsLite>>();
317  auto opbtr = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
318  auto phlit_ref = std::make_unique<std::vector<sim::SimPhotonsLite>>();
319  auto opbtr_ref = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
320  auto& dir_phlitcol(*phlit);
321  auto& ref_phlitcol(*phlit_ref);
322  // SimPhotons
323  auto phot = std::make_unique<std::vector<sim::SimPhotons>>();
324  auto phot_ref = std::make_unique<std::vector<sim::SimPhotons>>();
325  auto& dir_photcol(*phot);
326  auto& ref_photcol(*phot_ref);
327  if (fUseLitePhotons) {
328  dir_phlitcol.resize(fNOpChannels);
329  ref_phlitcol.resize(fNOpChannels);
330  for (unsigned int i = 0; i < fNOpChannels; i++) {
331  dir_phlitcol[i].OpChannel = i;
332  ref_phlitcol[i].OpChannel = i;
333  }
334  }
335  else { // SimPhotons
336  dir_photcol.resize(fNOpChannels);
337  ref_photcol.resize(fNOpChannels);
338  for (unsigned int i = 0; i < fNOpChannels; i++) {
339  dir_photcol[i].fOpChannel = i;
340  ref_photcol[i].fOpChannel = i;
341  }
342  }
343 
345  if (!event.getByLabel(fSimTag, edepHandle)) {
346  mf::LogError("PDFastSimPAR") << "PDFastSimPAR Module Cannot getByLabel: " << fSimTag;
347  return;
348  }
349 
350  auto const& edeps = edepHandle;
351 
352  int num_points = 0;
353  int num_fastph = 0;
354  int num_slowph = 0;
355  int num_fastdp = 0;
356  int num_slowdp = 0;
357 
358  for (auto const& edepi : *edeps) {
359  num_points++;
360 
361  int nphot_fast = edepi.NumFPhotons();
362  int nphot_slow = edepi.NumSPhotons();
363 
364  num_fastph += nphot_fast;
365  num_slowph += nphot_slow;
366 
367  if (!((nphot_fast > 0 && fDoFastComponent) || (nphot_slow > 0 && fDoSlowComponent))) continue;
368 
369  int trackID = edepi.TrackID();
370  int nphot = edepi.NumPhotons();
371  double edeposit = edepi.Energy() / nphot;
372  double pos[3] = {edepi.MidPointX(), edepi.MidPointY(), edepi.MidPointZ()};
373  geo::Point_t const ScintPoint = {pos[0], pos[1], pos[2]};
374 
375  if (fOnlyActiveVolume && !fISTPC.isScintInActiveVolume(ScintPoint)) continue;
376 
377  // direct light
378  std::vector<int> DetectedNumFast(fNOpChannels);
379  std::vector<int> DetectedNumSlow(fNOpChannels);
380 
381  std::vector<double> OpDetVisibilities;
382  fVisibilityModel->detectedDirectVisibilities(OpDetVisibilities, ScintPoint);
383  detectedNumPhotons(DetectedNumFast, OpDetVisibilities, nphot_fast);
384  detectedNumPhotons(DetectedNumSlow, OpDetVisibilities, nphot_slow);
385 
387  std::vector<int> AnodeDetectedNumFast(fNOpChannels);
388  std::vector<int> AnodeDetectedNumSlow(fNOpChannels);
389 
390  std::vector<double> OpDetVisibilitiesAnode;
391  fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesAnode, ScintPoint, true);
392  detectedNumPhotons(AnodeDetectedNumFast, OpDetVisibilitiesAnode, nphot_fast);
393  detectedNumPhotons(AnodeDetectedNumSlow, OpDetVisibilitiesAnode, nphot_slow);
394 
395  // add to existing count
396  for (size_t i = 0; i < AnodeDetectedNumFast.size(); ++i) {
397  DetectedNumFast[i] += AnodeDetectedNumFast[i];
398  }
399  for (size_t i = 0; i < AnodeDetectedNumSlow.size(); ++i) {
400  DetectedNumSlow[i] += AnodeDetectedNumSlow[i];
401  }
402  }
403 
404  // reflected light, if enabled
405  std::vector<int> ReflDetectedNumFast(fNOpChannels);
406  std::vector<int> ReflDetectedNumSlow(fNOpChannels);
407  if (fDoReflectedLight) {
408  std::vector<double> OpDetVisibilitiesRefl;
409  fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesRefl, ScintPoint, false);
410  detectedNumPhotons(ReflDetectedNumFast, OpDetVisibilitiesRefl, nphot_fast);
411  detectedNumPhotons(ReflDetectedNumSlow, OpDetVisibilitiesRefl, nphot_slow);
412  }
413 
414  // loop through direct photons then reflected photons cases
415  size_t DoReflected = (fDoReflectedLight) ? 1 : 0;
416  for (size_t Reflected = 0; Reflected <= DoReflected; ++Reflected) {
417  for (size_t channel = 0; channel < fNOpChannels; channel++) {
418 
419  if (fOpaqueCathode && !isOpDetInSameTPC(ScintPoint, fOpDetCenter[channel])) continue;
420 
421  int ndetected_fast = DetectedNumFast[channel];
422  int ndetected_slow = DetectedNumSlow[channel];
423  if (Reflected) {
424  ndetected_fast = ReflDetectedNumFast[channel];
425  ndetected_slow = ReflDetectedNumSlow[channel];
426  }
427  if (!((ndetected_fast > 0 && fDoFastComponent) ||
428  (ndetected_slow > 0 && fDoSlowComponent)))
429  continue;
430 
431  // calculate propagation time, does not matter whether fast or slow photon
432  std::vector<double> transport_time;
433  if (fIncludePropTime) {
434  transport_time.resize(ndetected_fast + ndetected_slow);
435  fPropTimeModel->propagationTime(transport_time, ScintPoint, channel, Reflected);
436  }
437 
438  // SimPhotonsLite case
439  if (fUseLitePhotons) {
440  sim::OpDetBacktrackerRecord tmpbtr(channel);
441  if (ndetected_fast > 0 && fDoFastComponent) {
442  int n = ndetected_fast;
443  num_fastdp += n;
444  for (int i = 0; i < n; ++i) {
445  // calculates the time at which the photon was produced
446  double dtime = edepi.StartT() + fScintTime->fastScintTime();
447  if (fIncludePropTime) dtime += transport_time[i];
448  int time = static_cast<int>(std::round(dtime));
449  if (Reflected)
450  ++ref_phlitcol[channel].DetectedPhotons[time];
451  else
452  ++dir_phlitcol[channel].DetectedPhotons[time];
453  tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
454  }
455  }
456  if (ndetected_slow > 0 && fDoSlowComponent) {
457  int n = ndetected_slow;
458  num_slowdp += n;
459  for (int i = 0; i < n; ++i) {
460  double dtime = edepi.StartT() + fScintTime->slowScintTime();
461  if (fIncludePropTime) dtime += transport_time[ndetected_fast + i];
462  int time = static_cast<int>(std::round(dtime));
463  if (Reflected)
464  ++ref_phlitcol[channel].DetectedPhotons[time];
465  else
466  ++dir_phlitcol[channel].DetectedPhotons[time];
467  tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
468  }
469  }
470  if (Reflected)
471  AddOpDetBTR(*opbtr_ref, PDChannelToSOCMapReflect, tmpbtr);
472  else
473  AddOpDetBTR(*opbtr, PDChannelToSOCMapDirect, tmpbtr);
474  }
475  // SimPhotons case
476  else {
477  sim::OnePhoton photon;
478  photon.SetInSD = false;
479  photon.InitialPosition = edepi.End();
480  photon.MotherTrackID = edepi.TrackID();
481  if (Reflected)
482  photon.Energy = 2.9 * CLHEP::eV; // 430 nm
483  else
484  photon.Energy = 9.7 * CLHEP::eV; // 128 nm
485  // TODO: un-hardcode and add another energy for Xe scintillation
486  if (ndetected_fast > 0 && fDoFastComponent) {
487  int n = ndetected_fast;
488  num_fastdp += n;
489  for (int i = 0; i < n; ++i) {
490  // calculates the time at which the photon was produced
491  double dtime = edepi.StartT() + fScintTime->fastScintTime();
492  if (fIncludePropTime) dtime += transport_time[i];
493  int time = static_cast<int>(std::round(dtime));
494  photon.Time = time;
495  if (Reflected)
496  ref_photcol[channel].insert(ref_photcol[channel].end(), 1, photon);
497  else
498  dir_photcol[channel].insert(dir_photcol[channel].end(), 1, photon);
499  }
500  }
501  if (ndetected_slow > 0 && fDoSlowComponent) {
502  int n = ndetected_slow;
503  num_slowdp += n;
504  for (int i = 0; i < n; ++i) {
505  double dtime = edepi.StartT() + fScintTime->slowScintTime();
506  if (fIncludePropTime) dtime += transport_time[ndetected_fast + i];
507  int time = static_cast<int>(std::round(dtime));
508  photon.Time = time;
509  if (Reflected)
510  ref_photcol[channel].insert(ref_photcol[channel].end(), 1, photon);
511  else
512  dir_photcol[channel].insert(dir_photcol[channel].end(), 1, photon);
513  }
514  }
515  }
516  }
517  }
518  }
519 
520  mf::LogTrace("PDFastSimPAR") << "Total points: " << num_points
521  << ", total fast photons: " << num_fastph
522  << ", total slow photons: " << num_slowph
523  << "\ndetected fast photons: " << num_fastdp
524  << ", detected slow photons: " << num_slowdp;
525 
526  if (fUseLitePhotons) {
527  event.put(move(phlit));
528  event.put(move(opbtr));
529  if (fDoReflectedLight) {
530  event.put(move(phlit_ref), "Reflected");
531  event.put(move(opbtr_ref), "Reflected");
532  }
533  }
534  else {
535  event.put(move(phot));
536  if (fDoReflectedLight) { event.put(move(phot_ref), "Reflected"); }
537  }
538 
539  return;
540  }
bool isOpDetInSameTPC(geo::Point_t const &ScintPoint, geo::Point_t const &OpDetPoint) const
void AddOpDetBTR(std::vector< sim::OpDetBacktrackerRecord > &opbtr, std::vector< int > &ChannelMap, const sim::OpDetBacktrackerRecord &btr) const
std::unique_ptr< PropagationTimeModel > fPropTimeModel
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
std::unique_ptr< ScintTime > fScintTime
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Energy deposited on a readout Optical Detector by simulated tracks.
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
Definition: SimPhotons.h:63
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
const std::vector< geo::Point_t > fOpDetCenter
std::unique_ptr< SemiAnalyticalModel > fVisibilityModel
const art::InputTag fSimTag
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:180
General LArSoft Utilities.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
bool SetInSD
Whether the photon reaches the sensitive detector.
Definition: SimPhotons.h:84
void detectedNumPhotons(std::vector< int > &DetectedNumPhotons, const std::vector< double > &OpDetVisibilities, const int NumPhotons) const
Char_t n[5]
MaybeLogger_< ELseverityLevel::ELsev_success, true > LogTrace
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:78
bool isScintInActiveVolume(geo::Point_t const &ScintPoint)
Definition: ISTPC.cxx:36
const bool fIncludeAnodeReflections
int MotherTrackID
ID of the GEANT4 track causing the scintillation.
Definition: SimPhotons.h:81
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

const std::vector<geo::BoxBoundedGeo> phot::PDFastSimPAR::fActiveVolumes
private

Definition at line 162 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

const bool phot::PDFastSimPAR::fDoFastComponent
private

Definition at line 168 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fDoReflectedLight
private

Definition at line 170 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fDoSlowComponent
private

Definition at line 169 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

geo::GeometryCore const& phot::PDFastSimPAR::fGeom
private

Definition at line 159 of file PDFastSimPAR_module.cc.

Referenced by opDetCenters(), and PDFastSimPAR().

const bool phot::PDFastSimPAR::fGeoPropTimeOnly
private

Definition at line 173 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

const bool phot::PDFastSimPAR::fIncludeAnodeReflections
private

Definition at line 171 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fIncludePropTime
private

Definition at line 172 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

larg4::ISTPC phot::PDFastSimPAR::fISTPC
private

Definition at line 160 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const size_t phot::PDFastSimPAR::fNOpChannels
private

Definition at line 161 of file PDFastSimPAR_module.cc.

Referenced by opDetCenters(), PDFastSimPAR(), and produce().

const int phot::PDFastSimPAR::fNTPC
private

Definition at line 163 of file PDFastSimPAR_module.cc.

Referenced by isOpDetInSameTPC(), and PDFastSimPAR().

const bool phot::PDFastSimPAR::fOnlyActiveVolume
private

Definition at line 176 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fOnlyOneCryostat
private

Definition at line 177 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

const bool phot::PDFastSimPAR::fOpaqueCathode
private

Definition at line 175 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const std::vector<geo::Point_t> phot::PDFastSimPAR::fOpDetCenter
private

Definition at line 164 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

CLHEP::HepRandomEngine& phot::PDFastSimPAR::fPhotonEngine
private

Definition at line 153 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

std::unique_ptr<PropagationTimeModel> phot::PDFastSimPAR::fPropTimeModel
private

Definition at line 150 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

std::unique_ptr<CLHEP::RandPoissonQ> phot::PDFastSimPAR::fRandPoissPhot
private

Definition at line 154 of file PDFastSimPAR_module.cc.

Referenced by detectedNumPhotons(), and PDFastSimPAR().

std::unique_ptr<ScintTime> phot::PDFastSimPAR::fScintTime
private

Definition at line 156 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

CLHEP::HepRandomEngine& phot::PDFastSimPAR::fScintTimeEngine
private

Definition at line 155 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

const art::InputTag phot::PDFastSimPAR::fSimTag
private

Definition at line 167 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fUseLitePhotons
private

Definition at line 174 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().

const bool phot::PDFastSimPAR::fUseXeAbsorption
private

Definition at line 178 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR().

std::unique_ptr<SemiAnalyticalModel> phot::PDFastSimPAR::fVisibilityModel
private

Definition at line 147 of file PDFastSimPAR_module.cc.

Referenced by PDFastSimPAR(), and produce().


The documentation for this class was generated from the following file: