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

#include <GeoApaChannelGroupService.h>

Inheritance diagram for GeoApaChannelGroupService:
ChannelGroupService

Public Member Functions

 GeoApaChannelGroupService (fhicl::ParameterSet const &pset)
 
 GeoApaChannelGroupService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
 ~GeoApaChannelGroupService ()=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
 
int m_LogLevel
 
std::vector< int > m_ApaRops
 
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 28 of file GeoApaChannelGroupService.h.

Member Typedef Documentation

Definition at line 56 of file GeoApaChannelGroupService.h.

Definition at line 55 of file GeoApaChannelGroupService.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file GeoApaChannelGroupService_service.cc.

30 : m_LogLevel(pset.get<int>("LogLevel")),
31  m_ApaRops(pset.get<vector<int>>("ApaRops")),
32  m_size(0) {
33  const string myname = "GeoApaChannelGroupService::ctor: ";
34  // Find the total # APAs and assign width for APA index.
35  Index ngrp = 0;
36  for ( const geo::CryostatID& cryid : m_pgeo->IterateCryostatIDs() ) {
37  ngrp += m_pgeo->NTPCsets(cryid);
38  }
39  unsigned int w = log10(ngrp-1) + 1;
40  m_names.resize(ngrp);
41  m_chanvecs.resize(ngrp);
42  Index igrp = 0;
43  Index ncry = m_pgeo->Ncryostats();
44  // Loop over cryostats.
45  for ( const geo::CryostatID& cryid : m_pgeo->IterateCryostatIDs() ) {
46  Index napa = m_pgeo->NTPCsets(cryid);
47  Index icry = cryid.Cryostat;
48  // Loop over APAs.
49  for ( Index iapa=0; iapa<napa; ++iapa, ++igrp ) {
50  APAID apaid(cryid, iapa);
51  Index nrop = m_pgeo->NROPs(apaid);
52  // Build name.
53  ostringstream ssname;
54  if ( ncry > 1 ) ssname << "cry" << icry << "-";
55  ssname << "apa" << setfill('0') << setw(w) << iapa;
56  m_names[igrp] = ssname.str();
57  // Loop over ROPs and fill channel vector.
58  vector<bool> skipRop(nrop, false);
59  Index naparop = m_ApaRops.size();
60  if ( naparop > 0 ) {
61  Index pat = m_ApaRops[iapa%naparop];
62  for ( Index irop=0; irop<nrop; ++irop ) {
63  Index mask = 1 << irop;
64  bool keep = mask & pat;
65  if ( ! keep ) skipRop[irop] = true;
66  }
67  }
68  Index nropUsed = 0;
69  for ( Index irop=0; irop<nrop; ++irop ) {
70  if ( skipRop[irop] ) continue;
71  ROPID ropid(apaid, irop);
72  // Find channels.
73  Index icha1 = m_pgeo->FirstChannelInROP(ropid);
74  Index icha2 = icha1 + m_pgeo->Nchannels(ropid);
75  for ( unsigned int icha=icha1; icha<icha2; ++icha ) m_chanvecs[igrp].push_back(icha);
76  ++nropUsed;
77  }
78  if ( m_LogLevel >= 1 ) {
79  cout << myname << "Group " << igrp << " (" << m_names[igrp] << ") has "
80  << m_chanvecs[igrp].size() << " channels from "
81  << nropUsed << "/" << nrop << " readout planes." << endl;
82  }
83  }
84  }
85  m_size = ngrp;
86 }
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.
unsigned int Index
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
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.
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
QTextStream & endl(QTextStream &s)
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
art::ServiceHandle< geo::Geometry > m_pgeo
GeoApaChannelGroupService::GeoApaChannelGroupService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 91 of file GeoApaChannelGroupService_service.cc.

92 : GeoApaChannelGroupService(pset) { }
GeoApaChannelGroupService(fhicl::ParameterSet const &pset)
GeoApaChannelGroupService::~GeoApaChannelGroupService ( )
default

Member Function Documentation

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

Implements ChannelGroupService.

Definition at line 109 of file GeoApaChannelGroupService_service.cc.

109  {
110  if ( igrp < m_chanvecs.size() ) return m_chanvecs[igrp];
111  static ChannelVector empty;
112  return empty;
113 }
ChannelGroupService::ChannelVector ChannelVector
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
Name GeoApaChannelGroupService::name ( Index  igrp) const
virtual

Implements ChannelGroupService.

Definition at line 102 of file GeoApaChannelGroupService_service.cc.

102  {
103  if ( igrp < m_names.size() ) return m_names[igrp];
104  return "NoSuchApa";
105 }
ostream & GeoApaChannelGroupService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements ChannelGroupService.

Definition at line 117 of file GeoApaChannelGroupService_service.cc.

117  {
118  out << prefix << "GeoApaChannelGroupService: " << endl;
119  out << prefix << " # ROP: " << size() << endl;
120  return out;
121 }
QTextStream & endl(QTextStream &s)
Index GeoApaChannelGroupService::size ( ) const
virtual

Implements ChannelGroupService.

Definition at line 96 of file GeoApaChannelGroupService_service.cc.

96  {
97  return m_size;
98 }

Member Data Documentation

std::vector<int> GeoApaChannelGroupService::m_ApaRops
private

Definition at line 62 of file GeoApaChannelGroupService.h.

ChannelVectorVector GeoApaChannelGroupService::m_chanvecs
private

Definition at line 66 of file GeoApaChannelGroupService.h.

int GeoApaChannelGroupService::m_LogLevel
private

Definition at line 61 of file GeoApaChannelGroupService.h.

NameVector GeoApaChannelGroupService::m_names
private

Definition at line 65 of file GeoApaChannelGroupService.h.

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

Definition at line 58 of file GeoApaChannelGroupService.h.

Index GeoApaChannelGroupService::m_size
private

Definition at line 64 of file GeoApaChannelGroupService.h.


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