ChannelMapCRMAlg.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ChannelMapCRMAlg.cxx
3 /// \brief Interface to algorithm class for a dual-phase detector channel mapping
4 ///
5 /// \version $Id: $
6 /// \author brebel@fnal.gov vgalymov@ipnl.in2p3.fr
7 ////////////////////////////////////////////////////////////////////////
8 
17 
19 
20 namespace geo{
21 
22  //----------------------------------------------------------------------------
24  : fSorter(geo::GeoObjectSorterCRM(p))
25  {
26  }
27 
28  //----------------------------------------------------------------------------
30  {
31  // start over:
32  Uninitialize();
33 
34  std::vector<geo::CryostatGeo> const& cgeo = geodata.cryostats;
35 
36  fNcryostat = cgeo.size();
37 
38  mf::LogInfo("ChannelMapCRMAlg") << "Initializing CRM ChannelMap...";
39 
40  fNTPC.resize(fNcryostat);
41  fWireCounts.resize(fNcryostat);
42  fNPlanes.resize(fNcryostat);
43  fFirstWireProj.resize(fNcryostat);
44  fOrthVectorsY.resize(fNcryostat);
45  fOrthVectorsZ.resize(fNcryostat);
47  fWiresPerPlane.resize(fNcryostat);
50  fPlaneIDs.clear();
51  fTopChannel = 0;
52 
53  int RunningTotal = 0;
54 
55  for(unsigned int cs = 0; cs != fNcryostat; ++cs){
56 
57  fNTPC[cs] = cgeo[cs].NTPC();
58 
59  // Size up all the vectors
60  fWireCounts[cs] .resize(fNTPC[cs]);
61  fFirstWireProj[cs] .resize(fNTPC[cs]);
62  fOrthVectorsY[cs] .resize(fNTPC[cs]);
63  fOrthVectorsZ[cs] .resize(fNTPC[cs]);
64  fPlaneBaselines[cs] .resize(fNTPC[cs]);
65  fWiresPerPlane[cs] .resize(fNTPC[cs]);
66  fNPlanes[cs] .resize(fNTPC[cs]);
67  fFirstChannelInThisPlane[cs].resize(fNTPC[cs]);
68  fFirstChannelInNextPlane[cs].resize(fNTPC[cs]);
69 
70  for(unsigned int TPCCount = 0; TPCCount != fNTPC[cs]; ++TPCCount)
71  {
72  unsigned int PlanesThisTPC = cgeo[cs].TPC(TPCCount).Nplanes();
73  fWireCounts[cs][TPCCount] .resize(PlanesThisTPC);
74  fFirstWireProj[cs][TPCCount].resize(PlanesThisTPC);
75  fOrthVectorsY[cs][TPCCount] .resize(PlanesThisTPC);
76  fOrthVectorsZ[cs][TPCCount] .resize(PlanesThisTPC);
77  fNPlanes[cs][TPCCount]=PlanesThisTPC;
78 
79  for(unsigned int PlaneCount = 0; PlaneCount != PlanesThisTPC; ++PlaneCount){
80 
81  if(PlaneCount >= 2) //should only find two views for dual-phase
82  throw cet::exception("Geometry") <<"CANNOT HAVE more than two readout planes for dual-phase"
83  << "\n";
84  /*
85  if(cgeo[cs].TPC(TPCCount).Plane(PlaneCount).View() == geo::kU)
86  std::cout<<" View is kU "<<std::endl;
87  else if(cgeo[cs].TPC(TPCCount).Plane(PlaneCount).View() == geo::kV)
88  std::cout<<" View is kV "<<std::endl;
89  else if(cgeo[cs].TPC(TPCCount).Plane(PlaneCount).View() == geo::kZ)
90  std::cout<<" View is kZ "<<std::endl;
91 
92  if(cgeo[cs].TPC(TPCCount).Plane(PlaneCount).SignalType() == geo::kInduction)
93  std::cout<<" View is kInduction "<<std::endl;
94  if(cgeo[cs].TPC(TPCCount).Plane(PlaneCount).SignalType() == geo::kCollection)
95  std::cout<<" View is kCollection "<<std::endl;
96  */
97 
98  fPlaneIDs.emplace(PlaneID(cs, TPCCount, PlaneCount));
99  double ThisWirePitch = cgeo[cs].TPC(TPCCount).WirePitch(PlaneCount);
100  fWireCounts[cs][TPCCount][PlaneCount] = cgeo[cs].TPC(TPCCount).Plane(PlaneCount).Nwires();
101 
102  double WireCentre1[3] = {0.,0.,0.};
103  double WireCentre2[3] = {0.,0.,0.};
104 
105  const geo::WireGeo& firstWire = cgeo[cs].TPC(TPCCount).Plane(PlaneCount).Wire(0);
106  const double sth = firstWire.SinThetaZ(), cth = firstWire.CosThetaZ();
107 
108  firstWire.GetCenter(WireCentre1,0);
109  cgeo[cs].TPC(TPCCount).Plane(PlaneCount).Wire(1).GetCenter(WireCentre2,0);
110 
111  // figure out if we need to flip the orthogonal vector
112  // (should point from wire n -> n+1)
113  double OrthY = cth, OrthZ = -sth;
114  if(((WireCentre2[1] - WireCentre1[1])*OrthY
115  + (WireCentre2[2] - WireCentre1[2])*OrthZ) < 0){
116  OrthZ *= -1;
117  OrthY *= -1;
118  }
119 
120  // Overall we are trying to build an expression that looks like
121  // int NearestWireNumber = round((worldPos.OrthVector - FirstWire.OrthVector)/WirePitch);
122  // That runs as fast as humanly possible.
123  // We predivide everything by the wire pitch so we don't do this in the loop.
124  //
125  // Putting this together into the useful constants we will use later per plane and tpc:
126  fOrthVectorsY[cs][TPCCount][PlaneCount] = OrthY / ThisWirePitch;
127  fOrthVectorsZ[cs][TPCCount][PlaneCount] = OrthZ / ThisWirePitch;
128 
129  fFirstWireProj[cs][TPCCount][PlaneCount] = WireCentre1[1]*OrthY + WireCentre1[2]*OrthZ;
130  fFirstWireProj[cs][TPCCount][PlaneCount] /= ThisWirePitch;
131 
132  // now to count up wires in each plane and get first channel in each plane
133  int WiresThisPlane = cgeo[cs].TPC(TPCCount).Plane(PlaneCount).Nwires();
134  fWiresPerPlane[cs] .at(TPCCount).push_back(WiresThisPlane);
135  fPlaneBaselines[cs].at(TPCCount).push_back(RunningTotal);
136 
137  RunningTotal += WiresThisPlane;
138 
139  fFirstChannelInThisPlane[cs].at(TPCCount).push_back(fTopChannel);
140  fTopChannel += WiresThisPlane;
141  fFirstChannelInNextPlane[cs].at(TPCCount).push_back(fTopChannel);
142 
143  }// end loop over planes
144  }// end loop over TPCs
145  }// end loop over cryostats
146 
147  // calculate the total number of channels in the detector
149 
150  MF_LOG_DEBUG("ChannelMapCRM") << "# of channels is " << fNchannels;
151 
152 
153  return;
154  }
155 
156  //----------------------------------------------------------------------------
158  {
159  }
160 
161  //----------------------------------------------------------------------------
163  {
164  std::vector< geo::WireID > AllSegments;
165  unsigned int cstat = 0;
166  unsigned int tpc = 0;
167  unsigned int plane = 0;
168  unsigned int wire = 0;
169 
170  // first check if this channel ID is legal
171  if(channel > fTopChannel)
172  throw cet::exception("Geometry") << "ILLEGAL CHANNEL ID for channel " << channel << "\n";
173 
174  // then go find which plane, tpc and cryostat it is in from the information we stored earlier
175  bool foundWid(false);
176  for(unsigned int csloop = 0; csloop != fNcryostat; ++csloop){
177  for(unsigned int tpcloop = 0; tpcloop != fNTPC[csloop]; ++tpcloop){
178  for(unsigned int planeloop = 0;
179  planeloop!=fFirstChannelInNextPlane[csloop][tpcloop].size();
180  ++planeloop)
181  {
182  if(channel < fFirstChannelInNextPlane[csloop][tpcloop][planeloop]){
183  cstat = csloop;
184  tpc = tpcloop;
185  plane = planeloop;
186  wire = channel - fFirstChannelInThisPlane[cstat][tpcloop][planeloop];
187  foundWid = true;
188  break;
189  }
190  if(foundWid) break;
191  }// end plane loop
192  if(foundWid) break;
193  }// end tpc loop
194  if(foundWid) break;
195  }// end cryostat loop
196 
197  geo::WireID CodeWire(cstat, tpc, plane, wire);
198 
199  AllSegments.push_back(CodeWire);
200 
201  return AllSegments;
202  }
203 
204  //----------------------------------------------------------------------------
206  {
207  return fNchannels;
208  }
209 
210  //----------------------------------------------------------------------------
211  unsigned int ChannelMapCRMAlg::Nchannels(readout::ROPID const& ropid) const {
212  if (!HasROP(ropid)) return 0;
213  // The number of channels matches the number of wires. Life is easy.
214  return WireCount(FirstWirePlaneInROP(ropid));
215  } // ChannelMapCRMAlg::Nchannels()
216 
217 
218  //----------------------------------------------------------------------------
220  (double YPos, double ZPos, geo::PlaneID const& planeID) const
221  {
222  // Returns the wire number corresponding to a (Y,Z) position in PlaneNo
223  // with float precision.
224  // B. Baller August 2014
225  return YPos*AccessElement(fOrthVectorsY, planeID)
226  + ZPos*AccessElement(fOrthVectorsZ, planeID)
227  - AccessElement(fFirstWireProj, planeID);
228  }
229 
230 
231  //----------------------------------------------------------------------------
233  (const TVector3& worldPos, geo::PlaneID const& planeID) const
234  {
235 
236  // This part is the actual calculation of the nearest wire number, where we assume
237  // uniform wire pitch and angle within a wireplane
238 
239  // add 0.5 to have the correct rounding
240  int NearestWireNumber = int
241  (0.5 + WireCoordinate(worldPos.Y(), worldPos.Z(), planeID));
242 
243  // If we are outside of the wireplane range, throw an exception
244  // (this response maintains consistency with the previous
245  // implementation based on geometry lookup)
246  if(NearestWireNumber < 0 ||
247  (unsigned int) NearestWireNumber >= WireCount(planeID))
248  {
249  int wireNumber = NearestWireNumber; // save for the output
250 
251  if(NearestWireNumber < 0 ) NearestWireNumber = 0;
252  else NearestWireNumber = WireCount(planeID) - 1;
253 
254  throw InvalidWireIDError("Geometry", wireNumber, NearestWireNumber)
255  << "Can't Find Nearest Wire for position ("
256  << worldPos[0] << "," << worldPos[1] << "," << worldPos[2] << ")"
257  << " in plane " << std::string(planeID) << " approx wire number # "
258  << wireNumber << " (capped from " << NearestWireNumber << ")\n";
259  }
260 
261  return geo::WireID(planeID, (geo::WireID::WireID_t) NearestWireNumber);
262  }
263 
264  //----------------------------------------------------------------------------
265  // This method returns the channel number, assuming the numbering scheme
266  // is heirachical - that is, channel numbers run in order, for example:
267  // (Ben J Oct 2011)
268  // Wire1 | 0
269  // Plane1 { Wire2 | 1
270  // TPC1 { Wire3 | 2
271  // Plane2 { Wire1 | 3 increasing channel number
272  // Wire2 | 4 (with no gaps)
273  // TPC2 { Plane1 { Wire1 | 5
274  // Plane2 { Wire1 | 6
275  // Wire2 v 7
276  //
278  (geo::WireID const& wireID) const
279  {
280  unsigned int const* pBaseLine = GetElementPtr(fPlaneBaselines, wireID);
281  // This is the actual lookup part - first make sure coordinates are legal
282  if (pBaseLine) {
283  // if the channel has legal coordinates, its ID is given by the wire
284  // number above the number of wires in lower planes, tpcs and cryostats
285  return *pBaseLine + wireID.Wire;
286  }
287  else{
288  // if the coordinates were bad, throw an exception
289  throw cet::exception("ChannelMapCRMAlg")
290  << "NO CHANNEL FOUND for " << std::string(wireID);
291  }
292 
293  // made it here, that shouldn't happen, return raw::InvalidChannelID
294  mf::LogWarning("ChannelMapCRMAlg") << "should not be at the point in the function, returning "
295  << "invalid channel";
296  return raw::InvalidChannelID;
297 
298  }
299 
300 
301  //----------------------------------------------------------------------------
303  {
304 
305  // still assume one cryostat for now -- faster
306  unsigned int nChanPerTPC = fNchannels/fNTPC[0];
307  // casting wil trunc towards 0 -- faster than floor
308  unsigned int tpc = channel / nChanPerTPC;
309  //need number of planes to know Collection
310  unsigned int PlanesThisTPC = fNPlanes[0][tpc];
311 
312 
313  //for dual-phase force a return of two collection views
315  if( (channel >= fFirstChannelInThisPlane[0][tpc][0]) &&
316  (channel < fFirstChannelInNextPlane[0][tpc][PlanesThisTPC-1]) )
317  { sigt = geo::kCollection; }
318  else
319  mf::LogWarning("BadChannelSignalType") << "Channel " << channel
320  << " not given signal type." << std::endl;
321 
322 
323  return sigt;
324  }
325 
326 
327  //----------------------------------------------------------------------------
328  /* // this code should be equivalent to the logic implemented in geo::PlaneGeo::UpdateView()
329  View_t ChannelMapCRMAlg::View(raw::ChannelID_t const channel) const
330  {
331 
332  // still assume one cryostat for now -- faster
333  unsigned int nChanPerTPC = fNchannels/fNTPC[0];
334  // casting wil trunc towards 0 -- faster than floor
335  unsigned int tpc = channel / nChanPerTPC;
336  //unsigned int PlanesThisTPC = fNPlanes[0][tpc];
337 
338  View_t view = geo::kUnknown;
339 
340  if( (channel >= fFirstChannelInThisPlane[0][tpc][0]) &&
341  (channel < fFirstChannelInNextPlane[0][tpc][0]) ){ view = geo::kY; }
342  else if( (channel >= fFirstChannelInThisPlane[0][tpc][1]) &&
343  (channel < fFirstChannelInNextPlane[0][tpc][1]) ){ view = geo::kZ; }
344  //else if( (channel >= fFirstChannelInThisPlane[0][tpc][2]) &&
345  //(channel < fFirstChannelInNextPlane[0][tpc][2]) ){ view = geo::kZ; }
346  else
347  mf::LogWarning("BadChannelSignalType") << "Channel " << channel
348  << " not given view type.";
349 
350  return view;
351  }
352  */
353 
354  //----------------------------------------------------------------------------
355  std::set<PlaneID> const& ChannelMapCRMAlg::PlaneIDs() const
356  {
357  return fPlaneIDs;
358  }
359 
360 
361  //----------------------------------------------------------------------------
362  /**
363  * @brief Returns the total number of TPC sets in the specified cryostat
364  * @param cryoid cryostat ID
365  * @return number of TPC sets in the cryostat, or 0 if no cryostat found
366  */
367  unsigned int ChannelMapCRMAlg::NTPCsets
368  (readout::CryostatID const& cryoid) const
369  {
370  // return the same number as the number of TPCs
371  return (cryoid.isValid && cryoid.Cryostat < fNTPC.size())?
372  fNTPC[cryoid.Cryostat]: 0;
373  } // ChannelMapCRMAlg::NTPCsets()
374 
375 
376  //----------------------------------------------------------------------------
377  /// Returns the largest number of TPC sets any cryostat in the detector has
378  unsigned int ChannelMapCRMAlg::MaxTPCsets() const {
379  return MaxTPCs();
380  } // ChannelMapCRMAlg::MaxTPCsets()
381 
382 
383  //----------------------------------------------------------------------------
384  /// Returns whether we have the specified TPC set
385  /// @return whether the TPC set is valid and exists
386  bool ChannelMapCRMAlg::HasTPCset(readout::TPCsetID const& tpcsetid) const {
387  return tpcsetid.TPCset < NTPCsets(tpcsetid);
388  } // ChannelMapCRMAlg::HasTPCset()
389 
390 
391  //----------------------------------------------------------------------------
392  /// Returns the ID of the TPC set tpcid belongs to
394  (geo::TPCID const& tpcid) const
395  {
396  return ConvertTPCtoTPCset(tpcid);
397  } // ChannelMapCRMAlg::TPCtoTPCset()
398 
399 
400  //----------------------------------------------------------------------------
401  /**
402  * @brief Returns a list of ID of TPCs belonging to the specified TPC set
403  * @param tpcsetid ID of the TPC set to convert into TPC IDs
404  * @return the list of TPCs, empty if TPC set is invalid
405  *
406  * Note that the check is performed on the validity of the TPC set ID, that
407  * does not necessarily imply that the TPC set specified by the ID actually
408  * exists. Check the existence of the TPC set first (HasTPCset()).
409  * Behaviour on valid, non-existent TPC set IDs is undefined.
410  */
411  std::vector<geo::TPCID> ChannelMapCRMAlg::TPCsetToTPCs
412  (readout::TPCsetID const& tpcsetid) const
413  {
414  std::vector<geo::TPCID> IDs;
415  if (tpcsetid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(tpcsetid));
416  return IDs;
417  } // ChannelMapCRMAlg::TPCsetToTPCs()
418 
419 
420  //----------------------------------------------------------------------------
421  /// Returns the ID of the first TPC belonging to the specified TPC set
423  (readout::TPCsetID const& tpcsetid) const
424  {
425  return ConvertTPCsetToTPC(tpcsetid);
426  } // ChannelMapCRMAlg::FirstTPCinTPCset()
427 
428 
429  //----------------------------------------------------------------------------
430  unsigned int ChannelMapCRMAlg::MaxTPCs() const
431  {
432  unsigned int max = 0;
433  for (unsigned int nTPCs: fNTPC) if (nTPCs > max) max = nTPCs;
434  return max;
435  } // ChannelMapCRMAlg::MaxTPCs()
436 
437 
438  //----------------------------------------------------------------------------
439  /**
440  * @brief Returns the total number of ROP in the specified TPC set
441  * @param tpcsetid TPC set ID
442  * @return number of readout planes in the TPC set, or 0 if no TPC set found
443  *
444  * Note that this methods explicitly check the existence of the TPC set.
445  */
446  unsigned int ChannelMapCRMAlg::NROPs(readout::TPCsetID const& tpcsetid) const
447  {
448  if (!HasTPCset(tpcsetid)) return 0;
449  return AccessElement(fNPlanes, FirstTPCinTPCset(tpcsetid));
450  } // ChannelMapCRMAlg::NROPs()
451 
452 
453  //----------------------------------------------------------------------------
454  /// Returns the largest number of ROPs a TPC set in the detector has
455  unsigned int ChannelMapCRMAlg::MaxROPs() const {
456  unsigned int max = 0;
457  for (auto const& cryo_tpc: fNPlanes)
458  for (unsigned int nPlanes: cryo_tpc)
459  if (nPlanes > max) max = nPlanes;
460  return max;
461  } // ChannelMapCRMAlg::MaxROPs()
462 
463 
464  //----------------------------------------------------------------------------
465  /// Returns whether we have the specified ROP
466  /// @return whether the readout plane is valid and exists
467  bool ChannelMapCRMAlg::HasROP(readout::ROPID const& ropid) const {
468  return ropid.ROP < NROPs(ropid);
469  } // ChannelMapCRMAlg::HasROP()
470 
471 
472  //----------------------------------------------------------------------------
473  /// Returns the ID of the ROP planeid belongs to
475  (geo::PlaneID const& planeid) const
476  {
477  return ConvertWirePlaneToROP(planeid);
478  } // ChannelMapCRMAlg::WirePlaneToROP()
479 
480 
481  //----------------------------------------------------------------------------
482  /// Returns a list of ID of planes belonging to the specified ROP
483  std::vector<geo::PlaneID> ChannelMapCRMAlg::ROPtoWirePlanes
484  (readout::ROPID const& ropid) const
485  {
486  std::vector<geo::PlaneID> IDs;
487  if (ropid.isValid) IDs.emplace_back(FirstWirePlaneInROP(ropid));
488  return IDs;
489  } // ChannelMapCRMAlg::ROPtoWirePlanes()
490 
491 
492  //----------------------------------------------------------------------------
493  /// Returns the ID of the first plane belonging to the specified ROP
495  (readout::ROPID const& ropid) const
496  {
497  return ConvertROPtoWirePlane(ropid);
498  } // ChannelMapCRMAlg::FirstWirePlaneInROP()
499 
500 
501  //----------------------------------------------------------------------------
502  /**
503  * @brief Returns a list of ID of TPCs the specified ROP spans
504  * @param ropid ID of the readout plane
505  * @return the list of TPC IDs, empty if readout plane ID is invalid
506  *
507  * Note that this check is performed on the validity of the readout plane
508  * ID, that does not necessarily imply that the readout plane specified by
509  * the ID actually exists. Check if the ROP exists with HasROP().
510  * The behaviour on non-existing readout planes is undefined.
511  */
512  std::vector<geo::TPCID> ChannelMapCRMAlg::ROPtoTPCs
513  (readout::ROPID const& ropid) const
514  {
515  std::vector<geo::TPCID> IDs;
516  // we take the TPC set of the ROP and convert it straight into a TPC ID
517  if (ropid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(ropid.asTPCsetID()));
518  return IDs;
519  } // ChannelMapCRMAlg::ROPtoTPCs()
520 
521 
522  //----------------------------------------------------------------------------
523  /// Returns the ID of the ROP the channel belongs to
524  /// @throws cet::exception (category: "Geometry") if non-existent channel
526  {
527  if (!raw::isValidChannelID(channel)) return {}; // invalid ROP returned
528 
529  // which wires does the channel cover?
530  std::vector<geo::WireID> wires = ChannelToWire(channel);
531 
532  // - none:
533  if (wires.empty()) return {}; // default-constructed ID, invalid
534 
535  // - one: maps its plane ID into a ROP ID
536  return WirePlaneToROP(wires[0]);
537  } // ChannelMapCRMAlg::ChannelToROP()
538 
539 
540  //----------------------------------------------------------------------------
541  /**
542  * @brief Returns the ID of the first channel in the specified readout plane
543  * @param ropid ID of the readout plane
544  * @return ID of first channel, or raw::InvalidChannelID if ID is invalid
545  *
546  * Note that this check is performed on the validity of the readout plane
547  * ID, that does not necessarily imply that the readout plane specified by
548  * the ID actually exists. Check if the ROP exists with HasROP().
549  * The behaviour for non-existing readout planes is undefined.
550  */
552  (readout::ROPID const& ropid) const
553  {
554  if (!ropid.isValid) return raw::InvalidChannelID;
555  return (raw::ChannelID_t)
557  } // ChannelMapCRMAlg::FirstChannelInROP()
558 
559 
560  //----------------------------------------------------------------------------
562  (geo::TPCID const& tpcid)
563  {
564  if (!tpcid.isValid) return {}; // invalid ID, default-constructed
565  return {
568  };
569  } // ChannelMapCRMAlg::ConvertTPCtoTPCset()
570 
571 
572  //----------------------------------------------------------------------------
574  (readout::TPCsetID const& tpcsetid)
575  {
576  if (!tpcsetid.isValid) return {};
577  return {
579  (geo::TPCID::TPCID_t) tpcsetid.TPCset
580  };
581  } // ChannelMapCRMAlg::ConvertTPCsetToTPC()
582 
583 
584  //----------------------------------------------------------------------------
586  (geo::PlaneID const& planeid)
587  {
588  if (!planeid.isValid) return {}; // invalid ID, default-constructed
589  return {
593  };
594 
595  } // ChannelMapCRMAlg::ConvertWirePlaneToROP()
596 
597 
598  //----------------------------------------------------------------------------
600  (readout::ROPID const& ropid)
601  {
602  if (!ropid.isValid) return {};
603  return {
605  (geo::TPCID::TPCID_t) ropid.TPCset,
607  };
608  } // ChannelMapCRMAlg::ConvertROPtoWirePlane()
609 
610 
611  //----------------------------------------------------------------------------
612 
613 } // namespace
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
virtual std::vector< geo::PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const override
Returns a list of ID of planes belonging to the specified ROP.
Who knows?
Definition: geo_types.h:147
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
Encapsulate the construction of a single cyostat.
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const override
Return the signal type of the specified channel.
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int ROPID_t
Type for the ID number.
unsigned short TPCsetID_t
Type for the ID number.
Definition: readout_types.h:71
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:473
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROP in the specified TPC set.
double SinThetaZ() const
Definition: WireGeo.h:265
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:211
PlaneInfoMap_t< unsigned int > fPlaneBaselines
virtual readout::TPCsetID TPCtoTPCset(geo::TPCID const &tpcid) const override
Returns the ID of the TPC set tpcid belongs to.
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
virtual geo::TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
CryostatList_t cryostats
The detector cryostats.
Definition: GeometryData.h:38
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const override
Returns the ID of the first channel in the specified readout plane.
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
void Initialize(GeometryData_t const &geodata) override
Geometry initialisation.
virtual std::set< PlaneID > const & PlaneIDs() const override
Returns a list of the plane IDs in the whole detector.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
ROPID_t ROP
Index of the readout plane within its TPC set.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Collection of exceptions for Geometry system.
enum geo::_plane_sigtype SigType_t
virtual unsigned int MaxROPs() const override
Returns the largest number of ROPs a TPC set in the detector has.
unsigned int fNchannels
number of channels in the detector
p
Definition: test.py:223
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:37
Encapsulate the geometry of an auxiliary detector.
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
Interface to algorithm class for a dual-phase detector channel mapping.
static readout::TPCsetID ConvertTPCtoTPCset(geo::TPCID const &tpcid)
Converts a TPC ID into a TPC set ID using the same numerical indices.
static int max(int a, int b)
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
virtual unsigned int MaxTPCsets() const override
Returns the largest number of TPC sets any cryostat in the detector has.
Class identifying a set of planes sharing readout channels.
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneInfoMap_t< unsigned int > fWiresPerPlane
unsigned int fNcryostat
number of cryostats in the detector
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
PlaneInfoMap_t< float > fOrthVectorsZ
Encapsulate the geometry of a wire.
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const override
Returns the channel ID a wire is connected to.
virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override
T const * GetElementPtr(PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
Returns a pointer to the specified element, or nullptr if invalid.
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
static readout::ROPID ConvertWirePlaneToROP(geo::PlaneID const &planeid)
Converts a ROP ID into a wire plane ID using the same numerical indices.
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
Encapsulate the construction of a single detector plane.
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
ChannelMapCRMAlg(fhicl::ParameterSet const &p)
TPCInfoMap_t< unsigned int > fNPlanes
virtual bool HasROP(readout::ROPID const &ropid) const override
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
unsigned int Nchannels() const override
Returns the total number of channels present (not necessarily contiguous)
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:561
Access the description of detector geometry.
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
virtual std::vector< geo::TPCID > ROPtoTPCs(readout::ROPID const &ropid) const override
Returns a list of ID of TPCs the specified ROP spans.
Exception thrown on invalid wire number (e.g. NearestWireID())
Definition: Exceptions.h:158
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
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:264
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
const char * cs
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
PlaneInfoMap_t< float > fWireCounts
PlaneInfoMap_t< float > fFirstWireProj
virtual readout::ROPID WirePlaneToROP(geo::PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
constexpr TPCsetID const & asTPCsetID() const
Conversion to TPCsetID (for convenience of notation).
Encapsulate the construction of a single detector plane.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
virtual WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
Signal from collection planes.
Definition: geo_types.h:146
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.