LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::WireReadoutDumper Class Reference

Algorithm dumping the full detector geometry down to wires. More...

#include "WireReadoutDumper.h"

Classes

struct  StreamAdapter
 Helper for insertion into C++ output streams. More...
 

Public Member Functions

 WireReadoutDumper (geo::GeometryCore const *geom, geo::WireReadoutGeom const *wireGeom, geo::AuxDetGeometryCore const *auxGeom)
 Constructor: acquires geometry service providers. More...
 
void dump (std::ostream &out, std::string const &indent, std::string const &firstIndent) const
 Dumps the full geometry information into a stream. More...
 
void dump (std::ostream &out, std::string const &indent="") const
 Dumps the full geometry information into a stream. More...
 
StreamAdapter toStream (std::string indent, std::string firstIndent) const
 Adapter to send the dump to a C++ output stream via insertion. More...
 
auto toStream (std::string indent="") const
 Adapter to send the dump to a C++ output stream via insertion. More...
 

Private Member Functions

void dumpDetectorInfo (std::ostream &out, std::string const &indent, std::string const &firstIndent) const
 Dumps the general detector information. More...
 
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. More...
 
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). More...
 
void dumpAuxiliaryDetectors (std::ostream &out, std::string const &indent, std::string const &firstIndent) const
 Dumps all auxiliary detector information. More...
 

Private Attributes

geo::GeometryCore const * fGeom = nullptr
 Cached geometry service provider. More...
 
geo::WireReadoutGeom const * fWireGeom = nullptr
 Cached wire readout service provider. More...
 
geo::AuxDetGeometryCore const * fAuxGeom = nullptr
 Cached auxiliary detector geometry service provider. More...
 

Friends

std::ostream & operator<< (std::ostream &out, StreamAdapter const &dumpAdapter)
 Helper for geo::WireReadoutDumper::toStream(). More...
 

Detailed Description

Algorithm dumping the full detector geometry down to wires.

This algorithm dumps all the available information from the geometry, including the chamber information (from geo::GeometryCore), the wire and readout information (from geo::WireReadoutGeom) and the auxiliary detectors (from geo::AuxDetGeometryCore). Any of the service providers can be omitted (nullptr), in which case the relative information will not be printed.

A typical usage example is to create the algorithm and then call its dump() method, like in:

auto const* geom = lar::providerFrom<geo::Geometry>();
auto const* wireGeom = &(art::ServiceHandle<geo::WireReadout>()->Get());
auto const* auxDetGeom = art::ServiceHandle<geo::AuxDetGeometry>()->GetProviderPtr();
geo::WireReadoutDumper const dumper{ geom, wireGeom, auxDetGeom };
dumper.dump(std::cout);

The interface supports only dumping to C++ output streams (including std::ostringstream to bridge to libraries which can us strings). However, for streams which support inserter operators to std::ostream, the following is also possible:

mf::LogInfo{ "DumpGeometry" } << dumper.toStream();

The messagefacility library streams (like in this example) fall into this category.

The output is documented in the dump() method.

Definition at line 59 of file WireReadoutDumper.h.

Constructor & Destructor Documentation

geo::WireReadoutDumper::WireReadoutDumper ( geo::GeometryCore const *  geom,
geo::WireReadoutGeom const *  wireGeom,
geo::AuxDetGeometryCore const *  auxGeom 
)

Constructor: acquires geometry service providers.

Definition at line 24 of file WireReadoutDumper.cxx.

References fAuxGeom, and fWireGeom.

27  : fGeom{geom}, fWireGeom{wireGeom}, fAuxGeom{auxGeom}
28 {}
geo::WireReadoutGeom const * fWireGeom
Cached wire readout service provider.
geo::GeometryCore const * fGeom
Cached geometry service provider.
geo::AuxDetGeometryCore const * fAuxGeom
Cached auxiliary detector geometry service provider.

Member Function Documentation

void geo::WireReadoutDumper::dump ( std::ostream &  out,
std::string const &  indent,
std::string const &  firstIndent 
) const

Dumps the full geometry information into a stream.

Parameters
outthe stream to write the information in
indentstring to be prepended to each output line except the first
firstIndentstring to be prepended to the first line only

The output is in human-readable format, structured as follows:

  • all the information for each cryostat, including:
    • all the information for each TPC, including:
      • all the information for each readout plane, including:
        • all the information for each sensitive element (e.g. wire)
    • all the optical detector information
  • all information for the "auxiliary" detectors (typically, scintillators for cosmic ray tagging), including:
    • all the information for the "sensitive detectors" in each module.

The output starts on the current line of the stream and it ends with a new line.

Definition at line 31 of file WireReadoutDumper.cxx.

References dumpAuxiliaryDetectors(), dumpCryostat(), dumpDetectorInfo(), fAuxGeom, fGeom, and geo::Iterable< IterationPolicy, Transform >::Iterate().

Referenced by geo::operator<<().

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";
48  }
49 
50  out << '\n';
51 
52 } // geo::WireReadoutDumper::dump()
geo::GeometryCore const * fGeom
Cached geometry service provider.
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.
Geometry information for a single cryostat.
Definition: CryostatGeo.h:42
void dumpAuxiliaryDetectors(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps all auxiliary detector information.
std::string indent(std::size_t const i)
void dumpDetectorInfo(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps the general detector information.
geo::AuxDetGeometryCore const * fAuxGeom
Cached auxiliary detector geometry service provider.
range_type< T > Iterate() const
Definition: Iterable.h:121
void geo::WireReadoutDumper::dump ( std::ostream &  out,
std::string const &  indent = "" 
) const
inline

Dumps the full geometry information into a stream.

Parameters
outthe stream to write the information in
indent(default: none) string to be prepended to all output lines
See also
dump(std::ostream&, std::string const&, std::string const&) const

Dumps the geometry like dump(std::ostream&, std::string const&, std::string const&) const does, but using the same indentation string for all lines.

Definition at line 117 of file WireReadoutDumper.h.

References dump(), geo::WireReadoutDumper::StreamAdapter::firstIndent, geo::WireReadoutDumper::StreamAdapter::indent, and toStream().

Referenced by dump().

117 { dump(out, indent, indent); }
std::string indent(std::size_t const i)
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent) const
Dumps the full geometry information into a stream.
void geo::WireReadoutDumper::dumpAuxiliaryDetectors ( std::ostream &  out,
std::string const &  indent,
std::string const &  firstIndent 
) const
private

Dumps all auxiliary detector information.

Definition at line 151 of file WireReadoutDumper.cxx.

References geo::AuxDetGeometryCore::AuxDet(), util::counter(), fAuxGeom, geo::AuxDetSensitiveGeo::MaxVerbosity, geo::AuxDetGeo::MaxVerbosity, geo::AuxDetGeometryCore::NAuxDets(), geo::AuxDetGeo::NSensitiveVolume(), geo::AuxDetSensitiveGeo::PrintAuxDetInfo(), geo::AuxDetGeo::PrintAuxDetInfo(), and geo::AuxDetGeo::SensitiveVolume().

Referenced by dump(), and toStream().

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()
AuxDetGeo const & AuxDet(std::size_t const ad=0) const
Returns the specified auxiliary detector.
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:123
std::size_t NAuxDets() const
Returns the number of auxiliary detectors.
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
std::string indent(std::size_t const i)
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:124
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
geo::AuxDetGeometryCore const * fAuxGeom
Cached auxiliary detector geometry service provider.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
Definition: AuxDetGeo.h:162
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this auxiliary detector.
Definition: AuxDetGeo.h:189
void geo::WireReadoutDumper::dumpCryostat ( std::ostream &  out,
geo::CryostatGeo const &  cryostat,
std::string const &  indent,
std::string const &  firstIndent 
) const
private

Dumps all content of the specified cryostat.

Definition at line 83 of file WireReadoutDumper.cxx.

References util::counter(), dumpTPCplane(), fWireGeom, art::detail::indent(), geo::Iterable< IterationPolicy, Transform >::Iterate(), geo::CryostatGeo::IterateTPCs(), geo::CryostatGeo::MaxVerbosity, geo::OpDetGeo::MaxVerbosity, geo::CryostatGeo::NOpDet(), geo::CryostatGeo::OpDet(), geo::CryostatGeo::PrintCryostatInfo(), and geo::OpDetGeo::PrintOpDetInfo().

Referenced by dump(), and toStream().

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()
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).
geo::WireReadoutGeom const * fWireGeom
Cached wire readout service provider.
Geometry information for a single TPC.
Definition: TPCGeo.h:33
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
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
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintOpDetInfo().
Definition: OpDetGeo.h:209
range_type< T > Iterate() const
Definition: Iterable.h:121
void geo::WireReadoutDumper::dumpDetectorInfo ( std::ostream &  out,
std::string const &  indent,
std::string const &  firstIndent 
) const
private

Dumps the general detector information.

Definition at line 63 of file WireReadoutDumper.cxx.

References geo::GeometryCore::DetectorEnclosureBox(), geo::GeometryCore::DetectorName(), fAuxGeom, fGeom, geo::BoxBoundedGeo::Max(), geo::BoxBoundedGeo::Min(), geo::AuxDetGeometryCore::NAuxDets(), geo::GeometryCore::Ncryostats(), geo::BoxBoundedGeo::SizeX(), geo::BoxBoundedGeo::SizeY(), geo::BoxBoundedGeo::SizeZ(), and util::to_string().

Referenced by dump(), and toStream().

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()
double SizeX() const
Returns the full size in the X dimension.
Definition: BoxBoundedGeo.h:97
Point_t Max() const
Returns the corner point with the largest coordinates.
geo::GeometryCore const * fGeom
Cached geometry service provider.
BoxBoundedGeo DetectorEnclosureBox(std::string const &name="volDetEnclosure") const
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
std::size_t NAuxDets() const
Returns the number of auxiliary detectors.
double SizeY() const
Returns the full size in the Y dimension.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::string indent(std::size_t const i)
double SizeZ() const
Returns the full size in the Z dimension.
Point_t Min() const
Returns the corner point with the smallest coordinates.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:31
geo::AuxDetGeometryCore const * fAuxGeom
Cached auxiliary detector geometry service provider.
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:140
void geo::WireReadoutDumper::dumpTPCplane ( std::ostream &  out,
geo::PlaneGeo const &  plane,
std::string const &  indent,
std::string const &  firstIndent 
) const
private

Dumps the information from the specified plane (including wires).

Definition at line 126 of file WireReadoutDumper.cxx.

References util::counter(), fWireGeom, geo::PlaneGeo::ID(), geo::WireGeo::MaxVerbosity, geo::PlaneGeo::MaxVerbosity, geo::PlaneGeo::Nwires(), geo::PlaneGeo::PrintPlaneInfo(), geo::WireGeo::PrintWireInfo(), geo::WireReadoutGeom::SignalType(), geo::SignalTypeName(), and geo::PlaneGeo::Wire().

Referenced by dumpCryostat(), and toStream().

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()
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
geo::WireReadoutGeom const * fWireGeom
Cached wire readout service provider.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
std::string indent(std::size_t const i)
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintWireInfo().
Definition: WireGeo.h:334
std::string SignalTypeName(SigType_t sigType)
Returns the name of the specified signal type.
Definition: geo_types.cxx:52
geo::WireReadoutDumper::StreamAdapter geo::WireReadoutDumper::toStream ( std::string  indent,
std::string  firstIndent 
) const

Adapter to send the dump to a C++ output stream via insertion.

Parameters
indent(default: none) string to be prepended to all output lines
firstIndentstring to be prepended to the first line only
Returns
an opaque adapter for insertion into a C++ output stream
See also
dump()

Example: after a geo::WireReadoutDumper dumper has been initialized,

std::cout << dumper.toStream("> ");

will dump the full geometry into std::cout.

Definition at line 55 of file WireReadoutDumper.cxx.

Referenced by dump().

58 {
59  return {this, std::move(indent), std::move(firstIndent)};
60 }
std::string indent(std::size_t const i)
auto geo::WireReadoutDumper::toStream ( std::string  indent = "") const
inline

Adapter to send the dump to a C++ output stream via insertion.

Parameters
indent(default: none) string to be prepended to all output lines
Returns
an opaque adapter for insertion into a C++ output stream
See also
dump()

Example: after a geo::WireReadoutDumper dumper has been initialized,

std::cout << dumper.toStream("> ");

will dump the full geometry into std::cout.

Definition at line 148 of file WireReadoutDumper.h.

References dumpAuxiliaryDetectors(), dumpCryostat(), dumpDetectorInfo(), dumpTPCplane(), operator<<, and toStream().

Referenced by toStream().

148 { return toStream(indent, std::move(indent)); }
StreamAdapter toStream(std::string indent, std::string firstIndent) const
Adapter to send the dump to a C++ output stream via insertion.
std::string indent(std::size_t const i)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
StreamAdapter const &  dumpAdapter 
)
friend

Helper for geo::WireReadoutDumper::toStream().

Referenced by toStream().

Member Data Documentation

geo::AuxDetGeometryCore const* geo::WireReadoutDumper::fAuxGeom = nullptr
private

Cached auxiliary detector geometry service provider.

Definition at line 68 of file WireReadoutDumper.h.

Referenced by dump(), dumpAuxiliaryDetectors(), dumpDetectorInfo(), and WireReadoutDumper().

geo::GeometryCore const* geo::WireReadoutDumper::fGeom = nullptr
private

Cached geometry service provider.

Definition at line 62 of file WireReadoutDumper.h.

Referenced by dump(), and dumpDetectorInfo().

geo::WireReadoutGeom const* geo::WireReadoutDumper::fWireGeom = nullptr
private

Cached wire readout service provider.

Definition at line 65 of file WireReadoutDumper.h.

Referenced by dumpCryostat(), dumpTPCplane(), and WireReadoutDumper().


The documentation for this class was generated from the following files: