DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DetectorPlaneMap.cpp
Go to the documentation of this file.
2#include <stdexcept>
3
4namespace triggeralgs {
5
6PlaneInfo DetectorPlaneMap::get_plane_info(std::string channel_map_name, int detelement, int plane) {
7
8 const std::map<std::pair<int,int>, PlaneInfo> *plane_map;
9 if (channel_map_name == "PD2HDTPCChannelMap") plane_map = &pdhd_plane_map;
10 else if (channel_map_name == "PD2VDTPCChannelMap" ||
11 channel_map_name == "PD2VDBottomTPCChannelMap" ||
12 channel_map_name == "PD2VDTopTPCChannelMap") plane_map = &pdvd_plane_map;
13 else throw std::invalid_argument("Unknown channel map: " + channel_map_name);
14
15 auto it = plane_map->find({detelement, plane});
16 if (it == plane_map->end()) {
17 throw std::out_of_range("Invalid detelement/plane combination");
18 }
19 return it->second;
20}
21
22} // triggeralgs
const std::map< std::pair< int, int >, PlaneInfo > pdhd_plane_map
PlaneInfo get_plane_info(std::string channel_map_name, int detelement, int plane)
const std::map< std::pair< int, int >, PlaneInfo > pdvd_plane_map