test_GeometryDune.cxx
Go to the documentation of this file.
1 // test_GeometryDune.cxx
2 
3 #ifndef test_GeometryDune_CXX
4 #define test_GeometryDune_CXX
5 
6 // David Adams
7 // November 2016
8 //
9 // Test the DUNE geometry including channel mapping.
10 //
11 // This test demonstrates how to configure and use the LArSoft Geometry
12 // service outside the art framework. DUNE geometry and geometry helper
13 // service are used.
14 //
15 // Note the geometry service requires the experiment-specific geometry
16 // helper with the channel map also be loaded.
17 //
18 // The functions that set the expected values must be defined externally.
19 
20 #undef NDEBUG
21 
23 #include <string>
24 #include <iostream>
25 #include <fstream>
26 #include <sstream>
27 #include <iomanip>
31 
32 using std::string;
33 using std::cout;
34 using std::cerr;
35 using std::endl;
36 using std::ofstream;
37 using std::istringstream;
38 using std::ostringstream;
39 using std::setw;
40 using std::vector;
41 using std::abs;
42 using geo::View_t;
43 using geo::SigType_t;
44 using geo::CryostatID;
45 using geo::TPCID;
46 using geo::PlaneID;
47 using geo::WireID;
49 using readout::ROPID;
50 using geo::Geometry;
51 using geo::CryostatGeo;
52 using geo::TPCGeo;
53 using geo::WireGeo;
54 
55 typedef unsigned int Index;
57 
58 template<class T>
59 using Vector = vector<T>;
60 
61 template<class T>
63 
64 template<class T>
66 
67 template<class T, class V>
68 void resize(Vector<T>& vec1, Index n1, const V& val) {
69  vec1.resize(n1, val);
70 }
71 
72 template<class T, class V>
73 void resize(TwoVector<T>& vec2, Index n1, Index n2, const V& val) {
74  vec2.resize(n1);
75  for ( Vector<T>& vec1 : vec2 ) {
76  vec1.resize(n2, val);
77  }
78 }
79 
80 template<class T, class V>
81 void resize(ThreeVector<T>& vec3, Index n1, Index n2, Index n3, const V& val) {
82  vec3.resize(n1);
83  for ( TwoVector<T>& vec2 : vec3 ) {
84  vec2.resize(n2);
85  for ( Vector<T>& vec1 : vec2 ) {
86  vec1.resize(n3, val);
87  }
88  }
89 }
90 
91 struct SpacePoint {
92  double x;
93  double y;
94  double z;
95  SpacePoint(double ax, double ay, double az) : x(ax), y(ay), z(az) { }
96 };
97 
98 //**********************************************************************
99 
100 // Helper functions
101 
102 namespace {
103 
104 template<class T>
105 void check(string name, T val) {
106  cout << name << ": " << val << endl;
107 }
108 
109 template<class T, class V>
110 void check(string name, T val, V checkval, bool print =true, bool doAssert =true) {
111  if ( print ) check(name, val);
112  T eval = checkval;
113  if ( val != eval ) {
114  cout << val << " != " << checkval << endl;
115  assert(! doAssert);
116  cout << "************** Assertion not made!!! *************" << endl;
117  }
118 }
119 
120 template<class T, class V>
121 void checkval(string name, T val, V chkval) {
122  T eval = chkval;
123  if ( val != eval ) {
124  cout << endl << "---------------------------------" << endl;
125  cout << name << ": " << val << " != " << chkval << endl;
126  cout << "---------------------------------" << endl;
127  assert(false);
128  }
129 }
130 
131 void checkfloat(double x1, double x2, double tol =1.e-5) {
132  double den = abs(x1) + abs(x2);
133  double num = abs(x2 - x1);
134  if ( num/den > tol ) {
135  cout << endl << "---------------------------------" << endl;
136  cout << "checkfloat: " << x1 << " != " << x2 << endl;
137  cout << "---------------------------------" << endl;
138  assert(false);
139  }
140 }
141 
142 //**********************************************************************
143 
144 // Helper classes.
145 
146 struct ExpectedValues {
147  typedef void (*FunPtr)(Geometry*);
148  string gname;
149  string chanmap;
150  string sorter;
151  string fullname;
152  Index ncry = 0;
153  Index ntpc = 0;
154  Index npla = 0;
155  Index napa = 0;
156  Index nrop = 0;
157  Index nchaPerApa = 0;
158  Index nchatot = 0;
159  ThreeVector<View_t> view;
160  ThreeVector<SigType_t> sigType;
161  TwoVector<Index> nwirPerPlane;
162  // For ROP tests.
163  Vector<Index> nchaPerRop;
164  Vector<Index> chacry; // Expected cryostat for each channel;
165  Vector<Index> chaapa; // Expected APA for each channel;
166  Vector<Index> charop; // Expected ROP for each channel;
167  ThreeVector<Index> firstchan; // First channel(cry, apa, rop)
168  // For space point tests.
169  FunPtr pfun = nullptr;
170  vector<double> xfs; // x-fractions for space points
171  vector<double> yfs; // y-fractions for space points
172  vector<double> zfs; // z-fractions for space points
173  Vector<SpacePoint> posXyz; // Space points.
174  vector<double> posTpc; // TPCs for space points
175  vector<double> posPla; // TPC planes for space points
176  vector<double> posWco; // Wire coordinates for space points
177  // Photon detectors.
178  Index nopdet = 0;
179  Index nopcha = 0; // # readout channels
180  Index nopchaHardware = 0; // # harware channels (0 means same as readout)
181  Vector<Index> nopdetcha;
182  TwoVector<Index> opdetcha;
183 };
184 
185 //**********************************************************************
186 
187 } //end unnamed namespace
188 
189 //**********************************************************************
190 
191 // Functions that set the expected values.
192 // These must be defined externally.
193 
194 void setExpectedValues(ExpectedValues& ev);
196 
197 //**********************************************************************
198 
199 // Function that carries out the test.
200 // ev - expected results
201 // dorop - If true ROP mapping methods are tested
202 // maxchanprint - Max # channels to display for each ROP
203 
204 int test_GeometryDune(const ExpectedValues& ev, bool dorop, Index maxchanprint,
205  bool useExistingFcl) {
206  const string myname = "test_GeometryDune: ";
207  cout << myname << "Starting test" << endl;
208 #ifdef NDEBUG
209  cout << myname << "NDEBUG must be off." << endl;
210  abort();
211 #endif
212  string line = "-----------------------------";
213 
214  cout << myname << line << endl;
215  cout << myname << " Geometry: " << ev.gname << endl;
216  cout << myname << "Channel map: " << ev.chanmap << endl;
217  cout << myname << " Sorter: " << ev.sorter << endl;
218  cout << myname << " Do ROP: " << dorop << endl;
219 
220  cout << myname << line << endl;
221  cout << myname << "Create configuration." << endl;
222  if (useExistingFcl) {
223  ArtServiceHelper::load_services("test_GeometryDune.fcl",
225  } else {
226  std::stringstream config;
227  config << "#include \"geometry_dune.fcl\"" << endl;
228  config << "services.Geometry: @local::" << ev.gname << endl;
229  config << "services.ExptGeoHelperInterface: @local::dune_geometry_helper" << endl;
230  if ( ev.chanmap.size() ) {
231  config << "services.ExptGeoHelperInterface.ChannelMapClass: " << ev.chanmap << endl;
232  }
233  //config << "services.ExptGeoHelperInterface.GeoSorterClass: " << ev.sorter << endl;
235  }
236 
237  cout << myname << line << endl;
238  cout << myname << "Get Geometry service." << endl;
240 
241  cout << myname << line << endl;
242  check("Default wiggle", pgeo->DefaultWiggle());
243  check("Geometry name", pgeo->DetectorName(), ev.fullname);
244  cout << myname << "ROOT name: " << pgeo->ROOTFile() << endl;
245  cout << myname << "GDML name: " << pgeo->GDMLFile() << endl;
246 
247  cout << myname << line << endl;
248  double xlo, ylo, zlo;
249  double xhi, yhi, zhi;
250  cout << myname << "World box" << endl;
251  pgeo->WorldBox(&xlo, &ylo, &zlo, &xhi, &yhi, &zhi);
252  check(" xlo", xlo);
253  check(" ylo", ylo);
254  check(" zlo", zlo);
255  check(" xhi", xhi);
256  check(" yhi", yhi);
257  check(" zhi", zhi);
258 
259  cout << myname << line << endl;
260  check("SurfaceY", pgeo->SurfaceY());
261 
262  cout << myname << line << endl;
263  if ( 0 ) check("GetWorldVolumeName", pgeo->GetWorldVolumeName());
264  if ( 0 ) check("TotalMass", pgeo->TotalMass());
265 
266  cout << myname << line << endl;
267  check("CryostatHalfWidth", pgeo->CryostatHalfWidth());
268  check("CryostatHalfHeight", pgeo->CryostatHalfHeight());
269  check("CryostatLength", pgeo->CryostatLength());
270  //check("", pgeo->());
271 
272  cout << myname << line << endl;
273  Index ncry = pgeo->Ncryostats();
274  check("Ncryostats", ncry, ev.ncry);
275  check("MaxTPCs", pgeo->MaxTPCs(), ev.ntpc);
276  check("MaxPlanes", pgeo->MaxPlanes(), ev.npla);
277  check("TotalNTPC", pgeo->TotalNTPC(), ev.ntpc);
278  check("Nviews", pgeo->Nviews(), ev.npla);
279  check("Nchannels", pgeo->Nchannels(), ev.nchatot);
280 
281  cout << myname << line << endl;
282  cout << "Check TPC wire plane counts." << endl;
283  for ( Index icry=0; icry<ncry; ++icry ) {
284  Index ntpc = pgeo->NTPC(icry);
285  cout << " Cryostat " << icry << " has " << ntpc << " TPCs" << endl;
286  for ( Index itpc=0; itpc<ntpc; ++itpc ) {
287  Index npla = pgeo->Nplanes(itpc, icry);
288  cout << " TPC " << itpc << " has " << npla << " planes" << endl;
289  assert( npla == 3 );
290  for ( Index ipla=0; ipla<npla; ++ipla ) {
291  Index nwir = pgeo->Nwires(ipla, itpc, icry);
292  Index ich1 = pgeo->Nchannels();
293  Index ich2 = 0;
294  for ( Index iwir=0; iwir<nwir; ++iwir ) {
295  Index ich = pgeo->PlaneWireToChannel(ipla, iwir, itpc, icry);
296  if ( ich < ich1 ) ich1 = ich;
297  if ( ich > ich2 ) ich2 = ich;
298  }
299  cout << " Plane " << ipla << " has " << setw(4) << nwir << " wires"
300  << " readout on channels [" << ich1 << ", " << ich2 << "]"
301  << endl;
302  assert( nwir == ev.nwirPerPlane[itpc][ipla] );
303  }
304  }
305  }
306 
307  cout << myname << line << endl;
308  cout << "Check wire planes." << endl;
309  const double piOver2 = 0.5*acos(-1.0);
310  for ( PlaneID plaid : pgeo->IteratePlaneIDs() ) {
311  const geo::PlaneGeo& gpla = pgeo->Plane(plaid);
312  cout << " Plane " << plaid << endl;
313  cout << " Signal type: " << pgeo->SignalType(plaid) << endl;
314  cout << " View: " << pgeo->View(plaid) << endl;
315  cout << " Wire angle: " << gpla.ThetaZ() - piOver2 << endl;
316  assert( pgeo->SignalType(plaid) == ev.sigType[plaid.Cryostat][plaid.TPC][plaid.Plane] );
317  assert( pgeo->View(plaid) == ev.view[plaid.Cryostat][plaid.TPC][plaid.Plane] );
318  }
319 
320  cout << myname << line << endl;
321  cout << "Check channel-wire mapping." << endl;
322  Index itpc1Last = TPCID::InvalidID;
323  Index ipla1Last = WireID::InvalidID;
324  Index nprint = 0;
325  TwoVector<Index> lastwire;
326  resize(lastwire, ev.ntpc, ev.npla, 0);
327  for ( Index itpc=0; itpc<ev.ntpc; ++itpc )
328  for ( Index ipla=0; ipla<ev.npla; ++ipla )
329  lastwire[itpc][ipla] = 0;
330  for ( Index icha=0; icha<ev.nchatot; ++icha ) {
331  vector<WireID> wirids = pgeo->ChannelToWire(icha);
332  assert( wirids.size() > 0 );
333  WireID wirid1 = wirids[0];
334  Index itpc1 = wirid1.TPC;
335  Index iapa1 = itpc1/2;
336  Index ipla1 = wirid1.Plane;
337  if ( itpc1 != itpc1Last || ipla1 != ipla1Last ) nprint = 0;
338  itpc1Last = itpc1;
339  ipla1Last = ipla1;
340  bool print = nprint < maxchanprint;
341  if ( print ) ++nprint;
342  if ( print ) cout << " Channel " << setw(4) << icha << " has " << wirids.size() << " wires:";
343  ostringstream sposs;
344  sposs.precision(2);
345  for ( WireID wirid : wirids ) {
346  Index itpc = wirid.TPC;
347  Index iapa = itpc/2;
348  Index ipla = wirid.Plane;
349  Index iwir = wirid.Wire;
350  if ( print ) cout << " " << itpc << "-" << ipla << "-" << setw(3) << iwir;
351  if ( iwir > lastwire[itpc][ipla] ) lastwire[itpc][ipla] = iwir;
352  assert( iapa == iapa1 );
353  assert( ipla == ipla1 );
354  checkval("\nPlaneWireToChannel", pgeo->PlaneWireToChannel(wirid), icha );
355  assert( pgeo->SignalType(icha) == ev.sigType[wirid.Cryostat][wirid.TPC][wirid.Plane] );
356  checkval("View", pgeo->View(icha), ev.view[wirid.Cryostat][wirid.TPC][wirid.Plane]);
357  const WireGeo* pwg = pgeo->WirePtr(wirid);
358  TVector3 p1 = pwg->GetStart();
359  TVector3 p2 = pwg->GetEnd();
360  if ( sposs.str().size() ) sposs << ", ";
361  sposs << "(" << setw(7) << std::fixed << p1.x() << ", "
362  << setw(7) << std::fixed << p1.y() << ", "
363  << setw(7) << std::fixed << p1.z() << ") - ";
364  sposs << "(" << setw(7) << std::fixed << p2.x() << ", "
365  << setw(7) << std::fixed << p2.y() << ", "
366  << setw(7) << std::fixed << p2.z() << ")";
367  }
368  if ( print ) cout << " " << sposs.str() << endl;
369  }
370  for ( Index itpc=0; itpc<ev.ntpc; ++itpc ) {
371  for ( Index ipla=0; ipla<ev.npla; ++ipla ) {
372  Index nwir = lastwire[itpc][ipla] + 1;
373  cout << " TPC-plane " << itpc << "-" << ipla << " has " << setw(3) << nwir << " wires" << endl;
374  assert( nwir == ev.nwirPerPlane[itpc][ipla] );
375  }
376  }
377 
378  if ( dorop ) {
379  cout << myname << line << endl;
380  cout << "Check ROP counts and channels." << endl;
381  check("MaxROPs", pgeo->MaxROPs(), ev.nrop);
382  Index icry = 0;
383  for ( CryostatID cryid: pgeo->IterateCryostatIDs() ) {
384  Index napa = pgeo->NTPCsets(cryid);
385  cout << " Cryostat " << icry << " has " << napa << " APAs" << endl;
386  assert( napa == ev.napa );
387  for ( Index iapa=0; iapa<napa; ++iapa ) {
388  APAID apaid(cryid, iapa);
389  Index nrop = pgeo->NROPs(apaid);
390  cout << " APA " << iapa << " has " << nrop << " ROPs" << endl;
391  assert( nrop == ev.nrop );
392  for ( Index irop=0; irop<nrop; ++irop ) {
393  ROPID ropid(apaid, irop);
394  Index ncha = pgeo->Nchannels(ropid);
395  Index icha1 = pgeo->FirstChannelInROP(ropid);
396  Index icha2 = icha1 + ncha - 1;
397  cout << " ROP " << irop << " has " << ncha << " channels: ["
398  << icha1 << ", " << icha2 << "]" << endl;
399  assert( ncha == ev.nchaPerRop[irop] );
400  assert( icha1 == ev.firstchan[icry][iapa][irop] );
401  }
402  }
403  ++icry;
404  }
405  assert( icry == ncry );
406  cout << myname << line << endl;
407  cout << "Check channel-ROP mapping." << endl;
408  icry = 0;
409  for ( Index icha=0; icha<ev.nchatot; ++icha ) {
410  ROPID ropid = pgeo->ChannelToROP(icha);
411  Index icry = ropid.Cryostat;
412  Index iapa = ropid.TPCset;
413  Index irop = ropid.ROP;
414  assert( icry == ev.chacry[icha] );
415  assert( iapa == ev.chaapa[icha] );
416  assert( irop == ev.charop[icha] );
417  }
418  cout << myname << line << endl;
419  cout << "Check ROP-TPC mapping." << endl;
420  for ( CryostatID cryid: pgeo->IterateCryostatIDs() ) {
421  Index napa = pgeo->NTPCsets(cryid);
422  cout << " Cryostat " << icry << " has " << napa << " APAs" << endl;
423  assert( napa == ev.napa );
424  for ( Index iapa=0; iapa<napa; ++iapa ) {
425  APAID apaid(cryid, iapa);
426  Index nrop = pgeo->NROPs(apaid);
427  cout << " APA " << iapa << " has " << nrop << " ROPs" << endl;
428  assert( nrop == ev.nrop );
429  for ( Index irop=0; irop<nrop; ++irop ) {
430  ROPID ropid(apaid, irop);
431  std::vector<geo::TPCID> rtpcs = pgeo->ROPtoTPCs(ropid);
432  Index nrtpc = rtpcs.size();
433  assert( nrtpc > 0 );
434  cout << " ROP " << irop << " TPCs:";
435  for ( Index irtpc=0; irtpc<nrtpc; ++irtpc ) {
436  assert(rtpcs[irtpc].Cryostat == icry);
437  cout << (irtpc > 0 ? "," : "") << " " << rtpcs[irtpc].TPC;
438  }
439  cout << endl;
440  }
441  }
442  }
443  } else {
444  cout << myname << line << endl;
445  cout << "Skipped APA and ROP tests." << endl;
446  } // end dorop
447 
448  cout << myname << line << endl;
449  Index nspt = ev.posXyz.size();
450  if ( nspt == 0 ) {
451  cout << myname << "No space points found." << endl;
452  cout << myname << "Creating space points." << endl;
454  } else {
455  cout << myname << "Check " << nspt << " space points." << endl;
456  assert( ev.posPla.size() == ev.posTpc.size() );
457  assert( ev.posWco.size() == ev.posTpc.size() );
458  Index ires = 0;
459  int w = 9;
460  for ( Index ispt=0; ispt<nspt; ++ispt ) {
461  double x = ev.posXyz[ispt].x;
462  double y = ev.posXyz[ispt].y;
463  double z = ev.posXyz[ispt].z;
464  double xyz[3] = {x, y, z};
465  TPCID tpcid = pgeo->FindTPCAtPosition(xyz);
466  cout << " (" << setw(w) << x << "," << setw(w) << y << "," << setw(w) << z << "): " << tpcid << endl;
467  assert( tpcid.Cryostat != CryostatID::InvalidID );
468  unsigned int itpc = tpcid.TPC;
469  assert( itpc != TPCID::InvalidID );
470  const TPCGeo& tpcgeo = pgeo->TPC(tpcid);
471  unsigned int npla = tpcgeo.Nplanes();
472  assert( npla == ev.npla );
473  assert( npla > 0 );
474  for ( unsigned int ipla=0; ipla<npla; ++ipla ) {
475  assert( ires < ev.posTpc.size() );
476  PlaneID plaid(tpcid, ipla);
477  WireID wirid;
478  try { wirid = pgeo->NearestWireID(xyz, plaid); }
479  catch (geo::InvalidWireError const& e) {
480  if (!e.hasSuggestedWire()) throw;
481  cerr << "ERROR (non-fatal):\n" << e;
482  wirid = e.suggestedWireID();
483  }
484  double xwire = pgeo->WireCoordinate(x, y, plaid);
485  cout << " TPC " << setw(2) << itpc << " plane " << ipla
486  << " nearest wire is " << setw(3) << wirid.Wire
487  << " and coordinate is " << xwire << endl;
488  assert( itpc == ev.posTpc[ires] );
489  assert( ipla == ev.posPla[ires] );
490  checkfloat(xwire, ev.posWco[ires], 2.e-4);
491  ++ires;
492  } // end loop over planes
493  } // end loop over space points
494  cout << " # checked planes: " << ires << endl;
495  }
496  // Optical detectors.
497  bool dophot = true;
498  bool doAssert = true; // Flag to turn off assertions while testing the test
499  if ( dophot ) {
500  Index nopt = pgeo->NOpDets();
501  check("# Optical detectors expected", nopt, ev.nopdet, true, doAssert);
502  Index nopchaReadout = ev.nopcha;
503  Index nopchaHardware = ev.nopchaHardware ? ev.nopchaHardware : nopchaReadout;
504  cout << " Expected optical readout channel count: " << nopchaReadout << endl;
505  cout << "Expected optical hardware channel count: " << nopchaHardware << endl;
506  cout << " Geometry optical channel count: " << pgeo->NOpChannels() << endl;
507  check("# Optical channels", pgeo->NOpChannels(), nopchaHardware, true, doAssert);
508  cout << "Per-detector optical channel counts:" << endl;
509  assert( ev.nopdetcha.size() == nopt );
510  bool doAssert = true; // True enable assertions in the indvidual channel checks.
511  for ( Index iopt=0; iopt<nopt; ++iopt ) {
512  ostringstream sslab;
513  sslab << " # channels for optical detector " << iopt;
514  //bool print = iopt < maxchanprint;
515  check(sslab.str(), pgeo->NOpHardwareChannels(iopt), ev.nopdetcha[iopt], true, doAssert);
516  }
517  assert(doAssert);
518  cout << " Opdet channels:" << endl;
519  for ( Index iopt=0; iopt<nopt; ++iopt ) {
520  Index noch = pgeo->NOpHardwareChannels(iopt);
521  for ( Index ioch=0; ioch<noch; ++ioch ) {
522  ostringstream sslab;
523  sslab << " Det " << iopt << ", chan " << ioch;
524  Index icha = pgeo->OpChannel(iopt, ioch);
525  check(sslab.str() + " (channel)", icha, ev.opdetcha[iopt][ioch], true, doAssert);
526  if ( nopchaHardware == nopchaReadout ) {
527  check(sslab.str() + " (OpDet)", pgeo->OpDetFromOpChannel(icha), iopt, true, doAssert);
528  }
529  check(sslab.str() + " (HardwareChannel)", pgeo->HardwareChannelFromOpChannel(icha), ioch, true, doAssert);
530  }
531  }
532  }
533 
534  cout << myname << line << endl;
535  cout << myname << "Done." << endl;
536  return 0;
537 }
538 
539 //**********************************************************************
540 
541 int main(int argc, const char* argv[]) {
542  ExpectedValues ev;
543  setExpectedValues(ev);
544  bool dorop = true;
545  Index maxchanprint = 10;
546  bool useExistingFcl = false;
547  if ( argc > 1 ) {
548  string sarg = argv[1];
549  if ( sarg == "-h" ) {
550  cout << argv[0] << ": . [dorop] [maxchan] [usefcl]" << endl;
551  cout << argv[0] << ": [ChannelMapClass] [dorop] [maxchan] [usefcl]" << endl;
552  cout << argv[0] << ": [Geometry/ChannelMapClass/sorter] [dorop] [maxchan] [usefcl]" << endl;
553  cout << " dorop: If true ROP mapping methods are tested [true]" << endl;
554  cout << " maxchan: Max # channels displayed for each ROP [10]" << endl;
555  cout << " usefcl: Take top-level fcl from current directory [false]" << endl;
556  return 0;
557  }
558  string::size_type ipos = sarg.find("/");
559  if ( ipos == string ::npos ) {
560  if ( sarg != "." ) ev.chanmap = sarg;
561  } else {
562  ev.gname = sarg.substr(0, ipos);
563  string::size_type jpos = sarg.find("/", ipos+1);
564  if ( jpos == string::npos ) {
565  ev.chanmap = sarg.substr(ipos+1);
566  } else {
567  ev.chanmap = sarg.substr(ipos+1, jpos-ipos-1);
568  ev.sorter = sarg.substr(jpos+1);
569  }
570  }
571  }
572  if ( argc > 2 ) {
573  string sarg = argv[2];
574  dorop = sarg == "1" || sarg == "true" || sarg == ".";
575  }
576  if ( argc > 3 ) {
577  istringstream ssarg(argv[3]);
578  ssarg >> maxchanprint;
579  }
580  if ( argc > 4 ) {
581  string sarg = argv[4];
582  useExistingFcl = sarg == "1" || sarg == "true";
583  }
584  test_GeometryDune(ev, dorop, maxchanprint, useExistingFcl);
585  cout << "Tests concluded." << endl;
586  return 0;
587 }
588 
589 //**********************************************************************
590 
591 #endif
static QCString name
Definition: declinfo.cpp:673
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
void GetStart(double *xyz) const
Definition: WireGeo.h:157
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
std::vector< geo::TPCID > ROPtoTPCs(readout::ROPID const &ropid) const
Returns a list of ID of TPCs the specified ROP spans.
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
geo::Length_t CryostatHalfHeight(geo::CryostatID const &cid) const
Returns the height of the cryostat (y direction)
int main(int argc, const char *argv[])
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
unsigned int TotalNTPC() const
Returns the total number of TPCs in the detector.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::string string
Definition: nybbler.cc:12
auto const tol
Definition: SurfXYZTest.cc:16
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:165
void WorldBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi) const
Fills the arguments with the boundaries of the world.
static constexpr FileOnPath_t FileOnPath
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
Geometry information for a single TPC.
Definition: TPCGeo.h:38
unsigned int MaxROPs() const
Returns the largest number of ROPs a TPC set in the detector has.
void setExpectedValuesSpacePoints(Geometry *)
struct vector vector
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
const std::string GetWorldVolumeName() const
Return the name of the world volume (needed by Geant4 simulation)
unsigned int NOpHardwareChannels(int opDet) const
unsigned int NTPCsets(readout::CryostatID const &cryoid) const
Returns the total number of TPC sets in the specified cryostat.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
unsigned int Index
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
void resize(Vector< T > &vec1, Index n1, const V &val)
static void load_services(std::string const &config)
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
bool check(const std::vector< std::vector< float > > &outputs)
art framework interface to geometry description
std::string ROOTFile() const
Returns the full directory path to the geometry file source.
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
double ThetaZ() const
Angle of the wires from positive z axis; .
Definition: PlaneGeo.cxx:726
double TotalMass() const
Returns the total mass [kg] of the specified volume (default: world).
IteratorBox< plane_id_iterator,&GeometryCore::begin_plane_id,&GeometryCore::end_plane_id > IteratePlaneIDs() const
Enables ranged-for loops on all plane IDs of the detector.
const Index InvalidIndex
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
T abs(T value)
readout::ROPID ROPID
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
const double e
ROPID_t ROP
Index of the readout plane within its TPC set.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
void setExpectedValues(ExpectedValues &ev)
Collection of exceptions for Geometry system.
static Config * config
Definition: config.cpp:1054
raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const
Returns the ID of the first channel in the specified readout plane.
unsigned int HardwareChannelFromOpChannel(int opChannel) const
Convert unique channel to hardware channel.
enum geo::_plane_sigtype SigType_t
readout::TPCsetID APAID
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
SpacePoint(double ax, double ay, double az)
unsigned int Index
geo::Length_t SurfaceY() const
The position of the detector respect to earth surface.
static int max(int a, int b)
The geometry of one entire detector, as served by art.
Definition: Geometry.h:196
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
double DefaultWiggle() const
Returns the tolerance used in looking for positions.
Class identifying a set of planes sharing readout channels.
unsigned int NOpDets() const
Number of OpDets in the whole detector.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
readout::ROPID ChannelToROP(raw::ChannelID_t channel) const
unsigned int OpChannel(int detNum, int hardwareChannel) const
Convert detector number and hardware channel to unique channel.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
geo::Length_t CryostatHalfWidth(geo::CryostatID const &cid) const
Returns the half width of the cryostat (x direction)
IteratorBox< cryostat_id_iterator,&GeometryCore::begin_cryostat_id,&GeometryCore::end_cryostat_id > IterateCryostatIDs() const
Enables ranged-for loops on all cryostat IDs of the detector.
void line(double t, double *p, double &x, double &y, double &z)
Exception thrown on invalid wire number.
Definition: Exceptions.h:42
geo::Length_t CryostatLength(geo::CryostatID const &cid) const
Returns the length of the cryostat (z direction)
geo::WireID NearestWireID(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const
Returns the total number of ROP in the specified TPC set.
unsigned int Nviews() const
Returns the number of views (different wire orientations)
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
int test_GeometryDune(const ExpectedValues &ev, bool dorop, Index maxchanprint, bool useExistingFcl)
bool hasSuggestedWire() const
Returns whether we known a better wire number.
Definition: Exceptions.h:114
unsigned int MaxTPCs() const
Returns the largest number of TPCs a cryostat in the detector has.
QTextStream & endl(QTextStream &s)
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.