Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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, 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.

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,
std::string const &  vol = "EMPTY" 
)

Definition at line 202 of file OpDetPhotonTable.cxx.

209  {
210  fSimEDepCol[vol].emplace_back(n_photon, n_elec, 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,end_time,
215  trackid,pdgcode);
216  }
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:184
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 61 of file OpDetPhotonTable.cxx.

62  {
63  if (!Reflected)
64  fLitePhotons[opchannel][time] += nphotons;
65  else
66  fReflectedLitePhotons[opchannel][time] += nphotons;
67  }
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 56 of file OpDetPhotonTable.h.

56 { 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 86 of file OpDetPhotonTable.cxx.

86  {
87 // std::cout << "DEBUG: Adding to " << (Reflected?"Reflected":"Direct") << " cOpDetBTR" << std::endl;
88  if (!Reflected)
90  else
92  }
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 95 of file OpDetPhotonTable.cxx.

97  {
98  int iChan = soc.OpDetNum();
99  std::map<int, int>::iterator channelPosition = ChannelMap.find(iChan);
100  if (channelPosition == ChannelMap.end() ){
101  ChannelMap[iChan] = RecordsCol.size();
102  RecordsCol.emplace_back(std::move(soc));
103  }else{
104  unsigned int idtest = channelPosition->second;
105  auto const& timePDclockSDPsMap = soc.timePDclockSDPsMap();
106  for(auto const& timePDclockSDP : timePDclockSDPsMap){
107  for(auto const& sdp : timePDclockSDP.second){
108  double xyz[3] = {sdp.x, sdp.y, sdp.z};
109  RecordsCol.at(idtest).AddScintillationPhotons(
110  sdp.trackID,
111  timePDclockSDP.first,
112  sdp.numPhotons,
113  xyz,
114  sdp.energy);
115  }//end sdp : timesdp.second
116  }//end const timesdp : timeSDPMap
117  }// if chanPos == cOpChan else
118 
119 
120 // std::cout << "DEBUG: Add to " << iChan << " to cOpDetBTR. Now " << RecordsCol.size() << " in size " << std::endl;
121  }//END void OpDetPhotonTable::AdOpDetBacktrackerRecords
intermediate_table::iterator iterator
int OpDetNum() const
Returns the readout Optical Detector this object describes.
def move(depos, offset)
Definition: depos.py:107
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 43 of file OpDetPhotonTable.cxx.

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

Definition at line 70 of file OpDetPhotonTable.cxx.

71  {
72  for(auto it = StepPhotonTable->begin(); it!=StepPhotonTable->end(); it++)
73  {
74  for(auto in_it = it->second.begin(); in_it!=it->second.end(); in_it++)
75  {
76  if (!Reflected)
77  fLitePhotons[it->first][in_it->first]+= in_it->second;
78  else
79  fReflectedLitePhotons[it->first][in_it->first]+= in_it->second;
80  }
81  }
82  }
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
void larg4::OpDetPhotonTable::ClearEnergyDeposits ( )

Definition at line 219 of file OpDetPhotonTable.cxx.

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

Definition at line 155 of file OpDetPhotonTable.cxx.

156  {
157  if(fDetectedPhotons.size() != nch) fDetectedPhotons.resize(nch);
158  for(size_t i=0; i<fDetectedPhotons.size(); ++i) {
159  fDetectedPhotons.at(i).clear();
160  fDetectedPhotons.at(i).SetChannel(i);
161  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
162  }
163  if(fReflectedDetectedPhotons.size() != nch) fReflectedDetectedPhotons.resize(nch);
164  for(size_t i=0; i<fReflectedDetectedPhotons.size(); ++i) {
165  fReflectedDetectedPhotons.at(i).clear();
166  fReflectedDetectedPhotons.at(i).SetChannel(i);
167  //fDetectedPhotons.at(i).reserve(10000); // Just a guess on minimum # photons
168  }
169 
170  for(auto it=fLitePhotons.begin(); it!=fLitePhotons.end(); ++it)
171  (it->second).clear();
172  for(auto it=fReflectedLitePhotons.begin(); it!=fReflectedLitePhotons.end(); ++it)
173  (it->second).clear();
174  fLitePhotons.clear();
175  fReflectedLitePhotons.clear();
176  }
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 63 of file OpDetPhotonTable.h.

63 { 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 65 of file OpDetPhotonTable.h.

65 { 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 58 of file OpDetPhotonTable.h.

58 { 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 179 of file OpDetPhotonTable.cxx.

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

Definition at line 64 of file OpDetPhotonTable.h.

64 { 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 66 of file OpDetPhotonTable.h.

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

Definition at line 59 of file OpDetPhotonTable.h.

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

Definition at line 190 of file OpDetPhotonTable.cxx.

191  {
192  if(opchannel >= fReflectedDetectedPhotons.size()) {
193  std::cerr << "<<" << __PRETTY_FUNCTION__ << ">>"
194  << "Invalid channel Number: " << opchannel
195  << std::endl;
196  }
197  return fReflectedDetectedPhotons.at(opchannel);
198  }
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
QTextStream & endl(QTextStream &s)
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 224 of file OpDetPhotonTable.cxx.

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

Definition at line 32 of file OpDetPhotonTable.cxx.

33  {
36  }
37  return TheOpDetPhotonTable;
38  }
OpDetPhotonTable * TheOpDetPhotonTable
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldOpDetBacktrackerRecords ( )

Definition at line 126 of file OpDetPhotonTable.cxx.

126  {
127  // we give the result to the caller, and don't retain it
128  std::vector<sim::OpDetBacktrackerRecord> result;
129 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
130 // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
132 // std::cout << "DEBUG: std::swap(result, cOpDetBacktrackerRecordsCol);" << std::endl;
133 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
134 // std::cout << "DEBUG: cOpDetBTRCol.size() = " << cOpDetBacktrackerRecordsCol.size() << std::endl;
135  cOpChannelToSOCMap.clear();
136  return result;
137  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
static QCString result
void swap(Handle< T > &a, Handle< T > &b)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::map< int, int > cOpChannelToSOCMap
std::vector< sim::OpDetBacktrackerRecord > larg4::OpDetPhotonTable::YieldReflectedOpDetBacktrackerRecords ( )

Definition at line 141 of file OpDetPhotonTable.cxx.

141  {
142  // we give the result to the caller, and don't retain it
143  std::vector<sim::OpDetBacktrackerRecord> result;
144 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
145 // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
147 // std::cout << "DEBUG: result.size() = " << result.size() << std::endl;
148 // std::cout << "DEBUG: cReflOpDetBTRCol.size() = " << cReflectedOpDetBacktrackerRecordsCol.size() << std::endl;
150  return result;
151  } // OpDetPhotonTable::YieldOpDetBacktrackerRecords()
static QCString result
void swap(Handle< T > &a, Handle< T > &b)
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
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 228 of file OpDetPhotonTable.cxx.

229  {
230  auto data { std::move(fSimEDepCol) };
232  return data;
233  }
def move(depos, offset)
Definition: depos.py:107
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol

Member Data Documentation

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

Definition at line 103 of file OpDetPhotonTable.h.

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

Definition at line 101 of file OpDetPhotonTable.h.

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

Definition at line 104 of file OpDetPhotonTable.h.

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

Definition at line 102 of file OpDetPhotonTable.h.

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

Definition at line 105 of file OpDetPhotonTable.h.

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

Definition at line 99 of file OpDetPhotonTable.h.

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

Definition at line 106 of file OpDetPhotonTable.h.

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

Definition at line 100 of file OpDetPhotonTable.h.

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

Definition at line 109 of file OpDetPhotonTable.h.


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