22 typedef std::vector<std::pair<DetectorRocId, CablingRocId> >::const_iterator IM;
23 for (IM im = theConnection.begin(); im != theConnection.end(); im++) {
24 if ((*(im->first.module) == *
roc.module) && (im->first.rocDetId ==
roc.rocDetId)) {
35 std::ifstream
file(cfg_name.c_str());
37 edm::LogError(
" ** PixelToLNKAssociateFromAscii,init ** ") <<
" cant open data file: " << cfg_name;
40 edm::LogInfo(
"PixelToLNKAssociateFromAscii, read data from: ") << cfg_name;
53 if (
pos != string::npos)
66 if (
line.compare(0, 3,
"VER") == 0) {
74 else if (posF != string::npos) {
82 else if (posL != string::npos) {
83 string srtL =
line.substr(posL + 4);
84 linkId = atoi(srtL.c_str());
90 if (posM != string::npos) {
91 if (posR != string::npos) {
92 string strM =
line.substr(posM + 4, posR - posM - 5);
94 if (
pos != string::npos)
95 strM = strM.substr(
pos + 1);
96 string strR =
line.substr(posR + 4);
101 string strM =
line.substr(posM + 4);
103 if (
pos != string::npos)
104 strM = strM.substr(
pos + 1);
105 addConnections(
fedId, linkId, strM,
Range(0, 0));
116 std::ostringstream
str;
117 str <<
" **PixelToLNKAssociateFromAscii ** CONNECTIONS: " << endl;
118 typedef vector<pair<DetectorRocId, CablingRocId> >::const_iterator ICON;
119 for (ICON ic = theConnection.begin(); ic != theConnection.end(); ic++) {
120 str << (*ic).first.module->name() <<
", rocDetId=" << (*ic).first.rocDetId <<
", fedId=" << ic->second.fedId
121 <<
", linkId=" << ic->second.linkId <<
", rocLinkId=" << ic->second.rocLinkId << endl;
130 pos = module.find(
"BPix");
131 if (
pos != string::npos) {
132 string module0 = module;
138 if (
p != string::npos)
139 module0 = module0.substr(0,
p);
143 string strP = module.substr(
pos + 6, 2);
147 else if (strP ==
"mI")
149 else if (strP ==
"pO")
184 bool loopExecuted =
false;
185 for (
int rocDetId = rocDetIds.
min(); rocDetId <= rocDetIds.
max(); rocDetId++) {
195 cablingRocId.
linkId = linkId;
198 edm::LogInfo(
" roc ") << rocDetId <<
" " << rocLnkId <<
" " <<
name->isHalfModule() << endl;
199 if (
name->isHalfModule() && (rocDetIds.
min() > 7) &&
205 detectorRocId.
rocDetId = rocDetId - 8;
207 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
214 pos = module.find(
"FPix");
215 if (
pos != string::npos) {
216 string strH = module.substr(
pos + 6, 2);
220 else if (strH ==
"mI")
222 else if (strH ==
"pO")
226 module = module.substr(
pos + 9);
229 pos = module.find(
'_');
230 if (
pos == string::npos)
232 int disk = atoi(module.substr(1,
pos - 1).c_str());
233 module = module.substr(
pos + 1);
236 pos = module.find(
'_');
237 if (
pos == string::npos)
239 int blade = atoi(module.substr(3,
pos - 3).c_str());
240 module = module.substr(
pos + 1);
243 pos = module.find(
'_');
244 if (
pos == string::npos)
246 int pannel = atoi(module.substr(3,
pos - 3).c_str());
247 module = module.substr(
pos + 1);
262 pos = module.find(
"RNG");
263 if (
pos == string::npos)
265 ring = atoi(module.substr(
pos + 3, 1).c_str());
269 pos = module.find(
"TYP:");
270 if (
pos == string::npos)
272 string strT = module.substr(
pos + 5, 3);
273 string strT4 = module.substr(
pos + 5, 4);
277 else if (strT ==
"P3L")
279 else if (strT ==
"P4R")
281 else if (strT ==
"P4L")
283 else if (strT4 ==
"P2X8")
286 throw cms::Exception(
"problem with pannel type formatting (unrecoginzed word)");
293 for (
int plaq = 1; plaq <= 4; plaq++) {
318 for (
int iroc =
rocs.min(); iroc <=
rocs.max(); iroc++) {
320 int rocDetId = firstRoc +
step * iroc;
329 cablingRocId.
linkId = linkId;
332 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
339 for (
int plaq = 4; plaq >= 1; plaq--) {
364 for (
int iroc =
rocs.min(); iroc -
rocs.max() <= 0; iroc++) {
366 int rocDetId = firstRoc +
step * iroc;
367 if (rocDetId >
rocs.max())
368 rocDetId = (rocDetId - 1) %
rocs.max();
376 cablingRocId.
linkId = linkId;
379 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
386 for (
int plaq = 1; plaq <= 3; plaq++) {
406 for (
int iroc =
rocs.min(); iroc <=
rocs.max(); iroc++) {
408 int rocDetId = firstRoc +
step * iroc;
416 cablingRocId.
linkId = linkId;
419 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
426 for (
int plaq = 3; plaq >= 1; plaq--) {
446 for (
int iroc =
rocs.min(); iroc <=
rocs.max(); iroc++) {
448 int rocDetId = firstRoc +
step * iroc;
449 if (rocDetId >
rocs.max())
450 rocDetId = (rocDetId - 1) %
rocs.max();
458 cablingRocId.
linkId = linkId;
461 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
472 bool loopExecuted =
false;
473 for (
int rocDetId = rocDetIds.
min(); rocDetId <= rocDetIds.
max(); rocDetId++) {
481 cablingRocId.
linkId = linkId;
483 theConnection.push_back(make_pair(detectorRocId, cablingRocId));
485 <<
" rocDetId: " << rocDetId <<
" rocLnkId:" << rocLnkId <<
" fedId = " <<
fedId <<
" linkId = " << linkId
486 <<
" name = " <<
name->name();
505 int i1 = -1,
i2 = -1;
511 if (
p != string::npos) {
513 l1 =
l.substr(0,
p - 1 + 1);
514 l2 =
l.substr(
p + 1, len - 1 -
p);