LArSoft sim::SimChannel equivalent data product. More...
#include <simch.hh>
Public Member Functions | |
simch (DATA::DATA_TYPE type=DATA::SimChannel) | |
Default constructor. | |
virtual | ~simch () |
Default destructor. | |
simch (const simch &origin) | |
Copy constructor. | |
virtual void | clear_data () |
Clear method. | |
void | set_channel (UShort_t ch) |
--- Setters ---/// | |
void | add_ide (UShort_t tdc, ide in) |
UShort_t | Channel () const |
--- Getters ---/// | |
std::vector< larlight::ide > | TrackIDsAndEnergies (UShort_t startTDC, UShort_t endTDC) const |
method to return a collection of IDE structs for all geant4 track ids represented between startTDC and endTDC | |
const std::map< UShort_t, std::vector< larlight::ide > > & | TDCIDEMap () const |
IDE map getter. | |
Double_t | Charge (UShort_t tdc) const |
The number of ionization electrons associated with this channel for the specified TDC. | |
Double_t | Energy (UShort_t tdc) const |
Total energy deposit associated with this channel for the specified TDC. | |
DATA::DATA_TYPE | data_type () const |
data type getter | |
void | add_association (DATA::DATA_TYPE type, const std::vector< unsigned short > ass) |
Adder for a set of association. | |
size_t | size_association (DATA::DATA_TYPE type) const |
Getter for # of associations. | |
const std::vector< unsigned short > | association (DATA::DATA_TYPE type, size_t index=0) const |
Getter of an association. | |
Protected Attributes | |
DATA::DATA_TYPE | _type |
DATA_TYPE. | |
std::map < larlight::DATA::DATA_TYPE, std::vector< std::vector < unsigned short > > > | _ass |
Association storage ... allow multiple set of associations. | |
Private Attributes | |
UShort_t | fChannel |
Comparison operator. | |
std::map< UShort_t, std::vector< larlight::ide > > | fTDCIDEs |
vector of IDE structs for each TDC with signal |
LArSoft sim::SimChannel equivalent data product.
Definition at line 68 of file simch.hh.
larlight::simch::simch | ( | DATA::DATA_TYPE | type = DATA::SimChannel |
) |
Default constructor.
Definition at line 23 of file simch.cc.
References larlight::data_base::_type, clear_data(), larlight::DATA::DATA_TREE_NAME, larlight::MSG::ERROR, larlight::Message::send(), and larlight::DATA::SimChannel.
00023 : data_base(type) 00024 //-------------------------------------------------- 00025 { 00026 if(_type != DATA::SimChannel) { 00027 00028 Message::send(MSG::ERROR,__FUNCTION__, 00029 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str())); 00030 00031 _type=DATA::SimChannel; 00032 } 00033 00034 clear_data(); 00035 00036 }
virtual larlight::simch::~simch | ( | ) | [inline, virtual] |
larlight::simch::simch | ( | const simch & | origin | ) | [inline] |
void larlight::data_base::add_association | ( | DATA::DATA_TYPE | type, | |
const std::vector< unsigned short > | ass | |||
) | [inherited] |
Adder for a set of association.
Definition at line 9 of file data_base.cc.
References larlight::data_base::_ass.
void larlight::simch::add_ide | ( | UShort_t | tdc, | |
ide | in | |||
) |
Definition at line 135 of file simch.cc.
References larlight::ide::energy, fTDCIDEs, larlight::ide::numElectrons, larlight::ide::trackID, larlight::ide::x, larlight::ide::y, and larlight::ide::z.
00137 { 00138 auto tdc_itr = fTDCIDEs.find(tdc); 00139 00140 if(tdc_itr == fTDCIDEs.end()) { 00141 // case 1: new tdc 00142 fTDCIDEs.insert(std::pair<UShort_t,std::vector<larlight::ide> >(tdc,std::vector<larlight::ide>(1,in))); 00143 return; 00144 } 00145 00146 // case 2: combining w/ existing ide from the same track id 00147 for(auto i_ide : (*tdc_itr).second) { 00148 00149 if(i_ide.trackID == in.trackID) { 00150 00151 Double_t weight = i_ide.numElectrons + in.numElectrons; 00152 00153 i_ide.x = (i_ide.x * i_ide.numElectrons + in.x * in.numElectrons)/weight; 00154 i_ide.y = (i_ide.y * i_ide.numElectrons + in.y * in.numElectrons)/weight; 00155 i_ide.z = (i_ide.z * i_ide.numElectrons + in.z * in.numElectrons)/weight; 00156 i_ide.numElectrons = weight; 00157 i_ide.energy += in.energy; 00158 00159 return; 00160 } 00161 00162 } 00163 00164 // case 3: inserting this ide as the 1st one from this track id 00165 (*tdc_itr).second.push_back(in); 00166 return; 00167 00168 }
const std::vector< unsigned short > larlight::data_base::association | ( | DATA::DATA_TYPE | type, | |
size_t | index = 0 | |||
) | const [inherited] |
Getter of an association.
Definition at line 35 of file data_base.cc.
References larlight::DATA::DATA_TREE_NAME, larlight::MSG::ERROR, and larlight::Message::send().
00037 { 00038 00039 size_t ass_length = size_association(type); 00040 00041 if( !(ass_length) ) { 00042 00043 Message::send(MSG::ERROR,__FUNCTION__, 00044 Form("There is no association to %s",DATA::DATA_TREE_NAME[type].c_str())); 00045 00046 return std::vector<unsigned short>(); 00047 00048 } 00049 00050 if( ass_length <= index ) { 00051 00052 Message::send(MSG::ERROR,__FUNCTION__, 00053 Form("There are only %zu associations. No association @ index=%zu",ass_length,index)); 00054 00055 return std::vector<unsigned short>(); 00056 00057 } 00058 00059 return ((_ass.find(type))->second).at(index); 00060 }
UShort_t larlight::simch::Channel | ( | ) | const [inline] |
Double_t larlight::simch::Charge | ( | UShort_t | tdc | ) | const |
The number of ionization electrons associated with this channel for the specified TDC.
void larlight::simch::clear_data | ( | ) | [virtual] |
Clear method.
Reimplemented from larlight::data_base.
Definition at line 39 of file simch.cc.
References fChannel, fTDCIDEs, and larlight::DATA::INVALID_USHORT.
Referenced by simch().
00041 { 00042 data_base::clear_data(); 00043 fChannel = DATA::INVALID_USHORT; 00044 fTDCIDEs.clear(); 00045 }
DATA::DATA_TYPE larlight::data_base::data_type | ( | ) | const [inline, inherited] |
data type getter
Reimplemented in larlight::event_base.
Definition at line 48 of file data_base.hh.
References larlight::data_base::_type.
00048 {return _type; }
Double_t larlight::simch::Energy | ( | UShort_t | tdc | ) | const |
Total energy deposit associated with this channel for the specified TDC.
void larlight::simch::set_channel | ( | UShort_t | ch | ) | [inline] |
size_t larlight::data_base::size_association | ( | DATA::DATA_TYPE | type | ) | const [inherited] |
Getter for # of associations.
Definition at line 23 of file data_base.cc.
Referenced by larlight::cluster::get_hit_type().
const std::map<UShort_t, std::vector<larlight::ide> >& larlight::simch::TDCIDEMap | ( | ) | const [inline] |
std::vector< larlight::ide > larlight::simch::TrackIDsAndEnergies | ( | UShort_t | startTDC, | |
UShort_t | endTDC | |||
) | const |
method to return a collection of IDE structs for all geant4 track ids represented between startTDC and endTDC
Definition at line 48 of file simch.cc.
00051 { 00052 // make a map of track ID values to larlight::ide objects 00053 std::map<UInt_t, larlight::ide> idToIDE; 00054 00055 std::vector<larlight::ide> ides; 00056 if(startTDC > endTDC) return ides; 00057 00058 std::map<UShort_t, std::vector<larlight::ide> >::const_iterator mitr; 00059 std::map<UShort_t, std::vector<larlight::ide> >::const_iterator start = fTDCIDEs.lower_bound(startTDC); 00060 std::map<UShort_t, std::vector<larlight::ide> >::const_iterator end = fTDCIDEs.upper_bound(endTDC); 00061 00062 for(mitr = start; mitr != end; mitr++){ 00063 00064 // grab the vector of IDEs for this tdc 00065 const std::vector<larlight::ide> &idelist = (*mitr).second; 00066 std::vector<larlight::ide>::const_iterator itr = idelist.begin(); 00067 // now loop over them and add their content to the map 00068 while( itr != idelist.end() ){ 00069 00070 if( idToIDE.find((*itr).trackID) != idToIDE.end() ){ 00071 Double_t nel1 = idToIDE[(*itr).trackID].numElectrons; 00072 Double_t nel2 = (*itr).numElectrons; 00073 Double_t en1 = idToIDE[(*itr).trackID].energy; 00074 Double_t en2 = (*itr).energy; 00075 Double_t energy = en1+en2; 00076 Double_t weight = nel1 + nel2; 00077 // make a weighted average for the location information 00078 idToIDE[(*itr).trackID].x = ((*itr).x*nel2 + idToIDE[(*itr).trackID].x*nel1)/weight; 00079 idToIDE[(*itr).trackID].y = ((*itr).y*nel2 + idToIDE[(*itr).trackID].y*nel1)/weight; 00080 idToIDE[(*itr).trackID].z = ((*itr).z*nel2 + idToIDE[(*itr).trackID].z*nel1)/weight; 00081 idToIDE[(*itr).trackID].numElectrons = weight; 00082 idToIDE[(*itr).trackID].energy = energy; 00083 } // end if the track id for this one is found 00084 else{ 00085 larlight::ide temp(*itr); 00086 idToIDE[(*itr).trackID] = temp; 00087 } 00088 00089 itr++; 00090 } // end loop over vector 00091 } // end loop over tdc values 00092 00093 00094 ides.reserve(idToIDE.size()); 00095 // now fill the vector with the ides from the map 00096 for(auto itr = idToIDE.begin(); itr != idToIDE.end(); itr++) 00097 00098 ides.push_back((*itr).second); 00099 00100 00101 return ides; 00102 }
std::map<larlight::DATA::DATA_TYPE,std::vector<std::vector<unsigned short> > > larlight::data_base::_ass [protected, inherited] |
Association storage ... allow multiple set of associations.
Definition at line 65 of file data_base.hh.
Referenced by larlight::data_base::add_association(), and larlight::data_base::clear_data().
DATA::DATA_TYPE larlight::data_base::_type [protected, inherited] |
DATA_TYPE.
Definition at line 62 of file data_base.hh.
Referenced by larlight::calorimetry::calorimetry(), larlight::cluster::cluster(), larlight::data_base::data_base(), larlight::event_base::data_type(), larlight::data_base::data_type(), larlight::endpoint2d::endpoint2d(), larlight::event_calorimetry::event_calorimetry(), larlight::event_cluster::event_cluster(), larlight::event_endpoint2d::event_endpoint2d(), larlight::event_fifo::event_fifo(), larlight::event_hit::event_hit(), larlight::event_mcpart::event_mcpart(), larlight::event_mcshower::event_mcshower(), larlight::event_mctruth::event_mctruth(), larlight::event_pulse::event_pulse(), larlight::event_shower::event_shower(), larlight::event_simch::event_simch(), larlight::event_sps::event_sps(), larlight::event_track::event_track(), larlight::event_user::event_user(), larlight::event_vertex::event_vertex(), larlight::event_wire::event_wire(), larlight::fifo::fifo(), larlight::hit::hit(), larlight::mcnu::mcnu(), larlight::mcpart::mcpart(), larlight::mcshower::mcshower(), larlight::mctrajectory::mctrajectory(), larlight::mctruth::mctruth(), larlight::pmtfifo::pmtfifo(), larlight::pulse::pulse(), larlight::fifo::readout_sample_number_16MHz(), larlight::fifo::readout_sample_number_2MHz(), larlight::fifo::readout_sample_number_64MHz(), larlight::shower::shower(), simch(), larlight::spacepoint::spacepoint(), larlight::tpcfifo::tpcfifo(), larlight::track::track(), larlight::trigger::trigger(), larlight::user_info::user_info(), larlight::vertex::vertex(), and larlight::wire::wire().
UShort_t larlight::simch::fChannel [private] |
Comparison operator.
electronics channel associated with these sim::Electrons
Definition at line 127 of file simch.hh.
Referenced by Channel(), clear_data(), and set_channel().
std::map<UShort_t, std::vector< larlight::ide > > larlight::simch::fTDCIDEs [private] |
vector of IDE structs for each TDC with signal
Definition at line 130 of file simch.hh.
Referenced by add_ide(), clear_data(), and TDCIDEMap().