Classes | Public Member Functions | Private Attributes | List of all members
dune::VDColdboxChannelMapService Class Reference

#include <VDColdboxChannelMapService.h>

Classes

struct  VDCBChanInfo
 

Public Member Functions

 VDColdboxChannelMapService (fhicl::ParameterSet const &pset)
 
 VDColdboxChannelMapService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
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 26 of file VDColdboxChannelMapService.h.

Constructor & Destructor Documentation

dune::VDColdboxChannelMapService::VDColdboxChannelMapService ( fhicl::ParameterSet const &  pset)

Definition at line 14 of file VDColdboxChannelMapService_service.cc.

14  {
15 
16  std::string channelMapFile = pset.get<std::string>("FileName");
17  std::string fullname;
18  cet::search_path sp("FW_SEARCH_PATH");
19  sp.find_file(channelMapFile, fullname);
20 
21  if (fullname.empty()) {
22  std::cout << "Input file " << channelMapFile << " not found" << std::endl;
23  throw cet::exception("File not found");
24  }
25  else
26  std::cout << "VD Coldbox Channel Map: Building TPC wiremap from file " << channelMapFile << std::endl;
27 
28  std::ifstream inFile(fullname, std::ios::in);
30  while (std::getline(inFile,line)) {
31  VDCBChanInfo chinfo;
32  std::stringstream linestream(line);
33  linestream >>
34  chinfo.offlchan >>
35  chinfo.wib >>
36  chinfo.wibconnector >>
37  chinfo.cebchan >>
38  chinfo.femb >>
39  chinfo.asic >>
40  chinfo.asicchan >>
41  chinfo.connector >>
42  chinfo.stripid;
43  chinfo.valid = true;
44  chantoinfomap[chinfo.offlchan] = chinfo;
45  infotochanmap[chinfo.wib][chinfo.wibconnector][chinfo.cebchan] = chinfo.offlchan;
46  }
47  inFile.close();
48 }
std::unordered_map< int, VDCBChanInfo > chantoinfomap
std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, int > > > infotochanmap
std::string string
Definition: nybbler.cc:12
TFile * inFile
Definition: makeDST.cxx:36
void line(double t, double *p, double &x, double &y, double &z)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
dune::VDColdboxChannelMapService::VDColdboxChannelMapService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 50 of file VDColdboxChannelMapService_service.cc.

51 }
VDColdboxChannelMapService(fhicl::ParameterSet const &pset)

Member Function Documentation

dune::VDColdboxChannelMapService::VDCBChanInfo dune::VDColdboxChannelMapService::getChanInfoFromOfflChan ( int  offlchan)

Definition at line 57 of file VDColdboxChannelMapService_service.cc.

58 {
59  VDCBChanInfo r;
60  auto fm = chantoinfomap.find(offlchan);
61  if (fm == chantoinfomap.end())
62  {
63  r.offlchan = -1;
64  r.wib = -1;
65  r.wibconnector = -1;
66  r.cebchan = -1;
67  r.femb = -1;
68  r.asic = -1;
69  r.asicchan = -1;
70  r.connector = -1;
71  r.stripid = "INVALID";
72  r.valid = false;
73  }
74  else
75  {
76  r = fm->second;
77  }
78  return r;
79 }
std::unordered_map< int, VDCBChanInfo > chantoinfomap
static constexpr double fm
Definition: Units.h:75
int dune::VDColdboxChannelMapService::getOfflChanFromSlotFiberChan ( int  slot,
int  fiber,
int  chan 
)

Definition at line 104 of file VDColdboxChannelMapService_service.cc.

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)
int dune::VDColdboxChannelMapService::getOfflChanFromWIBConnectorInfo ( int  wib,
int  wibconnector,
int  cechan 
)

Definition at line 85 of file VDColdboxChannelMapService_service.cc.

86 {
87  int r = -1;
88  auto fm1 = infotochanmap.find(wib);
89  if (fm1 == infotochanmap.end()) return r;
90  auto& m1 = fm1->second;
91  auto fm2 = m1.find(wibconnector);
92  if (fm2 == m1.end()) return r;
93  auto& m2 = fm2->second;
94  auto fm3 = m2.find(cechan);
95  if (fm3 == m2.end()) return r;
96  r = fm3->second;
97  return r;
98 }
std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, int > > > infotochanmap
static constexpr double fm3
Definition: Units.h:77
static constexpr double m2
Definition: Units.h:72
static constexpr double fm2
Definition: Units.h:76

Member Data Documentation

std::unordered_map<int,VDCBChanInfo> dune::VDColdboxChannelMapService::chantoinfomap
private

Definition at line 68 of file VDColdboxChannelMapService.h.

std::unordered_map<int,std::unordered_map<int,std::unordered_map<int,int> > > dune::VDColdboxChannelMapService::infotochanmap
private

Definition at line 72 of file VDColdboxChannelMapService.h.


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