DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::detchannelmaps::VDColdboxChannelMapService Class Reference

#include <VDColdboxChannelMapService.hpp>

Classes

struct  VDCBChanInfo
 

Public Member Functions

 VDColdboxChannelMapService (std::string mapfile)
 
VDCBChanInfo getChanInfoFromOfflChan (int offlchan)
 
int getOfflChanFromWIBConnectorInfo (int wib, int wibconnector, int cechan)
 
int getOfflChanFromSlotFiberChan (int slot, int fiber, int chan)
 

Private Attributes

std::unordered_map< int, VDCBChanInfochantoinfomap
 
std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, int > > > infotochanmap
 

Detailed Description

Definition at line 19 of file VDColdboxChannelMapService.hpp.

Constructor & Destructor Documentation

◆ VDColdboxChannelMapService()

dunedaq::detchannelmaps::VDColdboxChannelMapService::VDColdboxChannelMapService ( std::string mapfile)

Definition at line 18 of file VDColdboxChannelMapService.cpp.

18 {
19
20 std::ifstream inFile(filename, std::ios::in);
21 if (inFile.bad() || inFile.fail() || !inFile.is_open()) {
22 throw std::runtime_error(std::string("VDColdboxChannelMapService: Invalid map file ") + std::string(filename));
23 }
24
25 std::string line;
26 while (std::getline(inFile,line)) {
27 VDCBChanInfo chinfo;
28 std::stringstream linestream(line);
29 linestream >>
30 chinfo.offlchan >>
31 chinfo.wib >>
32 chinfo.wibconnector >>
33 chinfo.cebchan >>
34 chinfo.femb >>
35 chinfo.asic >>
36 chinfo.asicchan >>
37 chinfo.connector >>
38 chinfo.stripid;
39 chinfo.valid = true;
40 chantoinfomap[chinfo.offlchan] = chinfo;
41 infotochanmap[chinfo.wib][chinfo.wibconnector][chinfo.cebchan] = chinfo.offlchan;
42 }
43 inFile.close();
44
45}
std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, int > > > infotochanmap

Member Function Documentation

◆ getChanInfoFromOfflChan()

VDColdboxChannelMapService::VDCBChanInfo dunedaq::detchannelmaps::VDColdboxChannelMapService::getChanInfoFromOfflChan ( int offlchan)

Definition at line 51 of file VDColdboxChannelMapService.cpp.

52{
53 VDCBChanInfo r;
54 auto fm = chantoinfomap.find(offlchan);
55 if (fm == chantoinfomap.end())
56 {
57 r.offlchan = -1;
58 r.wib = -1;
59 r.wibconnector = -1;
60 r.cebchan = -1;
61 r.femb = -1;
62 r.asic = -1;
63 r.asicchan = -1;
64 r.connector = -1;
65 r.stripid = "INVALID";
66 r.valid = false;
67 }
68 else
69 {
70 r = fm->second;
71 }
72 return r;
73}

◆ getOfflChanFromSlotFiberChan()

int dunedaq::detchannelmaps::VDColdboxChannelMapService::getOfflChanFromSlotFiberChan ( int slot,
int fiber,
int chan )

Definition at line 104 of file VDColdboxChannelMapService.cpp.

105{
106 int wc = fiber*2 - 1;
107 if (chan>127)
108 {
109 chan -= 128;
110 wc++;
111 }
112 return getOfflChanFromWIBConnectorInfo(slot+1,wc,chan);
113}
int getOfflChanFromWIBConnectorInfo(int wib, int wibconnector, int cechan)

◆ getOfflChanFromWIBConnectorInfo()

int dunedaq::detchannelmaps::VDColdboxChannelMapService::getOfflChanFromWIBConnectorInfo ( int wib,
int wibconnector,
int cechan )

Definition at line 79 of file VDColdboxChannelMapService.cpp.

80{
81 // int r = -1;
82 // auto fm1 = infotochanmap.find(wib);
83 // if (fm1 == infotochanmap.end()) return r;
84 // auto& m1 = fm1->second;
85 // auto fm2 = m1.find(wibconnector);
86 // if (fm2 == m1.end()) return r;
87 // auto& m2 = fm2->second;
88 // auto fm3 = m2.find(cechan);
89 // if (fm3 == m2.end()) return r;
90 // r = fm3->second;
91 // return r;
92 try {
93 return infotochanmap.at(wib).at(wibconnector).at(cechan);
94 } catch (...) {
95 return -1;
96 }
97 // return -1;
98}
Definition wib.pb.cc:23

Member Data Documentation

◆ chantoinfomap

std::unordered_map<int,VDCBChanInfo> dunedaq::detchannelmaps::VDColdboxChannelMapService::chantoinfomap
private

Definition at line 60 of file VDColdboxChannelMapService.hpp.

◆ infotochanmap

std::unordered_map<int,std::unordered_map<int,std::unordered_map<int,int> > > dunedaq::detchannelmaps::VDColdboxChannelMapService::infotochanmap
private

Definition at line 64 of file VDColdboxChannelMapService.hpp.


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