LArSoft  v09_90_00
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 297 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, art::ProductRetriever::getHandle(), art::ProductRetriever::getMany(), art::ProductRetriever::getView(), art::Event::id(), phot::PhotonVisibilityService::IsBuildJob(), isVisible(), kVisibleThreshold, kVUVWavelength, sim::NoParticleId, geo::GeometryCore::NOpChannels(), cheat::ParticleInventoryService::ParticleList(), pi_serv, art::errors::ProductNotFound, art::Event::run(), sc, phot::PhotonVisibilityService::StoreReflected(), phot::PhotonVisibilityService::StoreReflT0(), storeVisibility(), and opdet::OpDetResponseInterface::wavelength().

298  {
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
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.getPointerByLabel<std::vector<simb::MCParticle>>("largeant");
319  mcpartVec = evt.getHandle<std::vector<simb::MCParticle>>("largeant").product();
320 
321  size_t maxNtracks = 1000U; // mcpartVec->size(); --- { to be fixed soon! ]
322  fSignals_vuv.clear();
323  fSignals_vuv.resize(maxNtracks);
324  fSignals_vis.clear();
325  fSignals_vis.resize(maxNtracks);
326  for (size_t itrack = 0; itrack != maxNtracks; itrack++) {
327  fSignals_vuv[itrack].resize(geo->NOpChannels());
328  fSignals_vis[itrack].resize(geo->NOpChannels());
329  }
330  totalEnergy_track.resize(maxNtracks, 0.);
331  //-------------------------stimation of dedx per trackID----------------------
332  //get the list of particles from this event
333  const sim::ParticleList* plist = pi_serv ? &(pi_serv->ParticleList()) : nullptr;
334 
335  // loop over all sim::SimChannels in the event and make sure there are no
336  // sim::IDEs with trackID values that are not in the sim::ParticleList
337  std::vector<const sim::SimChannel*> sccol;
338  //evt.getView(fG4ModuleLabel, sccol);
339  for (auto const& mod : fInputModule) {
340  evt.getView(mod, sccol);
341  //loop over the sim channels collection
342  for (size_t sc = 0; sc < sccol.size(); ++sc) {
343  const auto& tdcidemap = sccol[sc]->TDCIDEMap();
344  //loop over all of the tdc IDE map objects
345  for (auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
346  const std::vector<sim::IDE> idevec = (*mapitr).second;
347  //go over all of the IDEs in a given simchannel
348  for (size_t iv = 0; iv < idevec.size(); ++iv) {
349  if (plist) {
350  if (plist->find(idevec[iv].trackID) == plist->end() &&
351  idevec[iv].trackID != sim::NoParticleId) {
352  mf::LogWarning("LArG4Ana") << idevec[iv].trackID << " is not in particle list";
353  }
354  }
355  if (idevec[iv].trackID < 0) continue;
356 
357  totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy / 3.;
358  }
359  }
360  }
361  }
362  } //End of if(fMakeLightAnalysisTree)
363 
364  if (!fUseLitePhotons) {
365 
366  //Reset counters
367  fCountEventAll = 0;
369 
370  //Get *ALL* SimPhotonsCollection from Event
371  //std::vector< art::Handle< std::vector< sim::SimPhotons > > > photon_handles;
372  //evt.getManyByType(photon_handles);
373  auto photon_handles = evt.getMany<std::vector<sim::SimPhotons>>();
374  if (photon_handles.size() == 0)
376  << "sim SimPhotons retrieved and you requested them.";
377 
378  for (auto const& mod : fInputModule) {
379  // sim::SimPhotonsCollection TheHitCollection = sim::SimListUtils::GetSimPhotonsCollection(evt,mod);
380  //switching off to add reading in of labelled collections: Andrzej, 02/26/19
381 
382  for (auto const& ph_handle : photon_handles) {
383  // Do some checking before we proceed
384  if (!ph_handle.isValid()) continue;
385  if (ph_handle.provenance()->moduleLabel() != mod)
386  continue; //not the most efficient way of doing this, but preserves the logic of the module. Andrzej
387 
388  bool Reflected = (ph_handle.provenance()->productInstanceName() == "Reflected");
389 
390  if ((*ph_handle).size() > 0) {
392  //resetting the signalt to save in the analysis tree per event
393  const int maxNtracks = 1000;
394  for (size_t itrack = 0; itrack != maxNtracks; itrack++) {
395  for (size_t pmt_i = 0; pmt_i != geo->NOpChannels(); pmt_i++) {
396  fSignals_vuv[itrack][pmt_i].clear();
397  fSignals_vis[itrack][pmt_i].clear();
398  }
399  }
400  }
401  }
402 
403  // if(fVerbosity > 0) std::cout<<"Found OpDet hit collection of size "<< TheHitCollection.size()<<std::endl;
404  if (fVerbosity > 0)
405  std::cout << "Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
406 
407  if ((*ph_handle).size() > 0) {
408  // for(sim::SimPhotonsCollection::const_iterator itOpDet=TheHitCollection.begin(); itOpDet!=TheHitCollection.end(); itOpDet++)
409  for (auto const& itOpDet : (*ph_handle)) {
410  //Reset Counters
411  fCountOpDetAll = 0;
414  //Reset t0 for visible light
415  fT0_vis = 999.;
416 
417  //Get data from HitCollection entry
418  fOpChannel = itOpDet.OpChannel();
419  const sim::SimPhotons& TheHit = itOpDet;
420 
421  //std::cout<<"OpDet " << fOpChannel << " has size " << TheHit.size()<<std::endl;
422 
423  // Loop through OpDet phots.
424  // Note we make the screen output decision outside the loop
425  // in order to avoid evaluating large numbers of unnecessary
426  // if conditions.
427 
428  for (const sim::OnePhoton& Phot : TheHit) {
429  // Calculate wavelength in nm
430  fWavelength = odresponse->wavelength(Phot.Energy);
431 
432  //Get arrival time from phot
433  fTime = Phot.Time;
434  foriginX = Phot.InitialPosition.X();
435  foriginY = Phot.InitialPosition.Y();
436  foriginZ = Phot.InitialPosition.Z();
437 
438  // special case for LibraryBuildJob: no working "Reflected" handle and all photons stored in single object - must sort using wavelength instead
439  if (fPVS->IsBuildJob() && !Reflected) {
440  // all photons contained in object with Reflected = false flag
441  // Increment per OpDet counters and fill per phot trees
442  fCountOpDetAll++;
443  if (fMakeAllPhotonsTree) {
445  fThePhotonTreeAll->Fill();
446  }
447  }
448 
449  if (odresponse->detected(fOpChannel, Phot)) {
451  //only store direct direct light
453  // reflected and shifted light is in visible range
454  else if (fPVS->StoreReflected()) {
456  // find the first visible arrival time
457  if (fPVS->StoreReflT0() && fTime < fT0_vis) fT0_vis = fTime;
458  }
459  if (fVerbosity > 3)
460  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
461  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
462  << " Detected 1 " << std::endl;
463  }
464  else {
465  if (fVerbosity > 3)
466  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
467  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
468  << " Detected 0 " << std::endl;
469  }
470 
471  } // if build library and not reflected
472 
473  else {
474  // store in appropriate trees using "Reflected" handle and fPVS->StoreReflected() flag
475  // Increment per OpDet counters and fill per phot trees
476  fCountOpDetAll++;
477  if (fMakeAllPhotonsTree) {
478  if (!Reflected || (fPVS->StoreReflected() && Reflected)) {
479  fThePhotonTreeAll->Fill();
480  }
481  }
482 
483  if (odresponse->detected(fOpChannel, Phot)) {
485  //only store direct direct light
486  if (!Reflected) fCountOpDetDetected++;
487  // reflected and shifted light is in visible range
488  else if (fPVS->StoreReflected() && Reflected) {
490  // find the first visible arrival time
491  if (fPVS->StoreReflT0() && fTime < fT0_vis) fT0_vis = fTime;
492  }
493  if (fVerbosity > 3)
494  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
495  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
496  << " Detected 1 " << std::endl;
497  }
498  else {
499  if (fVerbosity > 3)
500  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
501  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
502  << " Detected 0 " << std::endl;
503  }
504  }
505  } // for each photon in collection
506 
507  // If this is a library building job, fill relevant entry
508  if (
509  fPVS->IsBuildJob() &&
510  !Reflected) // for library build job, both componenents stored in first object with Reflected = false
511  {
513  }
514 
515  // Incremenent per event and fill Per OpDet trees
516  if (fMakeOpDetsTree) fTheOpDetTree->Fill();
519 
520  // Give per OpDet output
521  if (fVerbosity > 2)
522  std::cout << "OpDetResponseInterface PerOpDet : Event " << fEventID << " OpDet "
523  << fOpChannel << " All " << fCountOpDetAll << " Det "
524  << fCountOpDetDetected << std::endl;
525  }
526 
527  // Fill per event tree
528  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
529 
530  // Give per event output
531  if (fVerbosity > 1)
532  std::cout << "OpDetResponseInterface PerEvent : Event " << fEventID << " All "
533  << fCountOpDetAll << " Det " << fCountOpDetDetected << std::endl;
534  }
535  else {
536  // if empty OpDet hit collection,
537  // add an empty record to the per event tree
538  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
539  }
541  assert(mcpartVec);
542  assert(fLightAnalysisTree);
543 
544  std::cout << "Filling the analysis tree" << std::endl;
545  //---------------Filling the analysis tree-----------:
546  fRun = evt.run();
547  std::vector<double> this_xyz;
548 
549  //loop over the particles
550  for (simb::MCParticle const& pPart : *mcpartVec) {
551 
552  if (pPart.Process() == "primary") fEnergy = pPart.E();
553 
554  //resetting the vectors
555  fstepPositions.clear();
556  fstepTimes.clear();
557  fSignalsvuv.clear();
558  fSignalsvis.clear();
559  fdEdx = -1.;
560  //filling the tree fields
561  fTrackID = pPart.TrackId();
562  fpdg = pPart.PdgCode();
563  fmotherTrackID = pPart.Mother();
564  fdEdx = totalEnergy_track[fTrackID];
567  fProcess = pPart.Process();
568  //filling the center positions of each step
569  for (size_t i_s = 1; i_s < pPart.NumberTrajectoryPoints(); i_s++) {
570  this_xyz.clear();
571  this_xyz.resize(3);
572  this_xyz[0] = pPart.Position(i_s).X();
573  this_xyz[1] = pPart.Position(i_s).Y();
574  this_xyz[2] = pPart.Position(i_s).Z();
575  fstepPositions.push_back(this_xyz);
576  fstepTimes.push_back(pPart.Position(i_s).T());
577  }
578  //filling the tree per track
579  fLightAnalysisTree->Fill();
580  }
581  } // if fMakeLightAnalysisTree
582  }
583  }
584  }
585  if (fUseLitePhotons) {
586 
587  //Get *ALL* SimPhotonsCollection from Event
588  //std::vector< art::Handle< std::vector< sim::SimPhotonsLite > > > photon_handles;
589  //evt.getManyByType(photon_handles);
590  auto photon_handles = evt.getMany<std::vector<sim::SimPhotonsLite>>();
591  if (photon_handles.size() == 0)
593  << "sim SimPhotons retrieved and you requested them.";
594 
595  //Get SimPhotonsLite from Event
596  for (auto const& mod : fInputModule) {
597  //art::Handle< std::vector<sim::SimPhotonsLite> > photonHandle;
598  //evt.getByLabel(mod, photonHandle);
599 
600  // Loop over direct/reflected photons
601  for (auto const& ph_handle : photon_handles) {
602  // Do some checking before we proceed
603  if (!ph_handle.isValid()) continue;
604  if (ph_handle.provenance()->moduleLabel() != mod)
605  continue; //not the most efficient way of doing this, but preserves the logic of the module. Andrzej
606 
607  bool Reflected = (ph_handle.provenance()->productInstanceName() == "Reflected");
608 
609  //Reset counters
610  fCountEventAll = 0;
612 
613  if (fVerbosity > 0)
614  std::cout << "Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
615 
616  if ((*ph_handle).size() > 0) {
617 
618  for (auto const& photon : (*ph_handle)) {
619  //Get data from HitCollection entry
620  fOpChannel = photon.OpChannel;
621  std::map<int, int> PhotonsMap = photon.DetectedPhotons;
622 
623  //Reset Counters
624  fCountOpDetAll = 0;
627 
628  for (auto it = PhotonsMap.begin(); it != PhotonsMap.end(); it++) {
629  // Calculate wavelength in nm
630  if (Reflected) { fWavelength = kVisibleThreshold; }
631  else {
632  fWavelength = kVUVWavelength; // original
633  }
634 
635  //Get arrival time from phot
636  fTime = it->first;
637  //std::cout<<"Arrival time: " << fTime<<std::endl;
638 
639  for (int i = 0; i < it->second; i++) {
640  // Increment per OpDet counters and fill per phot trees
641  fCountOpDetAll++;
643 
644  if (odresponse->detectedLite(fOpChannel)) {
646  // direct light
647  if (!Reflected) { fCountOpDetDetected++; }
648  else if (Reflected) {
650  }
651  if (fVerbosity > 3)
652  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
653  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
654  << " Detected 1 " << std::endl;
655  }
656  else if (fVerbosity > 3) {
657  std::cout << "OpDetResponseInterface PerPhoton : Event " << fEventID
658  << " OpChannel " << fOpChannel << " Wavelength " << fWavelength
659  << " Detected 0 " << std::endl;
660  }
661  }
662  }
663 
664  // Incremenent per event and fill Per OpDet trees
665  if (fMakeOpDetsTree) fTheOpDetTree->Fill();
668 
669  if (fPVS->IsBuildJob())
671 
672  // Give per OpDet output
673  if (fVerbosity > 2)
674  std::cout << "OpDetResponseInterface PerOpDet : Event " << fEventID << " OpDet "
675  << fOpChannel << " All " << fCountOpDetAll << " Det "
676  << fCountOpDetDetected << std::endl;
677  }
678  // Fill per event tree
679  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
680 
681  // Give per event output
682  if (fVerbosity > 1)
683  std::cout << "OpDetResponseInterface PerEvent : Event " << fEventID << " All "
684  << fCountOpDetAll << " Det " << fCountOpDetDetected << std::endl;
685  }
686  else {
687  // if empty OpDet hit collection,
688  // add an empty record to the per event tree
689  if (fMakeOpDetEventsTree) fTheEventTree->Fill();
690  }
691  }
692  }
693  }
694  } // SimPhotonCounter::analyze()
std::vector< std::vector< double > > fstepPositions
unsigned int event
Definition: DataStructs.h:627
unsigned int run
Definition: DataStructs.h:628
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
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.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
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
Namespace collecting geometry-related classes utilities.
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 197 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().

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

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

293  {
295  }
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 697 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().

702  {
704 
705  // ask PhotonVisibilityService which voxel was being served,
706  // and how many photons where there generated (yikes!!);
707  // this value was put there by LightSource (yikes!!)
708  int VoxID;
709  double NProd;
710  fPVS->RetrieveLightProd(VoxID, NProd);
711 
712  pvs.SetLibraryEntry(VoxID, channel, double(nDirectPhotons) / NProd);
713 
714  //store reflected light
715  if (fPVS->StoreReflected()) {
716  pvs.SetLibraryEntry(VoxID, channel, double(nReflectedPhotons) / NProd, true);
717 
718  //store reflected first arrival time
719  if (fPVS->StoreReflT0()) pvs.SetLibraryReflT0Entry(VoxID, channel, reflectedT0);
720 
721  } // if reflected
722 
723  } // 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 129 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountEventDetected
private

Definition at line 130 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetAll
private

Definition at line 124 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetDetected
private

Definition at line 125 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetReflDetected
private

Definition at line 126 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fdEdx
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fEnergy
private

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fEventID
private

Definition at line 133 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TVector3 opdet::SimPhotonCounter::finalPhotonPosition
private

Definition at line 114 of file SimPhotonCounter_module.cc.

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

Definition at line 98 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

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

Definition at line 141 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fMakeAllPhotonsTree
private

Definition at line 103 of file SimPhotonCounter_module.cc.

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

bool opdet::SimPhotonCounter::fMakeDetectedPhotonsTree
private

Definition at line 102 of file SimPhotonCounter_module.cc.

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

bool opdet::SimPhotonCounter::fMakeLightAnalysisTree
private

Definition at line 137 of file SimPhotonCounter_module.cc.

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

bool opdet::SimPhotonCounter::fMakeOpDetEventsTree
private

Definition at line 105 of file SimPhotonCounter_module.cc.

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

bool opdet::SimPhotonCounter::fMakeOpDetsTree
private

Definition at line 104 of file SimPhotonCounter_module.cc.

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

int opdet::SimPhotonCounter::fmotherTrackID
private

Definition at line 142 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fOpChannel
private

Definition at line 134 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginX
private

Definition at line 120 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginY
private

Definition at line 121 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::foriginZ
private

Definition at line 122 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fpdg
private

Definition at line 142 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 144 of file SimPhotonCounter_module.cc.

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

Definition at line 149 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 152 of file SimPhotonCounter_module.cc.

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

int opdet::SimPhotonCounter::fRun
private

Definition at line 142 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fSavePhotonOrigins
private

Definition at line 106 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 139 of file SimPhotonCounter_module.cc.

Referenced by analyze().

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

Definition at line 138 of file SimPhotonCounter_module.cc.

Referenced by analyze().

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

Definition at line 148 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 147 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 145 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 146 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::fT0_vis
private

Definition at line 127 of file SimPhotonCounter_module.cc.

Referenced by analyze().

TTree* opdet::SimPhotonCounter::fTheEventTree
private

Definition at line 94 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fTheOpDetTree
private

Definition at line 93 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fThePhotonTreeAll
private

Definition at line 91 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TTree* opdet::SimPhotonCounter::fThePhotonTreeDetected
private

Definition at line 92 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::fTime
private

Definition at line 119 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fTrackID
private

Definition at line 142 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool const opdet::SimPhotonCounter::fUseLitePhotons
private

Definition at line 154 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

int opdet::SimPhotonCounter::fVerbosity
private

Definition at line 100 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and isVisible().

Float_t opdet::SimPhotonCounter::fWavelength
private

Definition at line 118 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TVector3 opdet::SimPhotonCounter::initialPhotonPosition
private

Definition at line 113 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 81 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 84 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 87 of file SimPhotonCounter_module.cc.

Referenced by analyze().

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

Definition at line 151 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().


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