LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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_elec, int n_photon, 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, std::string const &vol="EMPTY")
 
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > const & GetSimEnergyDeposits () const
 

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 57 of file OpDetPhotonTable.h.

Constructor & Destructor Documentation

larg4::OpDetPhotonTable::~OpDetPhotonTable ( )

Definition at line 32 of file OpDetPhotonTable.cxx.

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

Definition at line 28 of file OpDetPhotonTable.cxx.

References fDetectedPhotons.

Referenced by Instance().

29  {
30  fDetectedPhotons.clear();
31  }
std::vector< sim::SimPhotons > fDetectedPhotons

Member Function Documentation

void larg4::OpDetPhotonTable::AddEnergyDeposit ( int  n_elec,
int  n_photon,
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,
std::string const &  vol = "EMPTY" 
)

Definition at line 205 of file OpDetPhotonTable.cxx.

References fSimEDepCol.

Referenced by larg4::OpFastScintillation::ProcessStep().

212  {
213  fSimEDepCol[vol].emplace_back(n_elec,n_photon,
214  energy,
215  geo::Point_t{start_x,start_y,start_z},
216  geo::Point_t{end_x,end_y,end_z},
217  start_time,end_time,
218  trackid,pdgcode);
219  }
double energy
Definition: plottest35.C:25
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
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:187
void larg4::OpDetPhotonTable::AddLitePhoton ( int  opchannel,
int  time,
int  nphotons,
bool  Reflected = false 
)

Definition at line 65 of file OpDetPhotonTable.cxx.

References fLitePhotons, and fReflectedLitePhotons.

Referenced by larg4::OpFastScintillation::RecordPhotonsProduced().

66  {
67  if (!Reflected)
68  fLitePhotons[opchannel][time] += nphotons;
69  else
70  fReflectedLitePhotons[opchannel][time] += nphotons;
71  }
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 66 of file OpDetPhotonTable.h.

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

Definition at line 90 of file OpDetPhotonTable.cxx.

References cOpChannelToSOCMap, cOpDetBacktrackerRecordsCol, cReflectedOpChannelToSOCMap, and cReflectedOpDetBacktrackerRecordsCol.

Referenced by larg4::OpFastScintillation::RecordPhotonsProduced().

90  {
91 // std::cout << "DEBUG: Adding to " << (Reflected?"Reflected":"Direct") << " cOpDetBTR" << std::endl;
92  if (!Reflected)
94  else
96  }
void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false)
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
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 99 of file OpDetPhotonTable.cxx.

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

101  {
102  int iChan = soc.OpDetNum();
103  std::map<int, int>::iterator channelPosition = ChannelMap.find(iChan);
104  if (channelPosition == ChannelMap.end() ){
105  ChannelMap[iChan] = RecordsCol.size();
106  RecordsCol.emplace_back(std::move(soc));
107  }else{
108  unsigned int idtest = channelPosition->second;
109  auto const& timePDclockSDPsMap = soc.timePDclockSDPsMap();
110  for(auto const& timePDclockSDP : timePDclockSDPsMap){
111  for(auto const& sdp : timePDclockSDP.second){
112  double xyz[3] = {sdp.x, sdp.y, sdp.z};
113  RecordsCol.at(idtest).AddScintillationPhotons(
114  sdp.trackID,
115  timePDclockSDP.first,
116  sdp.numPhotons,
117  xyz,
118  sdp.energy);
119  }//end sdp : timesdp.second
120  }//end const timesdp : timeSDPMap
121  }// if chanPos == cOpChan else
122 
123 
124 // std::cout << "DEBUG: Add to " << iChan << " to cOpDetBTR. Now " << RecordsCol.size() << " in size " << std::endl;
125  }//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 47 of file OpDetPhotonTable.cxx.

References fDetectedPhotons, and fReflectedDetectedPhotons.

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

48  {
49  if( opchannel >= fDetectedPhotons.size() ) {
50 
51  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
52  << "\033[93m"
53  << "Invalid channel: " << opchannel
54  << "\033[00m"
55  << std::endl;
56  throw std::exception();
57  }
58  if (!Reflected)
59  fDetectedPhotons.at(opchannel).push_back(photon);
60  else
61  fReflectedDetectedPhotons.at(opchannel).push_back(photon);
62  }
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 74 of file OpDetPhotonTable.cxx.

References fLitePhotons, and fReflectedLitePhotons.

75  {
76  for(auto it = StepPhotonTable->begin(); it!=StepPhotonTable->end(); it++)
77  {
78  for(auto in_it = it->second.begin(); in_it!=it->second.end(); in_it++)
79  {
80  if (!Reflected)
81  fLitePhotons[it->first][in_it->first]+= in_it->second;
82  else
83  fReflectedLitePhotons[it->first][in_it->first]+= in_it->second;
84  }
85  }
86  }
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 larg4::LArG4::produce().

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

Definition at line 159 of file OpDetPhotonTable.cxx.

References fDetectedPhotons, fLitePhotons, fReflectedDetectedPhotons, and fReflectedLitePhotons.

Referenced by larg4::LArG4::produce().

160  {
161  if(fDetectedPhotons.size() != nch) fDetectedPhotons.resize(nch);
162  for(size_t i=0; i<fDetectedPhotons.size(); ++i) {
163  fDetectedPhotons.at(i).clear();
164  fDetectedPhotons.at(i).SetChannel(i);
165  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
166  }
167  for(size_t i=0; i<fReflectedDetectedPhotons.size(); ++i) {
168  fReflectedDetectedPhotons.at(i).clear();
169  fReflectedDetectedPhotons.at(i).SetChannel(i);
170  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
171  }
172 
173  for(auto it=fLitePhotons.begin(); it!=fLitePhotons.end(); ++it)
174  (it->second).clear();
175  for(auto it=fReflectedLitePhotons.begin(); it!=fReflectedLitePhotons.end(); ++it)
176  (it->second).clear();
177  fLitePhotons.clear();
178  fReflectedLitePhotons.clear();
179  }
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > fDetectedPhotons
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::GetLitePhotons ( bool  Reflected = false)
inline

Definition at line 73 of file OpDetPhotonTable.h.

Referenced by larg4::LArG4::produce().

73 { return (Reflected ? fReflectedLitePhotons : fLitePhotons ); }
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 75 of file OpDetPhotonTable.h.

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

Definition at line 68 of file OpDetPhotonTable.h.

Referenced by larg4::LArG4::produce().

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

Definition at line 182 of file OpDetPhotonTable.cxx.

References fDetectedPhotons.

183  {
184  if(opchannel >= fDetectedPhotons.size()) {
185  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
186  << "Invalid channel Number: " << opchannel
187  << std::endl;
188  }
189  return fDetectedPhotons.at(opchannel);
190  }
std::vector< sim::SimPhotons > fDetectedPhotons
std::map<int, std::map<int, int> > larg4::OpDetPhotonTable::GetReflectedLitePhotons ( )
inline

Definition at line 74 of file OpDetPhotonTable.h.

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

Definition at line 76 of file OpDetPhotonTable.h.

References energy.

76 { return fReflectedLitePhotons[opchannel]; }
std::map< int, std::map< int, int > > fReflectedLitePhotons
std::vector<sim::SimPhotons >& larg4::OpDetPhotonTable::GetReflectedPhotons ( )
inline

Definition at line 69 of file OpDetPhotonTable.h.

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

Definition at line 193 of file OpDetPhotonTable.cxx.

References fReflectedDetectedPhotons.

194  {
195  if(opchannel >= fReflectedDetectedPhotons.size()) {
196  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
197  << "Invalid channel Number: " << opchannel
198  << std::endl;
199  }
200  return fReflectedDetectedPhotons.at(opchannel);
201  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > const & larg4::OpDetPhotonTable::GetSimEnergyDeposits ( ) const

Definition at line 227 of file OpDetPhotonTable.cxx.

References fSimEDepCol.

Referenced by larg4::LArG4::produce().

228  { return fSimEDepCol; }
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
OpDetPhotonTable * larg4::OpDetPhotonTable::Instance ( bool  LitePhotons = false)
static
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldOpDetBacktrackerRecords ( )

Definition at line 130 of file OpDetPhotonTable.cxx.

References cOpChannelToSOCMap, and cOpDetBacktrackerRecordsCol.

Referenced by larg4::LArG4::produce().

130  {
131  // we give the result to the caller, and don't retain it
132  std::vector<sim::OpDetBacktrackerRecord> result;
133 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
134 // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
136 // std::cout << "DEBUG: std::swap(result, cOpDetBacktrackerRecordsCol);" << std::endl;
137 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
138 // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
139  cOpChannelToSOCMap.clear();
140  return result;
141  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::map< int, int > cOpChannelToSOCMap
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldReflectedOpDetBacktrackerRecords ( )

Definition at line 145 of file OpDetPhotonTable.cxx.

References cReflectedOpChannelToSOCMap, and cReflectedOpDetBacktrackerRecordsCol.

Referenced by larg4::LArG4::produce().

145  {
146  // we give the result to the caller, and don't retain it
147  std::vector<sim::OpDetBacktrackerRecord> result;
148 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
149 // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
151 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
152 // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
154  return result;
155  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
std::map< int, int > cReflectedOpChannelToSOCMap

Member Data Documentation

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

Definition at line 110 of file OpDetPhotonTable.h.

Referenced by AddOpDetBacktrackerRecord(), and YieldOpDetBacktrackerRecords().

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

Definition at line 108 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

Definition at line 106 of file OpDetPhotonTable.h.

Referenced by AddLitePhoton(), AddPhoton(), and ClearTable().

std::vector<sim::SimPhotons> larg4::OpDetPhotonTable::fReflectedDetectedPhotons
private

Definition at line 113 of file OpDetPhotonTable.h.

Referenced by AddPhoton(), ClearTable(), and GetReflectedPhotonsForOpChannel().

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

Definition at line 107 of file OpDetPhotonTable.h.

Referenced by AddLitePhoton(), AddPhoton(), and ClearTable().

std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > larg4::OpDetPhotonTable::fSimEDepCol
private

Definition at line 116 of file OpDetPhotonTable.h.

Referenced by AddEnergyDeposit(), ClearEnergyDeposits(), and GetSimEnergyDeposits().


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