All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ICARUSChannelMapAlg.cxx
Go to the documentation of this file.
1 /**
2  * @file icarusalg/Geometry/ICARUSChannelMapAlg.cxx
3  * @brief Channel mapping algorithms for ICARUS detector: implementation file.
4  * @date October 19, 2019
5  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
6  * @see icarusalg/Geometry/ICARUSChannelMapAlg.h
7  */
8 
9 // library header
11 
12 // ICARUS libraries
14 
15 // LArSoft libraries
23 #include "larcorealg/CoreUtils/DebugUtils.h" // lar::debug::printBacktrace()
24 #include "larcorealg/CoreUtils/StdUtils.h" // util::size()
26 
27 // framework libraries
28 #include "messagefacility/MessageLogger/MessageLogger.h"
29 #include "fhiclcpp/ParameterSet.h"
30 #include "cetlib_except/exception.h" // cet::exception
31 
32 // C/C++ libraries
33 #include <vector>
34 #include <array>
35 #include <set>
36 #include <algorithm> // std::transform(), std::find()
37 #include <utility> // std::move()
38 #include <iterator> // std::back_inserter()
39 #include <functional> // std::mem_fn()
40 #include <tuple>
41 
42 
43 namespace {
44 
45  // ---------------------------------------------------------------------------
46  fhicl::ParameterSet getOptionalParameterSet
47  (fhicl::OptionalDelegatedParameter const& param)
48  {
49  fhicl::ParameterSet pset; // empty by default
50  param.get_if_present(pset);
51  return pset;
52  } // fhicl::ParameterSet getOptionalParameterSet()
53 
54 
55  // ---------------------------------------------------------------------------
56 
57  // Creates a STL vector with the result of the transformation of `coll`.
58  template <typename Coll, typename Op>
59  auto transformCollection(Coll const& coll, Op op) {
60 
61  using Result_t
62  = std::decay_t<decltype(op(std::declval<typename Coll::value_type>()))>;
63 
64  std::vector<Result_t> transformed;
65  transformed.reserve(util::size(coll));
67  (coll.begin(), coll.end(), std::back_inserter(transformed), op);
68  return transformed;
69  } // transformCollection()
70 
71 
72  // ---------------------------------------------------------------------------
73 
74 } // local namespace
75 
76 
77 // -----------------------------------------------------------------------------
79  : fWirelessChannelCounts
80  (extractWirelessChannelParams(config.WirelessChannels()))
81  , fSorter(getOptionalParameterSet(config.Sorter))
82  {}
83 
84 
85 // -----------------------------------------------------------------------------
87 {
88  // This is the only INFO level message we want this object to produce;
89  // given the dynamic nature of the channel mapping choice,
90  // it's better for the log to have some indication of chosen channel mapping.
91  mf::LogInfo("ICARUSChannelMapAlg")
92  << "Initializing ICARUSChannelMapAlg channel mapping algorithm.";
93 
94  buildReadoutPlanes(geodata.cryostats);
95 
96  fillChannelToWireMap(geodata.cryostats);
97 
98  MF_LOG_TRACE("ICARUSChannelMapAlg")
99  << "ICARUSChannelMapAlg::Initialize() completed.";
100 
101 } // icarus::ICARUSChannelMapAlg::Initialize()
102 
103 
104 // -----------------------------------------------------------------------------
106 
107  fReadoutMapInfo.clear();
108 
109  fChannelToWireMap.clear();
110 
111  fPlaneInfo.clear();
112 
113 } // icarus::ICARUSChannelMapAlg::Uninitialize()
114 
115 
116 //------------------------------------------------------------------------------
117 std::vector<geo::WireID> icarus::ICARUSChannelMapAlg::ChannelToWire
118  (raw::ChannelID_t channel) const
119 {
120  //
121  // input check
122  //
123  assert(!fPlaneInfo.empty());
124 
125  //
126  // output
127  //
128  std::vector<geo::WireID> AllSegments;
129 
130  //
131  // find the ROP with that channel
132  //
134  = fChannelToWireMap.find(channel);
135  if (!channelInfo) {
136  throw cet::exception("Geometry")
137  << "icarus::ICARUSChannelMapAlg::ChannelToWire(" << channel
138  << "): invalid channel requested (must be lower than "
139  << Nchannels() << ")\n";
140  }
141 
142  //
143  // find the wire planes in that ROP
144  //
145  PlaneColl_t const& planes = ROPplanes(channelInfo->ropid);
146 
147  //
148  // associate one wire for each of those wire planes to the channel
149  //
150  AllSegments.reserve(planes.size()); // this is sometimes (often?) too much
151  for (geo::PlaneGeo const* plane: planes) {
152 
153  geo::PlaneID const& pid = plane->ID();
154  ChannelRange_t const& channelRange = fPlaneInfo[pid].channelRange();
155 
156  if (!channelRange.contains(channel)) continue;
157  AllSegments.emplace_back
158  (pid, static_cast<geo::WireID::WireID_t>(channel - channelRange.begin()));
159 
160  } // for planes in ROP
161 
162  return AllSegments;
163 
164 } // icarus::ICARUSChannelMapAlg::ChannelToWire()
165 
166 
167 //------------------------------------------------------------------------------
169 
170  return fChannelToWireMap.nChannels();
171 
172 } // icarus::ICARUSChannelMapAlg::Nchannels()
173 
174 
175 //------------------------------------------------------------------------------
177  (readout::ROPID const& ropid) const
178 {
180  = fChannelToWireMap.find(ropid);
181  return ROPinfo? ROPinfo->nChannels: 0U;
182 } // icarus::ICARUSChannelMapAlg::Nchannels(ROPID)
183 
184 
185 //------------------------------------------------------------------------------
187  (double YPos, double ZPos, geo::PlaneID const& planeID) const
188 {
189  /*
190  * this should NOT be called... it shouldn't be here at all!
191  */
192 
193  cet::exception e("ICARUSChannelMapAlg");
194  e << "ICARUSChannelMapAlg does not support `WireCoordinate()` call."
195  "\nPlease update calling software to use geo::PlaneGeo::WireCoordinate()`:"
196  "\n";
197 
199 
200  throw e;
201 } // icarus::ICARUSChannelMapAlg::WireCoordinate()
202 
203 
204 //------------------------------------------------------------------------------
206  (const TVector3& worldPos, geo::PlaneID const& planeID) const
207 {
208  /*
209  * this should NOT be called... it shouldn't be here at all!
210  */
211 
212  cet::exception e("ICARUSChannelMapAlg");
213  e << "ICARUSChannelMapAlg does not support `NearestWireID()` call."
214  "\nPlease update calling software to use geo::PlaneGeo::NearestWireID()`:"
215  "\n";
216 
218 
219  throw e;
220 } // icarus::ICARUSChannelMapAlg::NearestWireID()
221 
222 
223 //------------------------------------------------------------------------------
225  (geo::WireID const& wireID) const
226 {
227  return fPlaneInfo[wireID].firstChannel() + wireID.Wire;
228 } // icarus::ICARUSChannelMapAlg::PlaneWireToChannel()
229 
230 
231 //------------------------------------------------------------------------------
232 std::set<geo::PlaneID> const& icarus::ICARUSChannelMapAlg::PlaneIDs() const {
233 
234  /*
235  * this should NOT be called... it shouldn't be here at all!
236  */
237 
238  cet::exception e("ICARUSChannelMapAlg");
239  e << "ICARUSChannelMapAlg does not support `PlaneIDs()` call."
240  "\nPlease update calling software to use geo::GeometryCore::IteratePlanes()`"
241  "\n";
242 
244 
245  throw e;
246 
247 } // icarus::ICARUSChannelMapAlg::PlaneIDs()
248 
249 
250 //------------------------------------------------------------------------------
252  (readout::CryostatID const& cryoid) const
253 {
254  return HasCryostat(cryoid)? TPCsetCount(cryoid): 0U;
255 } // icarus::ICARUSChannelMapAlg::NTPCsets()
256 
257 
258 //------------------------------------------------------------------------------
259 /// Returns the largest number of TPC sets any cryostat in the detector has
261  assert(fReadoutMapInfo);
262  return fReadoutMapInfo.MaxTPCsets();
263 } // icarus::ICARUSChannelMapAlg::MaxTPCsets()
264 
265 
266 //------------------------------------------------------------------------------
267 /// Returns whether we have the specified TPC set
268 /// @return whether the TPC set is valid and exists
270  (readout::TPCsetID const& tpcsetid) const
271 {
272  return
273  HasCryostat(tpcsetid)? (tpcsetid.TPCset < TPCsetCount(tpcsetid)): false;
274 } // icarus::ICARUSChannelMapAlg::HasTPCset()
275 
276 
277 //------------------------------------------------------------------------------
279  (geo::TPCID const& tpcid) const
280 {
281  return tpcid? TPCtoTPCset()[tpcid]: readout::TPCsetID{};
282 } // icarus::ICARUSChannelMapAlg::TPCtoTPCset()
283 
284 
285 //------------------------------------------------------------------------------
286 std::vector<geo::TPCID> icarus::ICARUSChannelMapAlg::TPCsetToTPCs
287  (readout::TPCsetID const& tpcsetid) const
288 {
289  std::vector<geo::TPCID> TPCs;
290  if (!tpcsetid) return TPCs;
291 
292  auto const& TPClist = TPCsetTPCs(tpcsetid);
293  TPCs.reserve(TPClist.size());
294  std::transform(TPClist.begin(), TPClist.end(), std::back_inserter(TPCs),
295  std::mem_fn(&geo::TPCGeo::ID)
296  );
297  return TPCs;
298 } // icarus::ICARUSChannelMapAlg::TPCsetToTPCs()
299 
300 
301 //------------------------------------------------------------------------------
303  (readout::TPCsetID const& tpcsetid) const
304 {
305  if (!tpcsetid) return {};
306 
307  auto const& TPClist = TPCsetTPCs(tpcsetid);
308  return TPClist.empty()? geo::TPCID{}: TPClist.front()->ID();
309 
310 } // icarus::ICARUSChannelMapAlg::FirstTPCinTPCset()
311 
312 
313 //------------------------------------------------------------------------------
315  (readout::TPCsetID const& tpcsetid) const
316 {
317  return HasTPCset(tpcsetid)? ROPcount(tpcsetid): 0U;
318 } // icarus::ICARUSChannelMapAlg::NROPs()
319 
320 
321 //------------------------------------------------------------------------------
323  assert(fReadoutMapInfo);
324  return fReadoutMapInfo.MaxROPs();
325 } // icarus::ICARUSChannelMapAlg::MaxROPs()
326 
327 //------------------------------------------------------------------------------
329  return HasTPCset(ropid)? (ropid.ROP < ROPcount(ropid)): false;
330 } // icarus::ICARUSChannelMapAlg::HasROP()
331 
332 
333 //------------------------------------------------------------------------------
334  /**
335  * @brief Returns the ID of the ROP planeid belongs to, or invalid if none
336  * @param planeid ID of the plane
337  * @return the ID of the corresponding ROP, or invalid ID when planeid is
338  *
339  * In this mapping, readout planes and wire planes are mapped one-to-one.
340  * The returned value mirrors the plane ID in the readout space.
341  * If the plane ID is not valid, an invalid readout plane ID is returned.
342  * Note that this check is performed on the validity of the plane ID, that
343  * does not necessarily imply that the plane specified by the ID actually
344  * exists.
345  */
347  (geo::PlaneID const& planeid) const
348 {
349  return planeid? PlaneToROP(planeid): readout::ROPID{};
350 } // icarus::ICARUSChannelMapAlg::WirePlaneToROP()
351 
352 
353 //------------------------------------------------------------------------------
354 std::vector<geo::PlaneID> icarus::ICARUSChannelMapAlg::ROPtoWirePlanes
355  (readout::ROPID const& ropid) const
356 {
357  std::vector<geo::PlaneID> Planes;
358  if (!ropid) return Planes;
359 
360  auto const& PlaneList = ROPplanes(ropid);
361  Planes.reserve(PlaneList.size());
362  std::transform(PlaneList.begin(), PlaneList.end(), std::back_inserter(Planes),
363  std::mem_fn(&geo::PlaneGeo::ID)
364  );
365  return Planes;
366 } // icarus::ICARUSChannelMapAlg::ROPtoWirePlanes()
367 
368 
369 //------------------------------------------------------------------------------
370 std::vector<geo::TPCID> icarus::ICARUSChannelMapAlg::ROPtoTPCs
371  (readout::ROPID const& ropid) const
372 {
373  std::vector<geo::TPCID> TPCs;
374  if (!ropid) return TPCs;
375 
376  /*
377  * We use the same algorithm as for extracting the plane IDs
378  * (they implicitly convert to TPC ID... kind of them).
379  * The algorithm does not test for duplication, i.e. in theory it could
380  * produce lists with the same TPC ID being present multiple times
381  * from different planes.
382  * But this is not expected in this mapping, where each TPC holds at most
383  * one wire plane for each view, and the planes in a ROP are all on the same
384  * view. It might be matter of an assertion, but it's too complex to fit in an
385  * `assert()` call.
386  */
387  auto const& PlaneList = ROPplanes(ropid);
388  TPCs.reserve(PlaneList.size());
389  std::transform(PlaneList.begin(), PlaneList.end(), std::back_inserter(TPCs),
390  std::mem_fn(&geo::PlaneGeo::ID)
391  );
392  return TPCs;
393 } // icarus::ICARUSChannelMapAlg::ROPtoTPCs()
394 
395 
396 //------------------------------------------------------------------------------
398  (raw::ChannelID_t channel) const
399 {
400  if (!raw::isValidChannelID(channel)) return {};
402  = fChannelToWireMap.find(channel);
403  return info? info->ropid: readout::ROPID{};
404 } // icarus::ICARUSChannelMapAlg::ChannelToROP()
405 
406 
407 //------------------------------------------------------------------------------
409  (readout::ROPID const& ropid) const
410 {
411  if (!ropid) return raw::InvalidChannelID;
413  = fChannelToWireMap.find(ropid);
414  return info? info->firstChannel: raw::InvalidChannelID;
415 } // icarus::ICARUSChannelMapAlg::FirstChannelInROP()
416 
417 
418 //------------------------------------------------------------------------------
420  (readout::ROPID const& ropid) const
421 {
422  if (!ropid) return {};
423  PlaneColl_t const& planes = ROPplanes(ropid);
424  return planes.empty()? geo::PlaneID{}: planes.front()->ID();
425 } // icarus::ICARUSChannelMapAlg::FirstWirePlaneInROP()
426 
427 
428 //------------------------------------------------------------------------------
430  (readout::CryostatID const& cryoid) const
431 {
432  assert(fReadoutMapInfo);
433  return cryoid.Cryostat < fReadoutMapInfo.NCryostats();
434 } // icarus::ICARUSChannelMapAlg::HasCryostat()
435 
436 
437 //------------------------------------------------------------------------------
440 {
441 
442  //
443  // input check
444  //
445  assert(fReadoutMapInfo);
446  assert(!Cryostats.empty());
447 
448  //
449  // output setup
450  //
451  assert(fPlaneInfo.empty());
452  std::array<unsigned int, 3U> maxSizes
453  = geo::details::extractMaxGeometryElements<3U>(Cryostats);
454 
455  fPlaneInfo.resize(maxSizes[0U], maxSizes[1U], maxSizes[2U]);
456 
457 
458  raw::ChannelID_t nextChannel = 0; // next available channel
459 
460  // once again we do not have iteration facilities from `geo::GeometryCore`
461  // available yet, so we go the nested loop way and bite it
462  for (geo::CryostatGeo const& cryo: Cryostats) {
463 
464  readout::CryostatID const cid { cryo.ID() };
465 
466  auto const nTPCsets
467  = static_cast<readout::TPCsetID::TPCsetID_t>(TPCsetCount(cid));
468 
470 
471  readout::TPCsetID const sid { cid, s };
472 
473  // select the channel count according to whether the TPC set is even or
474  // odd; the selected structure is an array with one element for wire
475  // plane signal type (first induction, second induction and collection):
476  auto const& TPCsetChannelCounts
477  = fWirelessChannelCounts.at(sid.TPCset & 1);
478 
479  auto const nROPs = static_cast<readout::ROPID::ROPID_t>(ROPcount(sid));
480 
481  for (readout::ROPID::ROPID_t r: util::counter(nROPs)) {
482 
483  mf::LogTrace log("ICARUSChannelMapAlg");
484 
485  readout::ROPID const rid { sid, r };
486  auto const planeType = findPlaneType(rid);
487  log << "ROP: " << rid
488  << " (plane type: " << PlaneTypeName(planeType) << ")";
489 
490  auto const& WirelessChannelCounts
491  = TPCsetChannelCounts.at(planeType);
492 
493  PlaneColl_t const& planes = ROPplanes(rid);
494  log << " (" << planes.size() << " planes):";
495  assert(!planes.empty());
496 
497  raw::ChannelID_t const firstROPchannel = nextChannel;
498 
499  auto iPlane = util::begin(planes);
500  auto const pend = util::end(planes);
501 
502  // assign available channels to all wires of the first plane
503  nextChannel += WirelessChannelCounts.first + (*iPlane)->Nwires();
504  fPlaneInfo[(*iPlane)->ID()] = {
506  { firstROPchannel + WirelessChannelCounts.first, nextChannel },
507  rid
508  };
509  log << " [" << (*iPlane)->ID() << "] "
510  << fPlaneInfo[(*iPlane)->ID()].firstChannel()
511  << " -- " << fPlaneInfo[(*iPlane)->ID()].lastChannel() << ";";
512 
513  geo::Point_t lastWirePos = (*iPlane)->LastWire().GetCenter<geo::Point_t>();
514 
515  while (++iPlane != pend) {
516 
517  geo::PlaneGeo const& plane = **iPlane;
518 
519  // find out which wire matches the last wire from the previous plane;
520  // if there is no such wire, an exception will be thrown,
521  // which is ok to us since we believe it should not happen.
522  geo::WireID const lastMatchedWireID
523  = plane.NearestWireID(lastWirePos);
524 
525  /*
526  mf::LogTrace("ICARUSChannelMapAlg")
527  << (*std::prev(iPlane))->ID() << " W:" << ((*std::prev(iPlane))->Nwires() - 1)
528  << " ending at " << (*std::prev(iPlane))->LastWire().GetEnd<geo::Point_t>()
529  << " matched " << lastMatchedWireID
530  << " which starts at " << plane.Wire(lastMatchedWireID).GetStart<geo::Point_t>()
531  ;
532  */
533 
534  //
535  // the first channel in this plane (`iPlane`) is the one associated
536  // to the first wire in the plane, which has local wire number `0`;
537  // the last channel from the previous plane (`nextChannel - 1`)
538  // is associated to the matched wire (`lastMatchedWireID`),
539  // which has some wire number (`lastMatchedWireID.Wire`).
540  //
541  auto const nWires = plane.Nwires();
542  raw::ChannelID_t const firstChannel
543  = (nextChannel - 1) - lastMatchedWireID.Wire;
544  nextChannel = firstChannel + nWires;
545 
546  fPlaneInfo[plane.ID()] = { { firstChannel, nextChannel }, rid };
547  log << " [" << plane.ID() << "] "
548  << fPlaneInfo[plane.ID()].firstChannel() << " -- "
549  << fPlaneInfo[plane.ID()].lastChannel() << ";";
550 
551  // update for the next iteration
552  lastWirePos = plane.LastWire().GetCenter<geo::Point_t>();
553 
554  } // while
555 
556  nextChannel += WirelessChannelCounts.second;
557  unsigned int const nChannels = nextChannel - firstROPchannel;
558  fChannelToWireMap.addROP(rid, firstROPchannel, nChannels);
559  log
560  << " => " << nChannels << " channels starting at " << firstROPchannel;
561 
562  } // for readout plane
563 
564  } // for TPC set
565 
566  } // for cryostat
567 
568  fChannelToWireMap.setEndChannel(nextChannel);
569  mf::LogTrace("ICARUSChannelMapAlg")
570  << "Counted " << fChannelToWireMap.nChannels() << " channels.";
571 
572 } // icarus::ICARUSChannelMapAlg::fillChannelToWireMap()
573 
574 
575 // -----------------------------------------------------------------------------
578 {
579  // the algorithm is delegated:
580  icarus::details::ROPandTPCsetBuildingAlg builder("ICARUSChannelMapAlg");
581 
582  auto results = builder.run(Cryostats);
583 
584  fReadoutMapInfo.set(
585  std::move(results).TPCsetCount(), std::move(results).TPCsetTPCs(),
586  std::move(results).ROPcount(), std::move(results).ROPplanes(),
587  std::move(results).TPCtoTPCset(), std::move(results).PlaneToROP()
588  );
589 
590 } // icarus::ICARUSChannelMapAlg::buildReadoutPlanes()
591 
592 
593 // -----------------------------------------------------------------------------
595  -> PlaneType_t
596 {
597  /*
598  * This implementation is very fragile, relying on the fact that the first
599  * induction plane numbers are `kFirstInductionType`, the second induction
600  * plane numbers are `kSecondInductionType` and the collection plane numbers
601  * are `kCollectionType`. This assumption is not checked anywhere.
602  *
603  */
604  constexpr std::array PlaneTypes = { // let's C++ figure out type and size
605  kFirstInductionType, // P:0
606  kSecondInductionType, // P:1
607  kCollectionType // P:2
608  };
609 
610  PlaneColl_t const& planes = ROPplanes(rid);
611  if (planes.empty()) return kUnknownType;
612  if (auto const planeNo = planes.front()->ID().Plane; planeNo < PlaneTypes.size())
613  return PlaneTypes[planeNo];
614  else return kUnknownType;
615 
616 } // icarus::ICARUSChannelMapAlg::findPlaneType()
617 
618 
619 // ----------------------------------------------------------------------------
621  (raw::ChannelID_t const channel) const
622 {
623  /*
624  * We rely on the accuracy of `findPlaneType()` (which is admittedly less than
625  * great) to assign signal type accordingly.
626  */
627 
629  = fChannelToWireMap.find(channel);
630  if (!channelInfo) return geo::kMysteryType;
631 
632  switch (findPlaneType(channelInfo->ropid)) {
633  case kFirstInductionType:
634  case kSecondInductionType:
635  return geo::kInduction;
636  case kCollectionType:
637  return geo::kCollection;
638  default:
639  return geo::kMysteryType;
640  } // switch
641 
642 } // icarus::ICARUSChannelMapAlg::SignalTypeForChannelImpl()
643 
644 
645 // -----------------------------------------------------------------------------
648 {
649  return {
650  // even TPC sets (e.g. C:0 S:0)
651  std::array{
652  std::make_pair(
653  params.FirstInductionPreChannels(),
655  ),
656  std::make_pair(
659  ),
660  std::make_pair(
661  params.CollectionEvenPreChannels(),
663  )
664  },
665  // odd TPC sets (e.g. C:0 S:1)
666  std::array{
667  std::make_pair(
668  params.FirstInductionPreChannels(),
670  ),
671  std::make_pair(
674  ),
675  std::make_pair(
676  params.CollectionOddPreChannels(),
678  )
679  }
680  };
681 
682 } // icarus::ICARUSChannelMapAlg::extractWirelessChannelParams()
683 
684 
685 // ----------------------------------------------------------------------------
687 
688  using namespace std::string_literals;
689  switch (planeType) {
690  case kFirstInductionType: return "first induction"s;
691  case kSecondInductionType: return "second induction"s;
692  case kCollectionType: return "collection induction"s;
693  case kUnknownType: return "unknown"s;
694  default:
695  return "unsupported ("s + std::to_string(planeType) + ")"s;
696  } // switch
697 
698 } // icarus::ICARUSChannelMapAlg::PlaneTypeName()
699 
700 
701 // ----------------------------------------------------------------------------
702 
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:333
virtual std::set< geo::PlaneID > const & PlaneIDs() const override
Returns a list of the plane IDs in the whole detector.
PlaneType_t findPlaneType(readout::ROPID const &ropid) const
Returns the &quot;type&quot; of readout plane.
readout::ROPID ropid
ID of the ROP we cover.
virtual std::vector< geo::TPCID > ROPtoTPCs(readout::ROPID const &ropid) const override
Returns a list of ID of TPCs the specified ROP spans.
ICARUSChannelMapAlg(Config const &config)
Constructor: taked a configuration object.
virtual geo::SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const override
Returns the type of signal on the specified channel.
Channel mapping algorithms for ICARUS detector.
Who knows?
Definition: geo_types.h:147
Encapsulate the construction of a single cyostat.
static constexpr Sample_t transform(Sample_t sample)
virtual void Initialize(geo::GeometryData_t const &geodata) override
Prepares the algorithm extracting information from the geometry.
virtual std::vector< geo::TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const override
Returns a list of ID of TPCs belonging to the specified TPC set.
void buildReadoutPlanes(geo::GeometryData_t::CryostatList_t const &Cryostats)
Fills information about the TPC set and readout plane structure.
geo::TPCDataContainer< readout::TPCsetID > const & TPCtoTPCset() const
The TPC set including each TPC.
std::size_t PlaneType_t
Type for plane type identifier.
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
Definition of util::enumerate().
unsigned int ROPID_t
Type for the ID number.
std::array< std::array< std::pair< unsigned int, unsigned int >, 3U >, 2U > WirelessChannelCounts_t
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
virtual readout::ROPID WirePlaneToROP(geo::PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to, or invalid if none.
unsigned short TPCsetID_t
Type for the ID number.
Definition: readout_types.h:71
BEGIN_PROLOG opflashtpc1 TPCs
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
virtual std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t channel) const override
Returns a collection of ID of wires connected to the channel.
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
std::vector< geo::CryostatGeo > CryostatList_t
Type of list of cryostats.
Definition: GeometryData.h:34
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
Algorithm discovering the number of elements in the geometry.
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const override
Returns the ID of the first channel in the specified readout plane.
constexpr raw::ChannelID_t begin() const
Returns the ID of the first channel in the range.
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
CryostatList_t cryostats
The detector cryostats.
Definition: GeometryData.h:38
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
virtual unsigned int MaxTPCsets() const override
Returns the largest number of TPC sets any cryostat in the detector has.
virtual bool HasROP(readout::ROPID const &ropid) const override
virtual geo::WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
static WirelessChannelCounts_t extractWirelessChannelParams(Config::WirelessChannelStruct const &params)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
virtual unsigned int MaxROPs() const override
Returns the largest number of ROPs a TPC set in the detector has.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:285
then echo ***************************************echo array
Definition: find_fhicl.sh:28
ROPID_t ROP
Index of the readout plane within its TPC set.
geo::WireID NearestWireID(geo::Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:649
Signal from induction planes.
Definition: geo_types.h:145
bool HasCryostat(readout::CryostatID const &cryoid) const
Returns whether the specified cryostat is known to the mapping.
Definitions of geometry vector data types.
enum geo::_plane_sigtype SigType_t
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of readout planes in the specified TPC set.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:37
Algorithm discovering TPC sets and readout planes for ICARUS.
Test of util::counter and support utilities.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
Class identifying a set of planes sharing readout channels.
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const override
Returns the channel ID a wire is connected to.
virtual geo::TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
virtual std::vector< geo::PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const override
Returns a list of ID of wire planes belonging to the specified ROP.
BEGIN_PROLOG Z planes
Extracts TPC sets and readout planes from a list of cryostats.
raw::ChannelID_t firstChannel
First channel in ROP.
Functions to help debugging by instrumenting code.
Encapsulate the construction of a single detector plane.
constexpr bool contains(raw::ChannelID_t channel) const
Returns whether this range includes the specified channel.
std::string to_string(WindowPattern const &pattern)
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
Functions pulling in STL customization if available.
do i e
void fillChannelToWireMap(geo::GeometryData_t::CryostatList_t const &Cryostats)
Fills the information about readout channel mapping.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
Results_t run(geo::GeometryData_t::CryostatList_t const &Cryostats)
Runs the algorithm as configured from start to end.
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:73
Data in the geometry description.
Definition: GeometryData.h:31
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void printBacktrace(Stream &&out, BacktracePrintOptions options)
Prints the full backtrace into a stream.
Definition: DebugUtils.h:403
Containers to hold one datum per TPC set or readout plane.
const WireGeo & LastWire() const
Return the last wire in the plane.
Definition: PlaneGeo.h:350
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
icarus::details::PlaneColl_t PlaneColl_t
esac echo uname r
virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override
Returns the ID of the ROP the channel belongs to (invalid if none).
virtual unsigned int Nchannels() const override
Returns the number of readout channels (ID&#39;s go 0 to Nchannels()).
static std::string PlaneTypeName(PlaneType_t planeType)
Returns the name of the specified plane type.
Encapsulate the construction of a single detector plane.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
virtual void Uninitialize() override
Frees the resources of this algorithm.
Signal from collection planes.
Definition: geo_types.h:146