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

#include <ChannelMap35Alg.h>

Inheritance diagram for geo::ChannelMap35Alg:
geo::ChannelMapAlg

Classes

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

Public Member Functions

 ChannelMap35Alg (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 Member Functions

template<typename T >
T const & AccessAPAelement (PlaneInfoMap_t< T > const &data, geo::PlaneID planeid) const
 
unsigned int WiresPerPlane (geo::PlaneID const &planeid) const
 
unsigned int AnchoredWires (geo::PlaneID const &planeid) const
 

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...
 
unsigned int fPlanesPerAPA
 
raw::ChannelID_t fChannelsPerAPA
 
PlaneInfoMap_t< unsigned int > nAnchoredWires
 
PlaneInfoMap_t< unsigned int > fWiresPerPlane
 
geo::GeoObjectSorter35 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 28 of file ChannelMap35Alg.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file ChannelMap35Alg.cxx.

30  {
31  }
geo::GeoObjectSorter35 fSorter
sorts geo::XXXGeo objects
p
Definition: test.py:223

Member Function Documentation

template<typename T >
T const& geo::ChannelMap35Alg::AccessAPAelement ( PlaneInfoMap_t< T > const &  data,
geo::PlaneID  planeid 
) const
inlineprivate

Definition at line 304 of file ChannelMap35Alg.h.

305  { planeid.TPC /= 2; return AccessElement(data, planeid); }
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
unsigned int geo::ChannelMap35Alg::AnchoredWires ( geo::PlaneID const &  planeid) const
inlineprivate

Definition at line 308 of file ChannelMap35Alg.h.

309  { return AccessAPAelement(nAnchoredWires, planeid); }
T const & AccessAPAelement(PlaneInfoMap_t< T > const &data, geo::PlaneID planeid) const
PlaneInfoMap_t< unsigned int > nAnchoredWires
readout::ROPID geo::ChannelMap35Alg::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 588 of file ChannelMap35Alg.cxx.

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

217  {
218 
219  // first check if this channel ID is legal
220  if(channel >= fNchannels )
221  throw cet::exception("Geometry") << "ILLEGAL CHANNEL ID for channel " << channel << "\n";
222 
223  std::vector< WireID > AllSegments;
224 
225  static unsigned int cstat;
226  static unsigned int tpc;
227  static unsigned int plane;
228  static unsigned int wireThisPlane;
229  static unsigned int NextPlane;
230  static unsigned int ThisPlane;
231 
232  for(unsigned int csloop = 0; csloop != fNcryostat; ++csloop){
233 
234  bool breakVariable = false;
235 
236  for(unsigned int apaloop = 0; apaloop != fNTPC[csloop]/2; ++apaloop){
237  for(unsigned int planeloop = 0; planeloop != fPlanesPerAPA; ++planeloop){
238 
239  NextPlane = fFirstChannelInNextPlane[csloop][apaloop][planeloop];
240  ThisPlane = fFirstChannelInThisPlane[csloop][apaloop][planeloop];
241 
242  if(channel < NextPlane){
243 
244  cstat = csloop;
245  tpc = 2*apaloop;
246  plane = planeloop;
247  wireThisPlane = channel - ThisPlane;
248 
249  breakVariable = true;
250  break;
251  }// end if break
252  if(breakVariable) break;
253 
254  }// end plane loop
255  if(breakVariable) break;
256 
257  }// end apa loop
258  if(breakVariable) break;
259 
260  }// end cryostat loop
261 
262 
263  int WrapDirection = 1; // go from tpc to (tpc+1) or tpc to (tpc-1)
264 
265  // find the lowest wire
266  raw::ChannelID_t ChannelGroup = std::floor( wireThisPlane/nAnchoredWires[cstat][tpc/2][plane] );
267  unsigned int bottomwire = wireThisPlane-ChannelGroup*nAnchoredWires[cstat][tpc/2][plane];
268 
269  if(ChannelGroup%2==1){
270  // start in the other TPC
271  tpc += 1;
272  WrapDirection = -1;
273  }
274 
275  for(unsigned int WireSegmentCount = 0; WireSegmentCount != 50; ++WireSegmentCount){
276 
277  tpc += WrapDirection*(WireSegmentCount%2);
278 
279  geo::WireID CodeWire(cstat, tpc, plane, bottomwire + WireSegmentCount*nAnchoredWires[cstat][std::floor(tpc/2)][plane]);
280 
281  AllSegments.push_back(CodeWire);
282 
283  // reset the tcp variable so it doesnt "accumulate value"
284  tpc -= WrapDirection*(WireSegmentCount%2);
285 
286  if( bottomwire + (WireSegmentCount+1)*nAnchoredWires[cstat][std::floor(tpc/2)][plane] >
287  fWiresPerPlane[cstat][std::floor(tpc/2)][plane]-1) break;
288 
289  } //end WireSegmentCount loop
290 
291 
292  return AllSegments;
293  }
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int fNcryostat
number of cryostats in the detector
unsigned int fPlanesPerAPA
PlaneInfoMap_t< unsigned int > fWiresPerPlane
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
PlaneInfoMap_t< unsigned int > nAnchoredWires
unsigned int fNchannels
number of channels in the detector
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::ChannelMap35Alg::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 596 of file ChannelMap35Alg.cxx.

597  {
598  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
599  } // ChannelMap35Alg::FirstChannelInROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::TPCID geo::ChannelMap35Alg::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 536 of file ChannelMap35Alg.cxx.

537  {
538  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
539  } // ChannelMap35Alg::FirstTPCinTPCset()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::PlaneID geo::ChannelMap35Alg::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 604 of file ChannelMap35Alg.cxx.

605  {
606  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
607  } // ChannelMap35Alg::FirstWirePlaneInROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMap35Alg::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 490 of file ChannelMap35Alg.cxx.

491  {
492  unsigned int channel = opChannel % 12;
493  return channel;
494  }
uint8_t channel
Definition: CRTFragment.hh:201
bool geo::ChannelMap35Alg::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 557 of file ChannelMap35Alg.cxx.

557  {
558  return ropid.ROP < NROPs(ropid);
559  } // ChannelMap35Alg::HasROP()
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROP in the specified TPC set.
bool geo::ChannelMap35Alg::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 512 of file ChannelMap35Alg.cxx.

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

Geometry initialisation.

Implements geo::ChannelMapAlg.

Definition at line 34 of file ChannelMap35Alg.cxx.

35  {
36  // start over:
37  Uninitialize();
38 
39  std::vector<geo::CryostatGeo> const& cgeo = geodata.cryostats;
40 
41  fNcryostat = cgeo.size();
42 
43  mf::LogInfo("ChannelMap35Alg") << "Initializing...";
44 
45  fNTPC.resize(fNcryostat);
46  fWiresPerPlane.resize(fNcryostat);
49  nAnchoredWires.resize(fNcryostat);
50  fViews.clear();
51  fPlaneIDs.clear();
52  fPlanesPerAPA = cgeo[0].TPC(0).Nplanes();
53 
54  fTopChannel = 0;
55 
56  // Size some vectors and initialize the FirstChannel vectors.
57  for(unsigned int cs = 0; cs != fNcryostat; ++cs){
58 
59  fNTPC[cs] = cgeo[cs].NTPC();
60 
61  nAnchoredWires[cs].resize(fNTPC[cs]);
62  fWiresPerPlane[cs].resize(fNTPC[cs]);
63  fFirstChannelInThisPlane[cs].resize(fNTPC[cs]/2);
64  fFirstChannelInNextPlane[cs].resize(fNTPC[cs]/2);
65 
66  for(unsigned int apa = 0; apa != fNTPC[cs]/2; ++apa){
67 
72 
73  }// end loop over apas
74  }// end cryostats
75 
76  // Find the number of wires anchored to the frame
77  for(unsigned int c = 0; c != fNcryostat; ++c){
78  for(unsigned int a = 0; a != fNTPC[c]/2; ++a){
79  for(unsigned int p = 0; p != fPlanesPerAPA; ++p){
80 
81  unsigned int t = 2*a;
82  fWiresPerPlane[c][a][p] = cgeo[c].TPC(t).Plane(p).Nwires();
83  double xyz[3] = {0.};
84  double xyz_next[3] = {0.};
85 
86  fViews.emplace(cgeo[c].TPC(t).Plane(p).View());
87 
88  for(unsigned int w = 0; w != fWiresPerPlane[c][a][p]; ++w){
89 
90  // for vertical planes
91  if(cgeo[c].TPC(t).Plane(p).View() == geo::kZ) {
92  nAnchoredWires[c][a][p] = fWiresPerPlane[c][a][p];
93  break;
94  }
95 
96  cgeo[c].TPC(t).Plane(p).Wire(w).GetCenter(xyz);
97  cgeo[c].TPC(t).Plane(p).Wire(w+1).GetCenter(xyz_next);
98 
99  if(xyz[2]==xyz_next[2]){
100  nAnchoredWires[c][a][p] = w-1; // this is a known bug, should be w
101  // fixed in ChannelMap35Alg
102  break;
103  }
104 
105  }
106  }
107  }
108  }
109 
110  raw::ChannelID_t CurrentChannel = 0;
111 
112  for(unsigned int cs = 0; cs != fNcryostat; ++cs){
113  for(unsigned int apa = 0; apa != fNTPC[cs]/2; ++apa){
114  for(unsigned int p = 0; p != fPlanesPerAPA; ++p){
115 
116  fFirstChannelInThisPlane[cs][apa][p] = CurrentChannel;
117  CurrentChannel = CurrentChannel + 2*nAnchoredWires[cs][apa][p];
118  fFirstChannelInNextPlane[cs][apa][p] = CurrentChannel;
119 
120  }// end plane loop
121  }// end apa loop
122  }// end cs
123 
124 
125  // Save the number of channels
126  fNchannels = CurrentChannel;
127 
128  // Save the number of channels
130 
131 
132  fWirePitch.resize(fPlanesPerAPA);
133  fOrientation.resize(fPlanesPerAPA);
136 
137 
138  //save data into fFirstWireCenterY, fFirstWireCenterZ and fWireSortingInZ
139  fPlaneData.resize(fNcryostat);
140  for (unsigned int cs=0; cs<fNcryostat; cs++){
141  fPlaneData[cs].resize(fNTPC[cs]);
142  for (unsigned int tpc=0; tpc<fNTPC[cs]; tpc++){
143  fPlaneData[cs][tpc].resize(fPlanesPerAPA);
144  for (unsigned int plane=0; plane<fPlanesPerAPA; plane++){
145  PlaneData_t& PlaneData = fPlaneData[cs][tpc][plane];
146  fPlaneIDs.emplace(cs, tpc, plane);
147  double xyz[3]={0.0, 0.0, 0.0};
148  const geo::PlaneGeo& thePlane = cgeo[cs].TPC(tpc).Plane(plane);
149  thePlane.Wire(0).GetCenter(xyz);
150  PlaneData.fFirstWireCenterY = xyz[1];
151  PlaneData.fFirstWireCenterZ = xyz[2];
152  // we are interested in the ordering of wire numbers: we find that a
153  // point is N wires left of a wire W: is that wire W + N or W - N?
154  // In fact, for TPC #0 it is W + N for V and Z planes, W - N for U
155  // plane; for TPC #0 it is W + N for V and Z planes, W - N for U
156  PlaneData.fWireSortingInZ = thePlane.WireIDincreasesWithZ()? +1.: -1.;
157 
158  // find boundaries of the APA frame for this plane by looking at endpoints of wires
159 
160  double endpoint[3];
161  thePlane.Wire(0).GetStart(endpoint);
162  PlaneData.fYmax = endpoint[1];
163  PlaneData.fYmin = endpoint[1];
164  PlaneData.fZmax = endpoint[2];
165  PlaneData.fZmin = endpoint[2];
166  unsigned int nwires = thePlane.Nwires();
167  for (unsigned int iwire=0;iwire<nwires;iwire++){
168  thePlane.Wire(iwire).GetStart(endpoint);
169  PlaneData.fYmax = std::max(PlaneData.fYmax,endpoint[1]);
170  PlaneData.fYmin = std::min(PlaneData.fYmin,endpoint[1]);
171  PlaneData.fZmax = std::max(PlaneData.fZmax,endpoint[2]);
172  PlaneData.fZmin = std::min(PlaneData.fZmin,endpoint[2]);
173  thePlane.Wire(iwire).GetEnd(endpoint);
174  PlaneData.fYmax = std::max(PlaneData.fYmax,endpoint[1]);
175  PlaneData.fYmin = std::min(PlaneData.fYmin,endpoint[1]);
176  PlaneData.fZmax = std::max(PlaneData.fZmax,endpoint[2]);
177  PlaneData.fZmin = std::min(PlaneData.fZmin,endpoint[2]);
178  } // loop on wire
179  } // for plane
180  } // for TPC
181  } // for cryostat
182 
183  //initialize fWirePitch and fOrientation
184  for (unsigned int plane=0; plane<fPlanesPerAPA; plane++){
185  fWirePitch[plane]=cgeo[0].TPC(0).WirePitch(plane);
186  fOrientation[plane]=cgeo[0].TPC(0).Plane(plane).Wire(0).ThetaZ();
187  fSinOrientation[plane] = sin(fOrientation[plane]);
188  fCosOrientation[plane] = cos(fOrientation[plane]);
189 
190  } // for
191 
192 
193  mf::LogVerbatim("ChannelMap35Alg") << "fNchannels = " << fNchannels ;
194  mf::LogVerbatim("ChannelMap35Alg") << "U channels per APA = " << 2*nAnchoredWires[0][0][0] ;
195  mf::LogVerbatim("ChannelMap35Alg") << "V channels per APA = " << 2*nAnchoredWires[0][0][1] ;
196  mf::LogVerbatim("ChannelMap35Alg") << "Z channels per APA side = " << nAnchoredWires[0][0][2] ;
197 
198  mf::LogVerbatim("ChannelMap35Alg") << "Pitch in U Plane = " << fWirePitch[0] ;
199  mf::LogVerbatim("ChannelMap35Alg") << "Pitch in V Plane = " << fWirePitch[1] ;
200  mf::LogVerbatim("ChannelMap35Alg") << "Pitch in Z Plane = " << fWirePitch[2] ;
201 
202  return;
203 
204  }
void GetStart(double *xyz) const
Definition: WireGeo.h:157
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int fNcryostat
number of cryostats in the detector
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
unsigned int fPlanesPerAPA
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:506
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > fWirePitch
PlaneInfoMap_t< unsigned int > fWiresPerPlane
Planes which measure Z direction.
Definition: geo_types.h:132
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
std::set< View_t > fViews
vector of the views present in the detector
std::vector< double > fCosOrientation
raw::ChannelID_t fTopChannel
book keeping highest channel #
std::vector< double > fOrientation
PlaneInfoMap_t< PlaneData_t > fPlaneData
const double a
View_t View(raw::ChannelID_t const channel) const
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
static int max(int a, int b)
std::vector< double > fSinOrientation
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
PlaneInfoMap_t< unsigned int > nAnchoredWires
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
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
raw::ChannelID_t fChannelsPerAPA
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:73
unsigned int fNchannels
number of channels in the detector
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
unsigned int geo::ChannelMap35Alg::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 551 of file ChannelMap35Alg.cxx.

551  {
552  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
553  } // ChannelMap35Alg::MaxROPs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMap35Alg::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 505 of file ChannelMap35Alg.cxx.

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

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

Implements geo::ChannelMapAlg.

Definition at line 297 of file ChannelMap35Alg.cxx.

298  {
299  return fNchannels;
300  }
unsigned int fNchannels
number of channels in the detector
unsigned int geo::ChannelMap35Alg::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 305 of file ChannelMap35Alg.cxx.

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

65  { 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::ChannelMap35Alg::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 347 of file ChannelMap35Alg.cxx.

348  {
349 
350  // cap the position to be within the boundaries of the wire endpoints.
351  // This simulates charge drifting in from outside of the wire frames inwards towards
352  // the first and last collection wires on the side, and towards the right endpoints
353 
354  const PlaneData_t& PlaneData = AccessElement(fPlaneData, planeid);
355  double ycap = std::max(PlaneData.fYmin,std::min(PlaneData.fYmax,xyz.Y()));
356  double zcap = std::max(PlaneData.fZmin,std::min(PlaneData.fZmax,xyz.Z()));
357 
358  // add 0.5 to have the correct rounding
359  int NearestWireNumber
360  = int (0.5 + WireCoordinate(ycap, zcap, planeid));
361 
362  // If we are outside of the wireplane range, throw an exception
363  // (this response maintains consistency with the previous
364  // implementation based on geometry lookup)
365  if(NearestWireNumber < 0 ||
366  NearestWireNumber >= (int) WiresPerPlane(planeid))
367  {
368  const int wireNumber = NearestWireNumber; // save for the output
369 
370  if(wireNumber < 0 ) NearestWireNumber = 0;
371  else NearestWireNumber = WiresPerPlane(planeid) - 1;
372 
373  /*
374  // comment in the following statement to throw an exception instead
375  throw InvalidWireIDError("Geometry", wireNumber, NearestWireNumber)
376  << "ChannelMap35Alg::NearestWireID(): can't Find Nearest Wire for position ("
377  << xyz.X() << "," << xyz.Y() << "," << xyz.Z() << ")"
378  << " approx wire number # " << wireNumber
379  << " (capped from " << NearestWireNumber << ")\n";
380  */
381  } // if invalid wire
382 
383  return { planeid, (geo::WireID::WireID_t) NearestWireNumber };
384  } // ChannelMap35Alg::NearestWireID()
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)
unsigned int WiresPerPlane(geo::PlaneID const &planeid) const
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
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.
unsigned int geo::ChannelMap35Alg::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 455 of file ChannelMap35Alg.cxx.

456  {
457  return 12*NOpDets;
458  }
unsigned int geo::ChannelMap35Alg::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 461 of file ChannelMap35Alg.cxx.

462  {
463  // CSU 3-sipm design
464  if (opDet == 0 || opDet == 4 || opDet == 6)
465  return 8;
466 
467  // LSU 2-sipm design
468  if (opDet == 2)
469  return 2;
470 
471  // IU 12-sipm design
472  return 12;
473  }
unsigned int geo::ChannelMap35Alg::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 544 of file ChannelMap35Alg.cxx.

545  {
546  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
547  } // ChannelMap35Alg::NROPs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMap35Alg::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 498 of file ChannelMap35Alg.cxx.

499  {
500  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
501  } // ChannelMap35Alg::NTPCsets()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMap35Alg::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 476 of file ChannelMap35Alg.cxx.

477  {
478  unsigned int uniqueChannel = (detNum * 12) + channel;
479  return uniqueChannel;
480  }
uint8_t channel
Definition: CRTFragment.hh:201
unsigned int geo::ChannelMap35Alg::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 483 of file ChannelMap35Alg.cxx.

484  {
485  unsigned int detectorNum = (unsigned int) opChannel / 12;
486  return detectorNum;
487  }
std::set< PlaneID > const & geo::ChannelMap35Alg::PlaneIDs ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 449 of file ChannelMap35Alg.cxx.

450  {
451  return fPlaneIDs;
452  }
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
virtual raw::ChannelID_t geo::ChannelMap35Alg::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 70 of file ChannelMap35Alg.h.

74  { 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::ChannelMap35Alg::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 388 of file ChannelMap35Alg.cxx.

389  {
390 
391  unsigned int OtherSideWires = 0;
392 
394 
395  // get number of wires starting on the first side of the APA if starting
396  // on the other side TPC.
397  if (wireid.TPC % 2 == 1) OtherSideWires += AnchoredWires(wireid);
398 
399  // Lastly, account for the fact that channel number while moving up wire number in one
400  // plane resets after 2 times the number of wires anchored -- one for each APA side.
401  // At the same time, OtherSideWires accounts for the fact that if a channel starts on
402  // the other side, it is offset by the number of wires on the first side.
403  Channel += (OtherSideWires + wireid.Wire)%(2*AnchoredWires(wireid));
404 
405  return Channel;
406 
407  }
T const & AccessAPAelement(PlaneInfoMap_t< T > const &data, geo::PlaneID planeid) const
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
unsigned int AnchoredWires(geo::PlaneID const &planeid) const
std::vector< geo::TPCID > geo::ChannelMap35Alg::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 580 of file ChannelMap35Alg.cxx.

581  {
582  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
583  } // ChannelMap35Alg::ROPtoTPCs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< geo::PlaneID > geo::ChannelMap35Alg::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 572 of file ChannelMap35Alg.cxx.

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

412  {
414  SigType_t sigt = kInduction;
415 
416  if( chan < fFirstChannelInThisPlane[0][0][2] ){ sigt = kInduction; }
417  else if( (chan >= fFirstChannelInThisPlane[0][0][2]) &&
418  (chan < fFirstChannelInNextPlane[0][0][2]) ){ sigt = kCollection; }
419  else{ mf::LogWarning("BadChannelSignalType") << "Channel " << channel
420  << " (" << chan << ") not given signal type." << std::endl; }
421 
422  return sigt;
423  }
uint8_t channel
Definition: CRTFragment.hh:201
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
Signal from induction planes.
Definition: geo_types.h:145
enum geo::_plane_sigtype SigType_t
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
raw::ChannelID_t fChannelsPerAPA
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::ChannelMap35Alg::Sorter ( ) const
inlineoverridevirtual

Returns the object to sort geometry with.

Implements geo::ChannelMapAlg.

Definition at line 255 of file ChannelMap35Alg.h.

256  { return fSorter; }
geo::GeoObjectSorter35 fSorter
sorts geo::XXXGeo objects
std::vector< geo::TPCID > geo::ChannelMap35Alg::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 528 of file ChannelMap35Alg.cxx.

529  {
530  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
531  } // ChannelMap35Alg::TPCsetToTPCs()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
readout::TPCsetID geo::ChannelMap35Alg::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 520 of file ChannelMap35Alg.cxx.

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

Deconfiguration: prepare for a following call of Initialize()

Implements geo::ChannelMapAlg.

Definition at line 207 of file ChannelMap35Alg.cxx.

208  {
209 
210  PlaneInfoMap_t<raw::ChannelID_t>().swap(fFirstChannelInThisPlane);
211  PlaneInfoMap_t<raw::ChannelID_t>().swap(fFirstChannelInNextPlane);
212 
213  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
void swap(Handle< T > &a, Handle< T > &b)
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
View_t geo::ChannelMap35Alg::View ( raw::ChannelID_t const  channel) const

Definition at line 426 of file ChannelMap35Alg.cxx.

427  {
429  View_t view = geo::kU;
430 
431  if( chan < fFirstChannelInNextPlane[0][0][0] ){ view = geo::kU; }
432  else if( (chan >= fFirstChannelInThisPlane[0][0][1]) &&
433  (chan < fFirstChannelInNextPlane[0][0][1]) ){ view = geo::kV; }
434  else if( (chan >= fFirstChannelInThisPlane[0][0][2]) &&
435  (chan < fFirstChannelInNextPlane[0][0][2]) ){ view = geo::kZ; }
436  else{ mf::LogWarning("BadChannelViewType") << "Channel " << channel
437  << " (" << chan << ") not given view type.";}
438 
439  return view;
440  }
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
Planes which measure U.
Definition: geo_types.h:129
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
raw::ChannelID_t fChannelsPerAPA
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::ChannelMap35Alg::Views ( ) const

Definition at line 443 of file ChannelMap35Alg.cxx.

444  {
445  return fViews;
446  }
std::set< View_t > fViews
vector of the views present in the detector
virtual double geo::ChannelMap35Alg::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 49 of file ChannelMap35Alg.h.

54  { 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, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const override
Returns the index of the wire nearest to the specified position.
double geo::ChannelMap35Alg::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 313 of file ChannelMap35Alg.cxx.

314  {
315  // Returns the wire number corresponding to a (Y,Z) position in the plane
316  // with float precision.
317  // Core code ripped from original NearestWireID() implementation
318 
319  const PlaneData_t& PlaneData = AccessElement(fPlaneData, planeid);
320 
321  //get the orientation angle of a given plane and calculate the distance between first wire
322  //and a point projected in the plane
323 // const double rotate = (planeid.TPC % 2 == 1)? -1.: +1.;
324 
325  // the formula used here is geometric:
326  // distance = delta_y cos(theta_z) + delta_z sin(theta_z)
327  // with a correction for the orientation of the TPC:
328  // odd TPCs have supplementary wire angle (pi-theta_z), changing cosine sign
329 
330  const bool bSuppl = (planeid.TPC % 2) == 1;
331  float distance =
332  -(YPos - PlaneData.fFirstWireCenterY) * (bSuppl? -1.: +1.) * fCosOrientation[planeid.Plane]
333  +(ZPos - PlaneData.fFirstWireCenterZ) * fSinOrientation[planeid.Plane]
334  ;
335 
336  // The sign of this formula is correct if the wire with larger ID is on the
337  // "right" (intuitively, larger z; rigorously, smaller intercept)
338  // than this one.
339  // Of course, we are not always that lucky. fWireSortingInZ fixes our luck.
340 
341  return PlaneData.fWireSortingInZ * distance/fWirePitch[planeid.Plane];
342  } // ChannelMap35Alg::WireCoordinate()
std::vector< double > fWirePitch
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
std::vector< double > fCosOrientation
PlaneInfoMap_t< PlaneData_t > fPlaneData
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< double > fSinOrientation
readout::ROPID geo::ChannelMap35Alg::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 564 of file ChannelMap35Alg.cxx.

565  {
566  throw cet::exception("ChannelMap35Alg") << __func__ << " not implemented!\n";
567  } // ChannelMap35Alg::WirePlaneToROP()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::ChannelMap35Alg::WiresPerPlane ( geo::PlaneID const &  planeid) const
inlineprivate

Definition at line 306 of file ChannelMap35Alg.h.

307  { return AccessAPAelement(fWiresPerPlane, planeid); }
T const & AccessAPAelement(PlaneInfoMap_t< T > const &data, geo::PlaneID planeid) const
PlaneInfoMap_t< unsigned int > fWiresPerPlane

Member Data Documentation

raw::ChannelID_t geo::ChannelMap35Alg::fChannelsPerAPA
private

Definition at line 275 of file ChannelMap35Alg.h.

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

Definition at line 300 of file ChannelMap35Alg.h.

unsigned int geo::ChannelMap35Alg::fNchannels
private

number of channels in the detector

Definition at line 268 of file ChannelMap35Alg.h.

unsigned int geo::ChannelMap35Alg::fNcryostat
private

number of cryostats in the detector

Definition at line 267 of file ChannelMap35Alg.h.

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

number of TPCs in each cryostat

Definition at line 270 of file ChannelMap35Alg.h.

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

Definition at line 298 of file ChannelMap35Alg.h.

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

Definition at line 295 of file ChannelMap35Alg.h.

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

vector of the PlaneIDs present in the detector

Definition at line 272 of file ChannelMap35Alg.h.

unsigned int geo::ChannelMap35Alg::fPlanesPerAPA
private

Definition at line 274 of file ChannelMap35Alg.h.

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

Definition at line 299 of file ChannelMap35Alg.h.

geo::GeoObjectSorter35 geo::ChannelMap35Alg::fSorter
private

sorts geo::XXXGeo objects

Definition at line 280 of file ChannelMap35Alg.h.

raw::ChannelID_t geo::ChannelMap35Alg::fTopChannel
private

book keeping highest channel #

Definition at line 269 of file ChannelMap35Alg.h.

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

vector of the views present in the detector

Definition at line 271 of file ChannelMap35Alg.h.

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

Definition at line 297 of file ChannelMap35Alg.h.

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

The number of wires in this plane in the heirachy

Definition at line 278 of file ChannelMap35Alg.h.

PlaneInfoMap_t<unsigned int> geo::ChannelMap35Alg::nAnchoredWires
private

Definition at line 276 of file ChannelMap35Alg.h.


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