Typedefs | Functions
MagnifySink.cxx File Reference
#include "WireCellRoot/MagnifySink.h"
#include "WireCellIface/ITrace.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TH2I.h"
#include "TFile.h"
#include "TTree.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellIface/FrameTools.h"
#include <vector>
#include <string>

Go to the source code of this file.

Typedefs

typedef std::unordered_set< std::stringstring_set_t
 

Functions

 WIRECELL_FACTORY (MagnifySink, WireCell::Root::MagnifySink, WireCell::IFrameFilter, WireCell::IConfigurable) using namespace WireCell
 
string_set_t getset (const WireCell::Configuration &cfg)
 
std::vector< WireCell::Binningcollate_byplane (const ITrace::vector &traces, const IAnodePlane::pointer anode, ITrace::vector byplane[])
 

Typedef Documentation

typedef std::unordered_set<std::string> string_set_t

Definition at line 113 of file MagnifySink.cxx.

Function Documentation

std::vector<WireCell::Binning> collate_byplane ( const ITrace::vector traces,
const IAnodePlane::pointer  anode,
ITrace::vector  byplane[] 
)

Definition at line 143 of file MagnifySink.cxx.

145 {
146  std::vector<int> uvwt[4];
147  for (auto trace : traces) {
148  const int chid = trace->channel();
149  auto wpid = anode->resolve(chid);
150  const int iplane = wpid.index();
151  if (iplane<0 || iplane>=3) {
152  THROW(RuntimeError() << errmsg{"Illegal wpid"});
153  }
154  uvwt[iplane].push_back(chid);
155  byplane[iplane].push_back(trace);
156  uvwt[3].push_back(trace->tbin());
157  uvwt[3].push_back(trace->tbin() + trace->charge().size());
158  }
159 
160  std::vector<Binning> binnings(4);
161  for (int ind=0; ind<4; ++ind) {
162  auto const& one = uvwt[ind];
163  // std::cerr << "[wgu] get ind: " << ind << " size: " << one.size() << std::endl;
164  if (one.empty()) {
165  // THROW(ValueError() << errmsg{"MagnifySink: bogus bounds"});
166  std::cerr << "[wgu] plane: " << ind << " has not traces. " << std::endl;
167  }
168  else{
169  auto mme = std::minmax_element(one.begin(), one.end());
170  const int vmin = *mme.first;
171  const int vmax = *mme.second;
172  if (ind == 3) {
173  const int n = vmax - vmin;
174  // binnings.push_back(Binning(n, vmin, vmax););
175  binnings.at(ind) = Binning(n, vmin, vmax);
176  }
177  else {
178  // Channel-centered binning
179  const double diff = vmax - vmin;
180  // binnings.push_back(Binning(diff+1, vmin-0.5, vmax+0.5));
181  binnings.at(ind) = Binning(diff+1, vmin-0.5, vmax+0.5);
182  }
183  }
184  }
185  return binnings;
186 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
#define THROW(e)
Definition: Exceptions.h:25
std::size_t n
Definition: format.h:3399
QTextStream & endl(QTextStream &s)
string_set_t getset ( const WireCell::Configuration cfg)

Definition at line 114 of file MagnifySink.cxx.

115 {
116  string_set_t ret;
117  for (auto jone : cfg) {
118  ret.insert(jone.asString());
119  }
120  return ret;
121 }
cfg
Definition: dbjson.py:29
std::unordered_set< std::string > string_set_t
WIRECELL_FACTORY ( MagnifySink  ,
WireCell::Root::MagnifySink  ,
WireCell::IFrameFilter  ,
WireCell::IConfigurable   
)