26 typedef std::vector< std::pair<DetectorRocId,CablingRocId> >::const_iterator IM;
27 for (IM im = theConnection.begin(); im != theConnection.end(); im++) {
28 if( ( *(im->first.module) == *roc.
module ) && (im->first.rocDetId == roc.
rocDetId)) {
40 std::ifstream
file( cfg_name.c_str() );
43 <<
" cant open data file: " << cfg_name;
46 edm::LogInfo(
"PixelToLNKAssociateFromAscii, read data from: ") <<cfg_name;
54 while (getline(
file,line)) {
59 if (pos != string::npos) line = line.erase(pos);
72 if ( line.compare(0,3,
"VER") == 0 ) {
80 else if ( posF != string::npos) {
81 line = line.substr(posF+4);
82 fedId = atoi(line.c_str());
88 else if ( posL != string::npos) {
89 string srtL = line.substr(posL+4);
90 linkId = atoi(srtL.c_str());
96 if ( posM != string::npos) {
97 if (posR != string::npos) {
98 string strM = line.substr(posM+4, posR-posM-5);
100 if(pos != string::npos) strM = strM.substr(pos+1);
101 string strR = line.substr(posR+4);
102 Range range = readRange(strR);
104 addConnections( fedId, linkId, strM, range);
106 string strM= line.substr(posM+4);
108 if(pos != string::npos) strM = strM.substr(pos+1);
109 addConnections( fedId, linkId, strM,
Range(0,0));
115 edm::LogError(
"**PixelToLNKAssociateFromAscii** exception")<<err.what();
121 std::ostringstream
str;
122 str <<
" **PixelToLNKAssociateFromAscii ** CONNECTIONS: "<< endl;
123 typedef vector< pair<DetectorRocId,CablingRocId> >::const_iterator ICON;
124 for (ICON ic = theConnection.begin(); ic != theConnection.end(); ic++) {
125 str<< (*ic).first.module->name()
126 <<
", rocDetId="<<(*ic).first.rocDetId
127 <<
", fedId="<<ic->second.fedId
128 <<
", linkId="<<ic->second.linkId
129 <<
", rocLinkId="<<ic->second.rocLinkId
132 edm::LogInfo(
"PixelToLNKAssociateFromAscii")<<str.str();
142 pos = module.find(
"BPix");
143 if (pos != string::npos) {
151 if(p != string::npos) module0 = module0.substr(0,p);
155 string strP = module.substr(pos+6,2);
193 for (
int rocDetId=rocDetIds.
min(); rocDetId <= rocDetIds.
max(); rocDetId++) {
202 cablingRocId.
linkId = linkId;
212 detectorRocId.
rocDetId = rocDetId-8;
214 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
219 pos = module.find(
"FPix");
220 if (pos != string::npos) {
222 string strH = module.substr(pos+6,2);
228 module = module.substr(pos+9);
231 pos = module.find(
"_");
232 if (pos == string::npos)
throw cms::Exception(
"problem with disk formatting");
233 int disk = atoi( module.substr(1,pos-1).c_str());
234 module = module.substr(pos+1);
237 pos = module.find(
"_");
238 if (pos == string::npos)
throw cms::Exception(
"problem with blade formatting");
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)
throw cms::Exception(
"problem with pannel formatting");
245 int pannel = atoi( module.substr(3,pos-3).c_str());
246 module = module.substr(pos+1);
261 pos = module.find(
"RNG");
262 if (pos == string::npos)
throw cms::Exception(
"problem with ring formatting");
263 ring = atoi( module.substr(pos+3,1).c_str());
267 pos = module.find(
"TYP:");
268 if (pos == string::npos)
throw cms::Exception(
"problem with pannel type formatting");
269 string strT = module.substr(pos+5,3);
270 string strT4 = module.substr(pos+5,4);
277 else throw cms::Exception(
"problem with pannel type formatting (unrecoginzed word)");
285 for (
int plaq = 1; plaq <= 4; plaq++) {
287 if (plaq==1) { rocs =
Range(0,1); firstRoc=1; step=-1; }
288 if (plaq==2) { rocs =
Range(0,5); firstRoc=0; step=+1; }
289 if (plaq==3) { rocs =
Range(0,7); firstRoc=0; step=+1; }
290 if (plaq==4) { rocs =
Range(0,4); firstRoc=0; step=+1; }
292 for (
int iroc =rocs.
min(); iroc<=rocs.
max(); iroc++) {
294 int rocDetId = firstRoc + step*iroc;
303 cablingRocId.
linkId = linkId;
306 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
314 for (
int plaq = 4; plaq >= 1; plaq--) {
316 if (plaq==1) { rocs =
Range(0,1); firstRoc=1; step=-1; }
317 if (plaq==2) { rocs =
Range(0,5); firstRoc=3; step=+1; }
318 if (plaq==3) { rocs =
Range(0,7); firstRoc=4; step=+1; }
319 if (plaq==4) { rocs =
Range(0,4); firstRoc=0; step=+1; }
321 for (
int iroc =rocs.
min(); iroc-rocs.
max() <= 0; iroc++) {
323 int rocDetId = firstRoc + step*iroc;
324 if (rocDetId > rocs.
max()) rocDetId = (rocDetId-1)%rocs.
max();
332 cablingRocId.
linkId = linkId;
335 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
343 for (
int plaq = 1; plaq <= 3; plaq++) {
345 if (plaq==1) { rocs =
Range(0,5); firstRoc=0; step=1; }
346 if (plaq==2) { rocs =
Range(0,7); firstRoc=0; step=1; }
347 if (plaq==3) { rocs =
Range(0,9); firstRoc=0; step=1; }
349 for (
int iroc =rocs.
min(); iroc<=rocs.
max(); iroc++) {
351 int rocDetId = firstRoc + step*iroc;
359 cablingRocId.
linkId = linkId;
362 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
370 for (
int plaq = 3; plaq >= 1; plaq--) {
372 if (plaq==1) { rocs =
Range(0,5); firstRoc=3; step=1; }
373 if (plaq==2) { rocs =
Range(0,7); firstRoc=4; step=1; }
374 if (plaq==3) { rocs =
Range(0,9); firstRoc=5; step=1; }
376 for (
int iroc =rocs.
min(); iroc<=rocs.
max(); iroc++) {
378 int rocDetId = firstRoc + step*iroc;
379 if (rocDetId > rocs.
max()) rocDetId = (rocDetId-1)%rocs.
max();
387 cablingRocId.
linkId = linkId;
390 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
401 for (
int rocDetId=rocDetIds.
min(); rocDetId <= rocDetIds.
max(); rocDetId++) {
408 cablingRocId.
linkId = linkId;
410 theConnection.push_back( make_pair(detectorRocId,cablingRocId));
412 <<
" rocDetId: " << rocDetId
413 <<
" rocLnkId:" << rocLnkId
414 <<
" fedId = " << fedId
415 <<
" linkId = " << linkId
416 <<
" name = " << name->
name();
440 if(p != string::npos) {
442 l1 = l.substr(0,p-1+1);
443 l2 = l.substr(p+1,len-1-p);
void init(const std::string &fileName)
initialisatin (read file)
std::string name() const override
from base class
const T & min() const
lower edge of range
void addConnections(int fedId, int linkId, std::string module, Range rocDetIds)
PixelRecoRange< float > Range
bool isHalfModule() const
full or half module
const CablingRocId * operator()(const DetectorRocId &roc) const override
LNK id for module.
const PixelModuleName * module
std::string version() const override
version
const T & max() const
upper edge of range
Range readRange(const std::string &) const
PixelToLNKAssociateFromAscii(const std::string &fileName, const bool phase1=false)