#include <PixelMapping.h>
Definition at line 18 of file PixelMapping.h.
◆ Coordinates
◆ PixelMapping()
pix::PixelMapping::PixelMapping |
( |
const std::string & |
csvFilename | ) |
|
Definition at line 18 of file PixelMapping.cxx.
23 fs.open(csvFilename.c_str());
24 if (not
fs.is_open()){
25 const std::string
msg =
"Failed to open the mapping file: " + csvFilename;
26 throw std::runtime_error(
msg);
30 std::regex re(R
"delim(^(.*), (\d+), (-?\d+), (\d+), (\d+), (-?\d+)$)delim");
31 auto dissectMatch=[](
const std::smatch &
m)->std::pair<std::string, Coordinates>{
32 static constexpr
size_t expectedSize(7);
33 static constexpr
size_t coordStart(2);
34 std::pair<std::string, PixelMapping::Coordinates>
result{};
35 if (
m.size()!=expectedSize)
return result;
36 const std::string
name =
m[1];
39 for (
size_t i(0);
i!=coords.size();++
i){
41 coords[
i] = std::stoi(
m.str(
i+coordStart));
42 }
catch (std::invalid_argument &
e){
43 const std::string
msg =
"PixelMapping: Line of csv file in unexpected format, \n"+ std::string(
m[0]);
44 throw std::runtime_error(
msg);
51 while (std::getline(
fs,
line)){
53 if (
line[0] ==
'#')
continue;
57 std::cout<<
"line in unexpected format:\n"<<
line<<std::endl;
62 std::cout<<
"repeated entry:\n"<<
line<<std::endl;
◆ contains()
bool pix::PixelMapping::contains |
( |
const std::string & |
geographicalID | ) |
const |
◆ getID()
int pix::PixelMapping::getID |
( |
const std::string & |
geographicalID | ) |
const |
Definition at line 86 of file PixelMapping.cxx.
89 std::cout<<
"id "<<geographicalID<<
" not found in mapping"<<std::endl;
92 const auto & coordinates = pName->second;
93 return coordinates[0];
◆ mapping()
void pix::PixelMapping::mapping |
( |
const std::string & |
geographicalID, |
|
|
int * |
hashID, |
|
|
int * |
bec, |
|
|
int * |
layer, |
|
|
int * |
phimod, |
|
|
int * |
etamod |
|
) |
| const |
Definition at line 70 of file PixelMapping.cxx.
73 std::cout<<
"id "<<geographicalID<<
" not found in mapping"<<std::endl;
76 const auto & coordinates = pName->second;
77 *hashID = coordinates[0];
78 *
bec = coordinates[1];
79 *
layer = coordinates[2];
◆ nModules()
int pix::PixelMapping::nModules |
( |
| ) |
const |
◆ m_internalMap
std::unordered_map<std::string,Coordinates > pix::PixelMapping::m_internalMap |
|
private |
The documentation for this class was generated from the following files: