VDColdboxChannelMapService.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////////////////////////
2 // Class: VDColdboxChannelMapService
3 // Module type: service
4 // File: VDColdboxChannelMapService.h
5 // Author: Tom Junk, October 2021
6 //
7 // Implementation of hardware-offline channel mapping reading from a file.
8 ///////////////////////////////////////////////////////////////////////////////////////////////////
9 
10 #ifndef VDColdboxChannelMapService_H
11 #define VDColdboxChannelMapService_H
12 
13 #include <map>
14 #include <vector>
15 #include <iostream>
16 #include <limits>
17 #include <fstream>
18 
21 
22 namespace dune {
23  class VDColdboxChannelMapService;
24 }
25 
27 
28  public:
29 
32 
33  struct VDCBChanInfo {
34  int offlchan; // in gdml and channel sorting convention
35  int wib; // slot number +1: 1, 2, 3, or 4
36  int wibconnector; // which board on the WIB 1, 2, 3, or 4
37  int cebchan; // cold electronics channel on board: 0 to 127
38  int femb; // FEMB ID: 1 to 14
39  int asic; // ASIC: 1 to 8
40  int asicchan; // ASIC channel: 0 to 15
41  int connector; // detector connector
42  std::string stripid; // strip name, with plane and number. e.g. U79
43  bool valid; // true if valid, false if not
44  };
45 
46  // Access methods
47 
48  // The function below gets cold electronics info from offline channel number. Sets valid to be false if
49  // there is no corresponding cold electronics channel
50 
52 
53  // The function below uses conventions from Nitish's spreadsheet. WIB: 1-3, wibconnector: 1-4, cechan: 0-127
54  // It returns an offline channel number of -1 if the wib, wibconnector, and cechan are not in the map
55 
56  int getOfflChanFromWIBConnectorInfo(int wib, int wibconnector, int cechan);
57 
58  // For convenience, the function below uses conventions from the DAQ WIB header, with two FEMBs per fiber
59  // on FELIX readout: slot: 0-2, fiber=1 or 2, cehcan: 0-255
60 
61  int getOfflChanFromSlotFiberChan(int slot, int fiber, int chan);
62 
63 
64  private:
65 
66  // map so we can look up channel info by offline channel number
67 
68  std::unordered_map<int,VDCBChanInfo> chantoinfomap;
69 
70  // map so we can look up offline channel number by channel info (three keys), wib, wibconnector, and cechan
71 
72  std::unordered_map<int,std::unordered_map<int,std::unordered_map<int,int> > > infotochanmap;
73 
74 };
75 
77 
78 #endif
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
VDColdboxChannelMapService(fhicl::ParameterSet const &pset)
#define DECLARE_ART_SERVICE(svc, scope)
int getOfflChanFromSlotFiberChan(int slot, int fiber, int chan)
int getOfflChanFromWIBConnectorInfo(int wib, int wibconnector, int cechan)