LArSoft  v10_06_00
Liquid Argon Software toolkit - https://larsoft.org/
sim::OBTRHelper Class Reference

#include "OpDetBacktrackerRecord.h"

Public Types

typedef double timePDclock_t
 
typedef SDP::TrackID_t TrackID_t
 

Public Member Functions

 OBTRHelper (TrackID_t trackID)
 
void AddScintillationPhotonsToMap (TrackID_t trackID, timePDclock_t iTimePDclock, double numberPhotons, double const *xyz, double energy)
 

Private Attributes

std::map< timePDclock_t, std::vector< sim::SDP > > fTimePDclockSDPs
 
TrackID_t fTrackID
 

Friends

class OpDetBacktrackerRecord
 

Detailed Description

Definition at line 88 of file OpDetBacktrackerRecord.h.

Member Typedef Documentation

Definition at line 92 of file OpDetBacktrackerRecord.h.

Constructor & Destructor Documentation

sim::OBTRHelper::OBTRHelper ( TrackID_t  trackID)
inline

Definition at line 95 of file OpDetBacktrackerRecord.h.

References sim::TrackSDP::energy, and sim::TrackSDP::trackID.

95 : fTrackID(trackID) {}

Member Function Documentation

void sim::OBTRHelper::AddScintillationPhotonsToMap ( TrackID_t  trackID,
timePDclock_t  iTimePDclock,
double  numberPhotons,
double const *  xyz,
double  energy 
)

The iTimePDclock from OpFastScintillation (where OpDetBacktrackerRecords originate) is done with CLHEP::ns (units of nanoseconds).

Definition at line 25 of file OpDetBacktrackerRecord.cxx.

References energy, fTimePDclockSDPs, MF_LOG_ERROR, and weight.

32  {
36  // look at the collection to see if the current iTimePDclock already
37  // exists, if not, add it, if so, just add a new track id to the
38  // vector, or update the information if track is already present
39 
40  // no photons? no good!
41  if ((numberPhotons < std::numeric_limits<double>::epsilon()) ||
42  (energy <= std::numeric_limits<double>::epsilon())) {
43  // will throw
44  MF_LOG_ERROR("OpDetBacktrackerRecord")
45  << "AddTrackPhotons() trying to add to iTimePDclock #" << iTimePDclock << " "
46  << numberPhotons << " photons with " << energy
47  << " MeV of energy from track ID=" << trackID;
48  return;
49  } // if no photons
50 
51  int rounded_time = std::round(iTimePDclock);
52 
53  auto itr = fTimePDclockSDPs.lower_bound(rounded_time);
54 
55  // check if this iTimePDclock value is in the vector, it is possible that
56  // the lower bound is different from the given TimePDclock, in which case
57  // we need to add something for that TimePDclock
58  if (itr == fTimePDclockSDPs.end() || fTimePDclockSDPs.key_comp()(rounded_time, itr->first)) {
59  fTimePDclockSDPs.insert(
60  {rounded_time,
61  std::vector<sim::SDP>{sim::SDP(trackID, numberPhotons, energy, xyz[0], xyz[1], xyz[2])}});
62  }
63  else { // we have that iTimePDclock already; itr points to it
64 
65  // loop over the SDP vector for this iTimePDclock and add the electrons
66  // to the entry with the same track id
67  for (auto& sdp : itr->second) {
68 
69  if (sdp.trackID != trackID) continue;
70 
71  // make a weighted average for the location information
72  double weight = sdp.numPhotons + numberPhotons;
73  sdp.x = (sdp.x * sdp.numPhotons + xyz[0] * numberPhotons) / weight;
74  sdp.y = (sdp.y * sdp.numPhotons + xyz[1] * numberPhotons) / weight;
75  sdp.z = (sdp.z * sdp.numPhotons + xyz[2] * numberPhotons) / weight;
76  sdp.numPhotons = weight;
77  sdp.energy = sdp.energy + energy;
78 
79  // found the track id we wanted, so return;
80  return;
81  } // for
82 
83  // if we never found the track id, then this is the first instance of
84  // the track id for this TimePDclock, so add sdp to the vector
85  itr->second.emplace_back(trackID, numberPhotons, energy, xyz[0], xyz[1], xyz[2]);
86 
87  } // end of else "We have that iTimePDclock already"
88 
89  } // OBTRHelper::AddIonizationElectrons()
#define MF_LOG_ERROR(category)
double energy
Definition: plottest35.C:25
std::map< timePDclock_t, std::vector< sim::SDP > > fTimePDclockSDPs
double weight
Definition: plottest35.C:25

Friends And Related Function Documentation

friend class OpDetBacktrackerRecord
friend

Definition at line 89 of file OpDetBacktrackerRecord.h.

Member Data Documentation

std::map<timePDclock_t, std::vector<sim::SDP> > sim::OBTRHelper::fTimePDclockSDPs
private
TrackID_t sim::OBTRHelper::fTrackID
private

Definition at line 107 of file OpDetBacktrackerRecord.h.


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