Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sim::OpDetDivRec Class Reference

#include <OpDetDivRec.h>

Classes

struct  CompareByPdTime
 
struct  time_slice
 

Public Types

typedef std::vector< OpDet_Time_ChansTime_Chans_t
 

Public Member Functions

 OpDetDivRec ()
 
 OpDetDivRec (int det)
 
Time_Chans_t const & GetTimeChans () const
 
int OpDetNum () const
 
void AddPhoton (int opchan, int tid, OpDet_Time_Chans::stored_time_t pdTime)
 
std::vector< std::pair< int, double > > GetFracs (OpDet_Time_Chans::stored_time_t time)
 
std::vector< std::pair< int, double > > GetFracs (OpDet_Time_Chans::stored_time_t time, int tid)
 
time_slice GetSlice (OpDet_Time_Chans::stored_time_t low_time, OpDet_Time_Chans::stored_time_t high_time)
 
std::pair< OpDetDivRec::Time_Chans_t::const_iterator, boolFindClosestTimeChan (OpDet_Time_Chans::stored_time_t pdTime) const
 
void clear ()
 
template<typename Stream >
void Dump (Stream &&out, std::string indent, std::string first_indent) const
 
template<typename Stream >
void Dump (Stream &&out, std::string indent="") const
 Documentation at Dump(Stream&&, std::string, std::string) const. More...
 

Private Member Functions

Time_Chans_t::iterator priv_FindClosestTimeChan (OpDet_Time_Chans::stored_time_t pdTime)
 
Time_Chans_t::const_iterator priv_FindClosestTimeChan (OpDet_Time_Chans::stored_time_t pdTime) const
 

Private Attributes

int fOpDetNum
 
Time_Chans_t time_chans
 

Detailed Description

Definition at line 87 of file OpDetDivRec.h.

Member Typedef Documentation

Definition at line 89 of file OpDetDivRec.h.

Constructor & Destructor Documentation

sim::OpDetDivRec::OpDetDivRec ( )

Definition at line 17 of file OpDetDivRec.cxx.

17  :
18  fOpDetNum(-1)
19  { }
sim::OpDetDivRec::OpDetDivRec ( int  det)

Definition at line 20 of file OpDetDivRec.cxx.

20  :
21  fOpDetNum(det)
22  { }

Member Function Documentation

void sim::OpDetDivRec::AddPhoton ( int  opchan,
int  tid,
OpDet_Time_Chans::stored_time_t  pdTime 
)

Definition at line 25 of file OpDetDivRec.cxx.

25  {
27  if(itr == time_chans.end() || itr->time!=time){
28  std::vector<Chan_Phot> cfl;
29  cfl.emplace_back(opchan, tid);
30  time_chans.emplace(itr, time, std::move(cfl));
31  if(! std::is_sorted(time_chans.begin(), time_chans.end(), CompareByPdTime() ) ) //Just to guarantee no funny buisiness in the ordering. This shold generally not be an issue because we should always pass this check. After I convince myself it is always filled correctly, I will remove this check.
32  std::sort(time_chans.begin(), time_chans.end(), CompareByPdTime());
33  }else{
34  for(auto cfp = itr->phots.begin(); cfp!= itr->phots.end(); ++cfp){
35  if(cfp!= itr->phots.end() && cfp->opChan != opchan && cfp->trackID!=tid){
36  continue;
37  }else if(cfp == itr->phots.end()){
38  itr->phots.emplace_back(opchan, tid);
39  }else{
40  cfp->AddPhoton();
41  break;
42  }
43  }
44  }
45  }//End AddPhoton
intermediate_table::iterator iterator
Time_Chans_t::iterator priv_FindClosestTimeChan(OpDet_Time_Chans::stored_time_t pdTime)
Definition: OpDetDivRec.cxx:65
def move(depos, offset)
Definition: depos.py:107
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
void sim::OpDetDivRec::clear ( )
template<class Stream >
void sim::OpDetDivRec::Dump ( Stream &&  out,
std::string  indent,
std::string  first_indent 
) const

Definition at line 147 of file OpDetDivRec.h.

148 {
149  out << first_indent << "OpDet #" << OpDetNum() << " read " << time_chans.size()
150  << " time_chans:\n";
151  for (const auto& tc: time_chans) {
152  auto time = tc.time;
153  out << indent << " time " << time
154  << " with " << tc.phots.size() << " Photon deposits\n";
155  for (const auto& photr: tc.phots) {
156  out << indent
157  << "OpChan: "<<photr.opChan <<" with "<<photr.phot<<" photons from particle with TrackID"<<photr.trackID<<"\n";
158  } // for SDPs
159  } // for timePDclocks
160 } // sim::OpDetBacktrackerRecord::Dump<>()
int OpDetNum() const
Definition: OpDetDivRec.h:102
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
template<typename Stream >
void sim::OpDetDivRec::Dump ( Stream &&  out,
std::string  indent = "" 
) const
inline

Documentation at Dump(Stream&&, std::string, std::string) const.

Definition at line 117 of file OpDetDivRec.h.

118  { Dump(std::forward<Stream>(out), indent, indent); }
void Dump(Stream &&out, std::string indent, std::string first_indent) const
Definition: OpDetDivRec.h:147
std::pair< OpDetDivRec::Time_Chans_t::const_iterator, bool > sim::OpDetDivRec::FindClosestTimeChan ( OpDet_Time_Chans::stored_time_t  pdTime) const

Definition at line 73 of file OpDetDivRec.cxx.

73  {
74  auto ret = priv_FindClosestTimeChan(pdTime);
75  bool found=false;
76  if(ret!=time_chans.end()){
77  found=true;
78  }
79  return std::make_pair(ret, found);
80  }
Time_Chans_t::iterator priv_FindClosestTimeChan(OpDet_Time_Chans::stored_time_t pdTime)
Definition: OpDetDivRec.cxx:65
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
std::vector< std::pair< int, double > > sim::OpDetDivRec::GetFracs ( OpDet_Time_Chans::stored_time_t  time)

Definition at line 47 of file OpDetDivRec.cxx.

47  {
48  std::vector<std::pair<int, double>> ret;
49  auto itr = priv_FindClosestTimeChan(time);
50  if( itr != time_chans.end() || itr->time==time ){
51  ret = itr->GetFracs();
52  }
53  return ret;
54  }
Time_Chans_t::iterator priv_FindClosestTimeChan(OpDet_Time_Chans::stored_time_t pdTime)
Definition: OpDetDivRec.cxx:65
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
std::vector< std::pair< int, double > > sim::OpDetDivRec::GetFracs ( OpDet_Time_Chans::stored_time_t  time,
int  tid 
)

Definition at line 56 of file OpDetDivRec.cxx.

56  {
57  std::vector<std::pair<int, double>> ret;
58  auto itr = priv_FindClosestTimeChan(time);
59  if( itr != time_chans.end() || itr->time==time ){
60  ret = itr->GetFracs(tid);
61  }
62  return ret;
63  }
Time_Chans_t::iterator priv_FindClosestTimeChan(OpDet_Time_Chans::stored_time_t pdTime)
Definition: OpDetDivRec.cxx:65
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
OpDetDivRec::time_slice sim::OpDetDivRec::GetSlice ( OpDet_Time_Chans::stored_time_t  low_time,
OpDet_Time_Chans::stored_time_t  high_time 
)

Definition at line 82 of file OpDetDivRec.cxx.

82  {
83  OpDetDivRec::time_slice ret;
84  ret.lower = priv_FindClosestTimeChan(low_time);
85  ret.upper = priv_FindClosestTimeChan(high_time);
86  if(ret.lower!=ret.upper && ret.upper < time_chans.end()){
87  return ret;
88  }else{
89  ret.lower=time_chans.end();
90  ret.upper=time_chans.end();
91  return ret;
92  }
93  }
Time_Chans_t::iterator priv_FindClosestTimeChan(OpDet_Time_Chans::stored_time_t pdTime)
Definition: OpDetDivRec.cxx:65
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
Time_Chans_t const& sim::OpDetDivRec::GetTimeChans ( ) const
inline

Definition at line 101 of file OpDetDivRec.h.

101 {return time_chans;}
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
int sim::OpDetDivRec::OpDetNum ( ) const
inline

Definition at line 102 of file OpDetDivRec.h.

102 { return fOpDetNum; }
OpDetDivRec::Time_Chans_t::iterator sim::OpDetDivRec::priv_FindClosestTimeChan ( OpDet_Time_Chans::stored_time_t  pdTime)
private

Definition at line 65 of file OpDetDivRec.cxx.

65  {
66  return std::lower_bound
67  (time_chans.begin(), time_chans.end(), pdTime, CompareByPdTime() );
68  }
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97
OpDetDivRec::Time_Chans_t::const_iterator sim::OpDetDivRec::priv_FindClosestTimeChan ( OpDet_Time_Chans::stored_time_t  pdTime) const
private

Definition at line 69 of file OpDetDivRec.cxx.

69  {
70  return std::lower_bound
71  (time_chans.begin(), time_chans.end(), pdTime, CompareByPdTime() );
72  }
Time_Chans_t time_chans
Definition: OpDetDivRec.h:97

Member Data Documentation

int sim::OpDetDivRec::fOpDetNum
private

Definition at line 96 of file OpDetDivRec.h.

Time_Chans_t sim::OpDetDivRec::time_chans
private

Definition at line 97 of file OpDetDivRec.h.


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