246 {
247
249
250
256 return false;
257 }
260 return false;
261 } else {
264 return false;
265 }
266 }
267 }
268
269
271
272
274
275
276 std::string LVL1_configuration_repository;
277 LVL1_configuration_repository = "ATLAS.data";
278
279
281 SectorLogicSetup::SECTORlist::const_iterator
it = sectors.begin();
282
283 char s_tag[4];
284 sprintf(s_tag, "s%02d", *it);
285
286 char t_tag[3];
287 sprintf(t_tag, "t%1d", id().PAD_index());
288
289 char c_tag[4] = {'_', 'c', '2', '\0'};
290 if (id().Ixx_index() == 1) c_tag[2] = '3';
291
292 std::ifstream CMAprogLow;
293 std::istringstream CMAprogLow_COOL;
295
296
297 const std::map<std::string, std::string>* p_trigroads =
setup.GetPtoTrigRoads();
298
299
300
301 if (p_trigroads == nullptr) {
302 while (!CMAprogLow.is_open() && it != sectors.end()) {
303 std::ostringstream namestr;
304
307 namestr <<
dir <<
"/" << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
308
309 namestr.str().copy(
name, namestr.str().length(), 0);
310 name[namestr.str().length()] = 0;
311 if (
log.level() <= MSG::DEBUG) {
313 }
314
315 CMAprogLow.open(
name);
317 namestr.clear();
318 }
319 }
320
321 else {
322 while (CMAprogLow_COOL.str().empty() && it != sectors.end()) {
323 std::ostringstream namestr;
324 namestr << s_tag << "_" << t_tag << "_pl" << c_tag << ".txt" << std::ends;
325 namestr.str().copy(
name, namestr.str().length(), 0);
326 name[namestr.str().length()] = 0;
327 std::map<std::string, std::string>::const_iterator itc;
328 itc = p_trigroads->find(
name);
329 if (itc != p_trigroads->end()) {
330 CMAprogLow_COOL.str(itc->second.c_str());
331
332 if (
log.level() <= MSG::VERBOSE) {
333 log << MSG::VERBOSE <<
"EtaCMA low: key " <<
name <<
"found in the Trigger Road Map --> OK"
334 << ", EtaCMA low: key " << itc->second.c_str()
335 << ", Etacma:CMAPROGLOW " << CMAprogLow_COOL.str()
337 }
338 }
340 namestr.clear();
341 }
342 }
343 if (CMAprogLow.is_open()) {
344 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow, true);
345 if (program->check()) {
347 if (
setup.cosmic()) {
350 }
351 for (
unsigned int i = 0;
i < 3; ++
i) {
353 if (
log.level() <= MSG::DEBUG) {
354 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " <<
i
355 <<
" not programmed." <<
endmsg;
356 }
357 }
358 }
359 }
360 CMAprogLow.close();
361 if (
log.level() <= MSG::DEBUG) {
362 log << MSG::DEBUG <<
"EtaCMA::setup low_pt program has been read ---- " <<
endmsg;
363 }
364 } else if (!CMAprogLow_COOL.str().empty()) {
365 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow_COOL, true);
366 if (program->check()) {
368 if (
setup.cosmic()) {
371 }
372 for (
unsigned int i = 0;
i < 3; ++
i) {
374 if (
log.level() <= MSG::DEBUG) {
375 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " <<
i
376 <<
" not programmed." <<
endmsg;
377 }
378 }
379 }
380 }
381 CMAprogLow_COOL.str("");
382 } else {
383 if (
log.level() <= MSG::DEBUG) {
384 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;
385 }
388 }
389
390 it = sectors.begin();
391 std::ifstream CMAprogHigh;
392 std::istringstream CMAprogHigh_COOL;
393
394 if (p_trigroads == nullptr) {
395 while (!CMAprogHigh.is_open() && it != sectors.end()) {
396 std::ostringstream namestr;
399 namestr <<
dir <<
"/" << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
400
401 namestr.str().copy(
name, namestr.str().length(), 0);
402 name[namestr.str().length()] = 0;
403 if (
log.level() <= MSG::DEBUG) {
404 log << MSG::DEBUG <<
"filename for the trigger roads " <<
name <<
endmsg;
405 }
406 CMAprogHigh.open(
name);
408 namestr.clear();
409 }
410 }
411
412 else {
413 while (CMAprogHigh_COOL.str().empty() && it != sectors.end()) {
414 std::ostringstream namestr;
415 namestr << s_tag << "_" << t_tag << "_ph" << c_tag << ".txt" << std::ends;
416 namestr.str().copy(
name, namestr.str().length(), 0);
417 name[namestr.str().length()] = 0;
418 std::map<std::string, std::string>::const_iterator itc;
419 itc = p_trigroads->find(
name);
420 if (itc != p_trigroads->end()) {
421 if (
log.level() <= MSG::VERBOSE) {
422 log << MSG::VERBOSE <<
"EtaCMA high: key " <<
name <<
"found in the Trigger Road Map --> OK"
423 <<
", EtaCMA high: key " << itc->second.c_str() <<
endmsg;
424 }
425 CMAprogHigh_COOL.str(itc->second.c_str());
426 if (
log.level() <= MSG::VERBOSE) {
427 log << MSG::VERBOSE <<
"EtaCMA:CMAPROGHIGH " << CMAprogHigh_COOL.str() <<
endmsg;
428 }
429 }
431 namestr.clear();
432 }
433 }
434
435 if (CMAprogHigh.is_open()) {
436 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh, true);
437 if (program->check()) {
439 if (
setup.cosmic()) {
442 }
443 for (
unsigned int i = 0;
i < 3; ++
i) {
445 if (
log.level() <= MSG::DEBUG) {
446 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " <<
i
447 <<
" not programmed." <<
endmsg;
448 }
449 }
450 }
451 }
452 CMAprogHigh.close();
453 if (
log.level() <= MSG::DEBUG) {
454 log << MSG::DEBUG <<
"EtaCMA::setup high_pt program has been read ---- " <<
endmsg;
455 }
456 } else if (!CMAprogHigh_COOL.str().empty()) {
457 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh_COOL, true);
458 if (program->check()) {
460 if (
setup.cosmic()) {
463 }
464 for (
unsigned int i = 0;
i < 3; ++
i) {
466 if (
log.level() <= MSG::DEBUG) {
467 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " <<
i
468 <<
" not programmed." <<
endmsg;
469 }
470 }
471 }
472 }
473 CMAprogHigh_COOL.str("");
474 } else {
475 if (
log.level() <= MSG::DEBUG) {
476 log << MSG::DEBUG <<
" not found! Putting a dummy configuration" <<
endmsg;
477 }
480 }
481
482 return true;
483}
std::string two_obj_error_message(const std::string &, CMAparameters *)
bool cable_CMA_channels(HalfType)
EtaCMA(const parseParams &parse)
bool doInversion(SectorLogicSetup &)
bool begin_at_RPC_Z_boundary(void) const
bool end_at_RPC_Z_boundary(void) const
bool connect(SectorLogicSetup &)