Public Member Functions | Private Types | Private Attributes | List of all members
GeoRopChannelGroupService Class Reference

#include <GeoRopChannelGroupService.h>

Inheritance diagram for GeoRopChannelGroupService:
ChannelGroupService

Public Member Functions

 GeoRopChannelGroupService (fhicl::ParameterSet const &pset)
 
 GeoRopChannelGroupService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
 ~GeoRopChannelGroupService ()=default
 
Index size () const
 
Name name (Index igrp) const
 
const ChannelVectorchannels (Index igrp) const
 
std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
- Public Member Functions inherited from ChannelGroupService
virtual ~ChannelGroupService ()=default
 

Private Types

typedef std::vector< NameNameVector
 
typedef std::vector< ChannelVectorChannelVectorVector
 

Private Attributes

art::ServiceHandle< geo::Geometrym_pgeo
 
Index m_size
 
NameVector m_names
 
ChannelVectorVector m_chanvecs
 

Additional Inherited Members

- Public Types inherited from ChannelGroupService
typedef unsigned int Index
 
typedef unsigned int Channel
 
typedef std::vector< ChannelChannelVector
 
typedef std::string Name
 

Detailed Description

Definition at line 15 of file GeoRopChannelGroupService.h.

Member Typedef Documentation

Definition at line 43 of file GeoRopChannelGroupService.h.

Definition at line 42 of file GeoRopChannelGroupService.h.

Constructor & Destructor Documentation

GeoRopChannelGroupService::GeoRopChannelGroupService ( fhicl::ParameterSet const &  pset)

Definition at line 29 of file GeoRopChannelGroupService_service.cc.

30 : m_size(0) {
31  // Find the total # APAs and assign width for APA index.
32  Index napatot = 0;
33  for ( const geo::CryostatID& cryid : m_pgeo->IterateCryostatIDs() ) {
34  napatot += m_pgeo->NTPCsets(cryid);
35  }
36  unsigned int w = log10(napatot-1) + 1;
37  // Loop over cryostats.
38  Index krop = 0;
39  for ( const geo::CryostatID& cryid : m_pgeo->IterateCryostatIDs() ) {
40  Index napa = m_pgeo->NTPCsets(cryid);
41  // Loop over APAs.
42  for ( Index iapa=0; iapa<napa; ++iapa ) {
43  APAID apaid(cryid, iapa);
44  Index nrop = m_pgeo->NROPs(apaid);
45  // Loop over ROPs.
46  unsigned int nvu = 0;
47  unsigned int nvv = 0;
48  unsigned int nvz = 0;
49  // First pass to get the number of each view.
50  for ( Index irop=0; irop<nrop; ++irop ) {
51  ROPID ropid(apaid, irop);
52  geo::View_t view = m_pgeo->View(ropid);
53  if ( view == geo::kU ) ++nvu;
54  else if ( view == geo::kV ) ++nvv;
55  else if ( view == geo::kZ ) ++nvz;
56  }
57  unsigned int ivu = 0;
58  unsigned int ivv = 0;
59  unsigned int ivz = 0;
60  // Loop over ROPs, assign name and fill channel vector.
61  for ( Index irop=0; irop<nrop; ++irop ) {
62  ROPID ropid(apaid, irop);
63  m_names.resize(krop+1);
64  m_chanvecs.resize(krop+1);
65  // Build name.
66  ostringstream ssname;
67  ssname << "apa" << setfill('0') << setw(w) << iapa;
68  geo::View_t view = m_pgeo->View(ropid);
69  if ( view == geo::kU ) {
70  ssname << "u";
71  ++ivu;
72  if ( nvu > 1 ) ssname << ivu;
73  } else if ( view == geo::kV ) {
74  ssname << "v";
75  ++ivv;
76  if ( nvv > 1 ) ssname << ivv;
77  } else if ( view == geo::kZ ) {
78  ssname << "z";
79  ++ivz;
80  if ( nvz > 1 ) ssname << ivz;
81  } else {
82  ssname << "UnknownView";
83  }
84  m_names[krop] = ssname.str();
85  // Find channels.
86  Index icha1 = m_pgeo->FirstChannelInROP(ropid);
87  Index icha2 = icha1 + m_pgeo->Nchannels(ropid);
88  for ( unsigned int icha=icha1; icha<icha2; ++icha ) m_chanvecs[krop].push_back(icha);
89  ++krop;
90  }
91  }
92  }
93  m_size = krop;
94 }
art::ServiceHandle< geo::Geometry > m_pgeo
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
unsigned int NTPCsets(readout::CryostatID const &cryoid) const
Returns the total number of TPC sets in the specified cryostat.
Planes which measure Z direction.
Definition: geo_types.h:132
unsigned int Index
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
Planes which measure U.
Definition: geo_types.h:129
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const
Returns the ID of the first channel in the specified readout plane.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Class identifying a set of planes sharing readout channels.
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
IteratorBox< cryostat_id_iterator,&GeometryCore::begin_cryostat_id,&GeometryCore::end_cryostat_id > IterateCryostatIDs() const
Enables ranged-for loops on all cryostat IDs of the detector.
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const
Returns the total number of ROP in the specified TPC set.
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
GeoRopChannelGroupService::GeoRopChannelGroupService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 99 of file GeoRopChannelGroupService_service.cc.

100 : GeoRopChannelGroupService(pset) { }
GeoRopChannelGroupService(fhicl::ParameterSet const &pset)
GeoRopChannelGroupService::~GeoRopChannelGroupService ( )
default

Member Function Documentation

const ChannelVector & GeoRopChannelGroupService::channels ( Index  igrp) const
virtual

Implements ChannelGroupService.

Definition at line 117 of file GeoRopChannelGroupService_service.cc.

117  {
118  if ( igrp < m_chanvecs.size() ) return m_chanvecs[igrp];
119  static ChannelVector empty;
120  return empty;
121 }
ChannelGroupService::ChannelVector ChannelVector
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
Name GeoRopChannelGroupService::name ( Index  igrp) const
virtual

Implements ChannelGroupService.

Definition at line 110 of file GeoRopChannelGroupService_service.cc.

110  {
111  if ( igrp < m_names.size() ) return m_names[igrp];
112  return "NoSuchRop";
113 }
ostream & GeoRopChannelGroupService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements ChannelGroupService.

Definition at line 125 of file GeoRopChannelGroupService_service.cc.

125  {
126  out << prefix << "GeoRopChannelGroupService: " << endl;
127  out << prefix << " # ROP: " << size() << endl;
128  return out;
129 }
QTextStream & endl(QTextStream &s)
Index GeoRopChannelGroupService::size ( ) const
virtual

Implements ChannelGroupService.

Definition at line 104 of file GeoRopChannelGroupService_service.cc.

104  {
105  return m_size;
106 }

Member Data Documentation

ChannelVectorVector GeoRopChannelGroupService::m_chanvecs
private

Definition at line 49 of file GeoRopChannelGroupService.h.

NameVector GeoRopChannelGroupService::m_names
private

Definition at line 48 of file GeoRopChannelGroupService.h.

art::ServiceHandle<geo::Geometry> GeoRopChannelGroupService::m_pgeo
private

Definition at line 45 of file GeoRopChannelGroupService.h.

Index GeoRopChannelGroupService::m_size
private

Definition at line 47 of file GeoRopChannelGroupService.h.


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