325 log << MSG::WARNING <<
"CaloDmDescrManager::build_element_list() -> Warning! Non empty list."
328 return StatusCode::FAILURE;
333 log << MSG::INFO <<
"Reading file " <<
file <<
endmsg;
335 std::ifstream fin(
file.c_str());
337 log << MSG::ERROR <<
"Can't open file " <<
file <<
endmsg;
338 return StatusCode::FAILURE;
343 while(fin.getline(cLine,
sizeof(cLine)-1)){
344 if( strlen(cLine)==0 || cLine[0] ==
'#' || cLine[0] ==
'\n')
continue;
345 sLine = std::string(cLine);
346 std::istringstream mypars( sLine.c_str() );
348 int key, distance, isBarrel;
349 float etamin, etamax, deta, dphi;
350 if(mypars >> key >> etamin >> etamax >> deta >> dphi >> distance >> isBarrel) {
351 fin.getline(cLine,
sizeof(cLine)-1);
352 sLine = std::string(cLine);
353 std::istringstream mynei( sLine.c_str() );
355 std::vector<short> neighbours;
356 std::vector<float> CaloEtaMinVector;
357 std::vector<float> CaloEtaMaxVector;
358 while (mynei >> sKey) {
359 if(sKey.find(
"CaloSampleNeighbors") != std::string::npos)
continue;
360 if(sKey.find(
"Unknown") != std::string::npos)
continue;
361 float caloEtaMin, caloEtaMax;
363 if(nsmp != CaloCell_ID::Unknown) {
364 neighbours.push_back((
int)nsmp);
365 CaloEtaMinVector.push_back(caloEtaMin);
366 CaloEtaMaxVector.push_back(caloEtaMax);
368 std::cout <<
"CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine <<
"', key '" << sKey <<
"'" << std::endl;
369 return StatusCode::FAILURE;
374 int type=(key-subdet*1000)/100;
375 int sampling=(key-subdet*1000-
type*100)/10;
376 int region=(key-subdet*1000-
type*100-sampling*10)/1;
377 if(subdet != 4 && subdet !=5) {
378 log << MSG::ERROR <<
" Error! Wrong subdet " << subdet <<
". Format error in line '" << sLine <<
"', key '" << sKey <<
"'" << std::endl;
379 return StatusCode::FAILURE;
389 hash_side_neg =
m_caloDM_ID->lar_zone_hash(id_side_neg);
390 hash_side_pos =
m_caloDM_ID->lar_zone_hash(id_side_pos);
391 }
else if (subdet == 5){
399 myRegionPos->
m_key=key;
404 myRegionPos->
m_neta_max=int((etamax-etamin)/deta+0.00001);
439 }
else if (subdet == 5){
440 int shift_reg =
m_caloDM_ID->lar_region_hash_max();
445 while(fin.getline(cLine,
sizeof(cLine)-1)) {
446 if(cLine[0] ==
'}')
break;
449 std::cout <<
"CaloDmDescrManager::load_regions() -> Fromat ERROR in line '" << sLine <<
"'" << std::endl;
450 return StatusCode::FAILURE;
473 return StatusCode::SUCCESS;
546 if ( SamplingName.find(
"PreSamplerB") != std::string::npos ) {
547 nsmp = CaloCell_ID::PreSamplerB;
548 }
else if ( SamplingName.find(
"EMB1") != std::string::npos ) {
549 nsmp = CaloCell_ID::EMB1;
550 }
else if ( SamplingName.find(
"EMB2") != std::string::npos ) {
551 nsmp = CaloCell_ID::EMB2;
552 }
else if ( SamplingName.find(
"EMB3") != std::string::npos ) {
553 nsmp = CaloCell_ID::EMB3;
554 }
else if ( SamplingName.find(
"PreSamplerE") != std::string::npos ) {
555 nsmp = CaloCell_ID::PreSamplerE;
556 }
else if ( SamplingName.find(
"EME1") != std::string::npos ) {
557 nsmp = CaloCell_ID::EME1;
558 }
else if ( SamplingName.find(
"EME2") != std::string::npos ) {
559 nsmp = CaloCell_ID::EME2;
560 }
else if ( SamplingName.find(
"EME3") != std::string::npos ) {
561 nsmp = CaloCell_ID::EME3;
562 }
else if ( SamplingName.find(
"HEC0") != std::string::npos ) {
563 nsmp = CaloCell_ID::HEC0;
564 }
else if ( SamplingName.find(
"HEC1") != std::string::npos ) {
565 nsmp = CaloCell_ID::HEC1;
566 }
else if ( SamplingName.find(
"HEC2") != std::string::npos ) {
567 nsmp = CaloCell_ID::HEC2;
568 }
else if ( SamplingName.find(
"HEC3") != std::string::npos ) {
569 nsmp = CaloCell_ID::HEC3;
570 }
else if ( SamplingName.find(
"TileBar0") != std::string::npos ) {
571 nsmp = CaloCell_ID::TileBar0;
572 }
else if ( SamplingName.find(
"TileBar1") != std::string::npos ) {
573 nsmp = CaloCell_ID::TileBar1;
574 }
else if ( SamplingName.find(
"TileBar2") != std::string::npos ) {
575 nsmp = CaloCell_ID::TileBar2;
576 }
else if ( SamplingName.find(
"TileGap1") != std::string::npos ) {
577 nsmp = CaloCell_ID::TileGap1;
578 }
else if ( SamplingName.find(
"TileGap2") != std::string::npos ) {
579 nsmp = CaloCell_ID::TileGap2;
580 }
else if ( SamplingName.find(
"TileGap3") != std::string::npos ) {
581 nsmp = CaloCell_ID::TileGap3;
582 }
else if ( SamplingName.find(
"TileExt0") != std::string::npos ) {
583 nsmp = CaloCell_ID::TileExt0;
584 }
else if ( SamplingName.find(
"TileExt1") != std::string::npos ) {
585 nsmp = CaloCell_ID::TileExt1;
586 }
else if ( SamplingName.find(
"TileExt2") != std::string::npos ) {
587 nsmp = CaloCell_ID::TileExt2;
588 }
else if ( SamplingName.find(
"FCAL0") != std::string::npos ) {
589 nsmp = CaloCell_ID::FCAL0;
590 }
else if ( SamplingName.find(
"FCAL1") != std::string::npos ) {
591 nsmp = CaloCell_ID::FCAL1;
592 }
else if ( SamplingName.find(
"FCAL2") != std::string::npos ) {
593 nsmp = CaloCell_ID::FCAL2;
595 std::cout <<
"CaloDmDescrManager::get_calo_sample() -> Calorimeter sampling '" << SamplingName
596 <<
"' is not a valid Calorimeter sampling name and will be ignored! " << std::endl;
597 return CaloCell_ID::Unknown;
600 if(SamplingName.find(
'(') == std::string::npos || SamplingName.find(
')') != SamplingName.size()-1 ){
601 std::cout <<
"CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName <<
"' string! Something with brackets..." << std::endl;
602 return CaloCell_ID::Unknown;
604 std::string sEtaRange(SamplingName,SamplingName.find(
'(')+1);
605 std::istringstream iEtaRange( sEtaRange.c_str() );
606 if(iEtaRange >> etaMin >> dummy >> etaMax) {
609 std::cout <<
"CaloDmDescrManager::get_calo_sample() -> Can't parse calorimeter sampling '" << SamplingName <<
"' string!" << std::endl;
610 return CaloCell_ID::Unknown;