Classes | Functions
Fourdee.cxx File Reference
#include "WireCellGen/Fourdee.h"
#include "WireCellGen/FrameUtil.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellUtil/ConfigManager.h"
#include "WireCellUtil/ExecMon.h"
#include "WireCellGen/GenPipeline.h"

Go to the source code of this file.

Classes

class  NoiseAdderProc
 

Functions

 WIRECELL_FACTORY (FourDee, WireCell::Gen::Fourdee, WireCell::IApplication, WireCell::IConfigurable) using namespace std
 
void dump (const IFrame::pointer frame)
 
template<typename DEPOS >
void dump (DEPOS &depos)
 

Function Documentation

void dump ( const IFrame::pointer  frame)

Definition at line 120 of file Fourdee.cxx.

121 {
122  if (!frame) {
123  cerr << "Fourdee: dump: empty frame\n";
124  return;
125  }
126 
127  for (auto tag: frame->frame_tags()) {
128  const auto& tlist = frame->tagged_traces(tag);
129  cerr << "Fourdee: frame tag: " << tag << " with " << tlist.size() << " traces\n";
130  }
131  for (auto tag: frame->trace_tags()) {
132  const auto& tlist = frame->tagged_traces(tag);
133  cerr << "Fourdee: trace tag: " << tag << " with " << tlist.size() << " traces\n";
134  }
135 
136  auto traces = frame->traces();
137  const int ntraces = traces->size();
138 
139  if (ntraces <= 0) {
140  cerr << "Fourdee: dump: no traces\n";
141  return;
142  }
143 
144  std::vector<int> tbins, tlens;
145  for (auto trace : *traces) {
146  const int tbin = trace->tbin();
147  tbins.push_back(tbin);
148  tlens.push_back(tbin+trace->charge().size());
149  }
150 
151  int tmin = *(std::minmax_element(tbins.begin(), tbins.end()).first);
152  int tmax = *(std::minmax_element(tlens.begin(), tlens.end()).second);
153 
154  cerr << "frame: #" << frame->ident()
155  << " @" << frame->time()/units::ms
156  << "ms with " << ntraces << " traces, tbins in: "
157  << "[" << tmin << "," << tmax << "]"
158  << endl;
159 }
Binning tbins(nticks, t0, t0+readout_time)
static const double ms
Definition: Units.h:100
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:80
QTextStream & endl(QTextStream &s)
template<typename DEPOS >
void dump ( DEPOS &  depos)

Definition at line 162 of file Fourdee.cxx.

163 {
164  if (depos.empty() or (depos.size() == 1 and !depos[0])) {
165  std::cerr << "Fourdee::dump: empty depos set\n";
166  return;
167  }
168 
169  std::vector<double> t,x,y,z;
170  double qtot = 0.0;
171  double qorig = 0.0;
172 
173  for (auto depo : depos) {
174  if (!depo) {
175  cerr << "Gen::Fourdee: null depo" << endl;
176  break;
177  }
178  auto prior = depo->prior();
179  if (!prior) {
180  cerr << "Gen::Fourdee: null prior depo" << endl;
181  }
182  else {
183  qorig += prior->charge();
184  }
185  t.push_back(depo->time());
186  x.push_back(depo->pos().x());
187  y.push_back(depo->pos().y());
188  z.push_back(depo->pos().z());
189  qtot += depo->charge();
190  }
191 
192  auto tmm = std::minmax_element(t.begin(), t.end());
193  auto xmm = std::minmax_element(x.begin(), x.end());
194  auto ymm = std::minmax_element(y.begin(), y.end());
195  auto zmm = std::minmax_element(z.begin(), z.end());
196  const int ndepos = depos.size();
197 
198  std::cerr << "Gen::FourDee: drifted " << ndepos << ", extent:\n"
199  << "\tt in [ " << (*tmm.first)/units::us << "," << (*tmm.second)/units::us << "]us,\n"
200  << "\tx in [" << (*xmm.first)/units::mm << ","<<(*xmm.second)/units::mm<<"]mm,\n"
201  << "\ty in [" << (*ymm.first)/units::mm << ","<<(*ymm.second)/units::mm<<"]mm,\n"
202  << "\tz in [" << (*zmm.first)/units::mm << ","<<(*zmm.second)/units::mm<<"]mm,\n"
203  << "\tQtot=" << qtot/units::eplus << ", <Qtot>=" << qtot/ndepos/units::eplus << " "
204  << " Qorig=" << qorig/units::eplus
205  << ", <Qorig>=" << qorig/ndepos/units::eplus << " electrons" << std::endl;
206 
207 
208 }
double y
const int ndepos
double z
static const double mm
Definition: Units.h:73
static const double us
Definition: Units.h:101
list x
Definition: train.py:276
QTextStream & endl(QTextStream &s)
WIRECELL_FACTORY ( FourDee  ,
WireCell::Gen::Fourdee  ,
WireCell::IApplication  ,
WireCell::IConfigurable   
)