Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
geo::ChannelMapCRMAlg Class Reference

#include <ChannelMapCRMAlg.h>

Inheritance diagram for geo::ChannelMapCRMAlg:
geo::ChannelMapAlg

Public Member Functions

 ChannelMapCRMAlg (fhicl::ParameterSet const &p)
 
void Initialize (GeometryData_t const &geodata) override
 Geometry initialisation. More...
 
void Uninitialize () override
 Deconfiguration: prepare for a following call of Initialize() More...
 
std::vector< WireIDChannelToWire (raw::ChannelID_t channel) const override
 
unsigned int Nchannels () const override
 Returns the total number of channels present (not necessarily contiguous) More...
 
virtual unsigned int Nchannels (readout::ROPID const &ropid) const override
 Returns the number of channels in the specified ROP. More...
 
virtual SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const override
 Return the signal type of the specified channel. More...
 
virtual std::set< PlaneID > const & PlaneIDs () const override
 Returns a list of the plane IDs in the whole detector. More...
 
virtual geo::GeoObjectSorter const & Sorter () const override
 Returns the object to sort geometry with. More...
 
virtual double WireCoordinate (double YPos, double ZPos, geo::PlaneID const &planeID) const override
 Returns the index of the wire nearest to the specified position. More...
 
virtual double WireCoordinate (double YPos, double ZPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const override
 Returns the index of the wire nearest to the specified position. More...
 
virtual WireID NearestWireID (const TVector3 &worldPos, geo::PlaneID const &planeID) const override
 Returns the ID of the wire nearest to the specified position. More...
 
virtual WireID NearestWireID (const TVector3 &worldPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const override
 Returns the ID of the wire nearest to the specified position. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (geo::WireID const &wireID) const override
 Returns the channel ID a wire is connected to. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (unsigned int plane, unsigned int wire, unsigned int tpc, unsigned int cstat) const override
 Returns the channel ID a wire is connected to. More...
 
TPC set mapping
virtual unsigned int NTPCsets (readout::CryostatID const &cryoid) const override
 Returns the total number of TPC sets in the specified cryostat. More...
 
virtual unsigned int MaxTPCsets () const override
 Returns the largest number of TPC sets any cryostat in the detector has. More...
 
virtual bool HasTPCset (readout::TPCsetID const &tpcsetid) const override
 
virtual readout::TPCsetID TPCtoTPCset (geo::TPCID const &tpcid) const override
 Returns the ID of the TPC set tpcid belongs to. More...
 
virtual std::vector< geo::TPCIDTPCsetToTPCs (readout::TPCsetID const &tpcsetid) const override
 Returns a list of ID of TPCs belonging to the specified TPC set. More...
 
virtual geo::TPCID FirstTPCinTPCset (readout::TPCsetID const &tpcsetid) const override
 Returns the ID of the first TPC belonging to the specified TPC set. More...
 
Readout plane mapping
virtual unsigned int NROPs (readout::TPCsetID const &tpcsetid) const override
 Returns the total number of ROP in the specified TPC set. More...
 
virtual unsigned int MaxROPs () const override
 Returns the largest number of ROPs a TPC set in the detector has. More...
 
virtual bool HasROP (readout::ROPID const &ropid) const override
 
virtual readout::ROPID WirePlaneToROP (geo::PlaneID const &planeid) const override
 Returns the ID of the ROP planeid belongs to. More...
 
virtual std::vector< geo::PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const override
 Returns a list of ID of planes belonging to the specified ROP. More...
 
virtual geo::PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first plane belonging to the specified ROP. More...
 
virtual std::vector< geo::TPCIDROPtoTPCs (readout::ROPID const &ropid) const override
 Returns a list of ID of TPCs the specified ROP spans. More...
 
virtual readout::ROPID ChannelToROP (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. More...
 
- Public Member Functions inherited from geo::ChannelMapAlg
virtual ~ChannelMapAlg ()=default
 Virtual destructor. More...
 
virtual unsigned int NOpChannels (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
virtual unsigned int MaxOpChannel (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
virtual unsigned int NOpHardwareChannels (unsigned int opDet) const
 Returns the number of channels in the specified optical detectors. More...
 
virtual bool IsValidOpChannel (unsigned int opChannel, unsigned int NOpDets) const
 Returns whether the ID identifies a valid optical detector channel. More...
 
virtual unsigned int OpChannel (unsigned int detNum, unsigned int hwchannel=0) const
 Returns the channel ID of the specified hardware channel. More...
 
virtual unsigned int OpDetFromOpChannel (unsigned int opChannel) const
 Returns the optical detector the specified optical channel belongs. More...
 
virtual unsigned int HardwareChannelFromOpChannel (unsigned int opChannel) const
 Returns the hardware channel number of specified optical channel. More...
 
unsigned int NearestWire (const TVector3 &worldPos, geo::PlaneID const &planeID) const
 Returns the index of the wire nearest to the specified position. More...
 
unsigned int NearestWire (const TVector3 &worldPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const
 Returns the index of the wire nearest to the specified position. More...
 
virtual size_t NearestAuxDet (const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns the auxiliary detector closest to the specified point. More...
 
virtual size_t NearestSensitiveAuxDet (const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns sensitive auxiliary detector closest to specified point. More...
 
virtual size_t ChannelToAuxDet (std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
 Returns the index of the detector containing the specified channel. More...
 
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet (std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
 Returns the index of the sensitive detector containing the channel. More...
 
const std::vector< std::vector< std::vector< raw::ChannelID_t > > > FirstChannelInNextPlane () const
 Retrieve the private fFirstChannelInNextPlane vector for testing. More...
 
const std::vector< std::vector< std::vector< raw::ChannelID_t > > > FirstChannelInThisPlane () const
 Retrieve the private fFirstChannelInThisPlane vector for testing. More...
 
virtual bool HasChannel (raw::ChannelID_t channel) const
 Returns whether the specified channel is valid This default implementation assumes all channels up to Nchannels() valid. More...
 
geo::SigType_t SignalTypeForChannel (raw::ChannelID_t const channel) const
 Return the signal type of the specified channel. More...
 
geo::SigType_t SignalTypeForROPID (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 

Private Member Functions

unsigned int WireCount (geo::PlaneID const &id) const
 Retrieved the wire cound for the specified plane ID. More...
 
unsigned int MaxTPCs () const
 Returns the largest number of TPCs in a single cryostat. More...
 

Static Private Member Functions

static readout::TPCsetID ConvertTPCtoTPCset (geo::TPCID const &tpcid)
 Converts a TPC ID into a TPC set ID using the same numerical indices. More...
 
static geo::TPCID ConvertTPCsetToTPC (readout::TPCsetID const &tpcsetid)
 Converts a TPC set ID into a TPC ID using the same numerical indices. More...
 
static readout::ROPID ConvertWirePlaneToROP (geo::PlaneID const &planeid)
 Converts a ROP ID into a wire plane ID using the same numerical indices. More...
 
static geo::PlaneID ConvertROPtoWirePlane (readout::ROPID const &ropid)
 Converts a wire plane ID into a ROP ID using the same numerical indices. More...
 

Private Attributes

unsigned int fNcryostat
 number of cryostats in the detector More...
 
unsigned int fNchannels
 number of channels in the detector More...
 
raw::ChannelID_t fTopChannel
 book keeping highest channel # More...
 
std::vector< unsigned int > fNTPC
 number of TPCs in each cryostat More...
 
std::set< View_tfViews
 vector of the views present in the detector More...
 
std::set< PlaneIDfPlaneIDs
 vector of the PlaneIDs present in the detector More...
 
PlaneInfoMap_t< float > fFirstWireProj
 
PlaneInfoMap_t< float > fOrthVectorsY
 Unit vectors orthogonal to wires in. More...
 
PlaneInfoMap_t< float > fOrthVectorsZ
 
PlaneInfoMap_t< float > fWireCounts
 
TPCInfoMap_t< unsigned int > fNPlanes
 
PlaneInfoMap_t< unsigned int > fPlaneBaselines
 
PlaneInfoMap_t< unsigned int > fWiresPerPlane
 
geo::GeoObjectSorterCRM fSorter
 class to sort geo objects More...
 

Additional Inherited Members

- Protected Types inherited from geo::ChannelMapAlg
template<typename T >
using TPCInfoMap_t = std::vector< std::vector< T >>
 Data type for per-TPC information. More...
 
template<typename T >
using PlaneInfoMap_t = TPCInfoMap_t< std::vector< T >>
 Data type for per-plane information. More...
 
- Protected Member Functions inherited from geo::ChannelMapAlg
template<typename T >
T const & AccessElement (PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
 Returns the specified element of the plane map. More...
 
template<typename T >
size_t AccessElementSize (PlaneInfoMap_t< T > const &map, geo::TPCID const &id) const
 Returns the number of elements in the specified TPC of the plane map. More...
 
template<typename T >
T const * GetElementPtr (PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
 Returns a pointer to the specified element, or nullptr if invalid. More...
 
template<typename T >
T const & AccessElement (TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
 Returns the specified element of the TPC map. More...
 
template<typename T >
size_t AccessElementSize (TPCInfoMap_t< T > const &map, geo::CryostatID const &id) const
 Returns the number of elements in the specified cryostat of the TPC map. More...
 
template<typename T >
bool isValidElement (TPCInfoMap_t< T > const &map, geo::CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::TPCID const &id) const
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
 
virtual geo::SigType_t SignalTypeForROPIDImpl (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 
- Protected Attributes inherited from geo::ChannelMapAlg
PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInThisPlane
 
PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInNextPlane
 
std::map< std::string, size_t > fADNameToGeo
 map the names of the dets to the AuxDetGeo objects More...
 
std::map< size_t, std::vector< size_t > > fADChannelToSensitiveGeo
 

Detailed Description

Definition at line 23 of file ChannelMapCRMAlg.h.

Constructor & Destructor Documentation

geo::ChannelMapCRMAlg::ChannelMapCRMAlg ( fhicl::ParameterSet const &  p)

Definition at line 23 of file ChannelMapCRMAlg.cxx.

25  {
26  }
geo::GeoObjectSorterCRM fSorter
class to sort geo objects
p
Definition: test.py:223

Member Function Documentation

readout::ROPID geo::ChannelMapCRMAlg::ChannelToROP ( raw::ChannelID_t  channel) const
overridevirtual

Returns the ID of the ROP the channel belongs to

Exceptions
cet::exception(category: "Geometry") if non-existent channel

Implements geo::ChannelMapAlg.

Definition at line 525 of file ChannelMapCRMAlg.cxx.

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()
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:37
virtual readout::ROPID WirePlaneToROP(geo::PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to.
std::vector< geo::WireID > geo::ChannelMapCRMAlg::ChannelToWire ( raw::ChannelID_t  channel) const
overridevirtual

Returns a list of TPC wires connected to the specified readout channel ID

Exceptions
cet::exception(category: "Geometry") if non-existent channel

Implements geo::ChannelMapAlg.

Definition at line 162 of file ChannelMapCRMAlg.cxx.

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  }
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
raw::ChannelID_t fTopChannel
book keeping highest channel #
unsigned int fNcryostat
number of cryostats in the detector
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::PlaneID geo::ChannelMapCRMAlg::ConvertROPtoWirePlane ( readout::ROPID const &  ropid)
staticprivate

Converts a wire plane ID into a ROP ID using the same numerical indices.

Definition at line 600 of file ChannelMapCRMAlg.cxx.

601  {
602  if (!ropid.isValid) return {};
603  return {
604  (geo::CryostatID::CryostatID_t) ropid.Cryostat,
605  (geo::TPCID::TPCID_t) ropid.TPCset,
606  (geo::PlaneID::PlaneID_t) ropid.ROP
607  };
608  } // ChannelMapCRMAlg::ConvertROPtoWirePlane()
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:473
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
geo::TPCID geo::ChannelMapCRMAlg::ConvertTPCsetToTPC ( readout::TPCsetID const &  tpcsetid)
staticprivate

Converts a TPC set ID into a TPC ID using the same numerical indices.

Definition at line 574 of file ChannelMapCRMAlg.cxx.

575  {
576  if (!tpcsetid.isValid) return {};
577  return {
578  (geo::CryostatID::CryostatID_t) tpcsetid.Cryostat,
579  (geo::TPCID::TPCID_t) tpcsetid.TPCset
580  };
581  } // ChannelMapCRMAlg::ConvertTPCsetToTPC()
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
readout::TPCsetID geo::ChannelMapCRMAlg::ConvertTPCtoTPCset ( geo::TPCID const &  tpcid)
staticprivate

Converts a TPC ID into a TPC set ID using the same numerical indices.

Definition at line 562 of file ChannelMapCRMAlg.cxx.

563  {
564  if (!tpcid.isValid) return {}; // invalid ID, default-constructed
565  return {
566  (readout::CryostatID::CryostatID_t) tpcid.Cryostat,
568  };
569  } // ChannelMapCRMAlg::ConvertTPCtoTPCset()
unsigned short TPCsetID_t
Type for the ID number.
Definition: readout_types.h:71
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
readout::ROPID geo::ChannelMapCRMAlg::ConvertWirePlaneToROP ( geo::PlaneID const &  planeid)
staticprivate

Converts a ROP ID into a wire plane ID using the same numerical indices.

Definition at line 586 of file ChannelMapCRMAlg.cxx.

587  {
588  if (!planeid.isValid) return {}; // invalid ID, default-constructed
589  return {
590  (readout::CryostatID::CryostatID_t) planeid.Cryostat,
591  (readout::TPCsetID::TPCsetID_t) planeid.TPC,
592  (readout::ROPID::ROPID_t) planeid.Plane
593  };
594 
595  } // ChannelMapCRMAlg::ConvertWirePlaneToROP()
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 CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
raw::ChannelID_t geo::ChannelMapCRMAlg::FirstChannelInROP ( readout::ROPID const &  ropid) const
overridevirtual

Returns the ID of the first channel in the specified readout plane.

Parameters
ropidID of the readout plane
Returns
ID of first channel, or raw::InvalidChannelID if ID is invalid

Note that this check is performed on the validity of the readout plane ID, that does not necessarily imply that the readout plane specified by the ID actually exists. Check if the ROP exists with HasROP(). The behaviour for non-existing readout planes is undefined.

Implements geo::ChannelMapAlg.

Definition at line 552 of file ChannelMapCRMAlg.cxx.

553  {
554  if (!ropid.isValid) return raw::InvalidChannelID;
555  return (raw::ChannelID_t)
557  } // ChannelMapCRMAlg::FirstChannelInROP()
PlaneInfoMap_t< unsigned int > fPlaneBaselines
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
geo::TPCID geo::ChannelMapCRMAlg::FirstTPCinTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

Returns the ID of the first TPC belonging to the specified TPC set.

Implements geo::ChannelMapAlg.

Definition at line 423 of file ChannelMapCRMAlg.cxx.

424  {
425  return ConvertTPCsetToTPC(tpcsetid);
426  } // ChannelMapCRMAlg::FirstTPCinTPCset()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
geo::PlaneID geo::ChannelMapCRMAlg::FirstWirePlaneInROP ( readout::ROPID const &  ropid) const
overridevirtual

Returns the ID of the first plane belonging to the specified ROP.

Implements geo::ChannelMapAlg.

Definition at line 495 of file ChannelMapCRMAlg.cxx.

496  {
497  return ConvertROPtoWirePlane(ropid);
498  } // ChannelMapCRMAlg::FirstWirePlaneInROP()
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
bool geo::ChannelMapCRMAlg::HasROP ( readout::ROPID const &  ropid) const
overridevirtual

Returns whether we have the specified ROP

Returns
whether the readout plane is valid and exists

Implements geo::ChannelMapAlg.

Definition at line 467 of file ChannelMapCRMAlg.cxx.

467  {
468  return ropid.ROP < NROPs(ropid);
469  } // ChannelMapCRMAlg::HasROP()
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROP in the specified TPC set.
bool geo::ChannelMapCRMAlg::HasTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

Returns whether we have the specified TPC set

Returns
whether the TPC set is valid and exists

Implements geo::ChannelMapAlg.

Definition at line 386 of file ChannelMapCRMAlg.cxx.

386  {
387  return tpcsetid.TPCset < NTPCsets(tpcsetid);
388  } // ChannelMapCRMAlg::HasTPCset()
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
void geo::ChannelMapCRMAlg::Initialize ( GeometryData_t const &  geodata)
overridevirtual

Geometry initialisation.

Implements geo::ChannelMapAlg.

Definition at line 29 of file ChannelMapCRMAlg.cxx.

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  }
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double SinThetaZ() const
Definition: WireGeo.h:265
PlaneInfoMap_t< unsigned int > fPlaneBaselines
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fNchannels
number of channels in the detector
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneInfoMap_t< unsigned int > fWiresPerPlane
unsigned int fNcryostat
number of cryostats in the detector
PlaneInfoMap_t< float > fOrthVectorsZ
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
#define MF_LOG_DEBUG(id)
TPCInfoMap_t< unsigned int > fNPlanes
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:73
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:264
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
const char * cs
PlaneInfoMap_t< float > fWireCounts
PlaneInfoMap_t< float > fFirstWireProj
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapCRMAlg::MaxROPs ( ) const
overridevirtual

Returns the largest number of ROPs a TPC set in the detector has.

Implements geo::ChannelMapAlg.

Definition at line 455 of file ChannelMapCRMAlg.cxx.

455  {
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()
static int max(int a, int b)
TPCInfoMap_t< unsigned int > fNPlanes
unsigned int geo::ChannelMapCRMAlg::MaxTPCs ( ) const
private

Returns the largest number of TPCs in a single cryostat.

Definition at line 430 of file ChannelMapCRMAlg.cxx.

431  {
432  unsigned int max = 0;
433  for (unsigned int nTPCs: fNTPC) if (nTPCs > max) max = nTPCs;
434  return max;
435  } // ChannelMapCRMAlg::MaxTPCs()
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
static int max(int a, int b)
unsigned int geo::ChannelMapCRMAlg::MaxTPCsets ( ) const
overridevirtual

Returns the largest number of TPC sets any cryostat in the detector has.

Implements geo::ChannelMapAlg.

Definition at line 378 of file ChannelMapCRMAlg.cxx.

378  {
379  return MaxTPCs();
380  } // ChannelMapCRMAlg::MaxTPCsets()
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
raw::ChannelID_t geo::ChannelMapCRMAlg::Nchannels ( ) const
overridevirtual

Returns the total number of channels present (not necessarily contiguous)

Implements geo::ChannelMapAlg.

Definition at line 205 of file ChannelMapCRMAlg.cxx.

206  {
207  return fNchannels;
208  }
unsigned int fNchannels
number of channels in the detector
unsigned int geo::ChannelMapCRMAlg::Nchannels ( readout::ROPID const &  ropid) const
overridevirtual

Returns the number of channels in the specified ROP.

Returns
number of channels in the specified ROP, 0 if non-existent
Todo:
Needs to be implemented

Implements geo::ChannelMapAlg.

Definition at line 211 of file ChannelMapCRMAlg.cxx.

211  {
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()
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
virtual bool HasROP(readout::ROPID const &ropid) const override
WireID geo::ChannelMapCRMAlg::NearestWireID ( const TVector3 &  worldPos,
geo::PlaneID const &  planeID 
) const
overridevirtual

Returns the ID of the wire nearest to the specified position.

Parameters
worldPosposition to be tested
planeIDplane containing the wire
Returns
the ID of the wire closest to worldPos in the specified plane
Exceptions
InvalidWireIDErrorthe ID found is not present in the detector
See also
WireCoordinate(double, double, geo::PlaneID const&)

The plane is required to be valid and exist in the detector. Otherwise, the behaviour is undefined. An exception is thrown if the wire that would be the closest is actually not present; but no check is performed whether the specified position is outside the wire plane: wires are extrapolated to be infinitely long. In other words, the result can be trusted only as long as the position is within the specified wire plane.

Reimplemented from geo::ChannelMapAlg.

Definition at line 233 of file ChannelMapCRMAlg.cxx.

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  }
std::string string
Definition: nybbler.cc:12
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:561
virtual WireID geo::ChannelMapCRMAlg::NearestWireID ( const TVector3 &  worldPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
inlineoverridevirtual

Returns the ID of the wire nearest to the specified position.

Parameters
worldPosposition to be tested
PlaneNonumber of plane containing the wire
TPCNonumber of TPC containing the wire
cstatnumber of cryostat containing the wire
Returns
the ID of the wire closest to worldPos in the specified plane
See also
NearestWireID(const TVector3&, geo::PlaneID const&)
Deprecated:
Use the version with geo::PlaneID instead

Implements geo::ChannelMapAlg.

Definition at line 54 of file ChannelMapCRMAlg.h.

58  { return NearestWireID(worldPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
virtual WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
unsigned int geo::ChannelMapCRMAlg::NROPs ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

Returns the total number of ROP in the specified TPC set.

Parameters
tpcsetidTPC set ID
Returns
number of readout planes in the TPC set, or 0 if no TPC set found

Note that this methods explicitly check the existence of the TPC set.

Implements geo::ChannelMapAlg.

Definition at line 446 of file ChannelMapCRMAlg.cxx.

447  {
448  if (!HasTPCset(tpcsetid)) return 0;
449  return AccessElement(fNPlanes, FirstTPCinTPCset(tpcsetid));
450  } // ChannelMapCRMAlg::NROPs()
virtual geo::TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
TPCInfoMap_t< unsigned int > fNPlanes
unsigned int geo::ChannelMapCRMAlg::NTPCsets ( readout::CryostatID const &  cryoid) const
overridevirtual

Returns the total number of TPC sets in the specified cryostat.

Parameters
cryoidcryostat ID
Returns
number of TPC sets in the cryostat, or 0 if no cryostat found

Implements geo::ChannelMapAlg.

Definition at line 368 of file ChannelMapCRMAlg.cxx.

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()
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
std::set< PlaneID > const & geo::ChannelMapCRMAlg::PlaneIDs ( ) const
overridevirtual

Returns a list of the plane IDs in the whole detector.

Implements geo::ChannelMapAlg.

Definition at line 355 of file ChannelMapCRMAlg.cxx.

356  {
357  return fPlaneIDs;
358  }
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
raw::ChannelID_t geo::ChannelMapCRMAlg::PlaneWireToChannel ( geo::WireID const &  wireID) const
overridevirtual

Returns the channel ID a wire is connected to.

Parameters
wireIDID of the wire
Returns
the ID of the channel
See also
PlaneWireToChannel(geo::WireID const&)

Behaviour on an invalid or not present wires is undefined.

Deprecated:
Use the version with geo::WireID

Reimplemented from geo::ChannelMapAlg.

Definition at line 278 of file ChannelMapCRMAlg.cxx.

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  }
std::string string
Definition: nybbler.cc:12
PlaneInfoMap_t< unsigned int > fPlaneBaselines
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
T const * GetElementPtr(PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
Returns a pointer to the specified element, or nullptr if invalid.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual raw::ChannelID_t geo::ChannelMapCRMAlg::PlaneWireToChannel ( unsigned int  plane,
unsigned int  wire,
unsigned int  tpc,
unsigned int  cstat 
) const
inlineoverridevirtual

Returns the channel ID a wire is connected to.

Parameters
planenumber of plane
wirenumber of wire
tpcnumber of TPC
cstatnumber of cryostat
Returns
the ID of the channel
See also
PlaneWireToChannel(geo::WireID const&)
Deprecated:
Use the version with geo::WireID

Implements geo::ChannelMapAlg.

Definition at line 64 of file ChannelMapCRMAlg.h.

68  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const override
Returns the channel ID a wire is connected to.
std::vector< geo::TPCID > geo::ChannelMapCRMAlg::ROPtoTPCs ( readout::ROPID const &  ropid) const
overridevirtual

Returns a list of ID of TPCs the specified ROP spans.

Parameters
ropidID of the readout plane
Returns
the list of TPC IDs, empty if readout plane ID is invalid

Note that this check is performed on the validity of the readout plane ID, that does not necessarily imply that the readout plane specified by the ID actually exists. Check if the ROP exists with HasROP(). The behaviour on non-existing readout planes is undefined.

Implements geo::ChannelMapAlg.

Definition at line 513 of file ChannelMapCRMAlg.cxx.

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()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
std::vector< geo::PlaneID > geo::ChannelMapCRMAlg::ROPtoWirePlanes ( readout::ROPID const &  ropid) const
overridevirtual

Returns a list of ID of planes belonging to the specified ROP.

Implements geo::ChannelMapAlg.

Definition at line 484 of file ChannelMapCRMAlg.cxx.

485  {
486  std::vector<geo::PlaneID> IDs;
487  if (ropid.isValid) IDs.emplace_back(FirstWirePlaneInROP(ropid));
488  return IDs;
489  } // ChannelMapCRMAlg::ROPtoWirePlanes()
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
SigType_t geo::ChannelMapCRMAlg::SignalTypeForChannelImpl ( raw::ChannelID_t const  channel) const
overridevirtual

Return the signal type of the specified channel.

Parameters
channelID of the channel
Returns
signal type of the channel, or geo::kMysteryType if not known

On any type of error (e.g., invalid or unknown channel ID), geo::kMysteryType is returned.

Implements geo::ChannelMapAlg.

Definition at line 302 of file ChannelMapCRMAlg.cxx.

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  }
Who knows?
Definition: geo_types.h:147
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
enum geo::_plane_sigtype SigType_t
unsigned int fNchannels
number of channels in the detector
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TPCInfoMap_t< unsigned int > fNPlanes
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
QTextStream & endl(QTextStream &s)
Signal from collection planes.
Definition: geo_types.h:146
virtual geo::GeoObjectSorter const& geo::ChannelMapCRMAlg::Sorter ( ) const
inlineoverridevirtual

Returns the object to sort geometry with.

Implements geo::ChannelMapAlg.

Definition at line 184 of file ChannelMapCRMAlg.h.

185  { return fSorter; }
geo::GeoObjectSorterCRM fSorter
class to sort geo objects
std::vector< geo::TPCID > geo::ChannelMapCRMAlg::TPCsetToTPCs ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

Returns a list of ID of TPCs belonging to the specified TPC set.

Parameters
tpcsetidID of the TPC set to convert into TPC IDs
Returns
the list of TPCs, empty if TPC set is invalid

Note that the check is performed on the validity of the TPC set ID, that does not necessarily imply that the TPC set specified by the ID actually exists. Check the existence of the TPC set first (HasTPCset()). Behaviour on valid, non-existent TPC set IDs is undefined.

Implements geo::ChannelMapAlg.

Definition at line 412 of file ChannelMapCRMAlg.cxx.

413  {
414  std::vector<geo::TPCID> IDs;
415  if (tpcsetid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(tpcsetid));
416  return IDs;
417  } // ChannelMapCRMAlg::TPCsetToTPCs()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
readout::TPCsetID geo::ChannelMapCRMAlg::TPCtoTPCset ( geo::TPCID const &  tpcid) const
overridevirtual

Returns the ID of the TPC set tpcid belongs to.

Implements geo::ChannelMapAlg.

Definition at line 394 of file ChannelMapCRMAlg.cxx.

395  {
396  return ConvertTPCtoTPCset(tpcid);
397  } // ChannelMapCRMAlg::TPCtoTPCset()
static readout::TPCsetID ConvertTPCtoTPCset(geo::TPCID const &tpcid)
Converts a TPC ID into a TPC set ID using the same numerical indices.
void geo::ChannelMapCRMAlg::Uninitialize ( )
overridevirtual

Deconfiguration: prepare for a following call of Initialize()

Implements geo::ChannelMapAlg.

Definition at line 157 of file ChannelMapCRMAlg.cxx.

158  {
159  }
double geo::ChannelMapCRMAlg::WireCoordinate ( double  YPos,
double  ZPos,
geo::PlaneID const &  planeID 
) const
overridevirtual

Returns the index of the wire nearest to the specified position.

Parameters
YPosy coordinate on the wire plane
ZPosz coordinate on the wire plane
planeIDID of the plane
Returns
an index interpolation between the two nearest wires
See also
NearestWireID()

Respect to NearestWireID(), this method returns a real number, representing a continuous coordinate in the wire axis, with the round values corresponding to the actual wires.

The plane is required to be valid and exist in the detector. Otherwise, the behaviour is undefined.

Reimplemented from geo::ChannelMapAlg.

Definition at line 220 of file ChannelMapCRMAlg.cxx.

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  }
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
PlaneInfoMap_t< float > fOrthVectorsZ
PlaneInfoMap_t< float > fFirstWireProj
virtual double geo::ChannelMapCRMAlg::WireCoordinate ( double  YPos,
double  ZPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
inlineoverridevirtual

Returns the index of the wire nearest to the specified position.

Parameters
YPosy coordinate on the wire plane
ZPosz coordinate on the wire plane
PlaneNonumber of plane
TPCNonumber of TPC
cstatnumber of cryostat
Returns
an index interpolation between the two nearest wires
See also
WireCoordinate(double, double, geo::PlaneID const&)
Deprecated:
Use the version with geo::PlaneID instead

Implements geo::ChannelMapAlg.

Definition at line 44 of file ChannelMapCRMAlg.h.

48  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
unsigned int geo::ChannelMapCRMAlg::WireCount ( geo::PlaneID const &  id) const
inlineprivate

Retrieved the wire cound for the specified plane ID.

Definition at line 214 of file ChannelMapCRMAlg.h.

215  { return AccessElement(fWireCounts, id); }
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
PlaneInfoMap_t< float > fWireCounts
readout::ROPID geo::ChannelMapCRMAlg::WirePlaneToROP ( geo::PlaneID const &  planeid) const
overridevirtual

Returns the ID of the ROP planeid belongs to.

Implements geo::ChannelMapAlg.

Definition at line 475 of file ChannelMapCRMAlg.cxx.

476  {
477  return ConvertWirePlaneToROP(planeid);
478  } // ChannelMapCRMAlg::WirePlaneToROP()
static readout::ROPID ConvertWirePlaneToROP(geo::PlaneID const &planeid)
Converts a ROP ID into a wire plane ID using the same numerical indices.

Member Data Documentation

PlaneInfoMap_t<float> geo::ChannelMapCRMAlg::fFirstWireProj
private

Distance (0,0,0) to first wire along orth vector per plane per TPC

Definition at line 195 of file ChannelMapCRMAlg.h.

unsigned int geo::ChannelMapCRMAlg::fNchannels
private

number of channels in the detector

Definition at line 190 of file ChannelMapCRMAlg.h.

unsigned int geo::ChannelMapCRMAlg::fNcryostat
private

number of cryostats in the detector

Definition at line 189 of file ChannelMapCRMAlg.h.

TPCInfoMap_t<unsigned int> geo::ChannelMapCRMAlg::fNPlanes
private

Number of planes in each TPC - for range checking after calculation

Definition at line 203 of file ChannelMapCRMAlg.h.

std::vector<unsigned int> geo::ChannelMapCRMAlg::fNTPC
private

number of TPCs in each cryostat

Definition at line 192 of file ChannelMapCRMAlg.h.

PlaneInfoMap_t<float> geo::ChannelMapCRMAlg::fOrthVectorsY
private

Unit vectors orthogonal to wires in.

Definition at line 197 of file ChannelMapCRMAlg.h.

PlaneInfoMap_t<float> geo::ChannelMapCRMAlg::fOrthVectorsZ
private

each plane - stored as 2 components to avoid having to invoke any bulky TObjects / CLHEP vectors etc

Definition at line 198 of file ChannelMapCRMAlg.h.

PlaneInfoMap_t<unsigned int> geo::ChannelMapCRMAlg::fPlaneBaselines
private

The number of wires in all the tpcs and planes up to this one in the heirachy

Definition at line 205 of file ChannelMapCRMAlg.h.

std::set<PlaneID> geo::ChannelMapCRMAlg::fPlaneIDs
private

vector of the PlaneIDs present in the detector

Definition at line 194 of file ChannelMapCRMAlg.h.

geo::GeoObjectSorterCRM geo::ChannelMapCRMAlg::fSorter
private

class to sort geo objects

Definition at line 210 of file ChannelMapCRMAlg.h.

raw::ChannelID_t geo::ChannelMapCRMAlg::fTopChannel
private

book keeping highest channel #

Definition at line 191 of file ChannelMapCRMAlg.h.

std::set<View_t> geo::ChannelMapCRMAlg::fViews
private

vector of the views present in the detector

Definition at line 193 of file ChannelMapCRMAlg.h.

PlaneInfoMap_t<float> geo::ChannelMapCRMAlg::fWireCounts
private

Number of wires in each plane - for range checking after calculation

Definition at line 201 of file ChannelMapCRMAlg.h.

PlaneInfoMap_t<unsigned int> geo::ChannelMapCRMAlg::fWiresPerPlane
private

The number of wires in this plane in the heirachy

Definition at line 208 of file ChannelMapCRMAlg.h.


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