LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
WireReadoutDumper.cxx
Go to the documentation of this file.
1 
9 // library header
11 
12 // LArSoft libraries
19 
20 // C++ libraries
21 #include <ostream>
22 
23 // -----------------------------------------------------------------------------
25  geo::WireReadoutGeom const* wireGeom,
26  geo::AuxDetGeometryCore const* auxGeom)
27  : fGeom{geom}, fWireGeom{wireGeom}, fAuxGeom{auxGeom}
28 {}
29 
30 // -----------------------------------------------------------------------------
31 void geo::WireReadoutDumper::dump(std::ostream& out,
32  std::string const& indent,
33  std::string const& firstIndent) const
34 {
35 
36  dumpDetectorInfo(out, indent, firstIndent);
37 
38  if (fGeom) {
39  for (auto const& cryostat : fGeom->Iterate<geo::CryostatGeo>()) {
40  out << "\n";
41  dumpCryostat(out, cryostat, indent + " ", indent + " ");
42  }
43  }
44 
45  if (fAuxGeom) {
46  out << "\n";
47  dumpAuxiliaryDetectors(out, indent, indent);
48  }
49 
50  out << '\n';
51 
52 } // geo::WireReadoutDumper::dump()
53 
54 // -----------------------------------------------------------------------------
56  std::string indent,
57  std::string firstIndent) const
58 {
59  return {this, std::move(indent), std::move(firstIndent)};
60 }
61 
62 // -----------------------------------------------------------------------------
64  std::string const& indent,
65  std::string const& firstIndent) const
66 {
67 
68  out << firstIndent << "Detector " << (fGeom ? fGeom->DetectorName() : "") << " has "
69  << (fGeom ? std::to_string(fGeom->Ncryostats()) : "unknown") << " cryostats and "
70  << (fAuxGeom ? std::to_string(fAuxGeom->NAuxDets()) : "unknown") << " auxiliary detectors:";
71 
72  if (fGeom) {
74 
75  out << "\n"
76  << indent << " Detector enclosure: " << box.Min() << " -- " << box.Max() << " cm => ( "
77  << box.SizeX() << " x " << box.SizeY() << " x " << box.SizeZ() << " ) cm^3";
78  }
79 
80 } // geo::WireReadoutDumper::dumpDetectorInfo()
81 
82 // -----------------------------------------------------------------------------
83 void geo::WireReadoutDumper::dumpCryostat(std::ostream& out,
84  geo::CryostatGeo const& cryostat,
85  std::string const& indent,
86  std::string const& firstIndent) const
87 {
88 
89  // the indentation game:
90  // `PrintXxxxInfo()` methods don't indent the first line;
91  // our `dumpCryostat()` do as directed, but don't start with a new line
92 
93  out << firstIndent;
94  cryostat.PrintCryostatInfo(out, indent, cryostat.MaxVerbosity);
95 
96  //
97  // TPC
98  //
99  for (geo::TPCGeo const& tpc : cryostat.IterateTPCs()) {
100 
101  out << "\n" << indent;
102  tpc.PrintTPCInfo(out, indent + " ", tpc.MaxVerbosity);
103 
104  // for (unsigned int const planeNo: tpc.Nplanes()) {
105  // geo::PlaneGeo const& plane = fWireGeom->Plane({ tpc.ID(), planeNo });
106 
107  for (auto const& plane : fWireGeom->Iterate<geo::PlaneGeo>(tpc.ID())) {
108  out << "\n";
109  dumpTPCplane(out, plane, indent + " ", indent + " ");
110 
111  } // for plane
112  } // for TPC
113 
114  //
115  // optical detectors
116  //
117  for (unsigned int const iOpDet : util::counter(cryostat.NOpDet())) {
118  geo::OpDetGeo const& opDet = cryostat.OpDet(iOpDet);
119  out << "\n" << indent << " [OpDet #" << iOpDet << "] ";
120  opDet.PrintOpDetInfo(out, indent + " ", opDet.MaxVerbosity);
121  } // for
122 
123 } // geo::WireReadoutDumper::dumpCryostat()
124 
125 // -----------------------------------------------------------------------------
127  geo::PlaneGeo const& plane,
128  std::string const& indent,
129  std::string const& firstIndent) const
130 {
131 
132  const unsigned int nWires = plane.Nwires();
133 
134  out << firstIndent;
135  plane.PrintPlaneInfo(out, indent, plane.MaxVerbosity);
136  SigType_t const sigType = fWireGeom->SignalType(plane.ID());
137  out << "\n"
138  << indent << "signal type: " << SignalTypeName(sigType) << " (" << static_cast<int>(sigType)
139  << ")";
140 
141  for (unsigned int const wireNo : util::counter(nWires)) {
142  geo::WireID const wireID{plane.ID(), wireNo};
143  geo::WireGeo const& wire = plane.Wire(wireID);
144  out << "\n" << indent << wireID << " ";
145  wire.PrintWireInfo(out, indent, wire.MaxVerbosity);
146  } // for wire
147 
148 } // geo::WireReadoutDumper::dumpTPCplane()
149 
150 // -----------------------------------------------------------------------------
152  std::string const& indent,
153  std::string const& firstIndent) const
154 {
155 
156  unsigned int const nAuxDets = fAuxGeom->NAuxDets();
157  out << firstIndent << "Auxiliary detectors (" << nAuxDets << "):";
158  for (unsigned int const iDet : util::counter(nAuxDets)) {
159  geo::AuxDetGeo const& auxDet = fAuxGeom->AuxDet(iDet);
160 
161  out << '\n' << indent << "[#" << iDet << "] ";
162  auxDet.PrintAuxDetInfo(out, indent + " ", auxDet.MaxVerbosity);
163 
164  unsigned int const nSensitive = auxDet.NSensitiveVolume();
165  switch (nSensitive) {
166  case 0: break;
167  case 1: {
168  AuxDetSensitiveGeo const& auxDetS = auxDet.SensitiveVolume(0U);
169  out << "\n" << indent << " ";
170  auxDetS.PrintAuxDetInfo(out, indent + " ", auxDetS.MaxVerbosity);
171  break;
172  }
173  default:
174  for (unsigned int const iSens : util::counter(nSensitive)) {
175  out << "\n" << indent << " [#" << iSens << "] ";
176  AuxDetSensitiveGeo const& auxDetS = auxDet.SensitiveVolume(iSens);
177  auxDetS.PrintAuxDetInfo(out, indent + " ", auxDetS.MaxVerbosity);
178  } // for
179  break;
180  } // if sensitive detectors
181 
182  } // for auxiliary detector
183 
184 } // geo::WireReadoutDumper::dumpAuxiliaryDetectors()
185 
186 // -----------------------------------------------------------------------------
187 std::ostream& geo::operator<<(std::ostream& out,
188  geo::WireReadoutDumper::StreamAdapter const& dumpAdapter)
189 {
190  dumpAdapter.dumper->dump(out, dumpAdapter.indent, dumpAdapter.firstIndent);
191  return out;
192 }
193 
194 // -----------------------------------------------------------------------------
void dumpTPCplane(std::ostream &out, geo::PlaneGeo const &plane, std::string const &indent, std::string const &firstIndent) const
Dumps the information from the specified plane (including wires).
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:112
void PrintWireInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this wire.
Definition: WireGeo.h:484
AuxDetGeo const & AuxDet(std::size_t const ad=0) const
Returns the specified auxiliary detector.
Encapsulate the construction of a single cyostat .
double SizeX() const
Returns the full size in the X dimension.
Definition: BoxBoundedGeo.h:97
OpDetGeo const & OpDet(unsigned int iopdet) const
Return the iopdet&#39;th optical detector in the cryostat.
Definition: CryostatGeo.cxx:83
geo::WireReadoutGeom const * fWireGeom
Cached wire readout service provider.
Point_t Max() const
Returns the corner point with the largest coordinates.
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:123
Geometry information for a single TPC.
Definition: TPCGeo.h:33
geo::GeometryCore const * fGeom
Cached geometry service provider.
BoxBoundedGeo DetectorEnclosureBox(std::string const &name="volDetEnclosure") const
ElementIteratorBox IterateTPCs() const
Returns an object suitable for iterating through all TPCs.
Definition: CryostatGeo.h:245
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:403
void dumpCryostat(std::ostream &out, geo::CryostatGeo const &cryostat, std::string const &indent, std::string const &firstIndent) const
Dumps all content of the specified cryostat.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Geometry information for a single cryostat.
Definition: CryostatGeo.h:42
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
Description of physical geometry of one set of auxiliary detectors.
std::size_t NAuxDets() const
Returns the number of auxiliary detectors.
StreamAdapter toStream(std::string indent, std::string firstIndent) const
Adapter to send the dump to a C++ output stream via insertion.
double SizeY() const
Returns the full size in the Y dimension.
WireReadoutDumper(geo::GeometryCore const *geom, geo::WireReadoutGeom const *wireGeom, geo::AuxDetGeometryCore const *auxGeom)
Constructor: acquires geometry service providers.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:292
void PrintCryostatInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this cryostat.
Definition: CryostatGeo.h:390
void dumpAuxiliaryDetectors(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps all auxiliary detector information.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Interface for a class providing readout channel mapping to geometry.
std::string indent(std::size_t const i)
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:67
void PrintOpDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this optical detector.
Definition: OpDetGeo.h:260
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:124
Test of util::counter and support utilities.
void dumpDetectorInfo(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps the general detector information.
Description of the physical geometry of one entire detector.
Definition: GeometryCore.h:91
Helper for insertion into C++ output streams.
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
Provides a base class aware of world box coordinates.
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps the full geometry information into a stream.
double SizeZ() const
Returns the full size in the Z dimension.
Encapsulate the geometry of an optical detector.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintCryostatInfo().
Definition: CryostatGeo.h:162
Point_t Min() const
Returns the corner point with the smallest coordinates.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:31
Encapsulate the construction of a single detector plane .
void PrintPlaneInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this plane.
Definition: PlaneGeo.h:1258
Algorithm dumping the full detector geometry down to wires.
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:317
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintOpDetInfo().
Definition: OpDetGeo.h:209
geo::AuxDetGeometryCore const * fAuxGeom
Cached auxiliary detector geometry service provider.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
Definition: AuxDetGeo.h:162
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:231
range_type< T > Iterate() const
Definition: Iterable.h:121
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintWireInfo().
Definition: WireGeo.h:334
std::ostream & operator<<(std::ostream &out, WireReadoutDumper::StreamAdapter const &dumpAdapter)
Helper for geo::WireReadoutDumper::toStream().
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:140
static constexpr unsigned int MaxVerbosity
Maximum value for print verbosity.
Definition: PlaneGeo.h:634
PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:173
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this auxiliary detector.
Definition: AuxDetGeo.h:189
std::string SignalTypeName(SigType_t sigType)
Returns the name of the specified signal type.
Definition: geo_types.cxx:52
Encapsulate the construction of a single detector plane .