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

#include <Dune35tChannelGroupService.h>

Inheritance diagram for Dune35tChannelGroupService:
ChannelGroupService

Public Member Functions

 Dune35tChannelGroupService (fhicl::ParameterSet const &pset)
 
 Dune35tChannelGroupService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
 ~Dune35tChannelGroupService ()=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

bool m_UseOffline
 
std::string m_Grouping
 
bool m_SplitByPlane
 
int m_LogLevel
 
art::ServiceHandle< lbne::ChannelMapService > m_pcms
 
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 22 of file Dune35tChannelGroupService.h.

Member Typedef Documentation

Definition at line 56 of file Dune35tChannelGroupService.h.

Definition at line 55 of file Dune35tChannelGroupService.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file Dune35tChannelGroupService_service.cc.

26 : m_UseOffline(true), m_LogLevel(1) {
27  const string myname = "Dune35tChannelGroupService::ctor: ";
28  const Index nAsicPerRce = 8;
29  const Index nRegPerRce = 2;
30  const string plname[4] = {"u", "v", "z1", "z2"};
31  // Fetch parameters.
32  m_UseOffline = pset.get<bool>("UseOffline");
33  m_SplitByPlane = pset.get<bool>("SplitByPlane");
34  m_Grouping = pset.get<string>("Grouping");
35  pset.get_if_present<int>("LogLevel", m_LogLevel);
36  const Index ncha = 2048;
37  bool useAPA = m_Grouping == "APA";
38  bool useASIC = m_Grouping == "ASIC";
39  bool useRegulator = m_Grouping == "Regulator";
40  bool split = m_SplitByPlane;
41  bool off = m_UseOffline;
42  Index ngrp = 0;
44  Index npla = split ? 4 : 1;
45  for ( Index icha=0; icha<ncha; ++icha ) {
46  Index igrp = 9999;
47  Index chon = off ? m_pcms->Online(icha) : icha;
48  Index irce = m_pcms->RCEFromOnlineChannel(chon);
49  Index ipla = m_pcms->PlaneFromOnlineChannel(chon);
50  if ( useAPA ) {
51  igrp = m_pcms->APAFromOnlineChannel(chon);
52  } else if ( useASIC ) {
53  Index iasc = m_pcms->ASICFromOnlineChannel(chon);
54  igrp = nAsicPerRce*irce + iasc;
55  } else if ( useRegulator ) {
56  Index ireg = m_pcms->RegulatorFromOnlineChannel(chon);
57  igrp = nRegPerRce*irce + ireg;
58  } else {
59  cout << myname << "ERROR: Invalid group name: " << m_Grouping << endl;
60  return;
61  }
62  if ( igrp >= ngrp ) {
63  ngrp = igrp + 1;
64  vvvchans.resize(ngrp, ChannelVectorVector(npla));
65  }
66  Index iview = split ? ipla : 0;
67  vvvchans[igrp][iview].push_back(icha);
68  }
69  Name base = useAPA ? "apa" :
70  useASIC ? "asic" :
71  useRegulator ? "reg" : "Unknown";
72  //if ( useAPA ) base = "apa";
73  //if ( useASIC ) base = "asic";
74  //if ( useRegulator ) base = "reg";
75  for ( Index igrp=0; igrp<ngrp; ++igrp ) {
76  for ( Index ipla=0; ipla<npla; ++ipla ) {
77  ChannelVector& chans = vvvchans[igrp][ipla];
78  if ( chans.size() ) {
79  ostringstream ssnam;
80  ssnam << base;
81  if ( ngrp > 100 && igrp < 100 ) ssnam << "0";
82  if ( ngrp > 10 && igrp < 10 ) ssnam << "0";
83  ssnam << igrp;
84  if ( split ) ssnam << plname[ipla];
85  m_names.push_back(ssnam.str());
86  m_chanvecs.push_back(chans);
87  }
88  }
89  }
90  if ( m_LogLevel > 0 ) print();
91 }
vector< ChannelVectorVector > ChannelVectorVectorVector
unsigned int Index
art::ServiceHandle< lbne::ChannelMapService > m_pcms
ChannelGroupService::ChannelVector ChannelVector
AdcCodeMitigator::Name Name
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
std::vector< ChannelVector > ChannelVectorVector
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35
QTextStream & endl(QTextStream &s)
Dune35tChannelGroupService::Dune35tChannelGroupService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 96 of file Dune35tChannelGroupService_service.cc.

Dune35tChannelGroupService(fhicl::ParameterSet const &pset)
Dune35tChannelGroupService::~Dune35tChannelGroupService ( )
default

Member Function Documentation

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

Implements ChannelGroupService.

Definition at line 114 of file Dune35tChannelGroupService_service.cc.

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

Implements ChannelGroupService.

Definition at line 107 of file Dune35tChannelGroupService_service.cc.

107  {
108  if ( igrp < m_names.size() ) return m_names[igrp];
109  return "NoSuchGroup";
110 }
ostream & Dune35tChannelGroupService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements ChannelGroupService.

Definition at line 122 of file Dune35tChannelGroupService_service.cc.

122  {
123  out << prefix << "Dune35tChannelGroupService: " << endl;
124  out << prefix << " UseOffline: " << ( m_UseOffline ? "true" : "false") << endl;
125  out << prefix << " Grouping: " << m_Grouping << endl;
126  out << prefix << " SplitByPlane: " << m_SplitByPlane << endl;
127  out << prefix << " # groups: " << size() << endl;
128  out << prefix << " LogLevel: " << m_LogLevel << endl;
129  return out;
130 }
QTextStream & endl(QTextStream &s)
Index Dune35tChannelGroupService::size ( ) const
virtual

Implements ChannelGroupService.

Definition at line 101 of file Dune35tChannelGroupService_service.cc.

101  {
102  return m_chanvecs.size();
103 }

Member Data Documentation

ChannelVectorVector Dune35tChannelGroupService::m_chanvecs
private

Definition at line 61 of file Dune35tChannelGroupService.h.

std::string Dune35tChannelGroupService::m_Grouping
private

Definition at line 51 of file Dune35tChannelGroupService.h.

int Dune35tChannelGroupService::m_LogLevel
private

Definition at line 53 of file Dune35tChannelGroupService.h.

NameVector Dune35tChannelGroupService::m_names
private

Definition at line 60 of file Dune35tChannelGroupService.h.

art::ServiceHandle<lbne::ChannelMapService> Dune35tChannelGroupService::m_pcms
private

Definition at line 58 of file Dune35tChannelGroupService.h.

bool Dune35tChannelGroupService::m_SplitByPlane
private

Definition at line 52 of file Dune35tChannelGroupService.h.

bool Dune35tChannelGroupService::m_UseOffline
private

Definition at line 50 of file Dune35tChannelGroupService.h.


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