Functions
test_anodeplane.cxx File Reference
#include "WireCellGen/AnodePlane.h"
#include "WireCellGen/AnodeFace.h"
#include "WireCellGen/WirePlane.h"
#include "WireCellUtil/Units.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellUtil/Exceptions.h"
#include <iostream>
#include "anode_loader.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 14 of file test_anodeplane.cxx.

15 {
16  std::string detector = "uboone";
17  if (argc > 1) {
18  detector = argv[1];
19  }
20  auto anode_tns = anode_loader(detector);
21 
22  for (std::string anode_tn : anode_tns) {
23  auto iap = Factory::find_tn<IAnodePlane>(anode_tn);
24  auto chans = iap->channels();
25  cerr << "Anode " << anode_tn << " with " << chans.size() << " channels:\n";
26 
27  for (auto face : iap->faces()) {
28  cerr << "face: " << face->ident() << "\n";
29  std::vector<float> originx;
30  for (auto plane : face->planes()) {
31  cerr << "\tplane: " << plane->ident() << "\n";
32 
33  auto pimpos = plane->pimpos();
34  cerr << "\torigin: " << pimpos->origin()/units::mm << "mm\n";
35  for (int axis : {0,1,2}) {
36  cerr << "\taxis " << axis << ": " << pimpos->axis(axis)/units::mm << "mm\n";
37  }
38  originx.push_back(pimpos->origin()[0]);
39  }
40 
41 
42  float diff = std::abs(originx.front() - originx.back());
43  if (diff > 0.1*units::mm) {
44  cerr << "ERROR, field response and wire location data do not match: diff = " << diff/units::mm << "mm\n";
45  cerr << "front: " << originx.front()/units::mm << "mm, back=" << originx.back()/units::mm<<"mm out of " << originx.size() << endl;
46  THROW(ValueError() << errmsg{"field response and wire location data do not match"});
47  }
48  }
49  }
50 
51 
52  return 0;
53 
54 }
std::string string
Definition: nybbler.cc:12
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
const Point & origin() const
Return given 3-point origin for plane pitch.
Definition: Pimpos.h:85
std::vector< std::string > anode_loader(std::string detector)
Definition: anode_loader.h:35
T abs(T value)
#define THROW(e)
Definition: Exceptions.h:25
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
static const double mm
Definition: Units.h:73
Pimpos pimpos(nwires, min_wire_pitch, max_wire_pitch)
const Vector & axis(int i) const
Definition: Pimpos.h:89
QTextStream & endl(QTextStream &s)