Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Protodune
singlephase
Tool
IcebergOnlineChannel_tool.cc
Go to the documentation of this file.
1
// IcebergOnlineChannel.cxx
2
3
#include "
IcebergOnlineChannel.h
"
4
#include "
dune-raw-data/Services/ChannelMap/IcebergChannelMapService.h
"
5
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
6
#include <iostream>
7
8
using
std::string
;
9
using
std::cout;
10
using
std::endl
;
11
using
Index
=
IcebergOnlineChannel::Index
;
12
13
//**********************************************************************
14
15
IcebergOnlineChannel::IcebergOnlineChannel
(
const
fhicl::ParameterSet
& pset)
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 =
"IcebergOnlineChannel::ctor: "
;
22
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
23
cout << myname <<
" Ordering: "
<<
m_Ordering
<<
endl
;
24
if
( !
m_orderByWib
&& !
m_orderByConnector
&& !
m_orderByFemb
) {
25
cout << myname <<
"ERROR: Invalid ordering: "
<<
m_Ordering
<<
endl
;
26
}
27
}
28
29
//**********************************************************************
30
31
Index
IcebergOnlineChannel::get
(
Index
chanOff)
const
{
32
const
string
myname =
"IcebergOnlineChannel::get: "
;
33
if
( chanOff >= 1280 ) {
34
if
(
m_LogLevel
> 1 ) cout << myname <<
"Invalid offline channel: "
<< chanOff <<
endl
;
35
return
badIndex
();
36
}
37
art::ServiceHandle<dune::IcebergChannelMapService>
pms;
38
// Fetch APA index.
39
Index
iapa = pms->
APAFromOfflineChannel
(chanOff);
40
if
( iapa > 1 ) {
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
Index
kfmb = 99;
69
if
(
m_orderByWib
) {
70
cout << myname <<
"WIB ordering is not yest supported."
<<
endl
;
71
return
badIndex
();
72
}
else
if
(
m_orderByConnector
) {
73
cout << myname <<
"Connector ordering is not yest supported."
<<
endl
;
74
}
else
if
(
m_orderByFemb
) {
75
// FEMB index mapping.
76
Index
ifmb = 99;
77
if
( chanOff < 200 ) {
78
ifmb = ( 199-chanOff)/40 + 0;
79
}
else
if
( chanOff < 400 ) {
80
ifmb = ( 399-chanOff)/40 + 5;
81
}
else
if
( chanOff < 800 ) {
82
ifmb = (chanOff- 400)/40 + 0;
83
}
else
if
( chanOff < 1040 ) {
84
ifmb = (chanOff- 800)/48 + 0;
85
}
else
if
( chanOff < 1280 ) {
86
ifmb = (1279-chanOff)/48 + 5;
87
}
else
{
88
cout <<
"Invalid offline channel: : "
<< chanOff <<
endl
;
89
return
badIndex
();
90
}
91
kfmb = ifmb + 1;
92
chanOn = 1280*kapa + 128*(ifmb) + kchf;
93
}
94
if
(
m_LogLevel
>= 4 ) {
95
cout << myname <<
"ChanOff --> (kapa kwib kcon kchf) --> chanON: "
96
<< chanOff <<
" --> ("
<< kapa <<
" "
<< kwib <<
" "
<< kcon <<
" "
<< kchf
97
<<
") --> "
<< chanOn
98
<<
" --> "
<< 100*(kapa+1) + kfmb <<
"-"
<< kchf <<
endl
;
99
}
100
return
chanOn;
101
}
102
103
//**********************************************************************
104
105
DEFINE_ART_CLASS_TOOL
(
IcebergOnlineChannel
)
art::ServiceHandle
Definition:
ServiceHandle.h:37
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
IcebergOnlineChannel::m_LogLevel
Index m_LogLevel
Definition:
IcebergOnlineChannel.h:61
string
std::string string
Definition:
nybbler.cc:12
IcebergOnlineChannel::m_Ordering
Name m_Ordering
Definition:
IcebergOnlineChannel.h:62
IcebergOnlineChannel
Definition:
IcebergOnlineChannel.h:48
IcebergOnlineChannel::m_orderByConnector
bool m_orderByConnector
Definition:
IcebergOnlineChannel.h:66
Index
unsigned int Index
Definition:
sspmapmaker_v1.c:14
ServiceHandle.h
IcebergOnlineChannel.h
IcebergOnlineChannel::Name
std::string Name
Definition:
IcebergOnlineChannel.h:52
IcebergChannelMapService.h
IcebergOnlineChannel::get
Index get(Index chanOff) const override
Definition:
IcebergOnlineChannel_tool.cc:31
dune::IcebergChannelMapService::APAFromOfflineChannel
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
Definition:
IcebergChannelMapService_service.cc:278
IcebergOnlineChannel::m_orderByWib
bool m_orderByWib
Definition:
IcebergOnlineChannel.h:65
IndexMapTool::Index
unsigned int Index
Definition:
IndexMapTool.h:16
IndexMapTool::badIndex
static Index badIndex()
Definition:
IndexMapTool.h:18
IcebergOnlineChannel::m_orderByFemb
bool m_orderByFemb
Definition:
IcebergOnlineChannel.h:67
dune::IcebergChannelMapService::FEMBChannelFromOfflineChannel
unsigned int FEMBChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB channel.
Definition:
IcebergChannelMapService_service.cc:303
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
dune::IcebergChannelMapService::WIBFromOfflineChannel
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
Definition:
IcebergChannelMapService_service.cc:287
dune::IcebergChannelMapService::FEMBFromOfflineChannel
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
Definition:
IcebergChannelMapService_service.cc:295
IcebergOnlineChannel::IcebergOnlineChannel
IcebergOnlineChannel(const fhicl::ParameterSet &ps)
Definition:
IcebergOnlineChannel_tool.cc:15
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11