Classes | Public Member Functions | Private Attributes | List of all members
geo::ChannelMapAPAAlg Class Reference

#include <ChannelMapAPAAlg.h>

Inheritance diagram for geo::ChannelMapAPAAlg:
geo::ChannelMapAlg

Classes

struct  PlaneData_t
 all data we need for each APA More...
 

Public Member Functions

 ChannelMapAPAAlg (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...
 
View_t View (raw::ChannelID_t const channel) const
 
SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const override
 Return the signal type of the specified channel. More...
 
std::set< View_t > const & Views () const
 
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...
 
unsigned int NOpChannels (unsigned int NOpDets) const override
 Returns the number of optical channels contained in some detectors. More...
 
unsigned int NOpHardwareChannels (unsigned int opDet) const override
 Returns the number of channels in the specified optical detectors. More...
 
unsigned int OpChannel (unsigned int detNum, unsigned int channel=0) const override
 Returns the channel ID of the specified hardware channel. More...
 
unsigned int OpDetFromOpChannel (unsigned int opChannel) const override
 Returns the optical detector the specified optical channel belongs. More...
 
unsigned int HardwareChannelFromOpChannel (unsigned int opChannel) const override
 Returns the hardware channel number of specified optical channel. 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 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 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 WireID NearestWireID (const TVector3 &worldPos, geo::PlaneID const &planeID) const override
 Returns the ID of the wire nearest to the specified position. 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...
 
virtual raw::ChannelID_t PlaneWireToChannel (geo::WireID const &wireID) 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
 
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 the specified TPC 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
 
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
 
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, or invalid if none. More...
 
virtual std::vector< geo::PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const override
 Returns a list of ID of wire planes 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...
 
virtual geo::PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first plane belonging to the specified ROP. More...
 
- Public Member Functions inherited from geo::ChannelMapAlg
virtual ~ChannelMapAlg ()=default
 Virtual destructor. More...
 
virtual unsigned int MaxOpChannel (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
virtual bool IsValidOpChannel (unsigned int opChannel, unsigned int NOpDets) const
 Returns whether the ID identifies a valid optical detector 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 Attributes

unsigned int fChannelsPerOpDet
 
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...
 
std::vector< unsigned int > fWiresInPlane
 
unsigned int fPlanesPerAPA
 
unsigned int fChannelsPerAPA
 
std::vector< unsigned int > nAnchoredWires
 
PlaneInfoMap_t< unsigned int > fWiresPerPlane
 
geo::GeoObjectSorterAPA fSorter
 sorts geo::XXXGeo objects More...
 
PlaneInfoMap_t< PlaneData_tfPlaneData
 
std::vector< double > fWirePitch
 
std::vector< double > fOrientation
 
std::vector< double > fSinOrientation
 
std::vector< double > fCosOrientation
 

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 25 of file ChannelMapAPAAlg.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file ChannelMapAPAAlg.cxx.

25  {
26  fChannelsPerOpDet = p.get< unsigned int >("ChannelsPerOpDet" );
27  }
geo::GeoObjectSorterAPA fSorter
sorts geo::XXXGeo objects
p
Definition: test.py:223
unsigned int fChannelsPerOpDet

Member Function Documentation

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

Returns the ID of the ROP the channel belongs to (invalid if none)

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

Implements geo::ChannelMapAlg.

Definition at line 564 of file ChannelMapAPAAlg.cxx.

565  {
566  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
567  } // ChannelMapAPAAlg::ROPtoTPCs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< geo::WireID > geo::ChannelMapAPAAlg::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 205 of file ChannelMapAPAAlg.cxx.

206  {
207 
208  // first check if this channel ID is legal
209  if(channel >= fNchannels )
210  throw cet::exception("Geometry") << "ILLEGAL CHANNEL ID for channel " << channel << "\n";
211 
212  std::vector< WireID > AllSegments;
213 
214  static unsigned int cstat;
215  static unsigned int tpc;
216  static unsigned int plane;
217  static unsigned int wireThisPlane;
218  static unsigned int NextPlane;
219  static unsigned int ThisPlane;
220 
222  raw::ChannelID_t pureAPAnum = std::floor( channel/fChannelsPerAPA );
223 
224  bool breakVariable = false;
225  for(unsigned int planeloop = 0; planeloop != fPlanesPerAPA; ++planeloop){
226 
227  NextPlane = fFirstChannelInNextPlane[0][0][planeloop];
228  ThisPlane = fFirstChannelInThisPlane[0][0][planeloop];
229 
230  if(chan < NextPlane){
231 
232  // fNTPC[0] works for now since there are the same number of TPCs per crostat
233  cstat = std::floor( channel / ((fNTPC[0]/2)*fChannelsPerAPA) );
234  tpc = (2*pureAPAnum) % fNTPC[0];
235  plane = planeloop;
236  wireThisPlane = chan - ThisPlane;
237 
238  breakVariable = true;
239  break;
240  }
241  if(breakVariable) break;
242  }// end plane loop
243 
244 
245 
246  int WrapDirection = 1; // go from tpc to (tpc+1) or tpc to (tpc-1)
247 
248  // find the lowest wire
249  raw::ChannelID_t ChannelGroup = std::floor( wireThisPlane/nAnchoredWires[plane] );
250  unsigned int bottomwire = wireThisPlane-ChannelGroup*nAnchoredWires[plane];
251 
252  if(ChannelGroup%2==1){
253  tpc += 1;
254  WrapDirection = -1;
255  }
256 
257  for(unsigned int SegCount = 0; SegCount != 50; ++SegCount){
258 
259  tpc += WrapDirection*(SegCount%2);
260  geo::WireID CodeWire(cstat, tpc, plane, bottomwire + SegCount*nAnchoredWires[plane]);
261  AllSegments.push_back(CodeWire);
262 
263  // reset the tcp variable so it doesnt "accumulate value"
264  tpc -= WrapDirection*(SegCount%2);
265 
266  if( bottomwire + (SegCount+1)*nAnchoredWires[plane] > fWiresInPlane[plane]-1) break;
267  }
268 
269  return AllSegments;
270  }
unsigned int fNchannels
number of channels in the detector
std::vector< unsigned int > fWiresInPlane
std::vector< unsigned int > nAnchoredWires
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fChannelsPerAPA
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
raw::ChannelID_t geo::ChannelMapAPAAlg::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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 572 of file ChannelMapAPAAlg.cxx.

573  {
574  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
575  } // ChannelMapAPAAlg::FirstChannelInROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::TPCID geo::ChannelMapAPAAlg::FirstTPCinTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

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

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 512 of file ChannelMapAPAAlg.cxx.

513  {
514  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
515  } // ChannelMapAPAAlg::FirstTPCinTPCset()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::PlaneID geo::ChannelMapAPAAlg::FirstWirePlaneInROP ( readout::ROPID const &  ropid) const
overridevirtual

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

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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 580 of file ChannelMapAPAAlg.cxx.

581  {
582  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
583  } // ChannelMapAPAAlg::FirstWirePlaneInROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapAPAAlg::HardwareChannelFromOpChannel ( unsigned int  opChannel) const
overridevirtual

Returns the hardware channel number of specified optical channel.

Parameters
opChannelthe optical detector channel being queried
Returns
the optical detector the specified optical channel belongs to

If the specified optical channel is invalid, behaviour is undefined.

Reimplemented from geo::ChannelMapAlg.

Definition at line 466 of file ChannelMapAPAAlg.cxx.

467  {
468  unsigned int channel = opChannel % fChannelsPerOpDet;
469  return channel;
470  }
uint8_t channel
Definition: CRTFragment.hh:201
unsigned int fChannelsPerOpDet
bool geo::ChannelMapAPAAlg::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 533 of file ChannelMapAPAAlg.cxx.

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

Returns whether we have the specified TPC set

Returns
whether the TPC set is valid and exists
Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 488 of file ChannelMapAPAAlg.cxx.

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

Geometry initialisation.

Implements geo::ChannelMapAlg.

Definition at line 30 of file ChannelMapAPAAlg.cxx.

31  {
32  // start over:
33  Uninitialize();
34 
35  std::vector<geo::CryostatGeo> const& cgeo = geodata.cryostats;
36 
37  fNcryostat = cgeo.size();
38 
39  mf::LogInfo("ChannelMapAPAAlg") << "Initializing channel map...";
40 
41  fNTPC.resize(fNcryostat);
42  fFirstChannelInNextPlane.resize(1); // Change 1 to Ncryostat if you want
43  fFirstChannelInThisPlane.resize(1); // to treat each APA uniquely,and do
44  // the same with the other resizes.
45  fPlanesPerAPA = cgeo[0].TPC(0).Nplanes();
48  fFirstChannelInThisPlane[0].resize(1); // remember FirstChannel vectors
49  fFirstChannelInNextPlane[0].resize(1); // for first APA only.
50  fFirstChannelInThisPlane[0][0].resize(fPlanesPerAPA); // Make room for info
51  fFirstChannelInNextPlane[0][0].resize(fPlanesPerAPA); // on each plane.
52  fViews.clear();
53  fPlaneIDs.clear();
54  fTopChannel = 0;
55 
56  // Size some vectors and initialize the FirstChannel vectors.
57  // If making FirstChannel's for every APA uniquely, they also
58  // need to be sized here. Not necessary for now
59  for(unsigned int cs = 0; cs != fNcryostat; ++cs){
60 
61  fNTPC[cs] = cgeo[cs].NTPC();
62 
63  }// end sizing loop over cryostats
64 
65  // Find the number of wires anchored to the frame
66  for(unsigned int p=0; p!=fPlanesPerAPA; ++p){
67 
68  fWiresInPlane[p] = cgeo[0].TPC(0).Plane(p).Nwires();
69  double xyz[3] = {0.};
70  double xyz_next[3] = {0.};
71 
72  fViews.emplace(cgeo[0].TPC(0).Plane(p).View());
73 
74  for(unsigned int w = 0; w != fWiresInPlane[p]; ++w){
75 
76  // for vertical planes
77  if(cgeo[0].TPC(0).Plane(p).View()==geo::kZ) {
79  break;
80  }
81 
82  cgeo[0].TPC(0).Plane(p).Wire(w).GetCenter(xyz);
83  cgeo[0].TPC(0).Plane(p).Wire(w+1).GetCenter(xyz_next);
84 
85  if(xyz[2]==xyz_next[2]){
86  nAnchoredWires[p] = w;
87  break;
88  }
89 
90  }// end wire loop
91 
92  }// end plane loop
93 
94  raw::ChannelID_t CurrentChannel = 0;
95 
96  for(unsigned int PCount = 0; PCount != fPlanesPerAPA; ++PCount){
97 
98  fFirstChannelInThisPlane[0][0][PCount] = CurrentChannel;
99  CurrentChannel = CurrentChannel + 2*nAnchoredWires[PCount];
100  fFirstChannelInNextPlane[0][0][PCount] = CurrentChannel;
101 
102  }// end build loop over planes
103 
104  // Save the number of channels
106 
107  fNchannels = 0;
108  for(size_t cs = 0; cs < fNcryostat; ++cs){
110  }
111 
112  //save data into fFirstWireCenterY and fFirstWireCenterZ
113  fPlaneData.resize(fNcryostat);
114  for (unsigned int cs=0; cs<fNcryostat; ++cs){
115  fPlaneData[cs].resize(cgeo[cs].NTPC());
116  for (unsigned int tpc=0; tpc<cgeo[cs].NTPC(); ++tpc){
117  fPlaneData[cs][tpc].resize(cgeo[cs].TPC(tpc).Nplanes());
118  for (unsigned int plane=0; plane<cgeo[cs].TPC(tpc).Nplanes(); ++plane){
119  PlaneData_t& PlaneData = fPlaneData[cs][tpc][plane];
120  const geo::PlaneGeo& thePlane = cgeo[cs].TPC(tpc).Plane(plane);
121  double xyz[3];
122  fPlaneIDs.emplace(cs, tpc, plane);
123  thePlane.Wire(0).GetCenter(xyz);
124  PlaneData.fFirstWireCenterY = xyz[1];
125  PlaneData.fFirstWireCenterZ = xyz[2];
126  // we are interested in the ordering of wire numbers: we find that a
127  // point is N wires left of a wire W: is that wire W + N or W - N?
128  // In fact, for TPC #0 it is W + N for V and Z planes, W - N for U
129  // plane; for TPC #0 it is W + N for V and Z planes, W - N for U
130  PlaneData.fWireSortingInZ = thePlane.WireIDincreasesWithZ()? +1.: -1.;
131 
132  // find boundaries of the outside APAs for this plane by looking at endpoints of wires
133 
134  double endpoint[3];
135  thePlane.Wire(0).GetStart(endpoint);
136  PlaneData.fYmax = endpoint[1];
137  PlaneData.fYmin = endpoint[1];
138  PlaneData.fZmax = endpoint[2];
139  PlaneData.fZmin = endpoint[2];
140  unsigned int nwires = thePlane.Nwires();
141  for (unsigned int iwire=0;iwire<nwires;iwire++){
142  thePlane.Wire(iwire).GetStart(endpoint);
143  PlaneData.fYmax = std::max(PlaneData.fYmax,endpoint[1]);
144  PlaneData.fYmin = std::min(PlaneData.fYmin,endpoint[1]);
145  PlaneData.fZmax = std::max(PlaneData.fZmax,endpoint[2]);
146  PlaneData.fZmin = std::min(PlaneData.fZmin,endpoint[2]);
147  thePlane.Wire(iwire).GetEnd(endpoint);
148  PlaneData.fYmax = std::max(PlaneData.fYmax,endpoint[1]);
149  PlaneData.fYmin = std::min(PlaneData.fYmin,endpoint[1]);
150  PlaneData.fZmax = std::max(PlaneData.fZmax,endpoint[2]);
151  PlaneData.fZmin = std::min(PlaneData.fZmin,endpoint[2]);
152  } // loop on wire
153 
154  } // for plane
155  } // for TPC
156  } // for cryostat
157 
158  //initialize fWirePitch and fOrientation
159  fWirePitch.resize(cgeo[0].TPC(0).Nplanes());
160  fOrientation.resize(cgeo[0].TPC(0).Nplanes());
161  fSinOrientation.resize(cgeo[0].TPC(0).Nplanes());
162  fCosOrientation.resize(cgeo[0].TPC(0).Nplanes());
163 
164  for (unsigned int plane=0; plane<cgeo[0].TPC(0).Nplanes(); plane++){
165  fWirePitch[plane]=cgeo[0].TPC(0).WirePitch(plane);
166  fOrientation[plane]=cgeo[0].TPC(0).Plane(plane).Wire(0).ThetaZ();
167  fSinOrientation[plane] = sin(fOrientation[plane]);
168  fCosOrientation[plane] = cos(fOrientation[plane]);
169  }
170 
171 
172  for(unsigned int c=0; c<fNcryostat; c++){
173 
174  mf::LogVerbatim("ChannelMapAPAAlg") << "Cryostat " << c << ":";
175 
176  mf::LogVerbatim("ChannelMapAPAAlg") << " " << fNchannels << " total channels";
177  mf::LogVerbatim("ChannelMapAPAAlg") << " " << fNTPC[c]/2 << " APAs";
178  mf::LogVerbatim("ChannelMapAPAAlg") << " For all identical APA:" ;
179  mf::LogVerbatim("ChannelMapAPAAlg") << " Number of channels per APA = " << fChannelsPerAPA ;
180 
181  mf::LogVerbatim("ChannelMapAPAAlg") << " U channels per APA = " << 2*nAnchoredWires[0] ;
182  mf::LogVerbatim("ChannelMapAPAAlg") << " V channels per APA = " << 2*nAnchoredWires[1] ;
183  mf::LogVerbatim("ChannelMapAPAAlg") << " Z channels per APA = " << 2*nAnchoredWires[2] ;
184 
185  mf::LogVerbatim("ChannelMapAPAAlg") << " Pitch in U Plane = " << fWirePitch[0] ;
186  mf::LogVerbatim("ChannelMapAPAAlg") << " Pitch in V Plane = " << fWirePitch[1] ;
187  mf::LogVerbatim("ChannelMapAPAAlg") << " Pitch in Z Plane = " << fWirePitch[2] ;
188 
189  }
190 
191  return;
192 
193  }
unsigned int fNchannels
number of channels in the detector
std::set< View_t > fViews
vector of the views present in the detector
void GetStart(double *xyz) const
Definition: WireGeo.h:157
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< unsigned int > fWiresInPlane
std::vector< unsigned int > nAnchoredWires
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:506
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > fSinOrientation
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
Planes which measure Z direction.
Definition: geo_types.h:132
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
raw::ChannelID_t fTopChannel
book keeping highest channel #
unsigned int fChannelsPerAPA
PlaneInfoMap_t< PlaneData_t > fPlaneData
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
std::vector< double > fOrientation
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
p
Definition: test.py:223
std::vector< double > fWirePitch
static int max(int a, int b)
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
unsigned int fNcryostat
number of cryostats in the detector
void GetEnd(double *xyz) const
Definition: WireGeo.h:163
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
bool WireIDincreasesWithZ() const
Returns whether the higher z wires have higher wire ID.
Definition: PlaneGeo.cxx:525
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:73
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
recob::tracking::Plane Plane
Definition: TrackState.h:17
View_t View(raw::ChannelID_t const channel) const
std::vector< double > fCosOrientation
unsigned int geo::ChannelMapAPAAlg::MaxROPs ( ) const
overridevirtual

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

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 527 of file ChannelMapAPAAlg.cxx.

527  {
528  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
529  } // ChannelMapAPAAlg::MaxROPs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapAPAAlg::MaxTPCsets ( ) const
overridevirtual

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

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 481 of file ChannelMapAPAAlg.cxx.

482  {
483  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
484  } // ChannelMapAPAAlg::MaxTPCsets()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapAPAAlg::Nchannels ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 274 of file ChannelMapAPAAlg.cxx.

275  {
276  return fNchannels;
277  }
unsigned int fNchannels
number of channels in the detector
unsigned int geo::ChannelMapAPAAlg::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:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 282 of file ChannelMapAPAAlg.cxx.

283  {
284  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
285  } // ChannelMapAPAAlg::Nchannels(ROPID)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual WireID geo::ChannelMapAPAAlg::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 58 of file ChannelMapAPAAlg.h.

62  { return NearestWireID(worldPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
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.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
WireID geo::ChannelMapAPAAlg::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 323 of file ChannelMapAPAAlg.cxx.

324  {
325 
326  // cap the position to be within the boundaries of the wire endpoints.
327  // This simulates charge drifting in from outside of the wire frames inwards towards
328  // the first and last collection wires on the side, and towards the right endpoints
329 
330  const PlaneData_t& PlaneData = AccessElement(fPlaneData, planeid);
331  double ycap = std::max(PlaneData.fYmin,std::min(PlaneData.fYmax,xyz.Y()));
332  double zcap = std::max(PlaneData.fZmin,std::min(PlaneData.fZmax,xyz.Z()));
333 
334  // add 0.5 to have the correct rounding
335  int NearestWireNumber
336  = int (0.5 + WireCoordinate(ycap, zcap, planeid));
337 
338  // If we are outside of the wireplane range, throw an exception
339  // (this response maintains consistency with the previous
340  // implementation based on geometry lookup)
341  if(NearestWireNumber < 0 ||
342  NearestWireNumber >= (int) fWiresInPlane[planeid.Plane])
343  {
344  const int wireNumber = NearestWireNumber; // save for the output
345 
346  if(wireNumber < 0 ) NearestWireNumber = 0;
347  else NearestWireNumber = fWiresInPlane[planeid.Plane] - 1;
348 
349  /*
350  // comment in the following statement to throw an exception instead
351  throw InvalidWireIDError("Geometry", wireNumber, NearestWireNumber)
352  << "ChannelMapAPAAlg::NearestWireID(): can't Find Nearest Wire for position ("
353  << xyz.X() << "," << xyz.Y() << "," << xyz.Z() << ")"
354  << " approx wire number # " << wireNumber
355  << " (capped from " << NearestWireNumber << ")\n";
356  */
357  } // if invalid wire
358 
359  return { planeid, (geo::WireID::WireID_t) NearestWireNumber };
360  } // ChannelMapAPAAlg::NearestWireID()
std::vector< unsigned int > fWiresInPlane
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.
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
PlaneInfoMap_t< PlaneData_t > fPlaneData
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:561
unsigned int geo::ChannelMapAPAAlg::NOpChannels ( unsigned int  NOpDets) const
overridevirtual

Returns the number of optical channels contained in some detectors.

Parameters
NOpDetsnumber of optical detectors
Returns
optical channels contained in NOpDets detectors

This function returns how many channels can be expected to be present in a detector with NOpDets optical detectors. This is an upper limit, as not all channels have necessarily to be present.

For example: if a detector has four channels per optical detector, the returned value will be four times the argument NOpDets. If there is a single channel on each optical detector, the return value will be the value NOpDets (this is in fact the fallback implementation). If each optical detector can have anywhere between 2 and 12 channels, the returned value is 12 times NOpDets, and it will be an overestimation of the number of channels.

Reimplemented from geo::ChannelMapAlg.

Definition at line 440 of file ChannelMapAPAAlg.cxx.

441  {
442  return fChannelsPerOpDet*NOpDets;
443  }
unsigned int fChannelsPerOpDet
unsigned int geo::ChannelMapAPAAlg::NOpHardwareChannels ( unsigned int  opDet) const
overridevirtual

Returns the number of channels in the specified optical detectors.

Parameters
opDetID of the chosen optical detector
Returns
optical channels contained in optical detector with ID opDet

This function returns how many channels are actually present in the optical detector with the specified ID.

For example: if a detector has four channels per optical detector, the returned value will be four, regardless opDet, and . If there is a single channel on each optical detector, the return value will be 1, again ignoring opDet (this is in fact the fallback implementation). If each optical detector can have anywhere between 2 and 12 channels, the returned value will be 2, 12, etc., that is the exact number of channels in opDet.

Although implementations are encouraged to return 0 on invalid optical detectors, the actual return value in that case is undefined.

Reimplemented from geo::ChannelMapAlg.

Definition at line 446 of file ChannelMapAPAAlg.cxx.

447  {
448  return fChannelsPerOpDet;
449  }
unsigned int fChannelsPerOpDet
unsigned int geo::ChannelMapAPAAlg::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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 520 of file ChannelMapAPAAlg.cxx.

521  {
522  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
523  } // ChannelMapAPAAlg::NROPs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapAPAAlg::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
Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 474 of file ChannelMapAPAAlg.cxx.

475  {
476  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
477  } // ChannelMapAPAAlg::NTPCsets()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMapAPAAlg::OpChannel ( unsigned int  detNum,
unsigned int  hwchannel = 0 
) const
overridevirtual

Returns the channel ID of the specified hardware channel.

Parameters
detNumoptical detector ID
hwchannelhardware channel within the specified optical detector
Returns
ID of the channel identified by detector and hardware channel IDs

If the input IDs identify a non-existing channel, the result is undefined.

Reimplemented from geo::ChannelMapAlg.

Definition at line 452 of file ChannelMapAPAAlg.cxx.

453  {
454  unsigned int uniqueChannel = (detNum * fChannelsPerOpDet) + channel;
455  return uniqueChannel;
456  }
uint8_t channel
Definition: CRTFragment.hh:201
unsigned int fChannelsPerOpDet
unsigned int geo::ChannelMapAPAAlg::OpDetFromOpChannel ( unsigned int  opChannel) const
overridevirtual

Returns the optical detector the specified optical channel belongs.

Parameters
opChannelthe optical detector channel being queried
Returns
the optical detector the specified optical channel belongs to

If the specified optical channel is invalid, behaviour is undefined.

Reimplemented from geo::ChannelMapAlg.

Definition at line 459 of file ChannelMapAPAAlg.cxx.

460  {
461  unsigned int detectorNum = (unsigned int) opChannel / fChannelsPerOpDet;
462  return detectorNum;
463  }
unsigned int fChannelsPerOpDet
std::set< PlaneID > const & geo::ChannelMapAPAAlg::PlaneIDs ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 434 of file ChannelMapAPAAlg.cxx.

435  {
436  return fPlaneIDs;
437  }
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
virtual raw::ChannelID_t geo::ChannelMapAPAAlg::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 67 of file ChannelMapAPAAlg.h.

71  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
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.
raw::ChannelID_t geo::ChannelMapAPAAlg::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 365 of file ChannelMapAPAAlg.cxx.

366  {
367  unsigned int OtherSideWires = 0;
368 
369  // start in very first APA:
370  raw::ChannelID_t Channel = fFirstChannelInThisPlane[0][0][wireid.Plane];
371  // move channel to proper cryostat:
372  Channel += wireid.Cryostat*(fNTPC[wireid.Cryostat]/2)*fChannelsPerAPA;
373  // move channel to proper APA:
374  Channel += std::floor( wireid.TPC/2 )*fChannelsPerAPA;
375  // get number of wires on the first side of the APA if starting on the other side TPC:
376  OtherSideWires += (wireid.TPC%2)*nAnchoredWires[wireid.Plane];
377 
378 
379  // Lastly, account for the fact that channel number while moving up wire number in one
380  // plane resets after 2 times the number of wires anchored -- one for each APA side.
381  // At the same time, OtherSideWires accounts for the fact that if a channel starts on
382  // the other side, it is offset by the number of wires on the first side.
383  Channel += (OtherSideWires + wireid.Wire)%(2*nAnchoredWires[wireid.Plane]);
384 
385  return Channel;
386 
387  }
std::vector< unsigned int > nAnchoredWires
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fChannelsPerAPA
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector< geo::TPCID > geo::ChannelMapAPAAlg::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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 556 of file ChannelMapAPAAlg.cxx.

557  {
558  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
559  } // ChannelMapAPAAlg::ROPtoTPCs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< geo::PlaneID > geo::ChannelMapAPAAlg::ROPtoWirePlanes ( readout::ROPID const &  ropid) const
overridevirtual

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

Parameters
ropidID of the readout plane to convert into wire planes
Returns
the list of wire plane 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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 548 of file ChannelMapAPAAlg.cxx.

549  {
550  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
551  } // ChannelMapAPAAlg::ROPtoWirePlanes()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
SigType_t geo::ChannelMapAPAAlg::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 390 of file ChannelMapAPAAlg.cxx.

391  {
393  SigType_t sigt = kInduction;
394 
395  // instead of calling channel to wire, we can make use of the way we
396  // up channels among APAs;
397  // the first two planes are induction, and the last one is collection
398  if( chan < fFirstChannelInThisPlane[0][0][2] ){ sigt = kInduction; }
399  else if( (chan >= fFirstChannelInThisPlane[0][0][2]) &&
400  (chan < fFirstChannelInNextPlane[0][0][2]) ){ sigt = kCollection; }
401  else{ mf::LogWarning("BadChannelSignalType") << "Channel " << channel
402  << " (" << chan << ") not given signal type." << std::endl; }
403 
404  return sigt;
405  }
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fChannelsPerAPA
Signal from induction planes.
Definition: geo_types.h:145
enum geo::_plane_sigtype SigType_t
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
QTextStream & endl(QTextStream &s)
Signal from collection planes.
Definition: geo_types.h:146
virtual geo::GeoObjectSorter const& geo::ChannelMapAPAAlg::Sorter ( ) const
inlineoverridevirtual

Returns the object to sort geometry with.

Implements geo::ChannelMapAlg.

Definition at line 251 of file ChannelMapAPAAlg.h.

252  { return fSorter; }
geo::GeoObjectSorterAPA fSorter
sorts geo::XXXGeo objects
std::vector< geo::TPCID > geo::ChannelMapAPAAlg::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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 504 of file ChannelMapAPAAlg.cxx.

505  {
506  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
507  } // ChannelMapAPAAlg::TPCsetToTPCs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
readout::TPCsetID geo::ChannelMapAPAAlg::TPCtoTPCset ( geo::TPCID const &  tpcid) const
overridevirtual

Returns the ID of the TPC set the specified TPC belongs to.

Parameters
tpcidID of the TPC
Returns
the ID of the corresponding TPC set

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.

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 496 of file ChannelMapAPAAlg.cxx.

497  {
498  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
499  } // ChannelMapAPAAlg::TPCtoTPCset()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void geo::ChannelMapAPAAlg::Uninitialize ( )
overridevirtual

Deconfiguration: prepare for a following call of Initialize()

Implements geo::ChannelMapAlg.

Definition at line 196 of file ChannelMapAPAAlg.cxx.

197  {
198 
199  PlaneInfoMap_t<raw::ChannelID_t>().swap(fFirstChannelInThisPlane);
200  PlaneInfoMap_t<raw::ChannelID_t>().swap(fFirstChannelInNextPlane);
201 
202  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
void swap(Handle< T > &a, Handle< T > &b)
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
View_t geo::ChannelMapAPAAlg::View ( raw::ChannelID_t const  channel) const

Definition at line 408 of file ChannelMapAPAAlg.cxx.

409  {
411  View_t view = geo::kU;
412 
413  // instead of calling channel to wire, we can make use of the way we
414  // up channels among APAs;
415  // Plane 0: U, Plane 1: V, Plane 2: W
416  if( chan < fFirstChannelInNextPlane[0][0][0] ){ view = geo::kU; }
417  else if( (chan >= fFirstChannelInThisPlane[0][0][1]) &&
418  (chan < fFirstChannelInNextPlane[0][0][1]) ){ view = geo::kV; }
419  else if( (chan >= fFirstChannelInThisPlane[0][0][2]) &&
420  (chan < fFirstChannelInNextPlane[0][0][2]) ){ view = geo::kZ; }
421  else{ mf::LogWarning("BadChannelViewType") << "Channel " << channel
422  << " (" << chan << ") not given view type."; }
423 
424  return view;
425  }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fChannelsPerAPA
Planes which measure U.
Definition: geo_types.h:129
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::set< View_t > const & geo::ChannelMapAPAAlg::Views ( ) const

Definition at line 428 of file ChannelMapAPAAlg.cxx.

429  {
430  return fViews;
431  }
std::set< View_t > fViews
vector of the views present in the detector
virtual double geo::ChannelMapAPAAlg::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 46 of file ChannelMapAPAAlg.h.

51  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
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.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
double geo::ChannelMapAPAAlg::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 290 of file ChannelMapAPAAlg.cxx.

291  {
292  // Returns the wire number corresponding to a (Y,Z) position in the plane
293  // with float precision.
294  // Core code ripped from original NearestWireID() implementation
295 
296  const PlaneData_t& PlaneData = AccessElement(fPlaneData, planeid);
297 
298  //get the orientation angle of a given plane and calculate the distance between first wire
299  //and a point projected in the plane
300 // const double rotate = (planeid.TPC % 2 == 1)? -1.: +1.;
301 
302  // the formula used here is geometric:
303  // distance = delta_y cos(theta_z) + delta_z sin(theta_z)
304  // with a correction for the orientation of the TPC:
305  // odd TPCs have supplementary wire angle (pi-theta_z), changing cosine sign
306 
307  const bool bSuppl = (planeid.TPC % 2) == 1;
308  float distance =
309  -(YPos - PlaneData.fFirstWireCenterY) * (bSuppl? -1.: +1.) * fCosOrientation[planeid.Plane]
310  +(ZPos - PlaneData.fFirstWireCenterZ) * fSinOrientation[planeid.Plane]
311  ;
312 
313  // The sign of this formula is correct if the wire with larger ID is on the
314  // "right" (intuitively, larger z; rigorously, smaller intercept)
315  // than this one.
316  // Of course, we are not always that lucky. fWireSortingInZ fixes our luck.
317 
318  return PlaneData.fWireSortingInZ * distance/fWirePitch[planeid.Plane];
319  } // ChannelMapAPAAlg::WireCoordinate()
std::vector< double > fSinOrientation
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
PlaneInfoMap_t< PlaneData_t > fPlaneData
std::vector< double > fWirePitch
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< double > fCosOrientation
readout::ROPID geo::ChannelMapAPAAlg::WirePlaneToROP ( geo::PlaneID const &  planeid) const
overridevirtual

Returns the ID of the ROP planeid belongs to, or invalid if none.

Parameters
planeidID of the wire plane
Returns
the ID of the corresponding ROP, or invalid ID when planeid is

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

Todo:
to be completed

Implements geo::ChannelMapAlg.

Definition at line 540 of file ChannelMapAPAAlg.cxx.

541  {
542  throw cet::exception("ChannelMapAPAAlg") << __func__ << " not implemented!\n";
543  } // ChannelMapAPAAlg::WirePlaneToROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

unsigned int geo::ChannelMapAPAAlg::fChannelsPerAPA
private

Definition at line 274 of file ChannelMapAPAAlg.h.

unsigned int geo::ChannelMapAPAAlg::fChannelsPerOpDet
private

Definition at line 264 of file ChannelMapAPAAlg.h.

std::vector< double > geo::ChannelMapAPAAlg::fCosOrientation
private

Definition at line 300 of file ChannelMapAPAAlg.h.

unsigned int geo::ChannelMapAPAAlg::fNchannels
private

number of channels in the detector

Definition at line 266 of file ChannelMapAPAAlg.h.

unsigned int geo::ChannelMapAPAAlg::fNcryostat
private

number of cryostats in the detector

Definition at line 265 of file ChannelMapAPAAlg.h.

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

number of TPCs in each cryostat

Definition at line 268 of file ChannelMapAPAAlg.h.

std::vector< double > geo::ChannelMapAPAAlg::fOrientation
private

Definition at line 298 of file ChannelMapAPAAlg.h.

PlaneInfoMap_t<PlaneData_t> geo::ChannelMapAPAAlg::fPlaneData
private

Definition at line 295 of file ChannelMapAPAAlg.h.

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

vector of the PlaneIDs present in the detector

Definition at line 270 of file ChannelMapAPAAlg.h.

unsigned int geo::ChannelMapAPAAlg::fPlanesPerAPA
private

Definition at line 273 of file ChannelMapAPAAlg.h.

std::vector< double > geo::ChannelMapAPAAlg::fSinOrientation
private

Definition at line 299 of file ChannelMapAPAAlg.h.

geo::GeoObjectSorterAPA geo::ChannelMapAPAAlg::fSorter
private

sorts geo::XXXGeo objects

Definition at line 280 of file ChannelMapAPAAlg.h.

raw::ChannelID_t geo::ChannelMapAPAAlg::fTopChannel
private

book keeping highest channel #

Definition at line 267 of file ChannelMapAPAAlg.h.

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

vector of the views present in the detector

Definition at line 269 of file ChannelMapAPAAlg.h.

std::vector< double > geo::ChannelMapAPAAlg::fWirePitch
private

Definition at line 297 of file ChannelMapAPAAlg.h.

std::vector< unsigned int > geo::ChannelMapAPAAlg::fWiresInPlane
private

Definition at line 272 of file ChannelMapAPAAlg.h.

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

The number of wires in this plane in the heirachy

Definition at line 277 of file ChannelMapAPAAlg.h.

std::vector< unsigned int > geo::ChannelMapAPAAlg::nAnchoredWires
private

Definition at line 275 of file ChannelMapAPAAlg.h.


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