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

#include <PdspOnlineChannel.h>

Inheritance diagram for PdspOnlineChannel:
IndexMapTool

Public Types

using Name = std::string
 
- Public Types inherited from IndexMapTool
using Index = unsigned int
 

Public Member Functions

 PdspOnlineChannel (const fhicl::ParameterSet &ps)
 
Index get (Index chanOff) const override
 
- Public Member Functions inherited from IndexMapTool
virtual ~IndexMapTool ()=default
 

Private Attributes

Index m_LogLevel
 
Name m_Ordering
 
bool m_orderByWib
 
bool m_orderByConnector
 
bool m_orderByFemb
 

Additional Inherited Members

- Static Public Member Functions inherited from IndexMapTool
static Index badIndex ()
 

Detailed Description

Definition at line 52 of file PdspOnlineChannel.h.

Member Typedef Documentation

Definition at line 56 of file PdspOnlineChannel.h.

Constructor & Destructor Documentation

PdspOnlineChannel::PdspOnlineChannel ( const fhicl::ParameterSet ps)

Definition at line 15 of file PdspOnlineChannel_tool.cc.

16 : m_LogLevel(pset.get<Index>("LogLevel")),
17  m_Ordering(pset.get<Name>("Ordering")),
18  m_orderByWib(m_Ordering == "WIB"),
19  m_orderByConnector(m_Ordering == "connector"),
20  m_orderByFemb(m_Ordering == "FEMB") {
21  const string myname = "PdspOnlineChannel::ctor: ";
22  cout << myname << " LogLevel: " << m_LogLevel << endl;
23  cout << myname << " Ordering: " << m_Ordering << endl;
25  cout << myname << "ERROR: Invalid ordering: " << m_Ordering << endl;
26  }
27 }
ChannelGroupService::Name Name
unsigned int Index
QTextStream & endl(QTextStream &s)

Member Function Documentation

Index PdspOnlineChannel::get ( Index  chanOff) const
overridevirtual

Implements IndexMapTool.

Definition at line 31 of file PdspOnlineChannel_tool.cc.

31  {
32  const string myname = "PdspOnlineChannel::get: ";
33  if ( chanOff >= 15360 ) {
34  if ( m_LogLevel > 1 ) cout << myname << "Invalid offline channel: " << chanOff << endl;
35  return badIndex();
36  }
38  // Fetch APA index.
39  Index iapa = pms->APAFromOfflineChannel(chanOff);
40  if ( iapa > 5 ) {
41  if ( m_LogLevel > 1 ) cout << myname << "Invalid APA index: " << iapa << endl;
42  return badIndex();
43  }
44  Index kapa = iapa;
45  // Fetch WIB index.
46  Index iwib = pms->WIBFromOfflineChannel(chanOff);
47  if ( iwib > 4 ) {
48  if ( m_LogLevel > 1 ) cout << myname << "Invalid WIB index: " << iwib << endl;
49  return badIndex();
50  }
51  Index kwib = iwib;
52  // Fetch connector index.
53  Index icon = pms->FEMBFromOfflineChannel(chanOff);
54  if ( icon < 1 || icon > 4 ) {
55  if ( m_LogLevel > 1 ) cout << myname << "Invalid connector index: " << icon << endl;
56  return badIndex();
57  }
58  Index kcon = icon - 1;
59  // Fetch FEMB channel.
60  Index ichf = pms->FEMBChannelFromOfflineChannel(chanOff);
61  if ( ichf > 127 ) {
62  if ( m_LogLevel > 1 ) cout << myname << "Invalid FEMB channel index: " << ichf << endl;
63  return badIndex();
64  }
65  Index kchf = ichf;
66  // Evauate online index.
67  Index chanOn = 0;
68  if ( m_orderByWib ) {
69  chanOn = 2560*kapa + 512*kwib + 128*kcon + kchf;
70  } else if ( m_orderByConnector ) {
71  chanOn = 2560*kapa + 640*kcon + 128*kwib + kchf;
72  } else if ( m_orderByFemb ) {
73  // FEMB index mapping.
74  static Index ifmb[20] = {10, 9, 8, 7, 6,
75  5, 4, 3, 2, 1,
76  20, 19, 18, 17, 16,
77  15, 14, 13, 12, 11};
78  Index jfmb = 5*kcon + kwib;
79  Index kfmb = ifmb[jfmb] - 1;
80  // Beam left, rotate FEMBs by 10.
81  bool beamLeft = kapa/2 != (kapa+1)/2;
82  if ( beamLeft ) kfmb = (kfmb + 10) % 20;
83  chanOn = 2560*kapa + 128*kfmb + kchf;
84  }
85  return chanOn;
86 }
unsigned int FEMBChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB channel.
unsigned int Index
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
static Index badIndex()
Definition: IndexMapTool.h:18
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
QTextStream & endl(QTextStream &s)

Member Data Documentation

Index PdspOnlineChannel::m_LogLevel
private

Definition at line 65 of file PdspOnlineChannel.h.

bool PdspOnlineChannel::m_orderByConnector
private

Definition at line 70 of file PdspOnlineChannel.h.

bool PdspOnlineChannel::m_orderByFemb
private

Definition at line 71 of file PdspOnlineChannel.h.

bool PdspOnlineChannel::m_orderByWib
private

Definition at line 69 of file PdspOnlineChannel.h.

Name PdspOnlineChannel::m_Ordering
private

Definition at line 66 of file PdspOnlineChannel.h.


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