hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ModuleMapper.h
Go to the documentation of this file.
1#ifndef _MODULE_MAPPER_H_
2#define _MODULE_MAPPER_H_
3
4#include <map>
5#include <vector>
6#include <string>
7#include <fstream>
8#include <sstream>
9
10
12
13 public:
14 ModuleMapper(const int year = 2019);
15
18
25 std::string getHwFromString(const std::string& key) {return string_to_hw[key];};
26
33 std::string getSwFromString(const std::string& key) {return string_to_sw[key];};
34
41 std::string getHwFromSw (const std::string& key) {return sw_to_hw[key];};
42
49 std::string getSwFromHw (const std::string& key) {return hw_to_sw[key];};
50
57 std::string getStringFromHw(const std::string& key) {return hw_to_string[key];};
58
65 std::string getStringFromSw(const std::string& key) {return sw_to_string[key];};
66
72 std::vector<std::string> getHybridStrings();
73
79 void getStrings (std::vector<std::string>& strings) {
80 for (strmap_it it = string_to_hw.begin(); it!= string_to_hw.end(); ++it)
81 strings.push_back(it->first);
82 }
83
89 void getHws (std::vector<std::string>& hws) {
90 for (strmap_it it = hw_to_string.begin(); it!= hw_to_string.end(); ++it)
91 hws.push_back(it->first);
92 }
93
99 void getSws (std::vector<std::string>& sws) {
100 for (strmap_it it = hw_to_string.begin(); it!= hw_to_string.end(); ++it)
101 sws.push_back(it->first);
102 }
103
109 std::map<std::string, std::map<int,int>> buildChannelSvtIDMap();
110
119 int getSvtIDFromHWChannel(int channel, std::string hwTag, std::map<std::string,std::map<int,int>> svtid_map);
120
125 void buildApvChannelMap();
126
133 void ReadThresholdsFile(std::string filename);
134
135
144 std::pair<std::string,int> findApvChannel(std::string feb, std::string hybrid, int channel);
145
154 int getThresholdValue(std::string feb, std::string hybrid, int channel);
155
156 //TODO Bidirectional maps could be used
157
158 private:
159
160 int year_{2019};
161
162 std::map<std::string, std::string> hw_to_sw;
163 std::map<std::string, std::string> sw_to_hw;
164
165 std::map<std::string,std::string> hw_to_string;
166 std::map<std::string,std::string> string_to_hw;
167
168 std::map<std::string,std::string> sw_to_string;
169 std::map<std::string,std::string> string_to_sw;
170
171 typedef std::map<std::string,std::string>::iterator strmap_it;
172
173 std::map<std::string,std::map<std::string,std::vector<int>>> apvChannelMap_;
174 std::map<std::string, std::vector<int>> thresholdsIn_;
175};
176
177#endif //_MODULE_MAPPER_H_
void getSws(std::vector< std::string > &sws)
Get list of sw names.
std::string getHwFromSw(const std::string &key)
Get the Hw From Sw.
std::map< std::string, std::vector< int > > thresholdsIn_
description
std::pair< std::string, int > findApvChannel(std::string feb, std::string hybrid, int channel)
get APV channel number given feb, hybrid, and channel number
std::string getStringFromSw(const std::string &key)
Get the String From Sw.
std::map< std::string, std::string > sw_to_hw
description
std::string getSwFromHw(const std::string &key)
Get the Sw From Hw.
std::map< std::string, std::string >::iterator strmap_it
description
std::string getStringFromHw(const std::string &key)
Get the String From Hw.
std::map< std::string, std::string > string_to_hw
description
void getStrings(std::vector< std::string > &strings)
Get list of string modules.
std::map< std::string, std::string > hw_to_sw
description
std::map< std::string, std::string > hw_to_string
description
std::string getHwFromString(const std::string &key)
Get the Hw From String.
int year_
description
std::string getSwFromString(const std::string &key)
Get the Sw From String.
void ReadThresholdsFile(std::string filename)
Used to read svt channel DAQ threshold values from daq thresholds file.
int getSvtIDFromHWChannel(int channel, std::string hwTag, std::map< std::string, std::map< int, int > > svtid_map)
Return global svt id for channel by providing local channel number and F<n>H<m> of channel.
void getHws(std::vector< std::string > &hws)
Get list of hw names.
int getThresholdValue(std::string feb, std::string hybrid, int channel)
Get channel DAQ threshold.
std::map< std::string, std::string > string_to_sw
description
std::map< std::string, std::map< int, int > > buildChannelSvtIDMap()
Build global svt id map for all FebHybrid combinations.
std::vector< std::string > getHybridStrings()
Get the Hybrid Strings.
std::map< std::string, std::string > sw_to_string
description
std::map< std::string, std::map< std::string, std::vector< int > > > apvChannelMap_
description
void buildApvChannelMap()
Used to generate apv channel map and read in thresholds from database.