17 return id.isBarrel() ? operator()(dynamic_cast<const PixelBarrelName&>(
id)) :
18 operator()(dynamic_cast<const PixelEndcapName&>(
id));
22 for (BarrelConnections::const_iterator ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
23 for (vector<Bdu>::const_iterator ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
24 if (ibd->b ==
id.shell() && ibd->l.inside(
id.
layerName()) && ibd->z.inside(
id.
moduleName()) &&
25 ibd->f.inside(
id.ladderName()))
29 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ") <<
id.name() <<
" not associated to FED";
34 for (EndcapConnections::const_iterator iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
35 for (vector<Edu>::const_iterator ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
36 if (ied->e ==
id.halfCylinder() && ied->d.inside(
id.diskName()) && ied->b.inside(
id.bladeName()))
40 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ") <<
id.name() <<
" not associated to FED";
45 LogDebug(
"init, input file:") << cfg_name.c_str();
47 std::ifstream
file(cfg_name.c_str());
49 edm::LogError(
" ** PixelToFEDAssociateFromAscii,init ** ") <<
" cant open data file: " << cfg_name;
52 edm::LogInfo(
"PixelToFEDAssociateFromAscii, read data from: ") << cfg_name;
56 pair<int, vector<Bdu> > barCon;
57 pair<int, vector<Edu> > endCon;
60 while (getline(
file, line)) {
65 if (pos != string::npos)
66 line = line.erase(pos);
77 if (line.compare(0, 3,
"VER") == 0) {
88 else if (posF != string::npos) {
89 line = line.substr(posF + 4);
90 int id = atoi(line.c_str());
99 else if (posB != string::npos) {
100 line = line.substr(posB + 2);
101 barCon.second.push_back(getBdu(line));
107 else if (posE != string::npos) {
108 line = line.substr(posE + 2);
109 endCon.second.push_back(getEdu(line));
112 send(barCon, endCon);
114 edm::LogError(
"**PixelToFEDAssociateFromAscii** exception") << err.what();
122 std::ostringstream
str;
123 str <<
" **PixelToFEDAssociateFromAscii ** BARREL FED CONNECTIONS: " << endl;
124 for (BarrelConnections::const_iterator ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
125 str <<
"FED: " << ibc->first << endl;
126 for (vector<Bdu>::const_iterator ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
127 str <<
"b: " << ibd->b <<
" l: " << ibd->l <<
" z: " << ibd->z <<
" f: " << ibd->f << endl;
130 str <<
" **PixelToFEDAssociateFromAscii ** ENDCAP FED CONNECTIONS: " << endl;
131 for (EndcapConnections::const_iterator iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
132 str <<
"FED: " << iec->first << endl;
133 for (vector<Edu>::const_iterator ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
134 str <<
" e: " << ied->e <<
" d: " << ied->d <<
" b: " << ied->b << endl;
137 edm::LogInfo(
"PixelToFEDAssociateFromAscii") << str.str();
141 if (!
b.second.empty())
142 theBarrel.push_back(
b);
143 if (!
e.second.empty())
144 theEndcap.push_back(
e);
153 result.
b = readRange(line).first;
155 pos = line.find(
"L:");
156 if (pos != string::npos)
157 line = line.substr(pos + 2);
158 result.
l = readRange(line);
160 pos = line.find(
"Z:");
161 if (pos != string::npos)
162 line = line.substr(pos + 2);
163 result.
z = readRange(line);
165 pos = line.find(
"F:");
166 if (pos != string::npos)
167 line = line.substr(pos + 2);
168 result.
f = readRange(line);
177 result.
e = readRange(line).first;
179 pos = line.find(
"D:");
180 if (pos != string::npos)
181 line = line.substr(pos + 2);
182 result.
d = readRange(line);
184 pos = line.find(
"B:");
185 if (pos != string::npos)
186 line = line.substr(pos + 2);
187 result.
b = readRange(line);
196 const char*
line = l.c_str();
199 int num = strtol(line, &evp, 10);
202 s <<
"raad from line: ";
217 string s =
"** PixelToFEDAssociateFromAscii, read data, cant intrpret: ";
218 edm::LogInfo(s) << endl << l << endl <<
"=====> send exception " << endl;
222 return Range(num1, num2);
constexpr char const * layerName[numberOfLayers]
uint16_t *__restrict__ id
PixelRecoRange< float > Range
Range readRange(const std::string &) const
Log< level::Error, false > LogError
PixelToFEDAssociateFromAscii(const std::string &fileName)
void init(const std::string &fileName)
initialisatin (read file)
Bdu getBdu(std::string) const
Log< level::Info, false > LogInfo
void send(std::pair< int, std::vector< Bdu > > &, std::pair< int, std::vector< Edu > > &)
initialisation (read input file)
Edu getEdu(std::string) const
int operator()(const PixelModuleName &) const override
FED id for module.
std::string version() const override
version