LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
opdet::SimPhotonCounter Class Reference

#include "SimPhotonCounter.h"

Inheritance diagram for opdet::SimPhotonCounter:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
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 &)
 
virtual ~SimPhotonCounter ()
 
void analyze (art::Event const &)
 
void beginJob ()
 
void endJob ()
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

float Wavelength (const sim::OnePhoton &ph)
 

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
 
TVector3 initialPhotonPosition
 
TVector3 finalPhotonPosition
 
Float_t fWavelength
 
Float_t fTime
 
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
 
int fRun
 
int fTrackID
 
int fpdg
 
int fmotherTrackID
 
double fEnergy
 
double fdEdx
 
std::vector< double > fPosition0
 
std::vector< std::vector< double > > fstepPrePositions
 
std::vector< std::vector< double > > fstepPostPositions
 
std::vector< double > fstepPreTimes
 
std::vector< double > fstepPostTimes
 
std::vector< std::vector< double > > fSignalsvuv
 
std::vector< std::vector< double > > fSignalsvis
 
std::string fProcess
 
cheat::ParticleInventoryServicepi_serv = nullptr
 

Detailed Description

Definition at line 17 of file SimPhotonCounter.h.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

opdet::SimPhotonCounter::SimPhotonCounter ( )
inline

Definition at line 20 of file SimPhotonCounter.h.

References e, and s.

20 {}
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 7 of file SimPhotonCounter.cxx.

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

12 {
13 
14  SetWavelengthRanges(min_w,max_w);
15  SetTimeRanges(t_p1,t_p2,t_l1,t_l2);
16 
17  _photonVector_prompt=std::vector<float>(s);
18  _photonVector_late=std::vector<float>(s);
19  _qeVector = std::vector<float>(s,e);
20 
21 }
Float_t s
Definition: plot.C:23
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:34
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 23 of file SimPhotonCounter.cxx.

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

27 {
28  SetWavelengthRanges(min_w,max_w);
29  SetTimeRanges(t_p1,t_p2,t_l1,t_l2);
30 
31  _photonVector_prompt=std::vector<float>(eV.size());
32  _photonVector_late=std::vector<float>(eV.size());
33  _qeVector = eV;
34 
35 }
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 )
opdet::SimPhotonCounter::~SimPhotonCounter ( )
virtual

Definition at line 284 of file SimPhotonCounter_module.cc.

285  {
286  }

Member Function Documentation

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

Definition at line 63 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(), and QEVector().

64 {
65  if(i_opdet > GetVectorSize())
66  throw std::runtime_error("ERROR in SimPhotonCounter: Opdet requested out of range!");
67 
68  if(Wavelength(photon) < _min_wavelength || Wavelength(photon) > _max_wavelength) return;
69 
70  if(photon.Time > _min_prompt_time && photon.Time <= _max_prompt_time)
71  _photonVector_prompt[i_opdet] += _qeVector[i_opdet];
72  else if(photon.Time > _min_late_time && photon.Time < _max_late_time)
73  _photonVector_late[i_opdet] += _qeVector[i_opdet];
74 
75 }
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 77 of file SimPhotonCounter.cxx.

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

Referenced by QEVector().

78 {
79  for(size_t i_ph=0; i_ph < photons.size(); i_ph++)
80  AddOnePhoton(photons.OpChannel(),photons[i_ph]);
81 }
int OpChannel() const
Definition: SimPhotons.h:161
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 DEFINE_ART_MODULE, opdet::OpDetResponseInterface::detected(), opdet::OpDetResponseInterface::detectedLite(), sim::ParticleList::end(), art::EventID::event(), fCountEventAll, fCountEventDetected, fCountOpDetAll, fCountOpDetDetected, fCountOpDetReflDetected, fdEdx, fEnergy, fEventID, finalPhotonPosition, sim::ParticleList::find(), fInputModule, fLightAnalysisTree, fMakeAllPhotonsTree, fMakeDetectedPhotonsTree, fMakeLightAnalysisTree, fMakeOpDetEventsTree, fMakeOpDetsTree, fmotherTrackID, fOpChannel, fpdg, fProcess, fRun, fSignals_vis, fSignals_vuv, fSignalsvis, fSignalsvuv, fstepPostPositions, fstepPostTimes, fstepPrePositions, fstepPreTimes, fT0_vis, fTheEventTree, fTheOpDetTree, fThePhotonTreeAll, fThePhotonTreeDetected, fTime, fTrackID, fVerbosity, fWavelength, art::DataViewImpl::getByLabel(), sim::SimListUtils::GetSimPhotonsCollection(), art::DataViewImpl::getView(), art::Event::id(), initialPhotonPosition, phot::PhotonVisibilityService::IsBuildJob(), sim::NoParticleId, geo::GeometryCore::NOpChannels(), cheat::ParticleInventoryService::ParticleList(), pi_serv, phot::PhotonVisibilityService::RetrieveLightProd(), art::Event::run(), phot::PhotonVisibilityService::SetLibraryEntry(), phot::PhotonVisibilityService::SetLibraryReflT0Entry(), phot::PhotonVisibilityService::StoreReflected(), phot::PhotonVisibilityService::StoreReflT0(), sim::LArG4Parameters::UseLitePhotons(), and opdet::OpDetResponseInterface::wavelength().

299  {
300 
301  // Lookup event ID from event
302  art::EventNumber_t event = evt.id().event();
303  fEventID=Int_t(event);
304 
306 
308  bool fUseLitePhotons = lgp->UseLitePhotons();
309 
310  // Service for determining opdet responses
312 
313  // get the geometry to be able to figure out signal types and chan -> plane mappings
315 
316  //-------------------------stimation of dedx per trackID------------------------
317 
318  //get the list of particles from this event
319  double totalEnergy_track[1000] = {0.};
321  const sim::ParticleList* plist = pi_serv? &(pi_serv->ParticleList()): nullptr;
322 
323  // loop over all sim::SimChannels in the event and make sure there are no
324  // sim::IDEs with trackID values that are not in the sim::ParticleList
325  std::vector<const sim::SimChannel*> sccol;
326  //evt.getView(fG4ModuleLabel, sccol);
327  for(auto mod : fInputModule){
328  evt.getView(mod, sccol);
329  double totalCharge=0.0;
330  double totalEnergy=0.0;
331  //loop over the sim channels collection
332  for(size_t sc = 0; sc < sccol.size(); ++sc){
333  double numIDEs=0.0;
334  double scCharge=0.0;
335  double scEnergy=0.0;
336  const auto & tdcidemap = sccol[sc]->TDCIDEMap();
337  //loop over all of the tdc IDE map objects
338  for(auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
339  const std::vector<sim::IDE> idevec = (*mapitr).second;
340  numIDEs += idevec.size();
341  //go over all of the IDEs in a given simchannel
342  for(size_t iv = 0; iv < idevec.size(); ++iv){
343  if (plist) {
344  if(plist->find( idevec[iv].trackID ) == plist->end()
345  && idevec[iv].trackID != sim::NoParticleId)
346  {
347  mf::LogWarning("LArG4Ana") << idevec[iv].trackID << " is not in particle list";
348  }
349  }
350  if(idevec[iv].trackID < 0) continue;
351  totalCharge +=idevec[iv].numElectrons;
352  scCharge += idevec[iv].numElectrons;
353  totalEnergy +=idevec[iv].energy;
354  scEnergy += idevec[iv].energy;
355 
356  totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy/3.;
357  }
358  }
359  }
360  }
361  }//End of if(fMakeLightAnalysisTree)
362 
363 
364  if(!fUseLitePhotons)
365  {
366 
367  //Reset counters
368  fCountEventAll=0;
370 
371  //Get SimPhotonsCollection from Event
372 
373  for(auto mod : fInputModule){
375 
376 
377  if(TheHitCollection.size()>0)
378  {
380  //resetting the signalt to save in the analysis tree per event
381  const int maxNtracks = 1000;
382  for(size_t itrack=0; itrack!=maxNtracks; itrack++) {
383  for(size_t pmt_i=0; pmt_i!=geo->NOpChannels(); pmt_i++) {
384  fSignals_vuv[itrack][pmt_i].clear();
385  fSignals_vis[itrack][pmt_i].clear();
386  }
387  }
388  }
389 
390  if(fVerbosity > 0) std::cout<<"Found OpDet hit collection of size "<< TheHitCollection.size()<<std::endl;
391  if(TheHitCollection.size()>0)
392  {
393  for(sim::SimPhotonsCollection::const_iterator itOpDet=TheHitCollection.begin(); itOpDet!=TheHitCollection.end(); itOpDet++)
394  {
395  //Reset Counters
396  fCountOpDetAll=0;
399  //Reset t0 for visible light
400  fT0_vis = 999.;
401 
402  //Get data from HitCollection entry
403  fOpChannel=itOpDet->first;
404  const sim::SimPhotons& TheHit=itOpDet->second;
405 
406  //std::cout<<"OpDet " << fOpChannel << " has size " << TheHit.size()<<std::endl;
407 
408  // Loop through OpDet phots.
409  // Note we make the screen output decision outside the loop
410  // in order to avoid evaluating large numbers of unnecessary
411  // if conditions.
412 
413  if(fVerbosity > 3)
414  {
415  for(const sim::OnePhoton& Phot: TheHit)
416  {
417  // Calculate wavelength in nm
418  fWavelength= odresponse->wavelength(Phot.Energy);
419 
420  //Get arrival time from phot
421  fTime= Phot.Time;
422 
423  // Increment per OpDet counters and fill per phot trees
424  fCountOpDetAll++;
426  if(odresponse->detected(fOpChannel, Phot))
427  {
429  //only store direct direct light
430  if(!pvs->StoreReflected() || (pvs->StoreReflected() && fWavelength <200 ))
432  // reflected and shifted light is in visible range
433  else if(pvs->StoreReflected() && fWavelength >380 ) {
435  // find the first visible arrival time
436  if(pvs->StoreReflT0() && fTime < fT0_vis)
437  fT0_vis = fTime;
438  }
439 
440  std::cout<<"OpDetResponseInterface PerPhoton : Event "<<fEventID<<" OpChannel " <<fOpChannel << " Wavelength " << fWavelength << " Detected 1 "<<std::endl;
441  }
442  else
443  std::cout<<"OpDetResponseInterface PerPhoton : Event "<<fEventID<<" OpChannel " <<fOpChannel << " Wavelength " << fWavelength << " Detected 0 "<<std::endl;
444  }
445  }
446  else
447  {
448  for(const sim::OnePhoton& Phot: TheHit)
449  {
450  // Calculate wavelength in nm
451  fWavelength= odresponse->wavelength(Phot.Energy);
452  fTime= Phot.Time;
453 
455  if(fWavelength <200)
456  fSignals_vuv[Phot.MotherTrackID][fOpChannel].push_back(fTime);
457  else
458  fSignals_vis[Phot.MotherTrackID][fOpChannel].push_back(fTime);
459 
460  initialPhotonPosition = Phot.InitialPosition;
461  finalPhotonPosition = Phot.FinalLocalPosition;
462  }
463 
464  // Increment per OpDet counters and fill per phot trees
465  fCountOpDetAll++;
467  if(odresponse->detected(fOpChannel, Phot))
468  {
470  //only store direct/UV light
471  if(!pvs->StoreReflected() || (pvs->StoreReflected() && fWavelength <200 ))
473  //shifted light is in visible range
474  else if(pvs->StoreReflected() && fWavelength >380 ) {
476  // find the first visible arrival time
477  if(pvs->StoreReflT0() && fTime < fT0_vis )
478  fT0_vis= fTime;
479  }
480  }
481  }
482  }
483 
484  // If this is a library building job, fill relevant entry
486  if(pvs->IsBuildJob())
487  {
488  int VoxID; double NProd;
489  pvs->RetrieveLightProd(VoxID, NProd);
490  pvs->SetLibraryEntry(VoxID, fOpChannel, double(fCountOpDetDetected)/NProd);
491  //store reflected light
492  if(pvs->StoreReflected())
493  pvs->SetLibraryEntry(VoxID, fOpChannel, double(fCountOpDetReflDetected)/NProd,true);
494  //store reflected first arrival time
495  if(pvs->StoreReflT0())
497  }
498 
499  // Incremenent per event and fill Per OpDet trees
500  if(fMakeOpDetsTree) fTheOpDetTree->Fill();
503 
504  // Give per OpDet output
505  if(fVerbosity >2) std::cout<<"OpDetResponseInterface PerOpDet : Event "<<fEventID<<" OpDet " << fOpChannel << " All " << fCountOpDetAll << " Det " <<fCountOpDetDetected<<std::endl;
506  }
507 
508  // Fill per event tree
510 
511  // Give per event output
512  if(fVerbosity >1) std::cout<<"OpDetResponseInterface PerEvent : Event "<<fEventID<<" All " << fCountOpDetAll << " Det " <<fCountOpDetDetected<<std::endl;
513 
514  }
515  else
516  {
517  // if empty OpDet hit collection,
518  // add an empty record to the per event tree
520  }
522  std::cout<<"Building the analysis tree"<<std::endl;
523  //---------------Building the analysis tree-----------:
524  fRun = evt.run();
525  std::vector<double> thisPrexyz;
526  std::vector<double> thisPostxyz;
527 
529  evt.getByLabel("mcreco",mctrackHandle);
530  std::vector<sim::MCTrack> const& mctrackVec(*mctrackHandle);
531 
532  //loop over the particles (so over the tracks)
533  fEnergy = mctrackVec[0][0].E();
534  for(size_t i_p=0; i_p < mctrackVec.size(); i_p++){
535  //resetting the vectors
536  fstepPrePositions.clear();
537  fstepPostPositions.clear();
538  fstepPreTimes.clear();
539  fstepPostTimes.clear();
540  fSignalsvuv.clear();
541  fSignalsvis.clear();
542  fdEdx = -1.;
543  //filling the tree fields
544  fTrackID = mctrackVec[i_p].TrackID();
545  fpdg = mctrackVec[i_p].PdgCode();
546  fmotherTrackID = mctrackVec[i_p].MotherTrackID();
547  fdEdx = totalEnergy_track[fTrackID];
550  fProcess = mctrackVec[i_p].Process();
551  //filling the center positions of each step
552  for(size_t i_s=1; i_s < mctrackVec[i_p].size(); i_s++){
553  TVector3 const& vec1 = mctrackVec[i_p][i_s-1].Position().Vect();
554  TVector3 const& vec2 = mctrackVec[i_p][i_s].Position().Vect();
555  thisPrexyz.clear();
556  thisPrexyz.resize(3);
557  thisPrexyz[0] = vec1.X();
558  thisPrexyz[1] = vec1.Y();
559  thisPrexyz[2] = vec1.Z();
560  fstepPrePositions.push_back(thisPrexyz);
561  thisPostxyz.clear();
562  thisPostxyz.resize(3);
563  thisPostxyz[0] = vec2.X();
564  thisPostxyz[1] = vec2.Y();
565  thisPostxyz[2] = vec2.Z();
566  fstepPostPositions.push_back(thisPostxyz);
567  fstepPreTimes.push_back(mctrackVec[i_p][i_s-1].T());
568  fstepPostTimes.push_back(mctrackVec[i_p][i_s].T());
569  //double stepL = (vec2-vec1).Mag();
570  //std::cout<<"step length: "<<stepL<<std::endl;
571 
572  }
573  //filling the tree per track
574  fLightAnalysisTree->Fill();
575  }
576  }
577  }
578  }
579  }
580 
581 
582  if (fUseLitePhotons)
583  {
584  //Get SimPhotonsLite from Event
585 
586  for(auto mod : fInputModule){
588  evt.getByLabel(mod, photonHandle);
589 
590 
591 
592 
593  //Reset counters
594  fCountEventAll=0;
596 
597  if(fVerbosity > 0) std::cout<<"Found OpDet hit collection of size "<< (*photonHandle).size()<<std::endl;
598 
599 
600  if((*photonHandle).size()>0)
601  {
602 
603  for ( auto const& photon : (*photonHandle) )
604  {
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;
612 
613  if(fVerbosity > 3)
614  {
615  for(auto it = PhotonsMap.begin(); it!= PhotonsMap.end(); it++)
616  {
617  // Calculate wavelength in nm
618  fWavelength= 128;
619 
620  //Get arrival time from phot
621  fTime= it->first;
622  //std::cout<<"Arrival time: " << fTime<<std::endl;
623 
624  for(int i = 0; i < it->second ; i++)
625  {
626  // Increment per OpDet counters and fill per phot trees
627  fCountOpDetAll++;
629  if(odresponse->detectedLite(fOpChannel))
630  {
633  std::cout<<"OpDetResponseInterface PerPhoton : Event "<<fEventID<<" OpChannel " <<fOpChannel << " Wavelength " << fWavelength << " Detected 1 "<<std::endl;
634  }
635  else
636  std::cout<<"OpDetResponseInterface PerPhoton : Event "<<fEventID<<" OpChannel " <<fOpChannel << " Wavelength " << fWavelength << " Detected 0 "<<std::endl;
637  }
638  }
639  }
640  else
641  {
642  for(auto it = PhotonsMap.begin(); it!= PhotonsMap.end(); it++)
643  {
644  // Calculate wavelength in nm
645  fWavelength= 128;
646  fTime= it->first;
647 
648  for(int i = 0; i < it->second; i++)
649  {
650  // Increment per OpDet counters and fill per phot trees
651  fCountOpDetAll++;
653  if(odresponse->detectedLite(fOpChannel))
654  {
657  }
658  }
659  }
660  }
661 
662  // Incremenent per event and fill Per OpDet trees
663  if(fMakeOpDetsTree) fTheOpDetTree->Fill();
666 
667  // Give per OpDet output
668  if(fVerbosity >2) std::cout<<"OpDetResponseInterface PerOpDet : Event "<<fEventID<<" OpDet " << fOpChannel << " All " << fCountOpDetAll << " Det " <<fCountOpDetDetected<<std::endl;
669  }
670  // Fill per event tree
672 
673  // Give per event output
674  if(fVerbosity >1) std::cout<<"OpDetResponseInterface PerEvent : Event "<<fEventID<<" All " << fCountOpDetAll << " Det " <<fCountOpDetDetected<<std::endl;
675 
676  }
677  else
678  {
679  // if empty OpDet hit collection,
680  // add an empty record to the per event tree
682  }
683  }
684  }
685  }
unsigned int event
Definition: DataStructs.h:537
void RetrieveLightProd(int &VoxID, double &N) const
unsigned int run
Definition: DataStructs.h:538
std::vector< std::vector< double > > fstepPostPositions
cheat::ParticleInventoryService * pi_serv
std::vector< std::vector< double > > fSignalsvuv
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
std::vector< std::vector< double > > fstepPrePositions
iterator find(const key_type &key)
Definition: ParticleList.h:318
std::vector< std::string > fInputModule
static const int NoParticleId
Definition: sim.h:28
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
void SetLibraryEntry(int VoxID, int OpChannel, float N, bool wantReflected=false)
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
std::vector< double > fstepPostTimes
list_type::const_iterator const_iterator
Definition: SimPhotons.h:134
std::vector< std::vector< std::vector< double > > > fSignals_vis
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
std::vector< std::vector< double > > fSignalsvis
TCEvent evt
Definition: DataStructs.cxx:5
virtual float wavelength(double energy) const
Namespace collecting geometry-related classes utilities.
std::vector< std::vector< std::vector< double > > > fSignals_vuv
std::vector< double > fstepPreTimes
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
bool UseLitePhotons() const
Event finding and building.
void opdet::SimPhotonCounter::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 184 of file SimPhotonCounter_module.cc.

References e, fCountEventAll, fCountEventDetected, fCountOpDetAll, fCountOpDetDetected, fCountOpDetReflDetected, fdEdx, fEnergy, fEventID, fLightAnalysisTree, fMakeAllPhotonsTree, fMakeDetectedPhotonsTree, fMakeLightAnalysisTree, fMakeOpDetEventsTree, fMakeOpDetsTree, fmotherTrackID, fOpChannel, fpdg, fProcess, fRun, fSignals_vis, fSignals_vuv, fSignalsvis, fSignalsvuv, fstepPostPositions, fstepPostTimes, fstepPrePositions, fstepPreTimes, fTheEventTree, fTheOpDetTree, fThePhotonTreeAll, fThePhotonTreeDetected, fTime, fTrackID, fWavelength, art::TFileDirectory::make(), geo::GeometryCore::NOpChannels(), pi_serv, art::errors::ServiceNotFound, and phot::PhotonVisibilityService::StoreReflected().

185  {
186  // Get file service to store trees
190 
191  try {
193  }
194  catch (art::Exception const& e) {
195  if (e.categoryCode() != art::errors::ServiceNotFound) throw;
196  mf::LogError("SimPhotonCounter")
197  << "ParticleInventoryService service is not configured!"
198  " Please add it in the job configuration."
199  " In the meanwhile, some checks to particles will be skipped."
200  ;
201  }
202 
203  // Create and assign branch addresses to required tree
205  {
206  fThePhotonTreeAll = tfs->make<TTree>("AllPhotons","AllPhotons");
207  fThePhotonTreeAll->Branch("EventID", &fEventID, "EventID/I");
208  fThePhotonTreeAll->Branch("Wavelength", &fWavelength, "Wavelength/F");
209  fThePhotonTreeAll->Branch("OpChannel", &fOpChannel, "OpChannel/I");
210  fThePhotonTreeAll->Branch("Time", &fTime, "Time/F");
211  }
212 
214  {
215  fThePhotonTreeDetected = tfs->make<TTree>("DetectedPhotons","DetectedPhotons");
216  fThePhotonTreeDetected->Branch("EventID", &fEventID, "EventID/I");
217  fThePhotonTreeDetected->Branch("Wavelength", &fWavelength, "Wavelength/F");
218  fThePhotonTreeDetected->Branch("OpChannel", &fOpChannel, "OpChannel/I");
219  fThePhotonTreeDetected->Branch("Time", &fTime, "Time/F");
220  }
221 
222  if(fMakeOpDetsTree)
223  {
224  fTheOpDetTree = tfs->make<TTree>("OpDets","OpDets");
225  fTheOpDetTree->Branch("EventID", &fEventID, "EventID/I");
226  fTheOpDetTree->Branch("OpChannel", &fOpChannel, "OpChannel/I");
227  fTheOpDetTree->Branch("CountAll", &fCountOpDetAll, "CountAll/I");
228  fTheOpDetTree->Branch("CountDetected", &fCountOpDetDetected, "CountDetected/I");
229  if(pvs->StoreReflected())
230  fTheOpDetTree->Branch("CountReflDetected", &fCountOpDetReflDetected, "CountReflDetected/I");
231  fTheOpDetTree->Branch("Time", &fTime, "Time/F");
232  }
233 
235  {
236  fTheEventTree = tfs->make<TTree>("OpDetEvents","OpDetEvents");
237  fTheEventTree->Branch("EventID", &fEventID, "EventID/I");
238  fTheEventTree->Branch("CountAll", &fCountEventAll, "CountAll/I");
239  fTheEventTree->Branch("CountDetected",&fCountEventDetected,"CountDetected/I");
240  if(pvs->StoreReflected())
241  fTheOpDetTree->Branch("CountReflDetected", &fCountOpDetReflDetected, "CountReflDetected/I");
242 
243  }
244 
245  //generating the tree for the light analysis:
247  {
248  fLightAnalysisTree = tfs->make<TTree>("LightAnalysis","LightAnalysis");
249  fLightAnalysisTree->Branch("RunNumber",&fRun);
250  fLightAnalysisTree->Branch("EventID",&fEventID);
251  fLightAnalysisTree->Branch("TrackID",&fTrackID);
252  fLightAnalysisTree->Branch("PdgCode",&fpdg);
253  fLightAnalysisTree->Branch("MotherTrackID",&fmotherTrackID);
254  fLightAnalysisTree->Branch("Energy",&fEnergy);
255  fLightAnalysisTree->Branch("dEdx",&fdEdx);
256  fLightAnalysisTree->Branch("StepPrePositions",&fstepPrePositions);
257  fLightAnalysisTree->Branch("StepPostPositions",&fstepPostPositions);
258  fLightAnalysisTree->Branch("StepPreTimes",&fstepPreTimes);
259  fLightAnalysisTree->Branch("StepPostTimes",&fstepPostTimes);
260  fLightAnalysisTree->Branch("SignalsVUV",&fSignalsvuv);
261  fLightAnalysisTree->Branch("SignalsVisible",&fSignalsvis);
262  fLightAnalysisTree->Branch("Process",&fProcess);
263 
264  const int maxNtracks = 1000;
265  fSignals_vuv.clear();
266  fSignals_vuv.resize(maxNtracks);
267  fSignals_vis.clear();
268  fSignals_vis.resize(maxNtracks);
269  for(size_t itrack=0; itrack!=maxNtracks; itrack++) {
270  fSignals_vuv[itrack].resize(geo->NOpChannels());
271  fSignals_vis[itrack].resize(geo->NOpChannels());
272  }
273 
274  fstepPrePositions.clear();
275  fstepPostPositions.clear();
276  fstepPreTimes.clear();
277  fstepPostTimes.clear();
278 
279  }
280 
281  }
std::vector< std::vector< double > > fstepPostPositions
cheat::ParticleInventoryService * pi_serv
std::vector< std::vector< double > > fSignalsvuv
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
std::vector< std::vector< double > > fstepPrePositions
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
T * make(ARGS...args) const
std::vector< double > fstepPostTimes
std::vector< std::vector< std::vector< double > > > fSignals_vis
std::vector< std::vector< double > > fSignalsvis
Float_t e
Definition: plot.C:34
Namespace collecting geometry-related classes utilities.
std::vector< std::vector< std::vector< double > > > fSignals_vuv
std::vector< double > fstepPreTimes
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

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

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
void opdet::SimPhotonCounter::ClearVectors ( )

Definition at line 83 of file SimPhotonCounter.cxx.

References _photonVector_late, _photonVector_prompt, and GetVectorSize().

Referenced by QEVector().

84 {
85  for(size_t i=0; i<GetVectorSize(); i++){
86  _photonVector_prompt[i]=0.0;
87  _photonVector_late[i]=0.0;
88  }
89 }
std::vector< float > _photonVector_prompt
std::vector< float > _photonVector_late
size_t GetVectorSize() const
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDAnalyzer::currentContext ( ) const
protectedinherited

Definition at line 114 of file EDAnalyzer.cc.

References art::EDAnalyzer::current_context_.

Referenced by art::EDAnalyzer::workerType().

115  {
116  return current_context_.get();
117  }
CPC_exempt_ptr current_context_
Definition: EDAnalyzer.h:179
void opdet::SimPhotonCounter::endJob ( )
virtual
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

Referenced by art::OutputModule::doWriteEvent().

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:34
size_t opdet::SimPhotonCounter::GetVectorSize ( ) const
inline
float opdet::SimPhotonCounter::LatePhotonTotal ( ) const
inline

Definition at line 63 of file SimPhotonCounter.h.

References _photonVector_late.

Referenced by opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo(), and PhotonTotal().

64  { return std::accumulate(_photonVector_late.begin(),_photonVector_late.end(),0.0); }
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 55 of file SimPhotonCounter.h.

References _photonVector_late, and TotalPhotonVector().

55 { return _photonVector_late.at(i); }
std::vector< float > _photonVector_late
float opdet::SimPhotonCounter::MaxLateTime ( ) const
inline

Definition at line 39 of file SimPhotonCounter.h.

References _max_late_time.

Referenced by Print().

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

Definition at line 37 of file SimPhotonCounter.h.

References _max_prompt_time.

Referenced by Print().

37 { return _max_prompt_time; }
float opdet::SimPhotonCounter::MaxWavelength ( ) const
inline

Definition at line 32 of file SimPhotonCounter.h.

References _max_wavelength, and SetTimeRanges().

32 { return _max_wavelength; }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
float opdet::SimPhotonCounter::MinLateTime ( ) const
inline

Definition at line 38 of file SimPhotonCounter.h.

References _min_late_time.

Referenced by Print().

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

Definition at line 36 of file SimPhotonCounter.h.

References _min_prompt_time.

Referenced by Print().

36 { return _min_prompt_time; }
float opdet::SimPhotonCounter::MinWavelength ( ) const
inline

Definition at line 31 of file SimPhotonCounter.h.

References _min_wavelength.

31 { return _min_wavelength; }
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
float opdet::SimPhotonCounter::PhotonTotal ( ) const
inline

Definition at line 65 of file SimPhotonCounter.h.

References LatePhotonTotal(), Print(), and PromptPhotonTotal().

65 { return (PromptPhotonTotal()+LatePhotonTotal()); }
float PromptPhotonTotal() const
float LatePhotonTotal() const
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void opdet::SimPhotonCounter::Print ( )

Definition at line 101 of file SimPhotonCounter.cxx.

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

Referenced by PhotonTotal().

102 {
103  std::cout << "Vector size: " << GetVectorSize() << std::endl;
104  std::cout << "Time cut ranges: ("
105  << MinPromptTime() << "," << MaxPromptTime() << ") , ("
106  << MinLateTime() << "," << MaxLateTime() << ")" << std::endl;
107  std::cout << "\t" << "i : QE / Prompt / Late / Total" << std::endl;
108  for(size_t i=0; i<GetVectorSize(); i++)
109  std::cout << "\t" << i << ": " << _qeVector[i] << " / " << _photonVector_prompt[i] << " / " << _photonVector_late[i] << " / " << TotalPhotonVector(i) << std::endl;
110 
111 }
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
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
float opdet::SimPhotonCounter::PromptPhotonTotal ( ) const
inline

Definition at line 61 of file SimPhotonCounter.h.

References _photonVector_prompt.

Referenced by opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo(), and PhotonTotal().

62  { return std::accumulate(_photonVector_prompt.begin(),_photonVector_prompt.end(),0.0); }
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 54 of file SimPhotonCounter.h.

References _photonVector_prompt.

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

Definition at line 42 of file SimPhotonCounter.h.

References _qeVector.

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

Definition at line 46 of file SimPhotonCounter.h.

References _qeVector, AddOnePhoton(), AddSimPhotons(), and ClearVectors().

46 { return _qeVector; }
std::vector< float > _qeVector
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

Referenced by art::RootOutputFile::writeOne().

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void opdet::SimPhotonCounter::SetQE ( size_t  i,
float  e 
)
inline

Definition at line 41 of file SimPhotonCounter.h.

References _qeVector, and e.

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

Definition at line 44 of file SimPhotonCounter.h.

References _qeVector, and SetVectorSize().

45  { SetVectorSize(eV.size()); _qeVector = eV; }
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 54 of file SimPhotonCounter.cxx.

References _max_late_time, _max_prompt_time, _min_late_time, and _min_prompt_time.

Referenced by MaxWavelength(), and SimPhotonCounter().

55 {
56  if(t_p2<t_p1 || t_l2<t_l1 || t_p2>t_l1 )
57  throw std::runtime_error("ERROR in SimPhotonCounter: bad time ranges");
58 
59  _min_prompt_time = t_p1; _max_prompt_time = t_p2;
60  _min_late_time = t_l1; _max_late_time = t_l2;
61 }
void opdet::SimPhotonCounter::SetVectorSize ( size_t  s)
inline

Definition at line 25 of file SimPhotonCounter.h.

References _photonVector_late, _photonVector_prompt, and _qeVector.

Referenced by SetQEVector().

26  { _photonVector_prompt.resize(s); _photonVector_late.resize(s); _qeVector.resize(s); }
Float_t s
Definition: plot.C:23
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 37 of file SimPhotonCounter.cxx.

References _max_wavelength, and _min_wavelength.

Referenced by GetVectorSize(), and SimPhotonCounter().

38 {
39  if(min_w >= max_w)
40  throw std::runtime_error("ERROR in SimPhotonCounter: bad wavelength range");
41 
42  _min_wavelength = min_w;
43  _max_wavelength = max_w;
44 }
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
std::vector< float > opdet::SimPhotonCounter::TotalPhotonVector ( ) const

Definition at line 91 of file SimPhotonCounter.cxx.

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

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

91  {
92 
93  std::vector<float> totalPhotonVector(GetVectorSize());
94  std::transform(PromptPhotonVector().begin(),PromptPhotonVector().end(),
96  totalPhotonVector.begin(),
97  std::plus<float>());
98  return totalPhotonVector;
99 }
const std::vector< float > & PromptPhotonVector() const
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
const std::vector< float > & LatePhotonVector() const
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_t GetVectorSize() const
float opdet::SimPhotonCounter::TotalPhotonVector ( size_t  i) const
inline

Definition at line 58 of file SimPhotonCounter.h.

References LatePhotonVector(), and PromptPhotonVector().

59  { return (PromptPhotonVector(i)+LatePhotonVector(i)); }
const std::vector< float > & PromptPhotonVector() const
const std::vector< float > & LatePhotonVector() const
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited
float opdet::SimPhotonCounter::Wavelength ( const sim::OnePhoton ph)
private

Definition at line 46 of file SimPhotonCounter.cxx.

References sim::OnePhoton::Energy.

Referenced by AddOnePhoton().

47 {
48  if(ph.Energy < std::numeric_limits<float>::epsilon())
49  throw std::runtime_error("ERROR in SimPhotonCounter: photon energy is zero.");
50 
51  return 0.00124 / ph.Energy;
52 }
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

float opdet::SimPhotonCounter::_max_late_time
private

Definition at line 77 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MaxLateTime(), and SetTimeRanges().

float opdet::SimPhotonCounter::_max_prompt_time
private

Definition at line 75 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MaxPromptTime(), and SetTimeRanges().

float opdet::SimPhotonCounter::_max_wavelength
private

Definition at line 81 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MaxWavelength(), and SetWavelengthRanges().

float opdet::SimPhotonCounter::_min_late_time
private

Definition at line 76 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MinLateTime(), and SetTimeRanges().

float opdet::SimPhotonCounter::_min_prompt_time
private

Definition at line 74 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MinPromptTime(), and SetTimeRanges().

float opdet::SimPhotonCounter::_min_wavelength
private

Definition at line 80 of file SimPhotonCounter.h.

Referenced by AddOnePhoton(), MinWavelength(), and SetWavelengthRanges().

std::vector<float> opdet::SimPhotonCounter::_photonVector_late
private
std::vector<float> opdet::SimPhotonCounter::_photonVector_prompt
private
std::vector<float> opdet::SimPhotonCounter::_qeVector
private
Int_t opdet::SimPhotonCounter::fCountEventAll
private

Definition at line 127 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountEventDetected
private

Definition at line 128 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetAll
private

Definition at line 122 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetDetected
private

Definition at line 123 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fCountOpDetReflDetected
private

Definition at line 124 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fdEdx
private

Definition at line 141 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

double opdet::SimPhotonCounter::fEnergy
private

Definition at line 141 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fEventID
private

Definition at line 131 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

TVector3 opdet::SimPhotonCounter::finalPhotonPosition
private

Definition at line 114 of file SimPhotonCounter_module.cc.

Referenced by analyze().

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

Definition at line 99 of file SimPhotonCounter_module.cc.

Referenced by analyze().

TTree* opdet::SimPhotonCounter::fLightAnalysisTree
private

Definition at line 139 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(), and beginJob().

bool opdet::SimPhotonCounter::fMakeDetectedPhotonsTree
private

Definition at line 103 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fMakeLightAnalysisTree
private

Definition at line 135 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fMakeOpDetEventsTree
private

Definition at line 106 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

bool opdet::SimPhotonCounter::fMakeOpDetsTree
private

Definition at line 105 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fmotherTrackID
private

Definition at line 140 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Int_t opdet::SimPhotonCounter::fOpChannel
private

Definition at line 132 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fpdg
private

Definition at line 140 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 142 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().

int opdet::SimPhotonCounter::fRun
private

Definition at line 140 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 137 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 136 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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::fstepPostPositions
private

Definition at line 144 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 146 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 143 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 145 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

Float_t opdet::SimPhotonCounter::fT0_vis
private

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

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fTrackID
private

Definition at line 140 of file SimPhotonCounter_module.cc.

Referenced by analyze(), and beginJob().

int opdet::SimPhotonCounter::fVerbosity
private

Definition at line 101 of file SimPhotonCounter_module.cc.

Referenced by analyze().

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 113 of file SimPhotonCounter_module.cc.

Referenced by analyze().

cheat::ParticleInventoryService* 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: