Line data Source code
1 : #include "triggeralgs/ProtoDUNEBSMWindow/DetectorPlaneMap.hpp"
2 : #include <stdexcept>
3 :
4 : namespace triggeralgs {
5 :
6 0 : PlaneInfo DetectorPlaneMap::get_plane_info(std::string channel_map_name, int detelement, int plane) {
7 :
8 0 : const std::map<std::pair<int,int>, PlaneInfo> *plane_map;
9 0 : if (channel_map_name == "PD2HDTPCChannelMap") plane_map = &pdhd_plane_map;
10 0 : else if (channel_map_name == "PD2VDTPCChannelMap" ||
11 0 : channel_map_name == "PD2VDBottomTPCChannelMap" ||
12 0 : channel_map_name == "PD2VDTopTPCChannelMap") plane_map = &pdvd_plane_map;
13 0 : else throw std::invalid_argument("Unknown channel map: " + channel_map_name);
14 :
15 0 : auto it = plane_map->find({detelement, plane});
16 0 : if (it == plane_map->end()) {
17 0 : throw std::out_of_range("Invalid detelement/plane combination");
18 : }
19 0 : return it->second;
20 : }
21 :
22 : } // triggeralgs
|