9 const std::vector<sim::SimChannel>& simch_v)
11 Reset(g4_trackid_v,simch_v);
15 const std::vector<sim::SimChannel>& simch_v)
22 for(
auto const&
id : g4_trackid_v)
30 const std::vector<sim::SimChannel>& simch_v)
37 for(
auto const&
id : g4_trackid_v)
50 for(
auto const& sch : simch_v) {
52 auto const ch = sch.Channel();
60 for(
auto const& time_ide : sch.TDCIDEMap()) {
62 auto const& time = time_ide.first;
63 auto const& ide_v = time_ide.second;
65 auto& edep_info = ch_info[time];
67 if(!edep_info.size()) edep_info.resize(_num_parts,0);
69 for(
auto const& ide : ide_v) {
75 if(_num_parts <= index) {
76 (*edep_info.rbegin()) += ide.numElectrons;
77 (*(
_sum_mcq[plane]).rbegin()) += ide.numElectrons;
80 edep_info[index] += ide.numElectrons;
81 _sum_mcq[plane][index] += ide.numElectrons;
91 throw MCBTException(Form(
"Invalid plane requested: %zu",plane_id));
106 auto itlow = ch_info.lower_bound((
unsigned int)(ts->
TPCTick2TDC(hit.
start)));
107 auto itup = ch_info.upper_bound((
unsigned int)(ts->
TPCTick2TDC(hit.
end))+1);
109 while(itlow != ch_info.end() && itlow != itup) {
111 auto const& edep_info = (*itlow).second;
113 for(
size_t part_index = 0; part_index<
_num_parts; ++part_index)
115 res[part_index] += edep_info[part_index];
126 if(!res.size())
return res;
129 for(
auto const& v : res) sum += v;
130 for(
size_t i=0; i<(res.size()-1); ++i)
131 res[i] /= (sum - (*res.rbegin()));
132 (*res.rbegin()) /= sum;
136 std::vector<double>
MCBTAlg::MCQ(
const std::vector<WireRange_t>& hit_v)
const 139 for(
auto const& h : hit_v) {
140 auto tmp_res =
MCQ(h);
141 for(
size_t i=0; i<res.size(); ++i) res[i] += tmp_res[i];
148 auto res =
MCQ(hit_v);
149 if(!res.size())
return res;
152 for(
auto const& v : res) sum += v;
153 for(
size_t i=0; i<(res.size()-1); ++i)
154 res[i] /= (sum - (*res.rbegin()));
155 (*res.rbegin()) /= sum;
178 unsigned int max_id = 0;
179 for(
auto const&
id : track_id_v)
if(max_id <
id) max_id = id;
183 for(
auto const&
id : track_id_v) {
const std::vector< double > & MCQSum(const size_t plane_id) const
std::vector< std::vector< double > > _sum_mcq
void Reset(const std::vector< unsigned int > &g4_trackid_v, const std::vector< sim::SimChannel > &simch_v)
Class def header for a class MCBTAlg.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
std::vector< double > MCQFrac(const WireRange_t &hit) const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
size_t Index(const unsigned int g4_track_id) const
static const size_t kINVALID_INDEX
Signifies invalid MCX index number.
void ProcessSimChannel(const std::vector< sim::SimChannel > &simch_v)
std::vector< size_t > _trkid_to_index
Detector simulation of raw signals on wires.
Conversion of times between different formats and references.
virtual double TPCTick2TDC(double tick) const =0
Converts a TPC time tick into a electronics time tick.
std::vector< double > MCQ(const WireRange_t &hit) const
Namespace collecting geometry-related classes utilities.
void Register(const unsigned int &g4_track_id)
std::vector< ::btutil::ch_info_t > _event_info