LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cheat::PhotonBackTracker Class Reference

#include "old.PhotonBackTracker.h"

Inheritance diagram for cheat::PhotonBackTracker:
cheat::PhotonBackTrackerService

Classes

struct  fhiclConfig
 

Public Member Functions

 PhotonBackTracker (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
 ~PhotonBackTracker ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void Rebuild (const art::Event &evt)
 
const sim::ParticleListParticleList () const
 
void SetEveIdCalculator (sim::EveIdCalculator *ec)
 
const simb::MCParticleTrackIDToParticle (int const &id) const
 
const simb::MCParticleTrackIDToMotherParticle (int const &id) const
 
std::vector< sim::SDPTrackIDToSimSDP (int const &id) const
 
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth (int const &id) const
 
const art::Ptr< simb::MCTruth > & ParticleToMCTruth (const simb::MCParticle *p) const
 
std::vector< const simb::MCParticle * > MCTruthToParticles (art::Ptr< simb::MCTruth > const &mct) const
 
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector () const
 
DEPRECATED std::vector< sim::TrackSDPOpHitToTrackID (art::Ptr< recob::OpHit > const &hit)
 
std::vector< sim::TrackSDPOpHitToTrackSDPs (art::Ptr< recob::OpHit > const &hit)
 
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIDsToOpHits (std::vector< art::Ptr< recob::OpHit >> const &allhits, std::vector< int > const &tkIDs)
 
std::vector< sim::TrackSDPOpHitToEveSDPs (art::Ptr< recob::OpHit > const &hit)
 
std::vector< sim::TrackSDPOpHitToEveID (art::Ptr< recob::OpHit > const &hit)
 
std::vector< double > SimSDPsToXYZ (std::vector< sim::SDP > const &sdps)
 
std::vector< double > OpHitToXYZ (art::Ptr< recob::OpHit > const &hit)
 
double OpHitCollectionPurity (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits)
 
double OpHitCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits)
 
double OpHitCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits, geo::View_t const &view)
 
double OpHitChargeCollectionPurity (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits)
 
double OpHitChargeCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits)
 
double OpHitChargeCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits, geo::View_t const &view)
 
std::set< int > GetSetOfEveIDs ()
 
std::set< int > GetSetOfTrackIDs ()
 
std::set< int > GetSetOfEveIDs (std::vector< art::Ptr< recob::OpHit >> const &hits)
 
std::set< int > GetSetOfTrackIDs (std::vector< art::Ptr< recob::OpHit >> const &hits)
 
const std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > & OpDetBacktrackerRecords () const
 
void ChannelToTrackSDPs (std::vector< sim::TrackSDP > &trackSDPs, int channel, const double hit_start_time, const double hit_end_time)
 
 PhotonBackTracker (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
 ~PhotonBackTracker ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void Rebuild (const art::Event &evt)
 
const sim::ParticleListParticleList () const
 
void SetEveIdCalculator (sim::EveIdCalculator *ec)
 
const simb::MCParticleTrackIDToParticle (int const &id) const
 
const simb::MCParticleTrackIDToMotherParticle (int const &id) const
 
std::vector< sim::SDPTrackIDToSimSDP (int const &id) const
 
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth (int const &id) const
 
const art::Ptr< simb::MCTruth > & ParticleToMCTruth (const simb::MCParticle *p) const
 
std::vector< const simb::MCParticle * > MCTruthToParticles (art::Ptr< simb::MCTruth > const &mct) const
 
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector () const
 
DEPRECATED std::vector< sim::TrackSDPOpHitToTrackID (art::Ptr< recob::OpHit > const &hit)
 
std::vector< sim::TrackSDPOpHitToTrackSDPs (art::Ptr< recob::OpHit > const &hit)
 
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIDsToOpHits (std::vector< art::Ptr< recob::OpHit >> const &allhits, std::vector< int > const &tkIDs)
 
std::vector< sim::TrackSDPOpHitToEveSDPs (art::Ptr< recob::OpHit > const &hit)
 
std::vector< sim::TrackSDPOpHitToEveID (art::Ptr< recob::OpHit > const &hit)
 
std::vector< double > SimSDPsToXYZ (std::vector< sim::SDP > const &sdps)
 
std::vector< double > OpHitToXYZ (art::Ptr< recob::OpHit > const &hit)
 
double OpHitCollectionPurity (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits)
 
double OpHitCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits)
 
double OpHitCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits, geo::View_t const &view)
 
double OpHitChargeCollectionPurity (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits)
 
double OpHitChargeCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits)
 
double OpHitChargeCollectionEfficiency (std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit >> const &hits, std::vector< art::Ptr< recob::OpHit >> const &allhits, geo::View_t const &view)
 
std::set< int > GetSetOfEveIDs ()
 
std::set< int > GetSetOfTrackIDs ()
 
std::set< int > GetSetOfEveIDs (std::vector< art::Ptr< recob::OpHit >> const &hits)
 
std::set< int > GetSetOfTrackIDs (std::vector< art::Ptr< recob::OpHit >> const &hits)
 
const std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > & OpDetBacktrackerRecords () const
 
void ChannelToTrackSDPs (std::vector< sim::TrackSDP > &trackSDPs, int channel, const double hit_start_time, const double hit_end_time)
 
 PhotonBackTracker (fhiclConfig const &config, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom)
 
 PhotonBackTracker (fhicl::ParameterSet const &pSet, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom)
 
 PhotonBackTracker (PhotonBackTracker const &)=delete
 
template<typename Evt >
void PrepEvent (Evt const &evt)
 
template<typename Evt >
const bool CanRun (Evt const &evt)
 
template<typename Evt >
void PrepOpDetBTRs (Evt const &evt)
 
template<typename Evt >
void PrepOpFlashToOpHits (Evt const &evt)
 
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps (art::Ptr< recob::OpFlash > &flash_P) const
 
const std::vector< double > OpFlashToXYZ (art::Ptr< recob::OpFlash > &flash_P) const
 
const std::set< int > OpFlashToTrackIds (art::Ptr< recob::OpFlash > &flash_P) const
 
const double GetDelay ()
 
void ClearEvent ()
 
const bool BTRsReady ()
 
const bool OpFlashToOpHitsReady ()
 
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > const & OpDetBTRs ()
 
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps (int const &id)
 
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps (int const &id, geo::View_t const &view)
 
const art::Ptr< sim::OpDetBacktrackerRecordFindOpDetBTR (int const &opDetNum) const
 
const std::vector< sim::TrackSDPOpDetToTrackSDPs (int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time) const
 
const std::vector< sim::TrackSDPOpHitToTrackSDPs (art::Ptr< recob::OpHit > const &opHit_P) const
 
const std::vector< sim::TrackSDPOpHitToTrackSDPs (recob::OpHit const &opHit) const
 
const std::vector< int > OpHitToTrackIds (recob::OpHit const &opHit) const
 
const std::vector< int > OpHitToTrackIds (art::Ptr< recob::OpHit > const &opHit) const
 
const std::vector< int > OpHitToEveTrackIds (recob::OpHit const &opHit)
 
const std::vector< int > OpHitToEveTrackIds (art::Ptr< recob::OpHit > const &opHit_P)
 
const std::vector< sim::TrackSDPOpHitToEveTrackSDPs (art::Ptr< recob::OpHit > const &opHit_P) const
 
const std::vector< sim::TrackSDPOpHitToEveTrackSDPs (recob::OpHit const &opHit) const
 
const std::vector< art::Ptr< recob::OpHit > > TrackIdToOpHits_Ps (int const &tkId, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
 
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIdsToOpHits_Ps (std::vector< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
 
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps (recob::OpHit const &opHit) const
 
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps (art::Ptr< recob::OpHit > const &opHit_P) const
 
const std::vector< const sim::SDP * > OpHitsToSimSDPs_Ps (std::vector< art::Ptr< recob::OpHit >> const &opHits_Ps) const
 
const std::vector< double > SimSDPsToXYZ (std::vector< sim::SDP > const &sdps) const &
 
const std::vector< double > SimSDPsToXYZ (std::vector< const sim::SDP * > const &sdps_Ps) const &
 
const std::vector< double > OpHitToXYZ (art::Ptr< recob::OpHit > const &opHit)
 
const std::vector< double > OpHitToXYZ (recob::OpHit const &opHit)
 
const std::vector< double > OpHitsToXYZ (std::vector< art::Ptr< recob::OpHit >> const &opHits_Ps) const
 
const std::unordered_set< const sim::SDP * > OpHitToEveSimSDPs_Ps (recob::OpHit const &opHit)
 
const std::unordered_set< const sim::SDP * > OpHitToEveSimSDPs_Ps (art::Ptr< recob::OpHit > &opHit_P)
 
const std::set< int > GetSetOfEveIds () const
 
const std::set< int > GetSetOfTrackIds () const
 
const std::set< int > GetSetOfEveIds (std::vector< art::Ptr< recob::OpHit >> const &opHits) const
 
const std::set< int > GetSetOfEveIds (std::vector< recob::OpHit > const &opHits) const
 
const std::set< int > GetSetOfTrackIds (std::vector< art::Ptr< recob::OpHit >> const &opHits) const
 
const std::set< int > GetSetOfTrackIds (std::vector< recob::OpHit > const &opHits) const
 
const double OpHitCollectionPurity (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits)
 
const double OpHitLightCollectionPurity (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits)
 
const double OpHitCollectionEfficiency (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits, std::vector< art::Ptr< recob::OpHit >> const &opHitsIn)
 
const double OpHitCollectionEfficiency (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits, std::vector< art::Ptr< recob::OpHit >> const &opHitsIn, geo::View_t const &view)
 
const double OpHitLightCollectionEfficiency (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits, std::vector< art::Ptr< recob::OpHit >> const &opHitsIn)
 
const double OpHitLightCollectionEfficiency (std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &opHits, std::vector< art::Ptr< recob::OpHit >> const &opHitsIn, geo::View_t const &view)
 
void OpHitToSDPs (recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
 
DEPRECATED void OpHitToSimSDPs (recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
 
void OpHitToSDPs (art::Ptr< recob::OpHit > const &hit, std::vector< sim::SDP > &sdps) const
 
DEPRECATED void OpHitToSimSDPs (art::Ptr< recob::OpHit > const &hit, std::vector< sim::SDP > &sdps) const
 
void OpHitToSDPs (recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
 
DEPRECATED void OpHitToSimSDPs (recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
 
void OpHitToSDPs (art::Ptr< recob::OpHit > const &hit, std::vector< sim::SDP > &sdps) const
 
DEPRECATED void OpHitToSimSDPs (art::Ptr< recob::OpHit > const &hit, std::vector< sim::SDP > &sdps) const
 

Private Member Functions

const art::Ptr< sim::OpDetBacktrackerRecordFindOpDetBacktrackerRecord (int channel) const
 
const void shouldThisFail () const
 
const art::Ptr< sim::OpDetBacktrackerRecordFindOpDetBacktrackerRecord (int channel) const
 
const void shouldThisFail () const
 

Private Attributes

geo::GeometryCore const * geom = lar::providerFrom<geo::Geometry>()
 
bool have_complained
 
sim::ParticleList fParticleList
 ParticleList to map track ID to sim::Particle. More...
 
sim::LArVoxelList fVoxelList
 
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
 all the MCTruths for the event More...
 
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
 all the OpDetBacktrackerRecords for the event More...
 
std::map< int, int > fTrackIDToMCTruthIndex
 map of track ids to MCTruthList entry More...
 
std::string fG4ModuleLabel
 label for geant4 module More...
 
double fMinOpHitEnergyFraction
 minimum fraction of energy a track id has to More...
 
double fDelay
 
const cheat::ParticleInventoryfPartInv
 
const geo::GeometryCorefGeom
 
const double fDelay
 
const art::InputTag fG4ModuleLabel
 
const std::vector< art::InputTagfG4ModuleLabels
 
const art::InputTag fOpHitLabel
 
const art::InputTag fOpFlashLabel
 
const double fMinOpHitEnergyFraction
 
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
 
std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< recob::OpHit > > > priv_OpFlashToOpHits
 

Detailed Description

Definition at line 43 of file old.PhotonBackTracker.h.

Constructor & Destructor Documentation

cheat::PhotonBackTracker::PhotonBackTracker ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)
cheat::PhotonBackTracker::~PhotonBackTracker ( )
cheat::PhotonBackTracker::PhotonBackTracker ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)
cheat::PhotonBackTracker::~PhotonBackTracker ( )
cheat::PhotonBackTracker::PhotonBackTracker ( fhiclConfig const &  config,
const cheat::ParticleInventory partInv,
const geo::GeometryCore geom 
)

Definition at line 35 of file PhotonBackTracker.cc.

39  : fPartInv(partInv)
40  , fGeom(geom)
41  ,
42  // fDetClocks (detClock),
43  fDelay(config.Delay())
44  , fG4ModuleLabel(config.G4ModuleLabel())
45  , fG4ModuleLabels(config.G4ModuleLabels())
46  , fOpHitLabel(config.OpHitLabel())
47  , fOpFlashLabel(config.OpFlashLabel())
48  ,
49  //fWavLabel(config.WavLabel()),
50  fMinOpHitEnergyFraction(config.MinOpHitEnergyFraction())
51  {}
std::string fG4ModuleLabel
label for geant4 module
const cheat::ParticleInventory * fPartInv
const geo::GeometryCore * fGeom
const art::InputTag fOpFlashLabel
const std::vector< art::InputTag > fG4ModuleLabels
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
const art::InputTag fOpHitLabel
cheat::PhotonBackTracker::PhotonBackTracker ( fhicl::ParameterSet const &  pSet,
const cheat::ParticleInventory partInv,
const geo::GeometryCore geom 
)

Definition at line 54 of file PhotonBackTracker.cc.

References fMinOpHitEnergyFraction, fOpFlashLabel, and fOpHitLabel.

58  : fPartInv(partInv)
59  , fGeom(geom)
60  ,
61  // fDetClocks(detClock),
62  fDelay(pSet.get<double>("Delay"))
63  , fG4ModuleLabel(pSet.get<art::InputTag>("G4ModuleLabel", "largeant"))
64  , fG4ModuleLabels(pSet.get<std::vector<art::InputTag>>("G4ModuleLabels", {}))
65  , fOpHitLabel(pSet.get<art::InputTag>("OpHitLabel", "ophit"))
66  , fOpFlashLabel(pSet.get<art::InputTag>("OpFlashLabel", "opflash"))
67  , fMinOpHitEnergyFraction(pSet.get<double>("MinimumOpHitEnergyFraction", 0.1))
68  {}
std::string fG4ModuleLabel
label for geant4 module
const cheat::ParticleInventory * fPartInv
const geo::GeometryCore * fGeom
const art::InputTag fOpFlashLabel
const std::vector< art::InputTag > fG4ModuleLabels
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
const art::InputTag fOpHitLabel
cheat::PhotonBackTracker::PhotonBackTracker ( PhotonBackTracker const &  )
delete

Member Function Documentation

const bool cheat::PhotonBackTracker::BTRsReady ( )

Definition at line 84 of file PhotonBackTracker.cc.

References priv_OpDetBTRs.

85  {
86  return !(priv_OpDetBTRs.empty());
87  }
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
template<typename Evt >
const bool cheat::PhotonBackTracker::CanRun ( Evt const &  evt)
void cheat::PhotonBackTracker::ChannelToTrackSDPs ( std::vector< sim::TrackSDP > &  trackSDPs,
int  channel,
const double  hit_start_time,
const double  hit_end_time 
)
void cheat::PhotonBackTracker::ChannelToTrackSDPs ( std::vector< sim::TrackSDP > &  trackSDPs,
int  channel,
const double  hit_start_time,
const double  hit_end_time 
)

Definition at line 660 of file old.PhotonBackTracker_service.cc.

References e, sim::TrackSDP::energy, energy, sim::TrackSDP::energyFrac, FindOpDetBacktrackerRecord(), geom, sim::NoParticleId, geo::GeometryCore::OpDetFromOpChannel(), shouldThisFail(), sim::TrackSDP::trackID, and sim::OpDetBacktrackerRecord::TrackIDsAndEnergies().

Referenced by GetSetOfTrackIDs(), OpDetBacktrackerRecords(), OpHitToTrackSDPs(), and TrackIDsToOpHits().

664  {
665  shouldThisFail();
666  trackSDPs.clear();
667 
668  double totalE = 0.;
669 
670  try {
673 
674  // loop over the photons in the channel and grab those that are in time
675  // with the identified opHit start and stop times
676  //const detinfo::DetectorClocks* ts = lar::providerFrom<detinfo::DetectorClocksService>();
677  //int start_tdc = ts->OpticalG4Time2TDC( opHit_start_time );
678  //int end_tdc = ts->OpticalG4Time2TDC( opHit_end_time );
679  // if(start_tdc<0) start_tdc = 0;
680  // if(end_tdc<0) end_tdc = 0;
681  std::vector<sim::SDP> simSDPs =
682  schannel->TrackIDsAndEnergies(opHit_start_time, opHit_end_time);
683 
684  // first get the total energy represented by all track ids for
685  // this channel and range of tdc values
686  for (size_t e = 0; e < simSDPs.size(); ++e)
687  totalE += simSDPs[e].energy;
688 
689  // protect against a divide by zero below
690  if (totalE < 1.e-5) totalE = 1.;
691 
692  // loop over the entries in the map and fill the input vectors
693 
694  for (size_t e = 0; e < simSDPs.size(); ++e) {
695 
696  if (simSDPs[e].trackID == sim::NoParticleId) continue;
697 
698  sim::TrackSDP info;
699  info.trackID = simSDPs[e].trackID;
700  info.energyFrac = simSDPs[e].energy / totalE;
701  info.energy = simSDPs[e].energy;
702 
703  trackSDPs.push_back(info);
704  }
705  } // end try
706  catch (cet::exception e) {
707  mf::LogWarning("PhotonBackTracker") << "caught exception \n" << e;
708  }
709 
710  return;
711  }
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
int trackID
Geant4 supplied trackID.
static const int NoParticleId
Definition: sim.h:21
float energyFrac
fraction of OpHit energy from the particle with this trackID
double energy
Definition: plottest35.C:25
Ionization photons from a Geant4 track.
const art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBacktrackerRecord(int channel) const
geo::GeometryCore const * geom
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< sim::SDP > TrackIDsAndEnergies(timePDclock_t startTimePDclock, timePDclock_t endTimePDclock) const
Return all the recorded energy deposition within a time interval.
float energy
energy from the particle with this trackID [MeV]
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void cheat::PhotonBackTracker::ClearEvent ( )

Definition at line 77 of file PhotonBackTracker.cc.

References priv_OpDetBTRs, and priv_OpFlashToOpHits.

Referenced by cheat::PhotonBackTrackerService::priv_PrepEvent().

78  {
79  priv_OpDetBTRs.clear();
80  priv_OpFlashToOpHits.clear();
81  }
std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< recob::OpHit > > > priv_OpFlashToOpHits
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
const art::Ptr<sim::OpDetBacktrackerRecord> cheat::PhotonBackTracker::FindOpDetBacktrackerRecord ( int  channel) const
private
const art::Ptr< sim::OpDetBacktrackerRecord > cheat::PhotonBackTracker::FindOpDetBacktrackerRecord ( int  channel) const
private

Definition at line 639 of file old.PhotonBackTracker_service.cc.

References cOpDetBacktrackerRecords, sc, and shouldThisFail().

Referenced by ChannelToTrackSDPs(), OpDetBacktrackerRecords(), and OpHitToSDPs().

641  {
642  shouldThisFail();
644 
645  for (size_t sc = 0; sc < cOpDetBacktrackerRecords.size(); ++sc) {
646  //This could become a bug. What if it occurs twice (shouldn't happen in correct recorts, but still, no error handeling included for the situation
647  if (cOpDetBacktrackerRecords[sc]->OpDetNum() == opDetNum)
648  opDet = cOpDetBacktrackerRecords[sc];
649  }
650 
651  if (!opDet) {
652  throw cet::exception("PhotonBackTracker2") << "No sim::OpDetBacktrackerRecord corresponding "
653  << "to opDetNum: " << opDetNum << "\n";
654  }
655 
656  return opDet;
657  }
Float_t sc
Definition: plot.C:23
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
all the OpDetBacktrackerRecords for the event
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const art::Ptr< sim::OpDetBacktrackerRecord > cheat::PhotonBackTracker::FindOpDetBTR ( int const &  opDetNum) const

Definition at line 128 of file PhotonBackTracker.cc.

References priv_OpDetBTRs, and sc.

Referenced by cheat::PhotonBackTrackerService::FindOpDetBTR(), OpDetToTrackSDPs(), and OpHitToSimSDPs_Ps().

130  {
132  for (size_t sc = 0; sc < priv_OpDetBTRs.size(); ++sc) {
133  //This could become a bug. What if it occurs twice (shouldn't happen in correct records, but still, no error handeling included for the situation
134  if (priv_OpDetBTRs.at(sc)->OpDetNum() == opDetNum) opDet = priv_OpDetBTRs.at(sc);
135  }
136  if (!opDet) {
137  throw cet::exception("PhotonBackTracker2") << "No sim:: OpDetBacktrackerRecord corresponding "
138  << "to opDetNum: " << opDetNum << "\n";
139  }
140  return opDet;
141  }
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
Float_t sc
Definition: plot.C:23
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const double cheat::PhotonBackTracker::GetDelay ( )

Definition at line 71 of file PhotonBackTracker.cc.

References fDelay.

Referenced by cheat::PhotonBackTrackerService::GetDelay().

72  {
73  return this->fDelay;
74  }
std::set< int > cheat::PhotonBackTracker::GetSetOfEveIDs ( )

Definition at line 371 of file old.PhotonBackTracker_service.cc.

References sim::ParticleList::begin(), sim::ParticleList::end(), sim::ParticleList::EveId(), fParticleList, and shouldThisFail().

Referenced by OpHitToSimSDPs().

372  {
373  shouldThisFail();
374  std::set<int> eveIDs;
375 
377  while (plitr != fParticleList.end()) {
378  int eveID = fParticleList.EveId((*plitr).first);
379  // look to see if this eveID is already in the set
380  if (eveIDs.find(eveID) == eveIDs.end()) eveIDs.insert(eveID);
381  plitr++;
382  }
383 
384  return eveIDs;
385  }
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
int EveId(const int trackID) const
iterator begin()
Definition: ParticleList.h:305
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
std::set<int> cheat::PhotonBackTracker::GetSetOfEveIDs ( )
std::set<int> cheat::PhotonBackTracker::GetSetOfEveIDs ( std::vector< art::Ptr< recob::OpHit >> const &  hits)
std::set< int > cheat::PhotonBackTracker::GetSetOfEveIDs ( std::vector< art::Ptr< recob::OpHit >> const &  hits)

Definition at line 400 of file old.PhotonBackTracker_service.cc.

References OpHitToEveID(), and shouldThisFail().

401  {
402  shouldThisFail();
403  std::set<int> eveIDs;
404 
405  std::vector<art::Ptr<recob::OpHit>>::const_iterator itr = opHits.begin();
406  while (itr != opHits.end()) {
407 
408  // get the eve ids corresponding to this opHit
409  const std::vector<sim::TrackSDP> sdps = OpHitToEveID(*itr);
410 
411  // loop over the sdps and extract the track ids
412  for (size_t i = 0; i < sdps.size(); ++i)
413  eveIDs.insert(sdps[i].trackID);
414 
415  itr++;
416  }
417 
418  return eveIDs;
419  }
std::vector< sim::TrackSDP > OpHitToEveID(art::Ptr< recob::OpHit > const &hit)
const std::set< int > cheat::PhotonBackTracker::GetSetOfEveIds ( ) const

Definition at line 508 of file PhotonBackTracker.cc.

References fPartInv, and cheat::ParticleInventory::GetSetOfEveIds().

Referenced by cheat::PhotonBackTrackerService::GetSetOfEveIds().

509  {
510  //std::set<int> out = fPartInv->GetSetOfEveIds();
511  return fPartInv->GetSetOfEveIds();
512  //return out;
513  }
const cheat::ParticleInventory * fPartInv
std::set< int > GetSetOfEveIds() const
const std::set< int > cheat::PhotonBackTracker::GetSetOfEveIds ( std::vector< art::Ptr< recob::OpHit >> const &  opHits) const

Definition at line 522 of file PhotonBackTracker.cc.

References OpHitToEveTrackSDPs().

524  {
525  std::set<int> eveIds;
526  for (auto const& opHit_P : opHits_Ps) {
527  const std::vector<sim::TrackSDP> sdps = this->OpHitToEveTrackSDPs(opHit_P);
528  for (auto const& sdp : sdps) {
529  eveIds.insert(sdp.trackID);
530  } //end sdps
531  } //End for hits
532  return eveIds;
533  }
const std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P) const
const std::set< int > cheat::PhotonBackTracker::GetSetOfEveIds ( std::vector< recob::OpHit > const &  opHits) const

Definition at line 536 of file PhotonBackTracker.cc.

References OpHitToEveTrackSDPs().

538  { /*NEW*/ /*COMPLETE*/
539  std::set<int> eveIds;
540  for (auto const& opHit : opHits) {
541  const std::vector<sim::TrackSDP> sdps = this->OpHitToEveTrackSDPs(opHit);
542  for (auto const& sdp : sdps) {
543  eveIds.insert(sdp.trackID);
544  } //end sdps
545  } //End for hits
546  return eveIds;
547  }
const std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P) const
std::set<int> cheat::PhotonBackTracker::GetSetOfTrackIDs ( )
std::set< int > cheat::PhotonBackTracker::GetSetOfTrackIDs ( )

Definition at line 388 of file old.PhotonBackTracker_service.cc.

References fParticleList, and shouldThisFail().

Referenced by OpHitToSimSDPs(), and Rebuild().

389  {
390  shouldThisFail();
391  // fParticleList::value_type is a pair (track, particle pointer)
392  std::set<int> trackIDs;
394  trackIDs.insert(pl.first);
395 
396  return trackIDs;
397  }
list_type::value_type value_type
Definition: ParticleList.h:130
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
std::set< int > cheat::PhotonBackTracker::GetSetOfTrackIDs ( std::vector< art::Ptr< recob::OpHit >> const &  hits)

Definition at line 422 of file old.PhotonBackTracker_service.cc.

References ChannelToTrackSDPs(), util::end(), fDelay, and shouldThisFail().

424  {
425  shouldThisFail();
426  std::set<int> trackIDs;
427 
428  std::vector<art::Ptr<recob::OpHit>>::const_iterator itr = opHits.begin();
429  while (itr != opHits.end()) {
430 
431  std::vector<sim::TrackSDP> trackSDPs;
432 
433  // get the track ids corresponding to this opHit
434  const double pTime = (*itr)->PeakTime();
435  const double pWidth = (*itr)->Width();
436  const double start = (pTime - pWidth) * 1000.0 - fDelay;
437  const double end = (pTime + pWidth) * 1000.0 - fDelay;
438  // const double start = (*itr)->PeakTimeMinusRMS();
439  // const double end = (*itr)->PeakTimePlusRMS();
440 
441  this->ChannelToTrackSDPs(trackSDPs, (*itr)->OpChannel(), start, end);
442 
443  // loop over the sdps and extract the track ids
444  for (size_t i = 0; i < trackSDPs.size(); ++i) {
445  trackIDs.insert(trackSDPs[i].trackID);
446  }
447 
448  itr++;
449  }
450 
451  return trackIDs;
452  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
void ChannelToTrackSDPs(std::vector< sim::TrackSDP > &trackSDPs, int channel, const double hit_start_time, const double hit_end_time)
std::set<int> cheat::PhotonBackTracker::GetSetOfTrackIDs ( std::vector< art::Ptr< recob::OpHit >> const &  hits)
const std::set< int > cheat::PhotonBackTracker::GetSetOfTrackIds ( ) const

Definition at line 516 of file PhotonBackTracker.cc.

References fPartInv, and cheat::ParticleInventory::GetSetOfTrackIds().

Referenced by cheat::PhotonBackTrackerService::GetSetOfTrackIds().

517  {
518  return fPartInv->GetSetOfTrackIds();
519  }
const cheat::ParticleInventory * fPartInv
std::set< int > GetSetOfTrackIds() const
const std::set< int > cheat::PhotonBackTracker::GetSetOfTrackIds ( std::vector< art::Ptr< recob::OpHit >> const &  opHits) const

Definition at line 550 of file PhotonBackTracker.cc.

References OpHitToTrackSDPs().

552  {
553  std::set<int> tids;
554  for (auto const& opHit : opHits) {
555  for (auto const& sdp : this->OpHitToTrackSDPs(opHit)) {
556  tids.insert(sdp.trackID);
557  } //End for TrackSDPs
558  } //End for hits
559  return tids;
560  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
const std::set< int > cheat::PhotonBackTracker::GetSetOfTrackIds ( std::vector< recob::OpHit > const &  opHits) const

Definition at line 563 of file PhotonBackTracker.cc.

References OpHitToTrackSDPs().

565  { /*NEW*/ /*COMPLETE*/
566  std::set<int> tids;
567  for (auto const& opHit : opHits) {
568  for (auto const& sdp : this->OpHitToTrackSDPs(opHit)) {
569  tids.insert(sdp.trackID);
570  } //End for TrackSDPs
571  } //End for hits
572  return tids;
573  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
std::vector<const simb::MCParticle*> cheat::PhotonBackTracker::MCTruthToParticles ( art::Ptr< simb::MCTruth > const &  mct) const
std::vector< const simb::MCParticle * > cheat::PhotonBackTracker::MCTruthToParticles ( art::Ptr< simb::MCTruth > const &  mct) const

Definition at line 256 of file old.PhotonBackTracker_service.cc.

References fParticleList, shouldThisFail(), and TrackIDToMCTruth().

Referenced by SetEveIdCalculator().

258  {
259  shouldThisFail();
260  std::vector<const simb::MCParticle*> ret;
261 
262  // sim::ParticleList::value_type is a pair (track ID, particle pointer)
263  for (const sim::ParticleList::value_type& TrackIDpair : fParticleList) {
264  if (TrackIDToMCTruth(TrackIDpair.first) == mct) ret.push_back(TrackIDpair.second);
265  }
266 
267  return ret;
268  }
list_type::value_type value_type
Definition: ParticleList.h:130
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth(int const &id) const
const std::vector<art::Ptr<simb::MCTruth> >& cheat::PhotonBackTracker::MCTruthVector ( ) const
inline

Definition at line 77 of file old.PhotonBackTracker.h.

References fMCTruthList.

77 { return fMCTruthList; }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
all the MCTruths for the event
const std::vector<art::Ptr<simb::MCTruth> >& cheat::PhotonBackTracker::MCTruthVector ( ) const
inline

Definition at line 77 of file old.PhotonBackTrackerService.h.

References fMCTruthList.

77 { return fMCTruthList; }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
all the MCTruths for the event
const std::vector<art::Ptr<sim::OpDetBacktrackerRecord> >& cheat::PhotonBackTracker::OpDetBacktrackerRecords ( ) const
inline

Definition at line 169 of file old.PhotonBackTrackerService.h.

References ChannelToTrackSDPs(), cOpDetBacktrackerRecords, DECLARE_ART_SERVICE, fDelay, fG4ModuleLabel, FindOpDetBacktrackerRecord(), fMCTruthList, fMinOpHitEnergyFraction, fParticleList, fTrackIDToMCTruthIndex, fVoxelList, geom, have_complained, and shouldThisFail().

170  {
172  }
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
all the OpDetBacktrackerRecords for the event
const std::vector<art::Ptr<sim::OpDetBacktrackerRecord> >& cheat::PhotonBackTracker::OpDetBacktrackerRecords ( ) const
inline

Definition at line 169 of file old.PhotonBackTracker.h.

References ChannelToTrackSDPs(), and cOpDetBacktrackerRecords.

170  {
172  }
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
all the OpDetBacktrackerRecords for the event
const std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > & cheat::PhotonBackTracker::OpDetBTRs ( )

Definition at line 96 of file PhotonBackTracker.cc.

References priv_OpDetBTRs.

Referenced by cheat::PhotonBackTrackerService::OpDetBTRs().

97  {
98  return priv_OpDetBTRs;
99  }
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
const std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpDetToTrackSDPs ( int const &  OpDetNum,
double const &  opHit_start_time,
double const &  opHit_end_time 
) const

Definition at line 144 of file PhotonBackTracker.cc.

References util::abs(), e, energy, sim::TrackSDP::energy, sim::TrackSDP::energyFrac, FindOpDetBTR(), sim::NoParticleId, sim::TrackSDP::trackID, and sim::OpDetBacktrackerRecord::TrackIDsAndEnergies().

Referenced by cheat::PhotonBackTrackerService::OpDetToTrackSDPs(), OpHitToTrackSDPs(), and TrackIdsToOpHits_Ps().

148  {
149  std::vector<sim::TrackSDP> tSDPs;
150  double totalE = 0;
151  try {
152  const art::Ptr<sim::OpDetBacktrackerRecord> opDetBTR = this->FindOpDetBTR(OpDetNum);
153  // ( fGeom->OpDetFromOpChannel(channel) );
154  std::vector<sim::SDP> simSDPs =
155  opDetBTR->TrackIDsAndEnergies(opHit_start_time, opHit_end_time);
156  for (size_t e = 0; e < simSDPs.size(); ++e)
157  totalE += simSDPs[e].energy;
158  if (totalE < 1.e-5) totalE = 1.;
159  for (size_t e = 0; e < simSDPs.size(); ++e) {
160  if (simSDPs[e].trackID == sim::NoParticleId) continue;
161  sim::TrackSDP info;
162  info.trackID = std::abs(simSDPs[e].trackID);
163  info.energyFrac = simSDPs[e].energy / totalE;
164  info.energy = simSDPs[e].energy;
165  tSDPs.push_back(info);
166  }
167  }
168  catch (
169  cet::exception const&
170  e) { //This needs to go. Make it specific if there is a really an exception we would like to catch.
171  mf::LogWarning("PhotonBackTracker") << "Exception caught\n" << e;
172  }
173  return tSDPs;
174  }
const art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const &opDetNum) const
constexpr auto abs(T v)
Returns the absolute value of the argument.
int trackID
Geant4 supplied trackID.
static const int NoParticleId
Definition: sim.h:21
float energyFrac
fraction of OpHit energy from the particle with this trackID
double energy
Definition: plottest35.C:25
Ionization photons from a Geant4 track.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< sim::SDP > TrackIDsAndEnergies(timePDclock_t startTimePDclock, timePDclock_t endTimePDclock) const
Return all the recorded energy deposition within a time interval.
float energy
energy from the particle with this trackID [MeV]
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::vector< art::Ptr< recob::OpHit > > cheat::PhotonBackTracker::OpFlashToOpHits_Ps ( art::Ptr< recob::OpFlash > &  flash_P) const

Definition at line 748 of file PhotonBackTracker.cc.

References priv_OpFlashToOpHits.

Referenced by cheat::PhotonBackTrackerService::OpFlashToOpHits_Ps(), OpFlashToTrackIds(), and OpFlashToXYZ().

751  { //There is not "non-pointer" version of this because the art::Ptr is needed to look up the assn. One could loop the Ptrs and dereference them, but I will not encourage the behavior by building the tool to do it.
752  //
753  std::vector<art::Ptr<recob::OpHit>> const& hits_Ps = priv_OpFlashToOpHits.at(flash_P);
754  return hits_Ps;
755  }
std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< recob::OpHit > > > priv_OpFlashToOpHits
const bool cheat::PhotonBackTracker::OpFlashToOpHitsReady ( )

Definition at line 90 of file PhotonBackTracker.cc.

References priv_OpFlashToOpHits.

91  {
92  return !(priv_OpFlashToOpHits.empty());
93  }
std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< recob::OpHit > > > priv_OpFlashToOpHits
const std::set< int > cheat::PhotonBackTracker::OpFlashToTrackIds ( art::Ptr< recob::OpFlash > &  flash_P) const

Definition at line 767 of file PhotonBackTracker.cc.

References OpFlashToOpHits_Ps(), and OpHitToTrackIds().

Referenced by cheat::PhotonBackTrackerService::OpFlashToTrackIds().

768  {
769  std::vector<art::Ptr<recob::OpHit>> opHits_Ps = this->OpFlashToOpHits_Ps(flash_P);
770  std::set<int> ids;
771  for (auto& opHit_P : opHits_Ps) {
772  for (const int& id : this->OpHitToTrackIds(opHit_P)) {
773  ids.insert(id);
774  } // end for ids
775  } // end for opHits
776  // std::set<int> ids;
777  return ids;
778  } // end OpFlashToTrackIds
const std::vector< int > OpHitToTrackIds(recob::OpHit const &opHit) const
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P) const
const std::vector< double > cheat::PhotonBackTracker::OpFlashToXYZ ( art::Ptr< recob::OpFlash > &  flash_P) const

Definition at line 758 of file PhotonBackTracker.cc.

References OpFlashToOpHits_Ps(), and OpHitsToXYZ().

Referenced by cheat::PhotonBackTrackerService::OpFlashToXYZ().

759  {
760  const std::vector<art::Ptr<recob::OpHit>> opHits_Ps = this->OpFlashToOpHits_Ps(flash_P);
761  const std::vector<double> retVec = this->OpHitsToXYZ(opHits_Ps);
762  //const std::vector<double> retVec(0.0,3);
763  return retVec;
764  }
const std::vector< double > OpHitsToXYZ(std::vector< art::Ptr< recob::OpHit >> const &opHits_Ps) const
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P) const
double cheat::PhotonBackTracker::OpHitChargeCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits 
)

Definition at line 575 of file old.PhotonBackTracker_service.cc.

References recob::OpHit::Area(), e, fMinOpHitEnergyFraction, OpHitToTrackSDPs(), and shouldThisFail().

Referenced by OpHitToSimSDPs().

579  {
580  shouldThisFail();
581  // get the list of EveIDs that correspond to the opHits in this collection
582  // and the energy associated with the desired trackID
583  float desired = 0.;
584  float total = 0.;
585 
586  // don't have to check the view in the opHits collection because
587  // those are assumed to be from the object we are testing and will
588  // the correct view by definition then.
589  for (size_t h = 0; h < opHits.size(); ++h) {
590 
591  art::Ptr<recob::OpHit> opHit = opHits[h];
592  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
593 
594  // don't worry about opHits where the energy fraction for the chosen
595  // trackID is < 0.1
596  // also don't double count if this opHit has more than one of the
597  // desired track IDs associated with it
598  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
599  if (trackIDs.find(opHitTrackIDs[e].trackID) != trackIDs.end() &&
600  opHitTrackIDs[e].energyFrac >= fMinOpHitEnergyFraction) {
601  desired += opHit->Area();
602  break;
603  }
604  }
605  } // end loop over opHits
606 
607  // now figure out how many opHits in the whole collection are associated with this id
608  for (size_t h = 0; h < allOpHits.size(); ++h) {
609 
610  art::Ptr<recob::OpHit> opHit = allOpHits[h];
611 
612  // check that we are looking at the appropriate view here
613  // in the case of 3D objects we take all opHits
614  //if(opHit->View() != view && view != geo::k3D ) continue;
615 
616  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
617 
618  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
619  // don't worry about opHits where the energy fraction for the chosen
620  // trackID is < 0.1
621  // also don't double count if this opHit has more than one of the
622  // desired track IDs associated with it
623  if (trackIDs.find(opHitTrackIDs[e].trackID) != trackIDs.end() &&
624  opHitTrackIDs[e].energyFrac >= fMinOpHitEnergyFraction) {
625  total += opHit->Area();
626  break;
627  }
628  }
629 
630  } // end loop over all opHits
631 
632  double efficiency = 0.;
633  if (total > 0.) efficiency = desired / total;
634 
635  return efficiency;
636  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
double Area() const
Definition: OpHit.h:114
Float_t e
Definition: plot.C:35
double cheat::PhotonBackTracker::OpHitChargeCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits 
)
double cheat::PhotonBackTracker::OpHitChargeCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits,
geo::View_t const &  view 
)
double cheat::PhotonBackTracker::OpHitChargeCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits,
geo::View_t const &  view 
)

Definition at line 566 of file old.PhotonBackTracker_service.cc.

571  {
572  throw cet::exception("PhotonBackTracker")
573  << "This function is not supported. OpHits do not have type View.\n";
574  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double cheat::PhotonBackTracker::OpHitChargeCollectionPurity ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits 
)

Definition at line 482 of file old.PhotonBackTracker_service.cc.

References recob::OpHit::Area(), e, OpHitToTrackSDPs(), and shouldThisFail().

Referenced by OpHitToSimSDPs().

485  {
486  shouldThisFail();
487  // get the list of EveIDs that correspond to the opHits in this collection
488  // if the EveID shows up in the input list of trackIDs, then it counts
489  float total = 0;
490  float desired = 0.;
491  // don't have to check the view in the opHits collection because
492  // those are assumed to be from the object we are testing and will
493  // the correct view by definition then.
494  for (size_t h = 0; h < opHits.size(); ++h) {
495  art::Ptr<recob::OpHit> opHit = opHits[h];
496  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
497  total += opHit->Area(); // sum up the charge in the cluster
498  // don't double count if this opHit has more than one of the
499  // desired track IDs associated with it
500  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
501  if (trackIDs.find(opHitTrackIDs[e].trackID) != trackIDs.end()) {
502  desired += opHit->Area();
503  break;
504  }
505  }
506  } // end loop over opHits
507  double purity = 0.;
508  if (total > 0) purity = desired / total;
509  return purity;
510  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double Area() const
Definition: OpHit.h:114
Float_t e
Definition: plot.C:35
double cheat::PhotonBackTracker::OpHitChargeCollectionPurity ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits 
)
double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits 
)

Definition at line 523 of file old.PhotonBackTracker_service.cc.

References e, fMinOpHitEnergyFraction, OpHitToTrackSDPs(), and shouldThisFail().

Referenced by cheat::PhotonBackTrackerService::OpHitCollectionEfficiency(), and OpHitToSimSDPs().

527  {
528  shouldThisFail();
529  float desired = 0.;
530  float total = 0.;
531  for (size_t h = 0; h < opHits.size(); ++h) {
532  art::Ptr<recob::OpHit> opHit = opHits[h];
533  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
534  // also don't double count if this opHit has more than one of the
535  // desired track IDs associated with it
536  for (size_t e = 0; e < opHitTrackSDP.size(); ++e) {
537  if (trackIDs.find(opHitTrackSDPs[e].trackID) != trackIDs.end() &&
538  opHitTrackSDPs[e].energyFrac >= fMinOpHitEnergyFraction) {
539  desired += 1.;
540  break;
541  }
542  }
543  } // end loop over opHits
544  // now figure out how many opHits in the whole collection are associated with this id
545  for (size_t h = 0; h < allOpHits.size(); ++h) {
546  art::Ptr<recob::OpHit> opHit = allOpHits[h];
547  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
548  for (size_t e = 0; e < opHitTrackSDPs.size(); ++e) {
549  // don't worry about opHits where the energy fraction for the chosen
550  // trackID is < 0.1
551  // also don't double count if this opHit has more than one of the
552  // desired track IDs associated with it
553  if (trackIDs.find(opHitTrackSDPs[e].trackID) != trackIDs.end() &&
554  opHitTrackIDs[e].energyFrac >= fMinOpHitEnergyFraction) {
555  total += 1.;
556  break;
557  }
558  }
559  } // end loop over all opHits
560  double efficiency = 0.;
561  if (total > 0.) efficiency = desired / total;
562  return efficiency;
563  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
Float_t e
Definition: plot.C:35
double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits 
)
double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits,
geo::View_t const &  view 
)

Definition at line 513 of file old.PhotonBackTracker_service.cc.

518  {
519  throw cet::exception("PhotonBackTracker")
520  << "This function is not supported. OpHits do not have type View.\n";
521  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits,
std::vector< art::Ptr< recob::OpHit >> const &  allhits,
geo::View_t const &  view 
)
const double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits,
std::vector< art::Ptr< recob::OpHit >> const &  opHitsIn 
)

Definition at line 644 of file PhotonBackTracker.cc.

References e, fMinOpHitEnergyFraction, and OpHitToTrackSDPs().

648  {
649  float desired = 0.;
650  float total = 0.;
651  for (size_t h = 0; h < opHits.size(); ++h) {
652  art::Ptr<recob::OpHit> opHit = opHits[h];
653  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
654  // also don't double count if this opHit has more than one of the
655  // desired track IDs associated with it
656  for (size_t e = 0; e < opHitTrackSDPs.size(); ++e) {
657  if (tkIds.find(opHitTrackSDPs[e].trackID) != tkIds.end() &&
658  opHitTrackSDPs[e].energyFrac >= fMinOpHitEnergyFraction) {
659  desired += 1.;
660  break;
661  }
662  }
663  } // end loop over opHits
664  // now figure out how many opHits in the whole collection are associated with this id
665  for (size_t h = 0; h < opHitsIn.size(); ++h) {
666  art::Ptr<recob::OpHit> opHit = opHitsIn[h];
667  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
668  for (size_t e = 0; e < opHitTrackSDPs.size(); ++e) {
669  // don't worry about opHits where the energy fraction for the chosen
670  // trackID is < 0.1
671  // also don't double count if this opHit has more than one of the
672  // desired track IDs associated with it
673  if (tkIds.find(opHitTrackSDPs[e].trackID) != tkIds.end() &&
674  opHitTrackSDPs[e].energyFrac >= fMinOpHitEnergyFraction) {
675  total += 1.;
676  break;
677  }
678  }
679  } // end loop over all opHits
680  double efficiency = 0.;
681  if (total > 0.) efficiency = desired / total;
682  return efficiency;
683  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
Float_t e
Definition: plot.C:35
const double cheat::PhotonBackTracker::OpHitCollectionEfficiency ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits,
std::vector< art::Ptr< recob::OpHit >> const &  opHitsIn,
geo::View_t const &  view 
)

Definition at line 633 of file PhotonBackTracker.cc.

638  {
639  throw cet::exception("PhotonBackTracker")
640  << "This function is not supported. OpHits do not have type View.\n";
641  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double cheat::PhotonBackTracker::OpHitCollectionPurity ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits 
)

Definition at line 455 of file old.PhotonBackTracker_service.cc.

References e, OpHitToTrackSDPs(), and shouldThisFail().

Referenced by cheat::PhotonBackTrackerService::OpHitCollectionPurity(), and OpHitToSimSDPs().

457  {
458  shouldThisFail();
459  // get the list of EveIDs that correspond to the opHits in this collection
460  // if the EveID shows up in the input list of trackIDs, then it counts
461  float total = 1. * opHits.size();
462  ;
463  float desired = 0.;
464  for (size_t h = 0; h < opHits.size(); ++h) {
465  art::Ptr<recob::OpHit> opHit = opHits[h];
466  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
467  // don't double count if this opHit has more than one of the
468  // desired track IDs associated with it
469  for (size_t e = 0; e < opHitTrackSDPs.size(); ++e) {
470  if (trackIds.find(opHitTrackSDPs[e].trackID) != trackIds.end()) {
471  desired += 1.;
472  break;
473  }
474  }
475  } // end loop over opHits
476  double purity = 0.;
477  if (total > 0) purity = desired / total;
478  return purity;
479  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
Float_t e
Definition: plot.C:35
double cheat::PhotonBackTracker::OpHitCollectionPurity ( std::set< int >  trackIDs,
std::vector< art::Ptr< recob::OpHit >> const &  hits 
)
const double cheat::PhotonBackTracker::OpHitCollectionPurity ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits 
)

Definition at line 576 of file PhotonBackTracker.cc.

References e, and OpHitToTrackSDPs().

579  {
580  // get the list of EveIDs that correspond to the opHits in this collection
581  // if the EveID shows up in the input list of tkIds, then it counts
582  float total = 1. * opHits.size();
583  ;
584  float desired = 0.;
585  for (size_t h = 0; h < opHits.size(); ++h) {
586  art::Ptr<recob::OpHit> opHit = opHits[h];
587  std::vector<sim::TrackSDP> opHitTrackSDPs = this->OpHitToTrackSDPs(opHit);
588  // don't double count if this opHit has more than one of the
589  // desired track IDs associated with it
590  for (size_t e = 0; e < opHitTrackSDPs.size(); ++e) {
591  if (tkIds.find(opHitTrackSDPs[e].trackID) != tkIds.end()) {
592  desired += 1.;
593  break;
594  }
595  }
596  } // end loop over opHits
597  double purity = 0.;
598  if (total > 0) purity = desired / total;
599  return purity;
600  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
Float_t e
Definition: plot.C:35
const double cheat::PhotonBackTracker::OpHitLightCollectionEfficiency ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits,
std::vector< art::Ptr< recob::OpHit >> const &  opHitsIn 
)

Definition at line 697 of file PhotonBackTracker.cc.

References recob::OpHit::Area(), e, fMinOpHitEnergyFraction, and OpHitToTrackSDPs().

Referenced by cheat::PhotonBackTrackerService::OpHitLightCollectionEfficiency().

701  {
702  float desired = 0.;
703  float total = 0.;
704 
705  // don't have to check the view in the opHits collection because
706  // those are assumed to be from the object we are testing and will
707  // the correct view by definition then.
708  for (size_t h = 0; h < opHits.size(); ++h) {
709 
710  art::Ptr<recob::OpHit> opHit = opHits[h];
711  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
712 
713  // don't worry about opHits where the energy fraction for the chosen
714  // trackID is < 0.1
715  // also don't double count if this opHit has more than one of the
716  // desired track IDs associated with it
717  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
718  if (tkIds.find(opHitTrackIDs[e].trackID) != tkIds.end() &&
719  opHitTrackIDs[e].energyFrac >= fMinOpHitEnergyFraction) {
720  desired += opHit->Area();
721  break;
722  }
723  }
724  } // end loop over opHits
725  for (size_t h = 0; h < opHitsIn.size(); ++h) {
726  art::Ptr<recob::OpHit> opHit = opHitsIn[h];
727  // check that we are looking at the appropriate view here
728  // in the case of 3D objects we take all opHits
729  //if(opHit->View() != view && view != geo::k3D ) continue;
730  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
731  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
732  // don't worry about opHits where the energy fraction for the chosen
733  // trackID is < 0.1
734  // also don't double count if this opHit has more than one of the
735  // desired track IDs associated with it
736  if (tkIds.find(opHitTrackIDs[e].trackID) != tkIds.end() &&
737  opHitTrackIDs[e].energyFrac >= fMinOpHitEnergyFraction) {
738  total += opHit->Area();
739  break;
740  }
741  }
742  } // end loop over all opHits
743  double efficiency = 0.;
744  if (total > 0.) efficiency = desired / total;
745  return efficiency;
746  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
double Area() const
Definition: OpHit.h:114
Float_t e
Definition: plot.C:35
const double cheat::PhotonBackTracker::OpHitLightCollectionEfficiency ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits,
std::vector< art::Ptr< recob::OpHit >> const &  opHitsIn,
geo::View_t const &  view 
)

Definition at line 686 of file PhotonBackTracker.cc.

691  {
692  throw cet::exception("PhotonBackTracker")
693  << "This function is not supported. OpHits do not have type View.\n";
694  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const double cheat::PhotonBackTracker::OpHitLightCollectionPurity ( std::set< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  opHits 
)

Definition at line 603 of file PhotonBackTracker.cc.

References recob::OpHit::Area(), e, and OpHitToTrackSDPs().

Referenced by cheat::PhotonBackTrackerService::OpHitLightCollectionPurity().

606  {
607  // get the list of EveIDs that correspond to the opHits in this collection
608  // if the EveID shows up in the input list of tkIds, then it counts
609  float total = 0;
610  float desired = 0.;
611  // don't have to check the view in the opHits collection because
612  // those are assumed to be from the object we are testing and will
613  // the correct view by definition then.
614  for (size_t h = 0; h < opHits.size(); ++h) {
615  art::Ptr<recob::OpHit> opHit = opHits[h];
616  std::vector<sim::TrackSDP> opHitTrackIDs = this->OpHitToTrackSDPs(opHit);
617  total += opHit->Area(); // sum up the charge in the cluster
618  // don't double count if this opHit has more than one of the
619  // desired track IDs associated with it
620  for (size_t e = 0; e < opHitTrackIDs.size(); ++e) {
621  if (tkIds.find(opHitTrackIDs[e].trackID) != tkIds.end()) {
622  desired += opHit->Area();
623  break;
624  }
625  }
626  } // end loop over opHits
627  double purity = 0.;
628  if (total > 0) purity = desired / total;
629  return purity;
630  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
double Area() const
Definition: OpHit.h:114
Float_t e
Definition: plot.C:35
const std::vector< const sim::SDP * > cheat::PhotonBackTracker::OpHitsToSimSDPs_Ps ( std::vector< art::Ptr< recob::OpHit >> const &  opHits_Ps) const

Definition at line 458 of file PhotonBackTracker.cc.

References OpHitToSimSDPs_Ps().

Referenced by OpHitsToXYZ().

460  {
461  std::vector<const sim::SDP*> sdps_Ps;
462  for (auto opHit_P : opHits_Ps) {
463  std::vector<const sim::SDP*> to_add_sdps_Ps = this->OpHitToSimSDPs_Ps(opHit_P);
464  sdps_Ps.insert(sdps_Ps.end(), to_add_sdps_Ps.begin(), to_add_sdps_Ps.end());
465  }
466  return sdps_Ps;
467  }
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps(recob::OpHit const &opHit) const
const std::vector< double > cheat::PhotonBackTracker::OpHitsToXYZ ( std::vector< art::Ptr< recob::OpHit >> const &  opHits_Ps) const

Definition at line 470 of file PhotonBackTracker.cc.

References OpHitsToSimSDPs_Ps(), and SimSDPsToXYZ().

Referenced by OpFlashToXYZ().

472  {
473  const std::vector<const sim::SDP*> SDPs_Ps = OpHitsToSimSDPs_Ps(opHits_Ps);
474  return this->SimSDPsToXYZ(SDPs_Ps);
475  }
std::vector< double > SimSDPsToXYZ(std::vector< sim::SDP > const &sdps)
const std::vector< const sim::SDP * > OpHitsToSimSDPs_Ps(std::vector< art::Ptr< recob::OpHit >> const &opHits_Ps) const
std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToEveID ( art::Ptr< recob::OpHit > const &  hit)

Definition at line 361 of file old.PhotonBackTracker_service.cc.

References OpHitToEveSDPs().

Referenced by GetSetOfEveIDs(), and OpHitToTrackID().

362  {
363  mf::LogWarning("PhotonBackTracker")
364  << "PhotonBackTracker::OpHitToEveID is being replaced with "
365  "PhotonBackTracker::OpHitToEveSDPs. Please \n update your code accordingly.\n ";
366  std::vector<sim::TrackSDP> eveSDPs = OpHitToEveSDPs(opHit);
367  return eveSDPs;
368  }
std::vector< sim::TrackSDP > OpHitToEveSDPs(art::Ptr< recob::OpHit > const &hit)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector<sim::TrackSDP> cheat::PhotonBackTracker::OpHitToEveID ( art::Ptr< recob::OpHit > const &  hit)
std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToEveSDPs ( art::Ptr< recob::OpHit > const &  hit)

Definition at line 333 of file old.PhotonBackTracker_service.cc.

References sim::TrackSDP::energy, sim::TrackSDP::energyFrac, sim::ParticleList::EveId(), fParticleList, OpHitToTrackSDPs(), shouldThisFail(), and sim::TrackSDP::trackID.

Referenced by OpHitToEveID(), and OpHitToTrackID().

334  {
335  shouldThisFail();
336  std::vector<sim::TrackSDP> trackSDPs = this->OpHitToTrackSDPs(opHit);
337 
338  // make a map of evd ID values and fraction of energy represented by
339  // that eve id in this opHit
340  std::map<int, float> eveIDtoEfrac;
341 
342  double totalE = 0.;
343  for (size_t t = 0; t < trackSDPs.size(); ++t) {
344  eveIDtoEfrac[fParticleList.EveId(trackSDPs[t].trackID)] += trackSDPs[t].energy;
345  totalE += trackSDPs[t].energy;
346  }
347 
348  // now fill the eveSDPs vector from the map
349  std::vector<sim::TrackSDP> eveSDPs;
350  eveSDPs.reserve(eveIDtoEfrac.size());
351  for (auto itr = eveIDtoEfrac.begin(); itr != eveIDtoEfrac.end(); itr++) {
352  sim::TrackSDP temp;
353  temp.trackID = (*itr).first;
354  temp.energyFrac = (*itr).second / totalE;
355  temp.energy = (*itr).second;
356  eveSDPs.push_back(std::move(temp));
357  }
358 
359  return eveSDPs;
360  }
int EveId(const int trackID) const
int trackID
Geant4 supplied trackID.
float energyFrac
fraction of OpHit energy from the particle with this trackID
Ionization photons from a Geant4 track.
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
float energy
energy from the particle with this trackID [MeV]
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
std::vector<sim::TrackSDP> cheat::PhotonBackTracker::OpHitToEveSDPs ( art::Ptr< recob::OpHit > const &  hit)
const std::unordered_set< const sim::SDP * > cheat::PhotonBackTracker::OpHitToEveSimSDPs_Ps ( recob::OpHit const &  opHit)

Definition at line 478 of file PhotonBackTracker.cc.

References OpHitToEveTrackIds(), and TrackIdToSimSDPs_Ps().

Referenced by cheat::PhotonBackTrackerService::OpHitToEveSimSDPs_Ps().

480  { /*NEW*/ /*COMPLETE*/
481  const std::vector<int> ids = this->OpHitToEveTrackIds(opHit_P);
482  std::unordered_set<const sim::SDP*> sdps;
483  for (auto const& id : ids) {
484  std::vector<const sim::SDP*> tmp_sdps = TrackIdToSimSDPs_Ps(id);
485  for (const sim::SDP* tmp_sdp : tmp_sdps) {
486  sdps.insert(tmp_sdp); //emplace not needed here.
487  }
488  }
489  return sdps;
490  }
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps(int const &id)
const std::vector< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
const std::unordered_set< const sim::SDP * > cheat::PhotonBackTracker::OpHitToEveSimSDPs_Ps ( art::Ptr< recob::OpHit > &  opHit_P)

Definition at line 493 of file PhotonBackTracker.cc.

References OpHitToEveTrackIds(), and TrackIdToSimSDPs_Ps().

495  { /*NEW*/ /*COMPLETE*/
496  const std::vector<int> ids = this->OpHitToEveTrackIds(opHit);
497  std::unordered_set<const sim::SDP*> sdps;
498  for (auto const& id : ids) {
499  std::vector<const sim::SDP*> tmp_sdps = TrackIdToSimSDPs_Ps(id);
500  for (const sim::SDP* tmp_sdp : tmp_sdps) {
501  sdps.insert(tmp_sdp); //emplace not needed here.
502  }
503  }
504  return sdps;
505  }
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps(int const &id)
const std::vector< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
const std::vector< int > cheat::PhotonBackTracker::OpHitToEveTrackIds ( recob::OpHit const &  opHit)

Definition at line 218 of file PhotonBackTracker.cc.

References OpHitToEveTrackSDPs().

Referenced by OpHitToEveSimSDPs_Ps(), cheat::PhotonBackTrackerService::OpHitToEveTrackIds(), and OpHitToEveTrackIds().

219  { /*NEW*/ /*COMPLETE*/
220  std::vector<int> retVec;
221  for (auto const trackSDP : this->OpHitToEveTrackSDPs(opHit)) {
222  retVec.push_back(trackSDP.trackID);
223  }
224  return retVec;
225  }
const std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P) const
const std::vector< int > cheat::PhotonBackTracker::OpHitToEveTrackIds ( art::Ptr< recob::OpHit > const &  opHit_P)

Definition at line 228 of file PhotonBackTracker.cc.

References OpHitToEveTrackIds().

230  { /*NEW*/ /*COMPLETE*/
231  return this->OpHitToEveTrackIds(*opHit_P);
232  }
const std::vector< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
const std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToEveTrackSDPs ( art::Ptr< recob::OpHit > const &  opHit_P) const

Definition at line 235 of file PhotonBackTracker.cc.

Referenced by GetSetOfEveIds(), OpHitToEveTrackIds(), and cheat::PhotonBackTrackerService::OpHitToEveTrackSDPs().

237  {
238  return this->OpHitToEveTrackSDPs(*opHit_P);
239  }
const std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P) const
const std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToEveTrackSDPs ( recob::OpHit const &  opHit) const

Definition at line 242 of file PhotonBackTracker.cc.

References sim::TrackSDP::energy, sim::TrackSDP::energyFrac, fPartInv, OpHitToTrackSDPs(), cheat::ParticleInventory::ParticleList(), and sim::TrackSDP::trackID.

244  {
245  std::vector<sim::TrackSDP> trackSDPs = this->OpHitToTrackSDPs(opHit);
246 
247  // make a map of evd ID values and fraction of energy represented by
248  // // that eve id in this opHit
249  std::map<int, float> eveIDtoEfrac;
250 
251  double totalE = 0.;
252  for (size_t t = 0; t < trackSDPs.size(); ++t) {
253  eveIDtoEfrac[(fPartInv->ParticleList()).EveId(trackSDPs[t].trackID)] += trackSDPs[t].energy;
254  totalE += trackSDPs[t].energy;
255  }
256 
257  // now fill the eveSDPs vector from the map
258  std::vector<sim::TrackSDP> eveSDPs;
259  eveSDPs.reserve(eveIDtoEfrac.size());
260  for (auto itr = eveIDtoEfrac.begin(); itr != eveIDtoEfrac.end(); itr++) {
261  sim::TrackSDP temp;
262  temp.trackID = (*itr).first;
263  temp.energyFrac = (*itr).second / totalE;
264  temp.energy = (*itr).second;
265  eveSDPs.push_back(std::move(temp));
266  }
267  return eveSDPs;
268  }
int trackID
Geant4 supplied trackID.
const cheat::ParticleInventory * fPartInv
float energyFrac
fraction of OpHit energy from the particle with this trackID
Ionization photons from a Geant4 track.
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
float energy
energy from the particle with this trackID [MeV]
const sim::ParticleList & ParticleList() const
void cheat::PhotonBackTracker::OpHitToSDPs ( recob::OpHit const &  hit,
std::vector< sim::SDP > &  sdps 
) const

Definition at line 714 of file old.PhotonBackTracker_service.cc.

References fDelay, FindOpDetBacktrackerRecord(), geom, recob::OpHit::OpChannel(), geo::GeometryCore::OpDetFromOpChannel(), recob::OpHit::PeakTime(), shouldThisFail(), sim::OpDetBacktrackerRecord::TrackIDsAndEnergies(), and recob::OpHit::Width().

Referenced by OpHitToSDPs(), OpHitToSimSDPs(), OpHitToTrackID(), and OpHitToXYZ().

715  {
716  shouldThisFail();
717  // Get services.
718  //const detinfo::DetectorClocks* ts = lar::providerFrom<detinfo::DetectorClocksService>();
719 
720  double fPeakTime = opHit.PeakTime();
721  double fWidth = opHit.Width();
723  ((fPeakTime - fWidth) * 1000.0) - fDelay;
724  sim::OpDetBacktrackerRecord::timePDclock_t end_time = ((fPeakTime + fWidth) * 1000.0) - fDelay;
725 
726  sdps = FindOpDetBacktrackerRecord(geom->OpDetFromOpChannel(opHit.OpChannel()))
727  ->TrackIDsAndEnergies(start_time, end_time);
728  }
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
double timePDclock_t
Type for iTimePDclock tick used in the interface.
const art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBacktrackerRecord(int channel) const
geo::GeometryCore const * geom
std::vector< sim::SDP > TrackIDsAndEnergies(timePDclock_t startTimePDclock, timePDclock_t endTimePDclock) const
Return all the recorded energy deposition within a time interval.
void cheat::PhotonBackTracker::OpHitToSDPs ( recob::OpHit const &  hit,
std::vector< sim::SDP > &  sdps 
) const
void cheat::PhotonBackTracker::OpHitToSDPs ( art::Ptr< recob::OpHit > const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline

Definition at line 104 of file old.PhotonBackTrackerService.h.

References OpHitToSDPs().

105  {
106  OpHitToSDPs(*hit, sdps);
107  }
void OpHitToSDPs(recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
void cheat::PhotonBackTracker::OpHitToSDPs ( art::Ptr< recob::OpHit > const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline

Definition at line 104 of file old.PhotonBackTracker.h.

References OpHitToSDPs().

105  {
106  OpHitToSDPs(*hit, sdps);
107  }
void OpHitToSDPs(recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
DEPRECATED void cheat::PhotonBackTracker::OpHitToSimSDPs ( recob::OpHit const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline

Definition at line 100 of file old.PhotonBackTracker.h.

References OpHitToSDPs().

101  {
102  OpHitToSDPs(hit, sdps);
103  }
void OpHitToSDPs(recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
Detector simulation of raw signals on wires.
DEPRECATED void cheat::PhotonBackTracker::OpHitToSimSDPs ( recob::OpHit const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline

Definition at line 100 of file old.PhotonBackTrackerService.h.

References OpHitToSDPs().

101  {
102  OpHitToSDPs(hit, sdps);
103  }
void OpHitToSDPs(recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
Detector simulation of raw signals on wires.
DEPRECATED void cheat::PhotonBackTracker::OpHitToSimSDPs ( art::Ptr< recob::OpHit > const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline
DEPRECATED void cheat::PhotonBackTracker::OpHitToSimSDPs ( art::Ptr< recob::OpHit > const &  hit,
std::vector< sim::SDP > &  sdps 
) const
inline
const std::vector< const sim::SDP * > cheat::PhotonBackTracker::OpHitToSimSDPs_Ps ( recob::OpHit const &  opHit) const

Definition at line 323 of file PhotonBackTracker.cc.

References fDelay, fGeom, FindOpDetBTR(), recob::OpHit::OpChannel(), geo::GeometryCore::OpDetFromOpChannel(), recob::OpHit::PeakTime(), and recob::OpHit::Width().

Referenced by OpHitsToSimSDPs_Ps(), cheat::PhotonBackTrackerService::OpHitToSimSDPs_Ps(), OpHitToSimSDPs_Ps(), and OpHitToXYZ().

325  {
326  std::vector<const sim::SDP*> retVec;
327  double fPeakTime = opHit.PeakTime();
328  double fWidth = opHit.Width();
330  ((fPeakTime - fWidth) * 1000.0) - fDelay;
331  sim::OpDetBacktrackerRecord::timePDclock_t end_time = ((fPeakTime + fWidth) * 1000.0) - fDelay;
332  if (start_time > end_time) { throw; }
333 
334  //BUG!!!fGeom->OpDetFromOpChannel(channel)
335  const std::vector<std::pair<double, std::vector<sim::SDP>>>& timeSDPMap =
336  (this->FindOpDetBTR(fGeom->OpDetFromOpChannel(opHit.OpChannel())))
337  ->timePDclockSDPsMap(); //Not guranteed to be sorted.
338  //const std::vector<std::pair<double, std::vector<sim::SDP>> >& timeSDPMap = (this->FindOpDetBTR(opHit.OpChannel()))->timePDclockSDPsMap(); //Not guranteed to be sorted.
339 
340  std::vector<const std::pair<double, std::vector<sim::SDP>>*> timePDclockSDPMap_SortedPointers;
341  for (auto& pair : timeSDPMap) {
342  timePDclockSDPMap_SortedPointers.push_back(&pair);
343  }
344  auto pairSort = [](auto& a, auto& b) { return a->first < b->first; };
345  if (!std::is_sorted(timePDclockSDPMap_SortedPointers.begin(),
346  timePDclockSDPMap_SortedPointers.end(),
347  pairSort)) {
348  std::sort(
349  timePDclockSDPMap_SortedPointers.begin(), timePDclockSDPMap_SortedPointers.end(), pairSort);
350  }
351 
352  //This section is a hack to make comparisons work right.
353  std::vector<sim::SDP> dummyVec;
354  std::pair<double, std::vector<sim::SDP>> start_timePair = std::make_pair(start_time, dummyVec);
355  std::pair<double, std::vector<sim::SDP>> end_timePair = std::make_pair(end_time, dummyVec);
356  auto start_timePair_P = &start_timePair;
357  auto end_timePair_P = &end_timePair;
358  //First interesting iterator.
359  auto mapFirst = std::lower_bound(timePDclockSDPMap_SortedPointers.begin(),
360  timePDclockSDPMap_SortedPointers.end(),
361  start_timePair_P,
362  pairSort);
363  //Last interesting iterator.
364  auto mapLast =
365  std::upper_bound(mapFirst, timePDclockSDPMap_SortedPointers.end(), end_timePair_P, pairSort);
366 
367  for (auto& mapitr = mapFirst; mapitr != mapLast; ++mapitr)
368  for (auto& sdp : (*mapitr)->second)
369  retVec.push_back(&sdp);
370 
371  return retVec;
372 
373  //sdps = FindOpDetBTR( geom->OpDetFromOpChannel(opHit. OpChannel()) )->TrackIDsAndEnergies(start_time, end_time);
374  // return (this->FindOpDetBTR( fGeom->OpDetFromOpChannel(opHit.OpChannel()) ))->TrackIDsAndEnergies(start_time, end_time);
375  }
const art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const &opDetNum) const
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
const geo::GeometryCore * fGeom
double timePDclock_t
Type for iTimePDclock tick used in the interface.
const std::vector< const sim::SDP * > cheat::PhotonBackTracker::OpHitToSimSDPs_Ps ( art::Ptr< recob::OpHit > const &  opHit_P) const

Definition at line 378 of file PhotonBackTracker.cc.

References OpHitToSimSDPs_Ps().

380  {
381  return this->OpHitToSimSDPs_Ps(*opHit_P);
382  }
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps(recob::OpHit const &opHit) const
DEPRECATED std::vector<sim::TrackSDP> cheat::PhotonBackTracker::OpHitToTrackID ( art::Ptr< recob::OpHit > const &  hit)
inline

Definition at line 81 of file old.PhotonBackTracker.h.

References OpHitToEveID(), OpHitToEveSDPs(), OpHitToSDPs(), OpHitToTrackSDPs(), TrackIDsToOpHits(), and lar::dump::vector().

82  {
83  return OpHitToTrackSDPs(hit);
84  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
DEPRECATED std::vector<sim::TrackSDP> cheat::PhotonBackTracker::OpHitToTrackID ( art::Ptr< recob::OpHit > const &  hit)
inline

Definition at line 81 of file old.PhotonBackTrackerService.h.

References OpHitToEveID(), OpHitToEveSDPs(), OpHitToSDPs(), OpHitToTrackSDPs(), TrackIDsToOpHits(), and lar::dump::vector().

82  {
83  return OpHitToTrackSDPs(hit);
84  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
const std::vector< int > cheat::PhotonBackTracker::OpHitToTrackIds ( recob::OpHit const &  opHit) const

Definition at line 201 of file PhotonBackTracker.cc.

References OpHitToTrackSDPs().

Referenced by OpFlashToTrackIds(), cheat::PhotonBackTrackerService::OpHitToTrackIds(), and OpHitToTrackIds().

202  {
203  std::vector<int> retVec;
204  for (auto const trackSDP : this->OpHitToTrackSDPs(opHit)) {
205  retVec.push_back(trackSDP.trackID);
206  }
207  return retVec;
208  }
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
const std::vector< int > cheat::PhotonBackTracker::OpHitToTrackIds ( art::Ptr< recob::OpHit > const &  opHit) const

Definition at line 211 of file PhotonBackTracker.cc.

References OpHitToTrackIds().

213  {
214  return this->OpHitToTrackIds(*opHit);
215  }
const std::vector< int > OpHitToTrackIds(recob::OpHit const &opHit) const
std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToTrackSDPs ( art::Ptr< recob::OpHit > const &  hit)

Definition at line 271 of file old.PhotonBackTracker_service.cc.

References ChannelToTrackSDPs(), util::end(), fDelay, recob::OpHit::OpChannel(), recob::OpHit::PeakTime(), shouldThisFail(), and recob::OpHit::Width().

Referenced by GetSetOfTrackIds(), OpHitChargeCollectionEfficiency(), OpHitChargeCollectionPurity(), OpHitCollectionEfficiency(), OpHitCollectionPurity(), OpHitLightCollectionEfficiency(), OpHitLightCollectionPurity(), OpHitToEveSDPs(), OpHitToEveTrackSDPs(), OpHitToTrackID(), OpHitToTrackIds(), and cheat::PhotonBackTrackerService::OpHitToTrackSDPs().

273  {
274  shouldThisFail();
275  std::vector<sim::TrackSDP> trackSDPs;
276  const double pTime = opHit->PeakTime();
277  const double pWidth = opHit->Width();
278  const double start = (pTime - pWidth) * 1000 - fDelay;
279  const double end = (pTime + pWidth) * 1000 - fDelay;
280 
281  this->ChannelToTrackSDPs(trackSDPs, opHit->OpChannel(), start, end);
282 
283  return trackSDPs;
284  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
void ChannelToTrackSDPs(std::vector< sim::TrackSDP > &trackSDPs, int channel, const double hit_start_time, const double hit_end_time)
std::vector<sim::TrackSDP> cheat::PhotonBackTracker::OpHitToTrackSDPs ( art::Ptr< recob::OpHit > const &  hit)
const std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToTrackSDPs ( art::Ptr< recob::OpHit > const &  opHit_P) const

Definition at line 177 of file PhotonBackTracker.cc.

References util::end(), fDelay, fGeom, recob::OpHit::OpChannel(), geo::GeometryCore::OpDetFromOpChannel(), OpDetToTrackSDPs(), recob::OpHit::PeakTime(), and recob::OpHit::Width().

179  {
180  auto OpDetNum = fGeom->OpDetFromOpChannel(opHit_P->OpChannel());
181  const double pTime = opHit_P->PeakTime();
182  const double pWidth = opHit_P->Width();
183  const double start = (pTime - pWidth) * 1000 - fDelay;
184  const double end = (pTime + pWidth) * 1000 - fDelay;
185  return this->OpDetToTrackSDPs(OpDetNum, start, end);
186  }
double PeakTime() const
Definition: OpHit.h:94
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double Width() const
Definition: OpHit.h:110
const geo::GeometryCore * fGeom
int OpChannel() const
Definition: OpHit.h:86
const std::vector< sim::TrackSDP > OpDetToTrackSDPs(int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time) const
const std::vector< sim::TrackSDP > cheat::PhotonBackTracker::OpHitToTrackSDPs ( recob::OpHit const &  opHit) const

Definition at line 189 of file PhotonBackTracker.cc.

References util::end(), fDelay, fGeom, recob::OpHit::OpChannel(), geo::GeometryCore::OpDetFromOpChannel(), OpDetToTrackSDPs(), recob::OpHit::PeakTime(), and recob::OpHit::Width().

191  {
192  auto OpDetNum = fGeom->OpDetFromOpChannel(opHit.OpChannel());
193  const double pTime = opHit.PeakTime();
194  const double pWidth = opHit.Width();
195  const double start = (pTime - pWidth) * 1000 - fDelay;
196  const double end = (pTime + pWidth) * 1000 - fDelay;
197  return this->OpDetToTrackSDPs(OpDetNum, start, end);
198  }
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
const geo::GeometryCore * fGeom
const std::vector< sim::TrackSDP > OpDetToTrackSDPs(int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time) const
std::vector<double> cheat::PhotonBackTracker::OpHitToXYZ ( art::Ptr< recob::OpHit > const &  hit)
const std::vector< double > cheat::PhotonBackTracker::OpHitToXYZ ( art::Ptr< recob::OpHit > const &  hit)

Definition at line 769 of file old.PhotonBackTracker_service.cc.

References DEFINE_ART_SERVICE, OpHitToSDPs(), shouldThisFail(), and SimSDPsToXYZ().

Referenced by OpHitToSimSDPs(), cheat::PhotonBackTrackerService::OpHitToXYZ(), and OpHitToXYZ().

770  {
771  shouldThisFail();
772  std::vector<sim::SDP> sdps;
773  OpHitToSDPs(opHit, sdps);
774  return SimSDPsToXYZ(sdps);
775  }
std::vector< double > SimSDPsToXYZ(std::vector< sim::SDP > const &sdps)
void OpHitToSDPs(recob::OpHit const &hit, std::vector< sim::SDP > &sdps) const
const std::vector<double> cheat::PhotonBackTracker::OpHitToXYZ ( art::Ptr< recob::OpHit > const &  opHit)
const std::vector< double > cheat::PhotonBackTracker::OpHitToXYZ ( recob::OpHit const &  opHit)

Definition at line 444 of file PhotonBackTracker.cc.

References OpHitToSimSDPs_Ps(), OpHitToXYZ(), and SimSDPsToXYZ().

445  {
446  return SimSDPsToXYZ(this->OpHitToSimSDPs_Ps(opHit));
447  }
std::vector< double > SimSDPsToXYZ(std::vector< sim::SDP > const &sdps)
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps(recob::OpHit const &opHit) const
const sim::ParticleList& cheat::PhotonBackTracker::ParticleList ( ) const
inline

Definition at line 60 of file old.PhotonBackTracker.h.

References fParticleList.

60 { return fParticleList; }
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
const sim::ParticleList& cheat::PhotonBackTracker::ParticleList ( ) const
inline

Definition at line 60 of file old.PhotonBackTrackerService.h.

References fParticleList.

60 { return fParticleList; }
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
const art::Ptr< simb::MCTruth > & cheat::PhotonBackTracker::ParticleToMCTruth ( const simb::MCParticle p) const

Definition at line 248 of file old.PhotonBackTracker_service.cc.

References shouldThisFail(), simb::MCParticle::TrackId(), and TrackIDToMCTruth().

Referenced by SetEveIdCalculator().

250  {
251  shouldThisFail();
252  return this->TrackIDToMCTruth(p->TrackId());
253  }
int TrackId() const
Definition: MCParticle.h:211
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth(int const &id) const
const art::Ptr<simb::MCTruth>& cheat::PhotonBackTracker::ParticleToMCTruth ( const simb::MCParticle p) const
template<typename Evt >
void cheat::PhotonBackTracker::PrepEvent ( Evt const &  evt)
template<typename Evt >
void cheat::PhotonBackTracker::PrepOpDetBTRs ( Evt const &  evt)
template<typename Evt >
void cheat::PhotonBackTracker::PrepOpFlashToOpHits ( Evt const &  evt)
void cheat::PhotonBackTracker::Rebuild ( const art::Event evt)

Definition at line 53 of file old.PhotonBackTracker_service.cc.

References sim::ParticleList::Add(), sim::ParticleList::AdoptEveIdCalculator(), sim::ParticleList::clear(), cOpDetBacktrackerRecords, art::Handle< T >::failedToGet(), fG4ModuleLabel, art::fill_ptr_vector(), fMCTruthList, fParticleList, fTrackIDToMCTruthIndex, art::ProductRetriever::getByLabel(), GetSetOfTrackIDs(), have_complained, art::Event::isRealData(), MF_LOG_DEBUG, part, art::errors::ProductNotFound, and art::Handle< T >::whyFailed().

54  {
55  // do nothing if this is data
56  if (evt.isRealData()) return;
57 
58  // get the particles from the event
60  evt.getByLabel(fG4ModuleLabel, pHandle);
61 
62  // first check to see if we got called to early, that is the particles are
63  // and sim channels are not made yet in a MC production job
64  // if that is the case, we'll take care of it later
65  if (pHandle.failedToGet()) {
66  mf::LogWarning("PhotonBackTracker")
67  << "failed to get handle to simb::MCParticle from " << fG4ModuleLabel << ", return";
68  return;
69  }
70 
71  // Clear out anything remaining from previous calls to Rebuild
73  fMCTruthList.clear();
75  //fVoxelList .clear();
76 
78 
79  if (fo.isValid()) {
80  for (size_t p = 0; p < pHandle->size(); ++p) {
81 
82  simb::MCParticle* part = new simb::MCParticle(pHandle->at(p));
83  fParticleList.Add(part);
84 
85  // get the simb::MCTruth associated to this sim::ParticleList
86  try {
87  art::Ptr<simb::MCTruth> mct = fo.at(p);
88  if (fMCTruthList.size() < 1)
89  fMCTruthList.push_back(mct);
90  else {
91  // check that we are not adding a simb::MCTruth twice to the collection
92  // we know that all the particles for a given simb::MCTruth are put into the
93  // collection of particles at the same time, so we can just check that the
94  // current art::Ptr has a different id than the last one put
95  if (!(mct == fMCTruthList.back())) fMCTruthList.push_back(mct);
96  }
97  // fill the track id to mctruth index map
98  fTrackIDToMCTruthIndex[pHandle->at(p).TrackId()] = fMCTruthList.size() - 1;
99  }
100  catch (cet::exception& ex) {
101  mf::LogWarning("PhotonBackTracker") << "unable to find MCTruth from ParticleList "
102  << "created in " << fG4ModuleLabel << " "
103  << "any attempt to get the MCTruth objects from "
104  << "the photon backtracker will fail\n"
105  << "message from caught exception:\n"
106  << ex;
107  }
108  } // end loop over particles to get MCTruthList
109  } // end if fo.isValid()
110 
111  // grab the sim::OpDetBacktrackerRecords for this event
112 
113  /*
114  try{evt.getView(fG4ModuleLabel, cOpDetBacktrackerRecords);}
115  catch(art::Exception const& e){
116  if(e.categoryCode() != art::errors::ProductNotFound) throw;
117  if(have_complained==false){
118  }
119  }
120  */
121 
123  // std::vector< art::Ptr< sim::OpDetBacktrackerRecords > > cOpDetBacktrackerRecords;
124  evt.getByLabel(fG4ModuleLabel, cPBTRHandle);
125  if (
126  cPBTRHandle
127  .failedToGet()) { //Failed to get products. Prepare for controlled freak out. Assuming this is because there is no OpDetBacktrackerRecords, we will not cause things to fail, but will prepare to fail if a user tries to call backtracker functionality.
128  auto failMode = cPBTRHandle.whyFailed();
129  if (failMode->categoryCode() != art::errors::ProductNotFound)
130  throw;
131  else if (have_complained == false) {
132  std::cout << "FAILED BECAUSE " << (*failMode) << "\n";
133  have_complained = true;
134  mf::LogWarning("PhotonBackTracker")
135  << "Failed to get BackTrackerRecords from this event. All calls to the PhotonBackTracker "
136  "will fail.\n"
137  << "This message will be generated only once per lar invokation. If this is event one, "
138  "be aware the PhotonBackTracker may not work on any events from this file.\n"
139  << "Please change the log level to debug if you need more information for each event.\n"
140  << "Failed with :" << (*failMode) << "\n";
141  mf::LogDebug("PhotonBackTracker") << "Failed to get BackTrackerRecords from this event.\n";
142  }
143  else {
144  mf::LogDebug("PhotonBackTracker") << "Failed to get BackTrackerRecords from this event.\n";
145  }
146  }
147  else { //Did not fail to get products. All is well. Run as expected.
149  }
150 
151  // grab the voxel list for this event
152  //fVoxelList = sim::SimListUtils::GetLArVoxelList(evt, fG4ModuleLabel);
153 
155 
156  MF_LOG_DEBUG("PhotonBackTracker")
157  << "PhotonBackTracker has " << cOpDetBacktrackerRecords.size()
158  << " sim::OpDetBacktrackerRecords and " << GetSetOfTrackIDs().size()
159  << " tracks. The particles are:\n"
160  << fParticleList << "\n the MCTruth information is\n";
161  for (size_t mc = 0; mc < fMCTruthList.size(); ++mc)
162  MF_LOG_DEBUG("PhotonBackTracker") << *(fMCTruthList.at(mc).get());
163 
164  return;
165  }
std::map< int, int > fTrackIDToMCTruthIndex
map of track ids to MCTruthList entry
void Add(simb::MCParticle *value)
Definition: ParticleList.h:315
bool isRealData() const
Definition: Event.cc:53
std::string fG4ModuleLabel
label for geant4 module
TString part[npart]
Definition: Style.C:32
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
std::shared_ptr< art::Exception const > whyFailed() const
Definition: Handle.h:231
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
all the OpDetBacktrackerRecords for the event
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
all the MCTruths for the event
static void AdoptEveIdCalculator(EveIdCalculator *)
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
bool failedToGet() const
Definition: Handle.h:210
void cheat::PhotonBackTracker::Rebuild ( const art::Event evt)
void cheat::PhotonBackTracker::reconfigure ( fhicl::ParameterSet const &  pset)

Referenced by ~PhotonBackTracker().

void cheat::PhotonBackTracker::reconfigure ( fhicl::ParameterSet const &  pset)
void cheat::PhotonBackTracker::SetEveIdCalculator ( sim::EveIdCalculator ec)
inline
void cheat::PhotonBackTracker::SetEveIdCalculator ( sim::EveIdCalculator ec)
inline
const void cheat::PhotonBackTracker::shouldThisFail ( ) const
private

Definition at line 168 of file old.PhotonBackTracker_service.cc.

References have_complained.

Referenced by ChannelToTrackSDPs(), FindOpDetBacktrackerRecord(), GetSetOfEveIDs(), GetSetOfTrackIDs(), MCTruthToParticles(), OpDetBacktrackerRecords(), OpHitChargeCollectionEfficiency(), OpHitChargeCollectionPurity(), OpHitCollectionEfficiency(), OpHitCollectionPurity(), OpHitToEveSDPs(), OpHitToSDPs(), OpHitToTrackSDPs(), OpHitToXYZ(), ParticleToMCTruth(), SimSDPsToXYZ(), TrackIDsToOpHits(), TrackIDToMCTruth(), TrackIDToMotherParticle(), TrackIDToParticle(), and TrackIDToSimSDP().

169  {
170  //I need to revisit this and see if this check is too aggressive, as it only takes one failed event to set have_complained to true for the rest of the file.
171  //I currently do believe this is okay, as have_complained only flips on ProductNotFound errors, and if that happens in one event of a file,
172  // it should happen in all events of the file.
173  if (have_complained == true) {
174  throw cet::exception("PhotonBackTracker1")
175  << "PhotonBackTracker methods called on a file without OpDetPhotonBacktrackerRecords. "
176  "Backtracked information is not available.";
177  }
178  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const void cheat::PhotonBackTracker::shouldThisFail ( ) const
private
std::vector< double > cheat::PhotonBackTracker::SimSDPsToXYZ ( std::vector< sim::SDP > const &  sdps)

Definition at line 731 of file old.PhotonBackTracker_service.cc.

References e, shouldThisFail(), w, weight, x, y, and z.

Referenced by OpHitsToXYZ(), OpHitToSimSDPs(), OpHitToXYZ(), and cheat::PhotonBackTrackerService::SimSDPsToXYZ().

732  {
733  shouldThisFail();
734  std::vector<double> xyz(3, -999.);
735 
736  double x = 0.;
737  double y = 0.;
738  double z = 0.;
739  double w = 0.;
740 
741  // loop over photons.
742 
743  for (auto const& sdp : sdps) {
744 
745  double weight = sdp.numPhotons;
746 
747  w += weight;
748  x += weight * sdp.x;
749  y += weight * sdp.y;
750  z += weight * sdp.z;
751 
752  } // end loop over sim::SDPs
753 
754  //If the sum of the weights is still zero, then fail to return a value.
755  //A hit with no contributing photons does't make sense.
756  if (w < 1.e-5)
757  throw cet::exception("PhotonBackTracker")
758  << "No sim::SDPs providing non-zero number of photons"
759  << " can't determine originating location from truth\n";
760 
761  xyz[0] = x / w;
762  xyz[1] = y / w;
763  xyz[2] = z / w;
764 
765  return xyz;
766  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
double weight
Definition: plottest35.C:25
Float_t e
Definition: plot.C:35
Float_t w
Definition: plot.C:20
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector<double> cheat::PhotonBackTracker::SimSDPsToXYZ ( std::vector< sim::SDP > const &  sdps)
const std::vector< double > cheat::PhotonBackTracker::SimSDPsToXYZ ( std::vector< sim::SDP > const &  sdps) const

Definition at line 385 of file PhotonBackTracker.cc.

References e, w, weight, x, y, and z.

387  {
388  std::vector<double> xyz(3, -999.);
389  double x = 0.;
390  double y = 0.;
391  double z = 0.;
392  double w = 0.;
393  // loop over photons.
394  for (auto const& sdp : sdps) {
395  double weight = sdp.numPhotons;
396  w += weight;
397  x += weight * sdp.x;
398  y += weight * sdp.y;
399  z += weight * sdp.z;
400  } // end loop over sim::SDPs
401  //If the sum of the weights is still zero, then fail to return a value.
402  //A hit with no contributing photons does't make sense.
403  if (w < 1.e-5)
404  throw cet::exception("PhotonBackTracker")
405  << "No sim::SDPs providing non-zero number of photons"
406  << " can't determine originating location from truth\n";
407  xyz[0] = x / w;
408  xyz[1] = y / w;
409  xyz[2] = z / w;
410  return xyz;
411  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
double weight
Definition: plottest35.C:25
Float_t e
Definition: plot.C:35
Float_t w
Definition: plot.C:20
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::vector< double > cheat::PhotonBackTracker::SimSDPsToXYZ ( std::vector< const sim::SDP * > const &  sdps_Ps) const

Definition at line 414 of file PhotonBackTracker.cc.

References e, w, weight, x, y, and z.

416  {
417  std::vector<double> xyz(3, -999.);
418  double x = 0.;
419  double y = 0.;
420  double z = 0.;
421  double w = 0.;
422  // loop over photons.
423  for (const sim::SDP* sdp_P : sdps_Ps) {
424  auto& sdp = *sdp_P;
425  double weight = sdp.numPhotons;
426  w += weight;
427  x += weight * sdp.x;
428  y += weight * sdp.y;
429  z += weight * sdp.z;
430  } // end loop over sim::SDPs
431  //If the sum of the weights is still zero, then fail to return a value.
432  //A hit with no contributing photons does't make sense.
433  if (w < 1.e-5)
434  throw cet::exception("PhotonBackTracker")
435  << "No sim::SDPs providing non-zero number of photons"
436  << " can't determine originating location from truth\n";
437  xyz[0] = x / w;
438  xyz[1] = y / w;
439  xyz[2] = z / w;
440  return xyz;
441  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
double weight
Definition: plottest35.C:25
Float_t e
Definition: plot.C:35
Float_t w
Definition: plot.C:20
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::vector< std::vector< art::Ptr< recob::OpHit > > > cheat::PhotonBackTracker::TrackIDsToOpHits ( std::vector< art::Ptr< recob::OpHit >> const &  allhits,
std::vector< int > const &  tkIDs 
)

Definition at line 287 of file old.PhotonBackTracker_service.cc.

References ChannelToTrackSDPs(), util::end(), fDelay, fMinOpHitEnergyFraction, recob::OpHit::OpChannel(), recob::OpHit::PeakTime(), shouldThisFail(), and recob::OpHit::Width().

Referenced by OpHitToTrackID().

290  {
291  shouldThisFail();
292  // returns a subset of the opHits in the allOpHits collection that are matched
293  // to MC particles listed in tkIDs
294 
295  // temporary vector of TrackIDs and Ptrs to opHits so only one
296  // loop through the (possibly large) allOpHits collection is needed
297  std::vector<std::pair<int, art::Ptr<recob::OpHit>>> opHitList;
298  std::vector<sim::TrackSDP> tids;
299  for (auto itr = allOpHits.begin(); itr != allOpHits.end(); ++itr) {
300  tids.clear();
301  art::Ptr<recob::OpHit> const& opHit = *itr;
302  const double pTime = opHit->PeakTime(), pWidth = opHit->Width();
303  const double start = (pTime - pWidth) * 1000.0 - fDelay,
304  end = (pTime + pWidth) * 1000.0 - fDelay;
305  this->ChannelToTrackSDPs(tids, opHit->OpChannel(), start, end);
306  for (auto itid = tids.begin(); itid != tids.end(); ++itid) {
307  for (auto itkid = tkIDs.begin(); itkid != tkIDs.end(); ++itkid) {
308  if (itid->trackID == *itkid) {
309  if (itid->energyFrac > fMinOpHitEnergyFraction)
310  opHitList.push_back(std::make_pair(*itkid, opHit));
311  }
312  } // itkid
313  } // itid
314  } // itr
315 
316  // now build the truOpHits vector that will be returned to the caller
317  std::vector<std::vector<art::Ptr<recob::OpHit>>> truOpHits;
318  // temporary vector containing opHits assigned to one MC particle
319  std::vector<art::Ptr<recob::OpHit>> tmpOpHits;
320  for (auto itkid = tkIDs.begin(); itkid != tkIDs.end(); ++itkid) {
321  tmpOpHits.clear();
322  for (auto itr = opHitList.begin(); itr != opHitList.end(); ++itr) {
323  if (*itkid == (*itr).first) tmpOpHits.push_back((*itr).second);
324  }
325  truOpHits.push_back(tmpOpHits);
326  }
327 
328  return truOpHits;
329  }
double PeakTime() const
Definition: OpHit.h:94
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double Width() const
Definition: OpHit.h:110
void ChannelToTrackSDPs(std::vector< sim::TrackSDP > &trackSDPs, int channel, const double hit_start_time, const double hit_end_time)
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
int OpChannel() const
Definition: OpHit.h:86
const std::vector<std::vector<art::Ptr<recob::OpHit> > > cheat::PhotonBackTracker::TrackIDsToOpHits ( std::vector< art::Ptr< recob::OpHit >> const &  allhits,
std::vector< int > const &  tkIDs 
)
const std::vector< std::vector< art::Ptr< recob::OpHit > > > cheat::PhotonBackTracker::TrackIdsToOpHits_Ps ( std::vector< int > const &  tkIds,
std::vector< art::Ptr< recob::OpHit >> const &  hitsIn 
)

Definition at line 286 of file PhotonBackTracker.cc.

References util::end(), fDelay, fGeom, fMinOpHitEnergyFraction, recob::OpHit::OpChannel(), geo::GeometryCore::OpDetFromOpChannel(), OpDetToTrackSDPs(), recob::OpHit::PeakTime(), and recob::OpHit::Width().

Referenced by cheat::PhotonBackTrackerService::TrackIdsToOpHits_Ps(), and TrackIdToOpHits_Ps().

289  {
290  std::vector<std::pair<int, art::Ptr<recob::OpHit>>> opHitList;
291  for (auto itr = hitsIn.begin(); itr != hitsIn.end(); ++itr) {
292  art::Ptr<recob::OpHit> const& opHit = *itr;
293  auto OpDetNum = fGeom->OpDetFromOpChannel(opHit->OpChannel());
294  const double pTime = opHit->PeakTime(), pWidth = opHit->Width();
295  const double start = (pTime - pWidth) * 1000.0 - fDelay,
296  end = (pTime + pWidth) * 1000.0 - fDelay;
297  std::vector<sim::TrackSDP> tids = this->OpDetToTrackSDPs(OpDetNum, start, end);
298  //std::vector<sim::TrackSDP> tids = this->OpDetToTrackSDPs( opHit->OpChannel(), start, end);
299  for (auto itid = tids.begin(); itid != tids.end(); ++itid) {
300  for (auto itkid = tkIds.begin(); itkid != tkIds.end(); ++itkid) {
301  if (itid->trackID == *itkid) {
302  if (itid->energyFrac > fMinOpHitEnergyFraction)
303  opHitList.push_back(std::make_pair(*itkid, opHit));
304  }
305  } // itkid
306  } // itid
307  } // itr
308  // now build the truOpHits vector that will be returned to the caller
309  std::vector<std::vector<art::Ptr<recob::OpHit>>> truOpHits;
310  // temporary vector containing opHits assigned to one MC particle
311  std::vector<art::Ptr<recob::OpHit>> tmpOpHits;
312  for (auto itkid = tkIds.begin(); itkid != tkIds.end(); ++itkid) {
313  tmpOpHits.clear();
314  for (auto itr = opHitList.begin(); itr != opHitList.end(); ++itr) {
315  if (*itkid == (*itr).first) tmpOpHits.push_back((*itr).second);
316  }
317  truOpHits.push_back(tmpOpHits);
318  }
319  return truOpHits;
320  }
double PeakTime() const
Definition: OpHit.h:94
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double Width() const
Definition: OpHit.h:110
const geo::GeometryCore * fGeom
double fMinOpHitEnergyFraction
minimum fraction of energy a track id has to
int OpChannel() const
Definition: OpHit.h:86
const std::vector< sim::TrackSDP > OpDetToTrackSDPs(int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time) const
const art::Ptr< simb::MCTruth > & cheat::PhotonBackTracker::TrackIDToMCTruth ( int const &  id) const

Definition at line 207 of file old.PhotonBackTracker_service.cc.

References util::abs(), fMCTruthList, fTrackIDToMCTruthIndex, and shouldThisFail().

Referenced by MCTruthToParticles(), ParticleToMCTruth(), and SetEveIdCalculator().

208  {
209  shouldThisFail();
210  // find the entry in the MCTruth collection for this track id
211  size_t mct = fTrackIDToMCTruthIndex.find(abs(id))->second;
212 
213  if (/* mct < 0 || */ mct > fMCTruthList.size())
214  throw cet::exception("PhotonBackTracker")
215  << "attempting to find MCTruth index for "
216  << "out of range value: " << mct << "/" << fMCTruthList.size() << "\n";
217 
218  return fMCTruthList[mct];
219  }
std::map< int, int > fTrackIDToMCTruthIndex
map of track ids to MCTruthList entry
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
all the MCTruths for the event
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const art::Ptr<simb::MCTruth>& cheat::PhotonBackTracker::TrackIDToMCTruth ( int const &  id) const
const simb::MCParticle * cheat::PhotonBackTracker::TrackIDToMotherParticle ( int const &  id) const

Definition at line 197 of file old.PhotonBackTracker_service.cc.

References util::abs(), sim::ParticleList::EveId(), fParticleList, shouldThisFail(), and TrackIDToParticle().

Referenced by SetEveIdCalculator().

198  {
199  shouldThisFail();
200  // get the mother id from the particle navigator
201  // the EveId was adopted in the Rebuild method
202 
203  return this->TrackIDToParticle(fParticleList.EveId(abs(id)));
204  }
const simb::MCParticle * TrackIDToParticle(int const &id) const
constexpr auto abs(T v)
Returns the absolute value of the argument.
int EveId(const int trackID) const
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
const simb::MCParticle* cheat::PhotonBackTracker::TrackIDToMotherParticle ( int const &  id) const
const std::vector< art::Ptr< recob::OpHit > > cheat::PhotonBackTracker::TrackIdToOpHits_Ps ( int const &  tkId,
std::vector< art::Ptr< recob::OpHit >> const &  hitsIn 
)

Definition at line 272 of file PhotonBackTracker.cc.

References TrackIdsToOpHits_Ps().

Referenced by cheat::PhotonBackTrackerService::TrackIdToOpHits_Ps().

275  {
276  //One would think we would want to have this function defined, and call this function in the std::vector<tkids> to opHits, but that would require more loops (and a higher overhead.) Instead, to provide this, we will just call the existing std::vector<tkids>ToOpHits with an input of 1.
277  std::vector<int> tkidFake(1, tkId);
278  //std::vector<art::Ptr<recob::OpHit>> retVec = (this->TrackIdsToOpHits_Ps(tkidFake, hitsIn)).at(0);
279  // return (this->TrackIdsToOpHits_Ps(tkidFake, hitsIn));
280  const std::vector<art::Ptr<recob::OpHit>> out =
281  (this->TrackIdsToOpHits_Ps(tkidFake, hitsIn)).at(0);
282  return out;
283  }
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIdsToOpHits_Ps(std::vector< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
const simb::MCParticle * cheat::PhotonBackTracker::TrackIDToParticle ( int const &  id) const

Definition at line 181 of file old.PhotonBackTracker_service.cc.

References sim::ParticleList::end(), sim::ParticleList::find(), fParticleList, and shouldThisFail().

Referenced by SetEveIdCalculator(), and TrackIDToMotherParticle().

182  {
183  shouldThisFail();
185 
186  if (part_it == fParticleList.end()) {
187  mf::LogWarning("PhotonBackTracker")
188  << "can't find particle with track id " << id << " in sim::ParticleList"
189  << " returning null pointer";
190  return 0;
191  }
192 
193  return part_it->second;
194  }
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
iterator find(const key_type &key)
Definition: ParticleList.h:318
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
sim::ParticleList fParticleList
ParticleList to map track ID to sim::Particle.
const simb::MCParticle* cheat::PhotonBackTracker::TrackIDToParticle ( int const &  id) const
std::vector< sim::SDP > cheat::PhotonBackTracker::TrackIDToSimSDP ( int const &  id) const

Definition at line 222 of file old.PhotonBackTracker_service.cc.

References util::abs(), cOpDetBacktrackerRecords, sc, and shouldThisFail().

Referenced by SetEveIdCalculator().

223  {
224  shouldThisFail();
225  std::vector<sim::SDP> sdps;
226 
227  // loop over all sim::OpDetBacktrackerRecords and fill a vector
228  // of sim::SDP objects for the given track id
229  for (size_t sc = 0; sc < cOpDetBacktrackerRecords.size(); ++sc) {
230  const auto& pdTimeSDPmap = cOpDetBacktrackerRecords[sc]->timePDclockSDPsMap();
231 
232  // loop over the SDPMAP
233  for (auto mapitr = pdTimeSDPmap.begin(); mapitr != pdTimeSDPmap.end(); mapitr++) {
234 
235  // loop over the vector of SDP objects.
236  const std::vector<sim::SDP>& sdpvec = (*mapitr).second;
237  for (size_t iv = 0; iv < sdpvec.size(); ++iv) {
238  if (abs(sdpvec[iv].trackID) == id) sdps.push_back(sdpvec[iv]);
239  }
240 
241  } // end loop over map from sim::OpDetBacktrackerRecord
242  } // end loop over sim::OpDetBacktrackerRecords
243 
244  return sdps;
245  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
Float_t sc
Definition: plot.C:23
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cOpDetBacktrackerRecords
all the OpDetBacktrackerRecords for the event
std::vector<sim::SDP> cheat::PhotonBackTracker::TrackIDToSimSDP ( int const &  id) const
const std::vector< const sim::SDP * > cheat::PhotonBackTracker::TrackIdToSimSDPs_Ps ( int const &  id)

Definition at line 102 of file PhotonBackTracker.cc.

References util::abs(), and priv_OpDetBTRs.

Referenced by OpHitToEveSimSDPs_Ps(), and cheat::PhotonBackTrackerService::TrackIdToSimSDPs_Ps().

103  {
104  std::vector<const sim::SDP*> sdp_Ps;
105  for (size_t odet = 0; odet < priv_OpDetBTRs.size(); ++odet) {
106  const auto& pdTimeSDPmap = priv_OpDetBTRs[odet]->timePDclockSDPsMap();
107  for (auto mapitr = pdTimeSDPmap.begin(); mapitr != pdTimeSDPmap.end(); mapitr++) {
108  std::vector<sim::SDP> const& sdpvec = (*mapitr).second;
109  for (size_t iv = 0; iv < sdpvec.size(); ++iv) {
110  // const sim::SDP* const sdp_P = &sdpvec[iv];
111  if (abs(sdpvec[iv].trackID) == id) sdp_Ps.push_back(&(sdpvec[iv]));
112  }
113  } // end loop over map from sim::OpDetBacktrackerRecord
114 
115  } // end loop over sim::OpDetBacktrackerRecords
116  return sdp_Ps;
117  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > priv_OpDetBTRs
const std::vector< const sim::SDP * > cheat::PhotonBackTracker::TrackIdToSimSDPs_Ps ( int const &  id,
geo::View_t const &  view 
)

Definition at line 120 of file PhotonBackTracker.cc.

122  {
123  throw cet::exception("PhotonBackTracker")
124  << "PhotonBackTracker is not equiped to handle geo::Views.";
125  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > cheat::PhotonBackTracker::cOpDetBacktrackerRecords
private

all the OpDetBacktrackerRecords for the event

Definition at line 194 of file old.PhotonBackTracker.h.

Referenced by FindOpDetBacktrackerRecord(), OpDetBacktrackerRecords(), Rebuild(), and TrackIDToSimSDP().

const double cheat::PhotonBackTracker::fDelay
private

Definition at line 287 of file PhotonBackTracker.h.

std::string cheat::PhotonBackTracker::fG4ModuleLabel
private

label for geant4 module

Definition at line 196 of file old.PhotonBackTracker.h.

Referenced by OpDetBacktrackerRecords(), Rebuild(), and ~PhotonBackTracker().

const art::InputTag cheat::PhotonBackTracker::fG4ModuleLabel
private

Definition at line 288 of file PhotonBackTracker.h.

const std::vector<art::InputTag> cheat::PhotonBackTracker::fG4ModuleLabels
private

Definition at line 289 of file PhotonBackTracker.h.

const geo::GeometryCore* cheat::PhotonBackTracker::fGeom
private

Definition at line 285 of file PhotonBackTracker.h.

Referenced by OpHitToSimSDPs_Ps(), OpHitToTrackSDPs(), and TrackIdsToOpHits_Ps().

std::vector< art::Ptr< simb::MCTruth > > cheat::PhotonBackTracker::fMCTruthList
private

all the MCTruths for the event

Definition at line 192 of file old.PhotonBackTracker.h.

Referenced by MCTruthVector(), OpDetBacktrackerRecords(), Rebuild(), and TrackIDToMCTruth().

double cheat::PhotonBackTracker::fMinOpHitEnergyFraction
private
const double cheat::PhotonBackTracker::fMinOpHitEnergyFraction
private

Definition at line 292 of file PhotonBackTracker.h.

const art::InputTag cheat::PhotonBackTracker::fOpFlashLabel
private

Definition at line 291 of file PhotonBackTracker.h.

Referenced by PhotonBackTracker().

const art::InputTag cheat::PhotonBackTracker::fOpHitLabel
private

Definition at line 290 of file PhotonBackTracker.h.

Referenced by PhotonBackTracker().

sim::ParticleList cheat::PhotonBackTracker::fParticleList
private
const cheat::ParticleInventory* cheat::PhotonBackTracker::fPartInv
private

Definition at line 284 of file PhotonBackTracker.h.

Referenced by GetSetOfEveIds(), GetSetOfTrackIds(), and OpHitToEveTrackSDPs().

std::map< int, int > cheat::PhotonBackTracker::fTrackIDToMCTruthIndex
private

map of track ids to MCTruthList entry

Definition at line 195 of file old.PhotonBackTracker.h.

Referenced by OpDetBacktrackerRecords(), Rebuild(), and TrackIDToMCTruth().

sim::LArVoxelList cheat::PhotonBackTracker::fVoxelList
private

List to map the position of energy depostions in voxels to the particles depositing the energy

Definition at line 189 of file old.PhotonBackTracker.h.

Referenced by OpDetBacktrackerRecords().

geo::GeometryCore const * cheat::PhotonBackTracker::geom = lar::providerFrom<geo::Geometry>()
private
bool cheat::PhotonBackTracker::have_complained
private
std::vector<art::Ptr<sim::OpDetBacktrackerRecord> > cheat::PhotonBackTracker::priv_OpDetBTRs
mutableprivate
std::map<art::Ptr<recob::OpFlash>, std::vector<art::Ptr<recob::OpHit> > > cheat::PhotonBackTracker::priv_OpFlashToOpHits
private

Definition at line 294 of file PhotonBackTracker.h.

Referenced by ClearEvent(), OpFlashToOpHits_Ps(), and OpFlashToOpHitsReady().


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