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

#include <VDColdboxChannelGroups.h>

Inheritance diagram for VDColdboxChannelGroups:
IndexRangeGroupTool

Public Member Functions

 VDColdboxChannelGroups (fhicl::ParameterSet const &ps)
 
 ~VDColdboxChannelGroups () override=default
 
IndexRangeGroup get (std::string nam) const override
 
- Public Member Functions inherited from IndexRangeGroupTool
virtual ~IndexRangeGroupTool ()=default
 

Private Types

using Name = std::string
 
using NameVector = std::vector< Name >
 

Private Member Functions

IndexRangeGroup makeGroup (Name nam, NameVector rnams, Name lab) const
 

Private Attributes

int m_LogLevel
 
IndexRangeToolm_pcrt =nullptr
 

Additional Inherited Members

- Public Types inherited from IndexRangeGroupTool
using Name = IndexRangeGroup::Name
 

Detailed Description

Definition at line 16 of file VDColdboxChannelGroups.h.

Member Typedef Documentation

Definition at line 38 of file VDColdboxChannelGroups.h.

Definition at line 39 of file VDColdboxChannelGroups.h.

Constructor & Destructor Documentation

VDColdboxChannelGroups::VDColdboxChannelGroups ( fhicl::ParameterSet const &  ps)

Definition at line 13 of file VDColdboxChannelGroups_tool.cc.

14 : m_LogLevel(ps.get<int>("LogLevel")) {
15  const string myname = "VDColdboxChannelGroups::ctor: ";
16  // Fetch the IndexRange tool.
18  if ( ptm == nullptr ) {
19  if ( m_LogLevel >= 1 ) cout << myname << "ERROR: Tool manager not found." << endl;
20  } else {
21  string crtName = "channelRanges";
22  m_pcrt = ptm->getShared<IndexRangeTool>(crtName);
23  if ( m_pcrt == nullptr ) {
24  if ( m_LogLevel >= 1 ) cout << myname << "ERROR: Channel range tool not found: " << crtName << endl;
25  }
26  }
27  cout << myname << " LogLevel: " << m_LogLevel << endl;
28 }
static constexpr double ps
Definition: Units.h:99
static DuneToolManager * instance(std::string fclname="", int dbg=1)
T * getShared(std::string name)
QTextStream & endl(QTextStream &s)
VDColdboxChannelGroups::~VDColdboxChannelGroups ( )
overridedefault

Member Function Documentation

IndexRangeGroup VDColdboxChannelGroups::get ( std::string  nam) const
overridevirtual

Implements IndexRangeGroupTool.

Definition at line 32 of file VDColdboxChannelGroups_tool.cc.

32  {
33  const string myname = "VDColdboxChannelGroups::get: ";
34  if ( m_pcrt == nullptr ) {
35  cout << myname << "ERROR: Channel range tool was not found." << endl;
36  return IndexRangeGroup();
37  }
38  // Construct group if this is a known group name.
39  const NameVector ufnams = {"femb01u", "femb02u", "femb03u", "femb04u", "femb05u", "femb06u",
40  "femb07u", "femb08u", "femb09u", "femb10u", "femb11u"};
41  const NameVector yfnams = {"femb01y", "femb02y", "femb03y", "femb04y",
42  "femb11y", "femb12y", "femb13y"};
43  const NameVector zfnams = {"femb04z", "femb05z", "femb06z", "femb07z",
44  "femb08z", "femb09z", "femb10z", "femb11z"};
45  NameVector fnams = ufnams;
46  fnams.insert(fnams.end(), yfnams.begin(), yfnams.end());
47  fnams.insert(fnams.end(), zfnams.begin(), zfnams.end());
48  if ( gnam == "fembviews" ) {
49  return makeGroup(gnam, fnams, "FEMB views");
50  } else if ( gnam == "fembu" ) {
51  return makeGroup(gnam, ufnams, "U FEMBs");
52  } else if ( gnam == "femby" ) {
53  return makeGroup(gnam, yfnams, "Y FEMBs");
54  } else if ( gnam == "fembz" ) {
55  return makeGroup(gnam, zfnams, "Z FEMBs");
56  }
57  // No groups found. Try range instead.
58  IndexRange ran = m_pcrt->get(gnam);
59  if ( ! ran.isValid() ) {
60  if ( m_LogLevel >= 2 ) cout << myname << "Range not found: " << gnam << endl;
61  return IndexRangeGroup();
62  }
63  return IndexRangeGroup(ran);
64 }
IndexRangeGroup makeGroup(Name nam, NameVector rnams, Name lab) const
bool isValid() const
Definition: IndexRange.h:94
std::vector< string > NameVector
QTextStream & endl(QTextStream &s)
virtual IndexRange get(Name nam) const =0
IndexRangeGroup VDColdboxChannelGroups::makeGroup ( Name  nam,
NameVector  rnams,
Name  lab 
) const
private

Definition at line 69 of file VDColdboxChannelGroups_tool.cc.

69  {
71  for ( Name rnam : rnams ) {
72  rans.push_back(m_pcrt->get(rnam));
73  }
74  NameVector labs = {lab};
75  return IndexRangeGroup(nam, labs, rans);
76 }
std::vector< IndexRange > RangeVector
ChannelGroupService::Name Name
std::vector< string > NameVector
virtual IndexRange get(Name nam) const =0

Member Data Documentation

int VDColdboxChannelGroups::m_LogLevel
private

Definition at line 32 of file VDColdboxChannelGroups.h.

IndexRangeTool* VDColdboxChannelGroups::m_pcrt =nullptr
private

Definition at line 35 of file VDColdboxChannelGroups.h.


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