LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::OpDetPhotonTable Class Reference

#include "OpDetPhotonTable.h"

Public Member Functions

 ~OpDetPhotonTable ()
 
void AddPhoton (size_t opchannel, sim::OnePhoton &&photon, bool Reflected=false)
 
void AddLitePhoton (int opchannel, int time, int nphotons, bool Reflected=false)
 
void AddPhoton (std::map< int, std::map< int, int >> *StepPhotonTable, bool Reflected=false)
 
void AddLitePhotons (std::map< int, std::map< int, int >> *StepPhotonTable, bool Reflected=false)
 
std::vector< sim::SimPhotons > & GetPhotons (bool Reflected=false)
 
std::vector< sim::SimPhotons > & GetReflectedPhotons ()
 
sim::SimPhotonsGetPhotonsForOpChannel (size_t opchannel)
 
sim::SimPhotonsGetReflectedPhotonsForOpChannel (size_t opchannel)
 
std::map< int, std::map< int, int > > GetLitePhotons (bool Reflected=false)
 
std::map< int, std::map< int, int > > GetReflectedLitePhotons ()
 
std::map< int, int > & GetLitePhotonsForOpChannel (int opchannel)
 
std::map< int, int > & GetReflectedLitePhotonsForOpChannel (int opchannel)
 
void ClearTable (size_t nch=0)
 
void AddOpDetBacktrackerRecord (sim::OpDetBacktrackerRecord soc, bool Reflected=false)
 
std::vector< sim::OpDetBacktrackerRecordYieldOpDetBacktrackerRecords ()
 
std::vector< sim::OpDetBacktrackerRecordYieldReflectedOpDetBacktrackerRecords ()
 
void ClearEnergyDeposits ()
 
void AddEnergyDeposit (int n_photon, int n_elec, double scint_yield, double energy, float start_x, float start_y, float start_z, float end_x, float end_y, float end_z, double start_time, double end_time, int trackid, int pdgcode, int g4trackid, std::string const &vol="EMPTY")
 
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > const & GetSimEnergyDeposits () const
 Returns the map of energy deposits by volume name. More...
 
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > YieldSimEnergyDeposits ()
 Yields the map of energy deposits by volume name, and resets the internal one. More...
 

Static Public Member Functions

static OpDetPhotonTableInstance (bool LitePhotons=false)
 

Protected Member Functions

 OpDetPhotonTable ()
 

Private Member Functions

void AddOpDetBacktrackerRecord (std::vector< sim::OpDetBacktrackerRecord > &RecordsCol, std::map< int, int > &ChannelMap, sim::OpDetBacktrackerRecord soc)
 

Private Attributes

std::map< int, std::map< int, int > > fLitePhotons
 
std::map< int, std::map< int, int > > fReflectedLitePhotons
 
std::vector< sim::OpDetBacktrackerRecordcOpDetBacktrackerRecordsCol
 
std::vector< sim::OpDetBacktrackerRecordcReflectedOpDetBacktrackerRecordsCol
 
std::map< int, int > cOpChannelToSOCMap
 
std::map< int, int > cReflectedOpChannelToSOCMap
 
std::vector< sim::SimPhotonsfDetectedPhotons
 
std::vector< sim::SimPhotonsfReflectedDetectedPhotons
 
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
 

Detailed Description

Definition at line 47 of file OpDetPhotonTable.h.

Constructor & Destructor Documentation

larg4::OpDetPhotonTable::~OpDetPhotonTable ( )

Definition at line 28 of file OpDetPhotonTable.cxx.

28 {}
larg4::OpDetPhotonTable::OpDetPhotonTable ( )
protected

Definition at line 23 of file OpDetPhotonTable.cxx.

References fDetectedPhotons, and fReflectedDetectedPhotons.

Referenced by GetReflectedLitePhotonsForOpChannel(), and Instance().

24  {
25  fDetectedPhotons.clear();
27  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > fDetectedPhotons

Member Function Documentation

void larg4::OpDetPhotonTable::AddEnergyDeposit ( int  n_photon,
int  n_elec,
double  scint_yield,
double  energy,
float  start_x,
float  start_y,
float  start_z,
float  end_x,
float  end_y,
float  end_z,
double  start_time,
double  end_time,
int  trackid,
int  pdgcode,
int  g4trackid,
std::string const &  vol = "EMPTY" 
)

Definition at line 191 of file OpDetPhotonTable.cxx.

References fSimEDepCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::OpFastScintillation::ProcessStep().

207  {
208  fSimEDepCol[vol].emplace_back(n_photon,
209  n_elec,
210  scint_yield,
211  energy,
212  geo::Point_t{start_x, start_y, start_z},
213  geo::Point_t{end_x, end_y, end_z},
214  start_time,
215  end_time,
216  trackid,
217  pdgcode,
218  g4trackid);
219  }
double energy
Definition: plottest35.C:25
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
void larg4::OpDetPhotonTable::AddLitePhoton ( int  opchannel,
int  time,
int  nphotons,
bool  Reflected = false 
)

Definition at line 54 of file OpDetPhotonTable.cxx.

References fLitePhotons, and fReflectedLitePhotons.

Referenced by larg4::OpDetSensitiveDetector::AddLitePhoton(), and larg4::OpFastScintillation::RecordPhotonsProduced().

55  {
56  if (!Reflected)
57  fLitePhotons[opchannel][time] += nphotons;
58  else
59  fReflectedLitePhotons[opchannel][time] += nphotons;
60  }
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
void larg4::OpDetPhotonTable::AddLitePhotons ( std::map< int, std::map< int, int >> *  StepPhotonTable,
bool  Reflected = false 
)
inline

Definition at line 55 of file OpDetPhotonTable.h.

References AddPhoton().

56  {
57  AddPhoton(StepPhotonTable, Reflected);
58  }
void AddPhoton(size_t opchannel, sim::OnePhoton &&photon, bool Reflected=false)
void larg4::OpDetPhotonTable::AddOpDetBacktrackerRecord ( sim::OpDetBacktrackerRecord  soc,
bool  Reflected = false 
)

Definition at line 78 of file OpDetPhotonTable.cxx.

References cOpChannelToSOCMap, cOpDetBacktrackerRecordsCol, cReflectedOpChannelToSOCMap, and cReflectedOpDetBacktrackerRecordsCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::OpFastScintillation::RecordPhotonsProduced().

79  {
80  // std::cout << "DEBUG: Adding to " << (Reflected?"Reflected":"Direct") << " cOpDetBTR" << std::endl;
81  if (!Reflected)
83  else
86  }
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::map< int, int > cOpChannelToSOCMap
std::map< int, int > cReflectedOpChannelToSOCMap
void larg4::OpDetPhotonTable::AddOpDetBacktrackerRecord ( std::vector< sim::OpDetBacktrackerRecord > &  RecordsCol,
std::map< int, int > &  ChannelMap,
sim::OpDetBacktrackerRecord  soc 
)
private

Definition at line 89 of file OpDetPhotonTable.cxx.

References sim::OpDetBacktrackerRecord::OpDetNum(), and sim::OpDetBacktrackerRecord::timePDclockSDPsMap().

93  {
94  int iChan = soc.OpDetNum();
95  std::map<int, int>::iterator channelPosition = ChannelMap.find(iChan);
96  if (channelPosition == ChannelMap.end()) {
97  ChannelMap[iChan] = RecordsCol.size();
98  RecordsCol.emplace_back(std::move(soc));
99  }
100  else {
101  unsigned int idtest = channelPosition->second;
102  auto const& timePDclockSDPsMap = soc.timePDclockSDPsMap();
103  for (auto const& timePDclockSDP : timePDclockSDPsMap) {
104  for (auto const& sdp : timePDclockSDP.second) {
105  double xyz[3] = {sdp.x, sdp.y, sdp.z};
106  RecordsCol.at(idtest).AddScintillationPhotons(
107  sdp.trackID, timePDclockSDP.first, sdp.numPhotons, xyz, sdp.energy);
108  } //end sdp : timesdp.second
109  } //end const timesdp : timeSDPMap
110  } // if chanPos == cOpChan else
111 
112  // std::cout << "DEBUG: Add to " << iChan << " to cOpDetBTR. Now " << RecordsCol.size() << " in size " << std::endl;
113  } //END void OpDetPhotonTable::AdOpDetBacktrackerRecords
intermediate_table::iterator iterator
int OpDetNum() const
Returns the readout Optical Detector this object describes.
timePDclockSDPs_t const & timePDclockSDPsMap() const
Returns all the deposited energy information as stored.
void larg4::OpDetPhotonTable::AddPhoton ( size_t  opchannel,
sim::OnePhoton &&  photon,
bool  Reflected = false 
)

Definition at line 38 of file OpDetPhotonTable.cxx.

References fDetectedPhotons, and fReflectedDetectedPhotons.

Referenced by AddLitePhotons(), larg4::OpDetSensitiveDetector::AddPhoton(), and larg4::OpFastScintillation::RecordPhotonsProduced().

39  {
40  if (opchannel >= fDetectedPhotons.size()) {
41 
42  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
43  << "\033[93m"
44  << "Invalid channel: " << opchannel << "\033[00m" << std::endl;
45  throw std::exception();
46  }
47  if (!Reflected)
48  fDetectedPhotons.at(opchannel).push_back(photon);
49  else
50  fReflectedDetectedPhotons.at(opchannel).push_back(photon);
51  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > fDetectedPhotons
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void larg4::OpDetPhotonTable::AddPhoton ( std::map< int, std::map< int, int >> *  StepPhotonTable,
bool  Reflected = false 
)

Definition at line 63 of file OpDetPhotonTable.cxx.

References fLitePhotons, and fReflectedLitePhotons.

65  {
66  for (auto it = StepPhotonTable->begin(); it != StepPhotonTable->end(); it++) {
67  for (auto in_it = it->second.begin(); in_it != it->second.end(); in_it++) {
68  if (!Reflected)
69  fLitePhotons[it->first][in_it->first] += in_it->second;
70  else
71  fReflectedLitePhotons[it->first][in_it->first] += in_it->second;
72  }
73  }
74  }
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
void larg4::OpDetPhotonTable::ClearEnergyDeposits ( )

Definition at line 222 of file OpDetPhotonTable.cxx.

References fSimEDepCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), larg4::LArG4::produce(), and YieldSimEnergyDeposits().

223  {
224  fSimEDepCol.clear();
225  }
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
void larg4::OpDetPhotonTable::ClearTable ( size_t  nch = 0)

Definition at line 147 of file OpDetPhotonTable.cxx.

References fDetectedPhotons, fLitePhotons, fReflectedDetectedPhotons, and fReflectedLitePhotons.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::LArG4::produce().

148  {
149  if (fDetectedPhotons.size() != nch) fDetectedPhotons.resize(nch);
150  for (size_t i = 0; i < fDetectedPhotons.size(); ++i) {
151  fDetectedPhotons.at(i).clear();
152  fDetectedPhotons.at(i).SetChannel(i);
153  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
154  }
155  if (fReflectedDetectedPhotons.size() != nch) fReflectedDetectedPhotons.resize(nch);
156  for (size_t i = 0; i < fReflectedDetectedPhotons.size(); ++i) {
157  fReflectedDetectedPhotons.at(i).clear();
158  fReflectedDetectedPhotons.at(i).SetChannel(i);
159  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
160  }
161 
162  for (auto it = fLitePhotons.begin(); it != fLitePhotons.end(); ++it)
163  (it->second).clear();
164  for (auto it = fReflectedLitePhotons.begin(); it != fReflectedLitePhotons.end(); ++it)
165  (it->second).clear();
166  fLitePhotons.clear();
167  fReflectedLitePhotons.clear();
168  }
std::map< int, std::map< int, int > > fLitePhotons
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > fDetectedPhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::GetLitePhotons ( bool  Reflected = false)
inline

Definition at line 68 of file OpDetPhotonTable.h.

References fLitePhotons, and fReflectedLitePhotons.

Referenced by GetReflectedLitePhotons(), and larg4::LArG4::produce().

69  {
70  return (Reflected ? fReflectedLitePhotons : fLitePhotons);
71  }
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
std::map<int, int>& larg4::OpDetPhotonTable::GetLitePhotonsForOpChannel ( int  opchannel)
inline

Definition at line 73 of file OpDetPhotonTable.h.

References fLitePhotons.

74  {
75  return fLitePhotons[opchannel];
76  }
std::map< int, std::map< int, int > > fLitePhotons
std::vector<sim::SimPhotons>& larg4::OpDetPhotonTable::GetPhotons ( bool  Reflected = false)
inline

Definition at line 60 of file OpDetPhotonTable.h.

References fDetectedPhotons, and fReflectedDetectedPhotons.

Referenced by GetReflectedPhotons(), and larg4::LArG4::produce().

61  {
62  return (Reflected ? fReflectedDetectedPhotons : fDetectedPhotons);
63  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > fDetectedPhotons
sim::SimPhotons & larg4::OpDetPhotonTable::GetPhotonsForOpChannel ( size_t  opchannel)

Definition at line 171 of file OpDetPhotonTable.cxx.

References fDetectedPhotons.

Referenced by GetReflectedPhotons().

172  {
173  if (opchannel >= fDetectedPhotons.size()) {
174  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
175  << "Invalid channel Number: " << opchannel << std::endl;
176  }
177  return fDetectedPhotons.at(opchannel);
178  }
std::vector< sim::SimPhotons > fDetectedPhotons
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::GetReflectedLitePhotons ( )
inline

Definition at line 72 of file OpDetPhotonTable.h.

References GetLitePhotons().

72 { return GetLitePhotons(true); }
std::map< int, std::map< int, int > > GetLitePhotons(bool Reflected=false)
std::map<int, int>& larg4::OpDetPhotonTable::GetReflectedLitePhotonsForOpChannel ( int  opchannel)
inline
std::vector<sim::SimPhotons>& larg4::OpDetPhotonTable::GetReflectedPhotons ( )
inline

Definition at line 64 of file OpDetPhotonTable.h.

References GetPhotons(), GetPhotonsForOpChannel(), and GetReflectedPhotonsForOpChannel().

64 { return GetPhotons(true); }
std::vector< sim::SimPhotons > & GetPhotons(bool Reflected=false)
sim::SimPhotons & larg4::OpDetPhotonTable::GetReflectedPhotonsForOpChannel ( size_t  opchannel)

Definition at line 181 of file OpDetPhotonTable.cxx.

References fReflectedDetectedPhotons.

Referenced by GetReflectedPhotons().

182  {
183  if (opchannel >= fReflectedDetectedPhotons.size()) {
184  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
185  << "Invalid channel Number: " << opchannel << std::endl;
186  }
187  return fReflectedDetectedPhotons.at(opchannel);
188  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > const & larg4::OpDetPhotonTable::GetSimEnergyDeposits ( ) const

Returns the map of energy deposits by volume name.

Definition at line 229 of file OpDetPhotonTable.cxx.

References fSimEDepCol.

Referenced by GetReflectedLitePhotonsForOpChannel().

230  {
231  return fSimEDepCol;
232  }
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldOpDetBacktrackerRecords ( )

Definition at line 117 of file OpDetPhotonTable.cxx.

References cOpChannelToSOCMap, and cOpDetBacktrackerRecordsCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::LArG4::produce().

118  {
119  // we give the result to the caller, and don't retain it
120  std::vector<sim::OpDetBacktrackerRecord> result;
121  // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
122  // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
124  // std::cout << "DEBUG: std::swap(result, cOpDetBacktrackerRecordsCol);" << std::endl;
125  // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
126  // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
127  cOpChannelToSOCMap.clear();
128  return result;
129  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::map< int, int > cOpChannelToSOCMap
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldReflectedOpDetBacktrackerRecords ( )

Definition at line 133 of file OpDetPhotonTable.cxx.

References cReflectedOpChannelToSOCMap, and cReflectedOpDetBacktrackerRecordsCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::LArG4::produce().

134  {
135  // we give the result to the caller, and don't retain it
136  std::vector<sim::OpDetBacktrackerRecord> result;
137  // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
138  // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
140  // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
141  // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
143  return result;
144  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
std::map< int, int > cReflectedOpChannelToSOCMap
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > larg4::OpDetPhotonTable::YieldSimEnergyDeposits ( )

Yields the map of energy deposits by volume name, and resets the internal one.

Definition at line 236 of file OpDetPhotonTable.cxx.

References ClearEnergyDeposits(), and fSimEDepCol.

Referenced by GetReflectedLitePhotonsForOpChannel(), and larg4::LArG4::produce().

237  {
238  auto data{std::move(fSimEDepCol)};
240  return data;
241  }
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol

Member Data Documentation

std::map<int, int> larg4::OpDetPhotonTable::cOpChannelToSOCMap
private

Definition at line 126 of file OpDetPhotonTable.h.

Referenced by AddOpDetBacktrackerRecord(), and YieldOpDetBacktrackerRecords().

std::vector<sim::OpDetBacktrackerRecord> larg4::OpDetPhotonTable::cOpDetBacktrackerRecordsCol
private

Definition at line 123 of file OpDetPhotonTable.h.

Referenced by AddOpDetBacktrackerRecord(), and YieldOpDetBacktrackerRecords().

std::map<int, int> larg4::OpDetPhotonTable::cReflectedOpChannelToSOCMap
private
std::vector<sim::OpDetBacktrackerRecord> larg4::OpDetPhotonTable::cReflectedOpDetBacktrackerRecordsCol
private
std::vector<sim::SimPhotons> larg4::OpDetPhotonTable::fDetectedPhotons
private
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::fLitePhotons
private
std::vector<sim::SimPhotons> larg4::OpDetPhotonTable::fReflectedDetectedPhotons
private
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::fReflectedLitePhotons
private
std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > larg4::OpDetPhotonTable::fSimEDepCol
private

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