ZSEndedTrace.cxx
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace WireCell;
5 
6 ZSEndedTrace::ZSEndedTrace(int chid, int nbins)
7  : m_chid(chid)
8  , m_nbins(nbins)
9 {
10 }
11 
13 {
14  bin = min(bin, m_nbins-1);
15  m_chqmap[bin] += charge;
16  m_charge.clear(); // invalidate;
17 }
18 
20 {
21  return m_chid;
22 }
23 
24 int ZSEndedTrace::tbin() const
25 {
26  return m_chqmap.begin()->first;
27 }
28 
30 {
31  if (!m_charge.size()) {
32  int first_bin = m_chqmap.begin()->first;
33  int last_bin = m_chqmap.rbegin()->first;
34  m_charge.resize(last_bin-first_bin+1, 0);
35  for (auto mit : m_chqmap) {
36  m_charge[mit.first - first_bin] = mit.second;
37  }
38  }
39  return m_charge;
40 }
virtual const ChargeSequence & charge() const
virtual int channel() const
STL namespace.
virtual int tbin() const
void operator()(int tbin, float charge)
used to fill.
Definition: Main.h:22
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
ChargeSequence m_charge
Definition: ZSEndedTrace.h:20
QTextStream & bin(QTextStream &s)
std::vector< float > ChargeSequence
Sequential collection of charge.
Definition: ITrace.h:21
std::map< int, float > m_chqmap
Definition: ZSEndedTrace.h:19