LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
opdet::SimPhotonCounter Class Reference

#include "SimPhotonCounter.h"

Inheritance diagram for opdet::SimPhotonCounter:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 SimPhotonCounter ()
 
 SimPhotonCounter (size_t s, float t_p1, float t_p2, float t_l1, float t_l2, float min_w=0, float max_w=1e6, float e=1.0)
 
 SimPhotonCounter (float t_p1, float t_p2, float t_l1, float t_l2, float min_w, float max_w, const std::vector< float > &eV)
 
void SetVectorSize (size_t s)
 
size_t GetVectorSize () const
 
void SetWavelengthRanges (float min_w, float max_w)
 
float MinWavelength () const
 
float MaxWavelength () const
 
void SetTimeRanges (float t_p1, float t_p2, float t_l1, float t_l2)
 
float MinPromptTime () const
 
float MaxPromptTime () const
 
float MinLateTime () const
 
float MaxLateTime () const
 
void SetQE (size_t i, float e)
 
float QE (size_t i) const
 
void SetQEVector (const std::vector< float > &eV)
 
std::vector< float > const & QEVector () const
 
void AddOnePhoton (size_t i_opdet, const sim::OnePhoton &photon)
 
void AddSimPhotons (const sim::SimPhotons &photons)
 
void ClearVectors ()
 
const std::vector< float > & PromptPhotonVector () const
 
const std::vector< float > & LatePhotonVector () const
 
float PromptPhotonVector (size_t i) const
 
float LatePhotonVector (size_t i) const
 
std::vector< float > TotalPhotonVector () const
 
float TotalPhotonVector (size_t i) const
 
float PromptPhotonTotal () const
 
float LatePhotonTotal () const
 
float PhotonTotal () const
 
void Print ()
 
 SimPhotonCounter (const fhicl::ParameterSet &)
 
void analyze (art::Event const &)
 
void beginJob ()
 
void endJob ()
 
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)
 
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

std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
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

float Wavelength (const sim::OnePhoton &ph)
 
void storeVisibility (int channel, int nDirectPhotons, int nReflectedPhotons, double reflectedT0=0.0) const
 
bool isVisible (double wavelength) const
 Returns if we label as "visibile" a photon with specified wavelength [nm]. More...
 

Private Attributes

std::vector< float > _photonVector_prompt
 
std::vector< float > _photonVector_late
 
float _min_prompt_time
 
float _max_prompt_time
 
float _min_late_time
 
float _max_late_time
 
std::vector< float > _qeVector
 
float _min_wavelength
 
float _max_wavelength
 
TTree * fThePhotonTreeAll
 
TTree * fThePhotonTreeDetected
 
TTree * fTheOpDetTree
 
TTree * fTheEventTree
 
std::vector< std::string > fInputModule
 
int fVerbosity
 
bool fMakeDetectedPhotonsTree
 
bool fMakeAllPhotonsTree
 
bool fMakeOpDetsTree
 
bool fMakeOpDetEventsTree
 
bool fSavePhotonOrigins
 
TVector3 initialPhotonPosition
 
TVector3 finalPhotonPosition
 
Float_t fWavelength
 
Float_t fTime
 
Float_t foriginX
 
Float_t foriginY
 
Float_t foriginZ
 
Int_t fCountOpDetAll
 
Int_t fCountOpDetDetected
 
Int_t fCountOpDetReflDetected
 
Float_t fT0_vis
 
Int_t fCountEventAll
 
Int_t fCountEventDetected
 
Int_t fEventID
 
Int_t fOpChannel
 
bool fMakeLightAnalysisTree
 
std::vector< std::vector< std::vector< double > > > fSignals_vuv
 
std::vector< std::vector< std::vector< double > > > fSignals_vis
 
TTree * fLightAnalysisTree = nullptr
 
int fRun
 
int fTrackID
 
int fpdg
 
int fmotherTrackID
 
double fEnergy
 
double fdEdx
 
std::vector< double > fPosition0
 
std::vector< std::vector< double > > fstepPositions
 
std::vector< double > fstepTimes
 
std::vector< std::vector< double > > fSignalsvuv
 
std::vector< std::vector< double > > fSignalsvis
 
std::string fProcess
 
cheat::ParticleInventoryService const * pi_serv = nullptr
 
phot::PhotonVisibilityService const * fPVS = nullptr
 
bool const fUseLitePhotons
 

Static Private Attributes

static constexpr double kVisibleThreshold = 200.0
 Threshold used to resolve between visible and ultraviolet light. More...
 
static constexpr double kVisibleWavelength = 450.0
 Value used when a typical visible light wavelength is needed. More...
 
static constexpr double kVUVWavelength = 128.0
 Value used when a typical ultraviolet light wavelength is needed. More...
 

Detailed Description

Definition at line 23 of file SimPhotonCounter.h.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

opdet::SimPhotonCounter::SimPhotonCounter ( )
inline

Definition at line 26 of file SimPhotonCounter.h.

References e.

Referenced by isVisible().

26 {}
opdet::SimPhotonCounter::SimPhotonCounter ( size_t  s,
float  t_p1,
float  t_p2,
float  t_l1,
float  t_l2,
float  min_w = 0,
float  max_w = 1e6,
float  e = 1.0 
)

Definition at line 10 of file SimPhotonCounter.cxx.

References _photonVector_late, _photonVector_prompt, _qeVector, e, SetTimeRanges(), and SetWavelengthRanges().

18 {
19 
20  SetWavelengthRanges(min_w, max_w);
21  SetTimeRanges(t_p1, t_p2, t_l1, t_l2);
22 
23  _photonVector_prompt = std::vector<float>(s);
24  _photonVector_late = std::vector<float>(s);
25  _qeVector = std::vector<float>(s, e);
26 }
void SetTimeRanges(float t_p1, float t_p2, float t_l1, float t_l2)
std::vector< float > _photonVector_prompt
std::vector< float > _qeVector
std::vector< float > _photonVector_late
void SetWavelengthRanges(float min_w, float max_w)
Float_t e
Definition: plot.C:35
opdet::SimPhotonCounter::SimPhotonCounter ( float  t_p1,
float  t_p2,
float  t_l1,
float  t_l2,
float  min_w,
float  max_w,
const std::vector< float > &  eV 
)

Definition at line 28 of file SimPhotonCounter.cxx.

References _photonVector_late, _photonVector_prompt, _qeVector, SetTimeRanges(), and SetWavelengthRanges().

35 {
36  SetWavelengthRanges(min_w, max_w);
37  SetTimeRanges(t_p1, t_p2, t_l1, t_l2);
38 
39  _photonVector_prompt = std::vector<float>(eV.size());
40  _photonVector_late = std::vector<float>(eV.size());
41  _qeVector = eV;
42 }
void SetTimeRanges(float t_p1, float t_p2, float t_l1, float t_l2)
std::vector< float > _photonVector_prompt
std::vector< float > _qeVector
std::vector< float > _photonVector_late
void SetWavelengthRanges(float min_w, float max_w)
opdet::SimPhotonCounter::SimPhotonCounter ( const fhicl::ParameterSet )

Member Function Documentation

void opdet::SimPhotonCounter::AddOnePhoton ( size_t  i_opdet,
const sim::OnePhoton photon 
)

Definition at line 71 of file SimPhotonCounter.cxx.

References _max_late_time, _max_prompt_time, _max_wavelength, _min_late_time, _min_prompt_time, _min_wavelength, _photonVector_late, _photonVector_prompt, _qeVector, GetVectorSize(), sim::OnePhoton::Time, and Wavelength().

Referenced by AddSimPhotons().

72 {
73  if (i_opdet > GetVectorSize())
74  throw std::runtime_error("ERROR in SimPhotonCounter: Opdet requested out of range!");
75 
76  if (Wavelength(photon) < _min_wavelength || Wavelength(photon) > _max_wavelength) return;
77 
78  if (photon.Time > _min_prompt_time && photon.Time <= _max_prompt_time)
79  _photonVector_prompt[i_opdet] += _qeVector[i_opdet];
80  else if (photon.Time > _min_late_time && photon.Time < _max_late_time)
81  _photonVector_late[i_opdet] += _qeVector[i_opdet];
82 }
std::vector< float > _photonVector_prompt
float Wavelength(const sim::OnePhoton &ph)
std::vector< float > _qeVector
std::vector< float > _photonVector_late
size_t GetVectorSize() const
void opdet::SimPhotonCounter::AddSimPhotons ( const sim::SimPhotons photons)

Definition at line 84 of file SimPhotonCounter.cxx.

References AddOnePhoton(), and sim::SimPhotons::OpChannel().

85 {
86  for (size_t i_ph = 0; i_ph < photons.size(); i_ph++)
87  AddOnePhoton(photons.OpChannel(), photons[i_ph]);
88 }
int OpChannel() const
Returns the optical channel number this object is associated to.
Definition: SimPhotons.h:239
void AddOnePhoton(size_t i_opdet, const sim::OnePhoton &photon)
void opdet::SimPhotonCounter::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 298 of file SimPhotonCounter_module.cc.

References opdet::OpDetResponseInterface::detected(), opdet::OpDetResponseInterface::detectedLite(), sim::ParticleList::end(), art::EventID::event(), fCountEventAll, fCountEventDetected, fCountOpDetAll, fCountOpDetDetected, fCountOpDetReflDetected, fdEdx, fEnergy, fEventID, sim::ParticleList::find(), fInputModule, fLightAnalysisTree, fMakeAllPhotonsTree, fMakeDetectedPhotonsTree, fMakeLightAnalysisTree, fMakeOpDetEventsTree, fMakeOpDetsTree, fmotherTrackID, fOpChannel, foriginX, foriginY, foriginZ, fpdg, fProcess, fPVS, fRun, fSignals_vis, fSignals_vuv, fSignalsvis, fSignalsvuv, fstepPositions, fstepTimes, fT0_vis, fTheEventTree, fTheOpDetTree, fThePhotonTreeAll, fThePhotonTreeDetected, fTime, fTrackID, fUseLitePhotons, fVerbosity, fWavelength, Get, art::ProductRetriever::getHandle(), art::ProductRetriever::getMany(), art::ProductRetriever::getView(), art::Event::id(), phot::PhotonVisibilityService::IsBuildJob(), isVisible(), kVisibleThreshold, kVUVWavelength, sim::NoParticleId, cheat::ParticleInventoryService::ParticleList(), pi_serv, art::errors::ProductNotFound, art::Event::run(), sc, phot::PhotonVisibilityService::StoreReflected(), phot::PhotonVisibilityService::StoreReflT0(), storeVisibility(), and opdet::OpDetResponseInterface::wavelength().

299  {
300  // Lookup event ID from event
301  art::EventNumber_t event = evt.id().event();
302  fEventID = Int_t(event);
303 
304  // Service for determining opdet responses
306 
307  // get the geometry to be able to figure out signal types and chan -> plane mappings
308  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
309 
310  // GEANT4 info on the particles (only used if making light analysis tree)
311  std::vector<simb::MCParticle> const* mcpartVec = nullptr;
312 
313  //-------------------------initializing light tree vectors------------------------
314  std::vector<double> totalEnergy_track;
315  fstepPositions.clear();
316  fstepTimes.clear();
318  mcpartVec = evt.getHandle<std::vector<simb::MCParticle>>("largeant").product();
319 
320  size_t maxNtracks = 1000U; // mcpartVec->size(); --- { to be fixed soon! ]
321  fSignals_vuv.clear();
322  fSignals_vuv.resize(maxNtracks);
323  fSignals_vis.clear();
324  fSignals_vis.resize(maxNtracks);
325  for (size_t itrack = 0; itrack != maxNtracks; itrack++) {
326  fSignals_vuv[itrack].resize(wireReadoutGeom.NOpChannels());
327  fSignals_vis[itrack].resize(wireReadoutGeom.NOpChannels());
328  }
329  totalEnergy_track.resize(maxNtracks, 0.);
330  //-------------------------stimation of dedx per trackID----------------------
331  //get the list of particles from this event
332  const sim::ParticleList* plist = pi_serv ? &(pi_serv->ParticleList()) : nullptr;
333 
334  // loop over all sim::SimChannels in the event and make sure there are no
335  // sim::IDEs with trackID values that are not in the sim::ParticleList
336  std::vector<const sim::SimChannel*> sccol;
337  for (auto const& mod : fInputModule) {
338  evt.getView(mod, sccol);
339  //loop over the sim channels collection
340  for (size_t sc = 0; sc < sccol.size(); ++sc) {
341  const auto& tdcidemap = sccol[sc]->TDCIDEMap();
342  //loop over all of the tdc IDE map objects
343  for (auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
344  const std::vector<sim::IDE> idevec = (*mapitr).second;
345  //go over all of the IDEs in a given simchannel
346  for (size_t iv = 0; iv < idevec.size(); ++iv) {
347  if (plist) {
348  if (plist->find(idevec[iv].trackID) == plist->end() &&
349  idevec[iv].trackID != sim::NoParticleId) {
350  mf::LogWarning("LArG4Ana") << idevec[iv].trackID << " is not in particle list";
351  }
352  }
353  if (idevec[iv].trackID < 0) continue;
354 
355  totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy / 3.;
356  }
357  }
358  }
359  }
360  } //End of if(fMakeLightAnalysisTree)
361 
362  if (!fUseLitePhotons) {
363 
364  //Reset counters
365  fCountEventAll = 0;
367 
368  //Get *ALL* SimPhotonsCollection from Event
369  auto photon_handles = evt.getMany<std::vector<sim::SimPhotons>>();
370  if (photon_handles.size() == 0)
372  << "sim SimPhotons retrieved and you requested them.";
373 
374  for (auto const& mod : fInputModule) {
375  //switching off to add reading in of labelled collections: Andrzej, 02/26/19
376 
377  for (auto const& ph_handle : photon_handles) {
378  // Do some checking before we proceed
379  if (!ph_handle.isValid()) continue;
380  if (ph_handle.provenance()->moduleLabel() != mod)
381  continue; //not the most efficient way of doing this, but preserves the logic of the module. Andrzej
382 
383  bool Reflected = (ph_handle.provenance()->productInstanceName() == "Reflected");
384 
385  if ((*ph_handle).size() > 0) {
387  //resetting the signalt to save in the analysis tree per event
388  const int maxNtracks = 1000;
389  for (size_t itrack = 0; itrack != maxNtracks; itrack++) {
390  for (size_t pmt_i = 0; pmt_i != wireReadoutGeom.NOpChannels(); pmt_i++) {
391  fSignals_vuv[itrack][pmt_i].clear();
392  fSignals_vis[itrack][pmt_i].clear();
393  }
394  }
395  }
396  }
397 
398  if (fVerbosity > 0)
399  std::cout << "Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
400 
401  if ((*ph_handle).size() > 0) {
402  for (auto const& itOpDet : (*ph_handle)) {
403  //Reset Counters
404  fCountOpDetAll = 0;
407  //Reset t0 for visible light
408  fT0_vis = 999.;
409 
410  //Get data from HitCollection entry
411  fOpChannel = itOpDet.OpChannel();
412  const sim::SimPhotons& TheHit = itOpDet;
413 
414  // Loop through OpDet phots.
415  // Note we make the screen output decision outside the loop
416  // in order to avoid evaluating large numbers of unnecessary
417  // if conditions.
418 
419  for (const sim::OnePhoton& Phot : TheHit) {
420  // Calculate wavelength in nm
421  fWavelength = odresponse->wavelength(Phot.Energy);
422 
423  //Get arrival time from phot
424  fTime = Phot.Time;
425  foriginX = Phot.InitialPosition.X();
426  foriginY = Phot.InitialPosition.Y();
427  foriginZ = Phot.InitialPosition.Z();
428 
429  // special case for LibraryBuildJob: no working "Reflected" handle and all photons stored in single object - must sort using wavelength instead
430  if (fPVS->IsBuildJob() && !Reflected) {
431  // all photons contained in object with Reflected = false flag
432  // Increment per OpDet counters and fill per phot trees
433  fCountOpDetAll++;
434  if (fMakeAllPhotonsTree) {
436  fThePhotonTreeAll->Fill();
437  }
438  }
439 
440  if (odresponse->detected(fOpChannel, Phot)) {
442  //only store direct direct light
444  // reflected and shifted light is in visible range
445  else if (fPVS->StoreReflected()) {
447  // find the first visible arrival time
448  if (fPVS->StoreReflT0() && fTime < fT0_vis) fT0_vis = fTime;
449  }
450  if (fVerbosity > 3)
451  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
452  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
453  << " Detected 1 " << std::endl;
454  }
455  else {
456  if (fVerbosity > 3)
457  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
458  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
459  << " Detected 0 " << std::endl;
460  }
461 
462  } // if build library and not reflected
463 
464  else {
465  // store in appropriate trees using "Reflected" handle and fPVS->StoreReflected() flag
466  // Increment per OpDet counters and fill per phot trees
467  fCountOpDetAll++;
468  if (fMakeAllPhotonsTree) {
469  if (!Reflected || (fPVS->StoreReflected() && Reflected)) {
470  fThePhotonTreeAll->Fill();
471  }
472  }
473 
474  if (odresponse->detected(fOpChannel, Phot)) {
476  //only store direct direct light
477  if (!Reflected) fCountOpDetDetected++;
478  // reflected and shifted light is in visible range
479  else if (fPVS->StoreReflected() && Reflected) {
481  // find the first visible arrival time
482  if (fPVS->StoreReflT0() && fTime < fT0_vis) fT0_vis = fTime;
483  }
484  if (fVerbosity > 3)
485  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
486  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
487  << " Detected 1 " << std::endl;
488  }
489  else {
490  if (fVerbosity > 3)
491  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
492  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
493  << " Detected 0 " << std::endl;
494  }
495  }
496  } // for each photon in collection
497 
498  // If this is a library building job, fill relevant entry
499  if (
500  fPVS->IsBuildJob() &&
501  !Reflected) // for library build job, both componenents stored in first object with Reflected = false
502  {
504  }
505 
506  // Incremenent per event and fill Per OpDet trees
507  if (fMakeOpDetsTree) fTheOpDetTree->Fill();
510 
511  // Give per OpDet output
512  if (fVerbosity > 2)
513  std::cout << "OpDetResponseInterface PerOpDet : Event " << fEventID << " OpDet "
514  << fOpChannel << " All " << fCountOpDetAll << " Det "
515  << fCountOpDetDetected << std::endl;
516  }
517 
518  // Fill per event tree
519  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
520 
521  // Give per event output
522  if (fVerbosity > 1)
523  std::cout << "OpDetResponseInterface PerEvent : Event " << fEventID << " All "
524  << fCountOpDetAll << " Det " << fCountOpDetDetected << std::endl;
525  }
526  else {
527  // if empty OpDet hit collection,
528  // add an empty record to the per event tree
529  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
530  }
532  assert(mcpartVec);
533  assert(fLightAnalysisTree);
534 
535  std::cout << "Filling the analysis tree" << std::endl;
536  //---------------Filling the analysis tree-----------:
537  fRun = evt.run();
538  std::vector<double> this_xyz;
539 
540  //loop over the particles
541  for (simb::MCParticle const& pPart : *mcpartVec) {
542 
543  if (pPart.Process() == "primary") fEnergy = pPart.E();
544 
545  //resetting the vectors
546  fstepPositions.clear();
547  fstepTimes.clear();
548  fSignalsvuv.clear();
549  fSignalsvis.clear();
550  fdEdx = -1.;
551  //filling the tree fields
552  fTrackID = pPart.TrackId();
553  fpdg = pPart.PdgCode();
554  fmotherTrackID = pPart.Mother();
555  fdEdx = totalEnergy_track[fTrackID];
558  fProcess = pPart.Process();
559  //filling the center positions of each step
560  for (size_t i_s = 1; i_s < pPart.NumberTrajectoryPoints(); i_s++) {
561  this_xyz.clear();
562  this_xyz.resize(3);
563  this_xyz[0] = pPart.Position(i_s).X();
564  this_xyz[1] = pPart.Position(i_s).Y();
565  this_xyz[2] = pPart.Position(i_s).Z();
566  fstepPositions.push_back(this_xyz);
567  fstepTimes.push_back(pPart.Position(i_s).T());
568  }
569  //filling the tree per track
570  fLightAnalysisTree->Fill();
571  }
572  } // if fMakeLightAnalysisTree
573  }
574  }
575  }
576  if (fUseLitePhotons) {
577 
578  //Get *ALL* SimPhotonsCollection from Event
579  auto photon_handles = evt.getMany<std::vector<sim::SimPhotonsLite>>();
580  if (photon_handles.size() == 0)
582  << "sim SimPhotons retrieved and you requested them.";
583 
584  //Get SimPhotonsLite from Event
585  for (auto const& mod : fInputModule) {
586  // Loop over direct/reflected photons
587  for (auto const& ph_handle : photon_handles) {
588  // Do some checking before we proceed
589  if (!ph_handle.isValid()) continue;
590  if (ph_handle.provenance()->moduleLabel() != mod)
591  continue; //not the most efficient way of doing this, but preserves the logic of the module. Andrzej
592 
593  bool Reflected = (ph_handle.provenance()->productInstanceName() == "Reflected");
594 
595  //Reset counters
596  fCountEventAll = 0;
598 
599  if (fVerbosity > 0)
600  std::cout << "Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
601 
602  if ((*ph_handle).size() > 0) {
603 
604  for (auto const& photon : (*ph_handle)) {
605  //Get data from HitCollection entry
606  fOpChannel = photon.OpChannel;
607  std::map<int, int> PhotonsMap = photon.DetectedPhotons;
608 
609  //Reset Counters
610  fCountOpDetAll = 0;
613 
614  for (auto it = PhotonsMap.begin(); it != PhotonsMap.end(); it++) {
615  // Calculate wavelength in nm
616  if (Reflected) { fWavelength = kVisibleThreshold; }
617  else {
618  fWavelength = kVUVWavelength; // original
619  }
620 
621  //Get arrival time from phot
622  fTime = it->first;
623 
624  for (int i = 0; i < it->second; i++) {
625  // Increment per OpDet counters and fill per phot trees
626  fCountOpDetAll++;
628 
629  if (odresponse->detectedLite(fOpChannel)) {
631  // direct light
632  if (!Reflected) { fCountOpDetDetected++; }
633  else if (Reflected) {
635  }
636  if (fVerbosity > 3)
637  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
638  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
639  << " Detected 1 " << std::endl;
640  }
641  else if (fVerbosity > 3) {
642  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
643  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
644  << " Detected 0 " << std::endl;
645  }
646  }
647  }
648 
649  // Incremenent per event and fill Per OpDet trees
650  if (fMakeOpDetsTree) fTheOpDetTree->Fill();
653 
654  if (fPVS->IsBuildJob())
656 
657  // Give per OpDet output
658  if (fVerbosity > 2)
659  std::cout << "OpDetResponseInterface PerOpDet : Event " << fEventID << " OpDet "
660  << fOpChannel << " All " << fCountOpDetAll << " Det "
661  << fCountOpDetDetected << std::endl;
662  }
663  // Fill per event tree
664  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
665 
666  // Give per event output
667  if (fVerbosity > 1)
668  std::cout << "OpDetResponseInterface PerEvent : Event " << fEventID << " All "
669  << fCountOpDetAll << " Det " << fCountOpDetDetected << std::endl;
670  }
671  else {
672  // if empty OpDet hit collection,
673  // add an empty record to the per event tree
674  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
675  }
676  }
677  }
678  }
679  } // SimPhotonCounter::analyze()
std::vector< std::vector< double > > fstepPositions
unsigned int event
Definition: DataStructs.h:626
unsigned int run
Definition: DataStructs.h:627
void storeVisibility(int channel, int nDirectPhotons, int nReflectedPhotons, double reflectedT0=0.0) const
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
phot::PhotonVisibilityService const * fPVS
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
std::vector< std::vector< double > > fSignalsvuv
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
static constexpr double kVUVWavelength
Value used when a typical ultraviolet light wavelength is needed.
std::vector< double > fstepTimes
iterator find(const key_type &key)
Definition: ParticleList.h:318
std::vector< std::string > fInputModule
bool isVisible(double wavelength) const
Returns if we label as "visibile" a photon with specified wavelength [nm].
static const int NoParticleId
Definition: sim.h:21
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
const sim::ParticleList & ParticleList() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:127
Float_t sc
Definition: plot.C:23
std::vector< std::vector< std::vector< double > > > fSignals_vis
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:118
static constexpr double kVisibleThreshold
Threshold used to resolve between visible and ultraviolet light.
std::vector< std::vector< double > > fSignalsvis
TCEvent evt
Definition: DataStructs.cxx:8
virtual float wavelength(double energy) const
std::vector< std::vector< std::vector< double > > > fSignals_vuv
Event finding and building.
cheat::ParticleInventoryService const * pi_serv
void opdet::SimPhotonCounter::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 198 of file SimPhotonCounter_module.cc.

References geo::CryostatGeo::Boundaries(), geo::GeometryCore::Cryostat(), e, fCountEventAll, fCountEventDetected, fCountOpDetAll, fCountOpDetDetected, fCountOpDetReflDetected, fdEdx, fEnergy, fEventID, fLightAnalysisTree, fMakeAllPhotonsTree, fMakeDetectedPhotonsTree, fMakeLightAnalysisTree, fMakeOpDetEventsTree, fMakeOpDetsTree, fmotherTrackID, fOpChannel, foriginX, foriginY, foriginZ, fpdg, fProcess, fPVS, fRun, fSavePhotonOrigins, fSignalsvis, fSignalsvuv, fstepPositions, fstepTimes, fTheEventTree, fTheOpDetTree, fThePhotonTreeAll, fThePhotonTreeDetected, fTime, fTrackID, fWavelength, geo::OpDetGeo::GetCenter(), geo::BoxBoundedGeo::MinX(), geo::CryostatGeo::NOpDet(), geo::GeometryCore::OpDetGeoFromOpDet(), pi_serv, art::errors::ServiceNotFound, and phot::PhotonVisibilityService::StoreReflected().

199  {
200  // Get file service to store trees
203 
204  std::cout << "Optical Channels positions: " << geo->Cryostat().NOpDet() << std::endl;
205  for (int ch = 0; ch != int(geo->Cryostat().NOpDet()); ch++) {
206  auto const OpDetCenter = geo->OpDetGeoFromOpDet(ch).GetCenter();
207  std::cout << ch << " " << OpDetCenter.X() << " " << OpDetCenter.Y() << " "
208  << OpDetCenter.Z() << std::endl;
209  }
210 
211  auto const CryoBounds = geo->Cryostat().Boundaries();
212  std::cout << "Cryo Boundaries" << std::endl;
213  std::cout << "Xmin: " << CryoBounds.MinX() << " Xmax: " << CryoBounds.MaxX()
214  << " Ymin: " << CryoBounds.MinY() << " Ymax: " << CryoBounds.MaxY()
215  << " Zmin: " << CryoBounds.MinZ() << " Zmax: " << CryoBounds.MaxZ() << std::endl;
216 
217  try {
219  }
220  catch (art::Exception const& e) {
221  if (e.categoryCode() != art::errors::ServiceNotFound) throw;
222  mf::LogError("SimPhotonCounter")
223  << "ParticleInventoryService service is not configured!"
224  " Please add it in the job configuration."
225  " In the meanwhile, some checks to particles will be skipped.";
226  }
227 
228  // Create and assign branch addresses to required tree
229  if (fMakeAllPhotonsTree) {
230  fThePhotonTreeAll = tfs->make<TTree>("AllPhotons", "AllPhotons");
231  fThePhotonTreeAll->Branch("EventID", &fEventID, "EventID/I");
232  fThePhotonTreeAll->Branch("Wavelength", &fWavelength, "Wavelength/F");
233  fThePhotonTreeAll->Branch("OpChannel", &fOpChannel, "OpChannel/I");
234  fThePhotonTreeAll->Branch("Time", &fTime, "Time/F");
235  if (fSavePhotonOrigins) {
236  fThePhotonTreeAll->Branch("originX", &foriginX, "originX/F");
237  fThePhotonTreeAll->Branch("originY", &foriginY, "originY/F");
238  fThePhotonTreeAll->Branch("originZ", &foriginZ, "originZ/F");
239  }
240  }
241 
243  fThePhotonTreeDetected = tfs->make<TTree>("DetectedPhotons", "DetectedPhotons");
244  fThePhotonTreeDetected->Branch("EventID", &fEventID, "EventID/I");
245  fThePhotonTreeDetected->Branch("Wavelength", &fWavelength, "Wavelength/F");
246  fThePhotonTreeDetected->Branch("OpChannel", &fOpChannel, "OpChannel/I");
247  fThePhotonTreeDetected->Branch("Time", &fTime, "Time/F");
248  if (fSavePhotonOrigins) {
249  fThePhotonTreeDetected->Branch("originX", &foriginX, "originX/F");
250  fThePhotonTreeDetected->Branch("originY", &foriginY, "originY/F");
251  fThePhotonTreeDetected->Branch("originZ", &foriginZ, "originZ/F");
252  }
253  }
254 
255  if (fMakeOpDetsTree) {
256  fTheOpDetTree = tfs->make<TTree>("OpDets", "OpDets");
257  fTheOpDetTree->Branch("EventID", &fEventID, "EventID/I");
258  fTheOpDetTree->Branch("OpChannel", &fOpChannel, "OpChannel/I");
259  fTheOpDetTree->Branch("CountAll", &fCountOpDetAll, "CountAll/I");
260  fTheOpDetTree->Branch("CountDetected", &fCountOpDetDetected, "CountDetected/I");
261  if (fPVS->StoreReflected())
262  fTheOpDetTree->Branch("CountReflDetected", &fCountOpDetReflDetected, "CountReflDetected/I");
263  fTheOpDetTree->Branch("Time", &fTime, "Time/F");
264  }
265 
266  if (fMakeOpDetEventsTree) {
267  fTheEventTree = tfs->make<TTree>("OpDetEvents", "OpDetEvents");
268  fTheEventTree->Branch("EventID", &fEventID, "EventID/I");
269  fTheEventTree->Branch("CountAll", &fCountEventAll, "CountAll/I");
270  fTheEventTree->Branch("CountDetected", &fCountEventDetected, "CountDetected/I");
271  if (fPVS->StoreReflected())
272  fTheOpDetTree->Branch("CountReflDetected", &fCountOpDetReflDetected, "CountReflDetected/I");
273  }
274 
275  //generating the tree for the light analysis:
277  fLightAnalysisTree = tfs->make<TTree>("LightAnalysis", "LightAnalysis");
278  fLightAnalysisTree->Branch("RunNumber", &fRun);
279  fLightAnalysisTree->Branch("EventID", &fEventID);
280  fLightAnalysisTree->Branch("TrackID", &fTrackID);
281  fLightAnalysisTree->Branch("PdgCode", &fpdg);
282  fLightAnalysisTree->Branch("MotherTrackID", &fmotherTrackID);
283  fLightAnalysisTree->Branch("Energy", &fEnergy);
284  fLightAnalysisTree->Branch("dEdx", &fdEdx);
285  fLightAnalysisTree->Branch("StepPositions", &fstepPositions);
286  fLightAnalysisTree->Branch("StepTimes", &fstepTimes);
287  fLightAnalysisTree->Branch("SignalsVUV", &fSignalsvuv);
288  fLightAnalysisTree->Branch("SignalsVisible", &fSignalsvis);
289  fLightAnalysisTree->Branch("Process", &fProcess);
290  }
291  }
std::vector< std::vector< double > > fstepPositions
Point_t const & GetCenter() const
Definition: OpDetGeo.h:71
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
phot::PhotonVisibilityService const * fPVS
std::vector< std::vector< double > > fSignalsvuv
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< double > fstepTimes
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:317
BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
Definition: CryostatGeo.h:113
std::vector< std::vector< double > > fSignalsvis
Float_t e
Definition: plot.C:35
ROOT libraries.
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
cheat::ParticleInventoryService const * pi_serv
void opdet::SimPhotonCounter::ClearVectors ( )

Definition at line 90 of file SimPhotonCounter.cxx.

References _photonVector_late, _photonVector_prompt, and GetVectorSize().

91 {
92  for (size_t i = 0; i < GetVectorSize(); i++) {
93  _photonVector_prompt[i] = 0.0;
94  _photonVector_late[i] = 0.0;
95  }
96 }
std::vector< float > _photonVector_prompt
std::vector< float > _photonVector_late
size_t GetVectorSize() const
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 art::detail::Analyzer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 25 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

26  {
27  setupQueues(resources);
28  ProcessingFrame const frame{ScheduleID{}};
29  beginJobWithFrame(frame);
30  }
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void setupQueues(SharedResources const &)=0
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 68 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

69  {
70  ProcessingFrame const frame{mc.scheduleID()};
71  beginRunWithFrame(std::as_const(rp).makeRun(mc), frame);
72  return true;
73  }
virtual void beginRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 84 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

85  {
86  ProcessingFrame const frame{mc.scheduleID()};
87  beginSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
88  return true;
89  }
virtual void beginSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doEndJob ( )
inherited

Definition at line 33 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

34  {
35  ProcessingFrame const frame{ScheduleID{}};
36  endJobWithFrame(frame);
37  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 76 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

77  {
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(std::as_const(rp).makeRun(mc), frame);
80  return true;
81  }
virtual void endRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 92 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

93  {
94  ProcessingFrame const frame{mc.scheduleID()};
95  endSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
96  return true;
97  }
virtual void endSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::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 100 of file Analyzer.cc.

References e, and art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

105  {
106  auto const e = std::as_const(ep).makeEvent(mc);
107  if (wantEvent(mc.scheduleID(), e)) {
108  ++counts_run;
109  ProcessingFrame const frame{mc.scheduleID()};
110  analyzeWithFrame(e, frame);
111  ++counts_passed;
112  }
113  return true;
114  }
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
Float_t e
Definition: plot.C:35
virtual void analyzeWithFrame(Event const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 47 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

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

Definition at line 61 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

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

Definition at line 40 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

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

Definition at line 54 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

55  {
56  ProcessingFrame const frame{ScheduleID{}};
58  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void opdet::SimPhotonCounter::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 293 of file SimPhotonCounter_module.cc.

References fPVS, and phot::PhotonVisibilityService::IsBuildJob().

294  {
296  }
phot::PhotonVisibilityService const * fPVS
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
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
size_t opdet::SimPhotonCounter::GetVectorSize ( ) const
inline
bool opdet::SimPhotonCounter::isVisible ( double  wavelength) const
inlineprivate
float opdet::SimPhotonCounter::LatePhotonTotal ( ) const
inline

Definition at line 93 of file SimPhotonCounter.h.

Referenced by opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo().

94  {
95  return std::accumulate(_photonVector_late.begin(), _photonVector_late.end(), 0.0);
96  }
std::vector< float > _photonVector_late
const std::vector<float>& opdet::SimPhotonCounter::LatePhotonVector ( ) const
inline
float opdet::SimPhotonCounter::LatePhotonVector ( size_t  i) const
inline

Definition at line 81 of file SimPhotonCounter.h.

81 { return _photonVector_late.at(i); }
std::vector< float > _photonVector_late
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
float opdet::SimPhotonCounter::MaxLateTime ( ) const
inline

Definition at line 62 of file SimPhotonCounter.h.

Referenced by Print().

62 { return _max_late_time; }
float opdet::SimPhotonCounter::MaxPromptTime ( ) const
inline

Definition at line 60 of file SimPhotonCounter.h.

Referenced by Print().

float opdet::SimPhotonCounter::MaxWavelength ( ) const
inline

Definition at line 55 of file SimPhotonCounter.h.

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 &)
float opdet::SimPhotonCounter::MinLateTime ( ) const
inline

Definition at line 61 of file SimPhotonCounter.h.

Referenced by Print().

61 { return _min_late_time; }
float opdet::SimPhotonCounter::MinPromptTime ( ) const
inline

Definition at line 59 of file SimPhotonCounter.h.

Referenced by Print().

float opdet::SimPhotonCounter::MinWavelength ( ) const
inline

Definition at line 54 of file SimPhotonCounter.h.

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
float opdet::SimPhotonCounter::PhotonTotal ( ) const
inline

Definition at line 97 of file SimPhotonCounter.h.

References pyG4Element::Print().

97 { return (PromptPhotonTotal() + LatePhotonTotal()); }
float PromptPhotonTotal() const
float LatePhotonTotal() const
void opdet::SimPhotonCounter::Print ( )

Definition at line 110 of file SimPhotonCounter.cxx.

References _photonVector_late, _photonVector_prompt, _qeVector, GetVectorSize(), MaxLateTime(), MaxPromptTime(), MinLateTime(), MinPromptTime(), and TotalPhotonVector().

111 {
112  std::cout << "Vector size: " << GetVectorSize() << std::endl;
113  std::cout << "Time cut ranges: (" << MinPromptTime() << "," << MaxPromptTime() << ") , ("
114  << MinLateTime() << "," << MaxLateTime() << ")" << std::endl;
115  std::cout << "\t"
116  << "i : QE / Prompt / Late / Total" << std::endl;
117  for (size_t i = 0; i < GetVectorSize(); i++)
118  std::cout << "\t" << i << ": " << _qeVector[i] << " / " << _photonVector_prompt[i] << " / "
119  << _photonVector_late[i] << " / " << TotalPhotonVector(i) << std::endl;
120 }
float MinPromptTime() const
float MinLateTime() const
std::vector< float > _photonVector_prompt
std::vector< float > TotalPhotonVector() const
float MaxPromptTime() const
float MaxLateTime() const
std::vector< float > _qeVector
std::vector< float > _photonVector_late
size_t GetVectorSize() const
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
float opdet::SimPhotonCounter::PromptPhotonTotal ( ) const
inline

Definition at line 89 of file SimPhotonCounter.h.

Referenced by opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo().

90  {
91  return std::accumulate(_photonVector_prompt.begin(), _photonVector_prompt.end(), 0.0);
92  }
std::vector< float > _photonVector_prompt
const std::vector<float>& opdet::SimPhotonCounter::PromptPhotonVector ( ) const
inline
float opdet::SimPhotonCounter::PromptPhotonVector ( size_t  i) const
inline

Definition at line 80 of file SimPhotonCounter.h.

80 { return _photonVector_prompt.at(i); }
std::vector< float > _photonVector_prompt
float opdet::SimPhotonCounter::QE ( size_t  i) const
inline

Definition at line 65 of file SimPhotonCounter.h.

65 { return _qeVector.at(i); }
std::vector< float > _qeVector
std::vector<float> const& opdet::SimPhotonCounter::QEVector ( ) const
inline

Definition at line 72 of file SimPhotonCounter.h.

72 { return _qeVector; }
std::vector< float > _qeVector
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 opdet::SimPhotonCounter::SetQE ( size_t  i,
float  e 
)
inline

Definition at line 64 of file SimPhotonCounter.h.

References e.

64 { _qeVector.at(i) = e; }
std::vector< float > _qeVector
Float_t e
Definition: plot.C:35
void opdet::SimPhotonCounter::SetQEVector ( const std::vector< float > &  eV)
inline

Definition at line 67 of file SimPhotonCounter.h.

68  {
69  SetVectorSize(eV.size());
70  _qeVector = eV;
71  }
void SetVectorSize(size_t s)
std::vector< float > _qeVector
void opdet::SimPhotonCounter::SetTimeRanges ( float  t_p1,
float  t_p2,
float  t_l1,
float  t_l2 
)

Definition at line 60 of file SimPhotonCounter.cxx.

References _max_late_time, _max_prompt_time, _min_late_time, and _min_prompt_time.

Referenced by SimPhotonCounter().

61 {
62  if (t_p2 < t_p1 || t_l2 < t_l1 || t_p2 > t_l1)
63  throw std::runtime_error("ERROR in SimPhotonCounter: bad time ranges");
64 
65  _min_prompt_time = t_p1;
66  _max_prompt_time = t_p2;
67  _min_late_time = t_l1;
68  _max_late_time = t_l2;
69 }
void opdet::SimPhotonCounter::SetVectorSize ( size_t  s)
inline

Definition at line 44 of file SimPhotonCounter.h.

45  {
46  _photonVector_prompt.resize(s);
47  _photonVector_late.resize(s);
48  _qeVector.resize(s);
49  }
std::vector< float > _photonVector_prompt
std::vector< float > _qeVector
std::vector< float > _photonVector_late
void opdet::SimPhotonCounter::SetWavelengthRanges ( float  min_w,
float  max_w 
)

Definition at line 44 of file SimPhotonCounter.cxx.

References _max_wavelength, and _min_wavelength.

Referenced by SimPhotonCounter().

45 {
46  if (min_w >= max_w) throw std::runtime_error("ERROR in SimPhotonCounter: bad wavelength range");
47 
48  _min_wavelength = min_w;
49  _max_wavelength = max_w;
50 }
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)
void opdet::SimPhotonCounter::storeVisibility ( int  channel,
int  nDirectPhotons,
int  nReflectedPhotons,
double  reflectedT0 = 0.0 
) const
private

Definition at line 682 of file SimPhotonCounter_module.cc.

References DEFINE_ART_MODULE, fPVS, phot::PhotonVisibilityService::RetrieveLightProd(), phot::PhotonVisibilityService::SetLibraryEntry(), phot::PhotonVisibilityService::SetLibraryReflT0Entry(), phot::PhotonVisibilityService::StoreReflected(), and phot::PhotonVisibilityService::StoreReflT0().

Referenced by analyze().

687  {
689 
690  // ask PhotonVisibilityService which voxel was being served,
691  // and how many photons where there generated (yikes!!);
692  // this value was put there by LightSource (yikes!!)
693  int VoxID;
694  double NProd;
695  fPVS->RetrieveLightProd(VoxID, NProd);
696 
697  pvs.SetLibraryEntry(VoxID, channel, double(nDirectPhotons) / NProd);
698 
699  //store reflected light
700  if (fPVS->StoreReflected()) {
701  pvs.SetLibraryEntry(VoxID, channel, double(nReflectedPhotons) / NProd, true);
702 
703  //store reflected first arrival time
704  if (fPVS->StoreReflT0()) pvs.SetLibraryReflT0Entry(VoxID, channel, reflectedT0);
705 
706  } // if reflected
707 
708  } // SimPhotonCounter::storeVisibility()
void RetrieveLightProd(int &VoxID, double &N) const
phot::PhotonVisibilityService const * fPVS
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
std::vector< float > opdet::SimPhotonCounter::TotalPhotonVector ( ) const

Definition at line 98 of file SimPhotonCounter.cxx.

References util::begin(), util::end(), GetVectorSize(), LatePhotonVector(), and PromptPhotonVector().

Referenced by opdet::FlashHypothesisComparison::FillComparisonInfo(), opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo(), and Print().

99 {
100 
101  std::vector<float> totalPhotonVector(GetVectorSize());
102  std::transform(PromptPhotonVector().begin(),
105  totalPhotonVector.begin(),
106  std::plus<float>());
107  return totalPhotonVector;
108 }
const std::vector< float > & PromptPhotonVector() const
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
const std::vector< float > & LatePhotonVector() const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
size_t GetVectorSize() const
float opdet::SimPhotonCounter::TotalPhotonVector ( size_t  i) const
inline

Definition at line 84 of file SimPhotonCounter.h.

85  {
86  return (PromptPhotonVector(i) + LatePhotonVector(i));
87  }
const std::vector< float > & PromptPhotonVector() const
const std::vector< float > & LatePhotonVector() const
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

Referenced by art::OutputModule::doEvent(), art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
float opdet::SimPhotonCounter::Wavelength ( const sim::OnePhoton ph)
private

Definition at line 52 of file SimPhotonCounter.cxx.

References sim::OnePhoton::Energy.

Referenced by AddOnePhoton().

53 {
54  if (ph.Energy < std::numeric_limits<float>::epsilon())
55  throw std::runtime_error("ERROR in SimPhotonCounter: photon energy is zero.");
56 
57  return 0.00124 / ph.Energy;
58 }
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:78

Member Data Documentation

float opdet::SimPhotonCounter::_max_late_time
private

Definition at line 108 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetTimeRanges().

float opdet::SimPhotonCounter::_max_prompt_time
private

Definition at line 106 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetTimeRanges().

float opdet::SimPhotonCounter::_max_wavelength
private

Definition at line 112 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetWavelengthRanges().

float opdet::SimPhotonCounter::_min_late_time
private

Definition at line 107 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetTimeRanges().

float opdet::SimPhotonCounter::_min_prompt_time
private

Definition at line 105 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetTimeRanges().

float opdet::SimPhotonCounter::_min_wavelength
private

Definition at line 111 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), and SetWavelengthRanges().

std::vector<float> opdet::SimPhotonCounter::_photonVector_late
private

Definition at line 103 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), ClearVectors(), Print(), and SimPhotonCounter().

std::vector<float> opdet::SimPhotonCounter::_photonVector_prompt
private

Definition at line 102 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), ClearVectors(), Print(), and SimPhotonCounter().

std::vector<float> opdet::SimPhotonCounter::_qeVector
private

Definition at line 109 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), Print(), and SimPhotonCounter().

Int_t opdet::SimPhotonCounter::fCountEventAll
private

Definition at line 130 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountEventDetected
private

Definition at line 131 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetAll
private

Definition at line 125 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetDetected
private

Definition at line 126 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetReflDetected
private

Definition at line 127 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fdEdx
private

Definition at line 144 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fEnergy
private

Definition at line 144 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fEventID
private

Definition at line 134 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TVector3 opdet::SimPhotonCounter::finalPhotonPosition
private

Definition at line 115 of file SimPhotonCounter_module.cc.

std::vector<std::string> opdet::SimPhotonCounter::fInputModule
private

Definition at line 99 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

TTree* opdet::SimPhotonCounter::fLightAnalysisTree = nullptr
private

Definition at line 142 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fMakeAllPhotonsTree
private

Definition at line 104 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), and isVisible().

bool opdet::SimPhotonCounter::fMakeDetectedPhotonsTree
private

Definition at line 103 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), and isVisible().

bool opdet::SimPhotonCounter::fMakeLightAnalysisTree
private

Definition at line 138 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), and isVisible().

bool opdet::SimPhotonCounter::fMakeOpDetEventsTree
private

Definition at line 106 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), and isVisible().

bool opdet::SimPhotonCounter::fMakeOpDetsTree
private

Definition at line 105 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), and isVisible().

int opdet::SimPhotonCounter::fmotherTrackID
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fOpChannel
private

Definition at line 135 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginX
private

Definition at line 121 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginY
private

Definition at line 122 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginZ
private

Definition at line 123 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fpdg
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

std::vector<double> opdet::SimPhotonCounter::fPosition0
private

Definition at line 145 of file SimPhotonCounter_module.cc.

std::string opdet::SimPhotonCounter::fProcess
private

Definition at line 150 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

phot::PhotonVisibilityService const* opdet::SimPhotonCounter::fPVS = nullptr
private

Definition at line 153 of file SimPhotonCounter_module.cc.

Referenced by analyze(), beginJob(), endJob(), isVisible(), and storeVisibility().

int opdet::SimPhotonCounter::fRun
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fSavePhotonOrigins
private

Definition at line 107 of file SimPhotonCounter_module.cc.

Referenced by beginJob(), and isVisible().

std::vector<std::vector<std::vector<double> > > opdet::SimPhotonCounter::fSignals_vis
private

Definition at line 140 of file SimPhotonCounter_module.cc.

Referenced by analyze().

std::vector<std::vector<std::vector<double> > > opdet::SimPhotonCounter::fSignals_vuv
private

Definition at line 139 of file SimPhotonCounter_module.cc.

Referenced by analyze().

std::vector<std::vector<double> > opdet::SimPhotonCounter::fSignalsvis
private

Definition at line 149 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

std::vector<std::vector<double> > opdet::SimPhotonCounter::fSignalsvuv
private

Definition at line 148 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

std::vector<std::vector<double> > opdet::SimPhotonCounter::fstepPositions
private

Definition at line 146 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

std::vector<double> opdet::SimPhotonCounter::fstepTimes
private

Definition at line 147 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::fT0_vis
private

Definition at line 128 of file SimPhotonCounter_module.cc.

Referenced by analyze().

TTree* opdet::SimPhotonCounter::fTheEventTree
private

Definition at line 95 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fTheOpDetTree
private

Definition at line 94 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fThePhotonTreeAll
private

Definition at line 92 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fThePhotonTreeDetected
private

Definition at line 93 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::fTime
private

Definition at line 120 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fTrackID
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool const opdet::SimPhotonCounter::fUseLitePhotons
private

Definition at line 155 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

int opdet::SimPhotonCounter::fVerbosity
private

Definition at line 101 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

Float_t opdet::SimPhotonCounter::fWavelength
private

Definition at line 119 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TVector3 opdet::SimPhotonCounter::initialPhotonPosition
private

Definition at line 114 of file SimPhotonCounter_module.cc.

constexpr double opdet::SimPhotonCounter::kVisibleThreshold = 200.0
staticprivate

Threshold used to resolve between visible and ultraviolet light.

Definition at line 82 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

constexpr double opdet::SimPhotonCounter::kVisibleWavelength = 450.0
staticprivate

Value used when a typical visible light wavelength is needed.

Definition at line 85 of file SimPhotonCounter_module.cc.

constexpr double opdet::SimPhotonCounter::kVUVWavelength = 128.0
staticprivate

Value used when a typical ultraviolet light wavelength is needed.

Definition at line 88 of file SimPhotonCounter_module.cc.

Referenced by analyze().

cheat::ParticleInventoryService const* opdet::SimPhotonCounter::pi_serv = nullptr
private

Definition at line 152 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().


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