From 72f996be9122af4d753b28db222447557cea773b Mon Sep 17 00:00:00 2001 From: Giuseppe Della Ricca Date: Thu, 1 Oct 2009 10:17:57 +0000 Subject: [PATCH] --- yaml --- r: 74487 b: "refs/heads/CMSSW_7_1_X" c: 41a2defa3fb8f755ff1b273bfae5640095fa1015 h: "refs/heads/CMSSW_7_1_X" i: 74485: 76e6afddcdca205ee6be3a7caa7f1f8a0f3df211 74483: 0ea2e01cefc48071e02a1c26c4cb33465b5aabaf 74479: e8570f33b1b9e04a06284583f3b9a7106c36287c v: v3 --- [refs] | 2 +- trunk/DQM/EcalBarrelMonitorClient/BuildFile | 1 - .../src/EcalErrorMask.cc | 713 ++++++++++++++++++ .../EcalBarrelMonitorClient/src/LogicID.cc | 98 +++ trunk/DQM/EcalEndcapMonitorClient/BuildFile | 2 +- 5 files changed, 813 insertions(+), 3 deletions(-) create mode 100644 trunk/DQM/EcalBarrelMonitorClient/src/EcalErrorMask.cc create mode 100644 trunk/DQM/EcalBarrelMonitorClient/src/LogicID.cc diff --git a/[refs] b/[refs] index 7db2b1cd369d5..67905c272705b 100644 --- a/[refs] +++ b/[refs] @@ -1,3 +1,3 @@ --- refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e -"refs/heads/CMSSW_7_1_X": 08a419cf126da5c564f2143c50cc990b0984d620 +"refs/heads/CMSSW_7_1_X": 41a2defa3fb8f755ff1b273bfae5640095fa1015 diff --git a/trunk/DQM/EcalBarrelMonitorClient/BuildFile b/trunk/DQM/EcalBarrelMonitorClient/BuildFile index 751976ab33fe0..6d32cdeda77e3 100644 --- a/trunk/DQM/EcalBarrelMonitorClient/BuildFile +++ b/trunk/DQM/EcalBarrelMonitorClient/BuildFile @@ -1,6 +1,5 @@ - diff --git a/trunk/DQM/EcalBarrelMonitorClient/src/EcalErrorMask.cc b/trunk/DQM/EcalBarrelMonitorClient/src/EcalErrorMask.cc new file mode 100644 index 0000000000000..719e8b2fe8e93 --- /dev/null +++ b/trunk/DQM/EcalBarrelMonitorClient/src/EcalErrorMask.cc @@ -0,0 +1,713 @@ +// $Id: EcalErrorMask.cc,v 1.11 2009/09/23 07:28:59 emanuele Exp $ + +/*! + \file EcalErrorMask.cc + \brief Error mask from text file or database + \author B. Gobbo + \version $Revision: 1.11 $ + \date $Date: 2009/09/23 07:28:59 $ +*/ + +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" + +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" + +#include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h" +#include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h" +#include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h" +#include "OnlineDB/EcalCondDB/interface/RunMemChErrorsDat.h" +#include "OnlineDB/EcalCondDB/interface/RunMemTTErrorsDat.h" +#include "OnlineDB/EcalCondDB/interface/RunIOV.h" + +#include "CondTools/Ecal/interface/EcalErrorDictionary.h" + +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + +#include "DQM/EcalCommon/interface/Numbers.h" +#include "DQM/EcalCommon/interface/LogicID.h" + +#include "DQM/EcalCommon/interface/EcalErrorMask.h" + +#include +#include +#include +#include +#include + +int EcalErrorMask::runNb_ = -1; +std::map EcalErrorMask::mapCrystalErrors_; +std::map EcalErrorMask::mapTTErrors_; +std::map EcalErrorMask::mapPNErrors_; +std::map EcalErrorMask::mapMemChErrors_; +std::map EcalErrorMask::mapMemTTErrors_; + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::readFile( std::string& inFile, bool debug, bool verifySyntax ) throw( std::runtime_error ) { + + if( verifySyntax ) { + std::cout << "----------------------------------------------------------------" << std::endl + << "---> Verifying syntax in " << inFile << std::endl + << "----------------------------------------------------------------" << std::endl; + } + + const unsigned int lineSize = 512; + char line[lineSize]; + + std::fstream f( inFile.c_str(), std::ios::in ); + if( f.fail() ) { + throw( std::runtime_error( "Error accessing input file " + inFile ) ); + return; + } + + int linecount = 0; + int nerrors = 0; + + // Local copy of error dictionary + std::vector errors; + EcalErrorDictionary::getDictionary( errors ); + + if( debug ) std::cout << std::endl + << "--------- Input Mask File Dump ----------" + << std::endl; + + while( f.getline( line, lineSize ) ) { + + linecount++; + + EcalErrorMask::clearComments_( line ); + EcalErrorMask::clearFinalBlanks_( line ); + + std::istringstream is( line ); + std::string s; + is >> s; + if( s.size() == 0 ) continue; + + if( debug ) std::cout << is.str() << std::endl; + + int subdet = 0; + + // get SM number (1...36 or EB-18...EB+18 or EE-09...EE+09) + + std::string ssm; is >> ssm; + int sm; + + if( strncmp(ssm.c_str(), "EB", 2) == 0 ) { + subdet = EcalBarrel; + sm = atoi( ssm.substr(2, ssm.size()-2).c_str() ); + sm = (sm>=0) ? sm : 18-sm; + } + else if( strncmp(ssm.c_str(), "EE", 2) == 0 ) { + subdet = EcalEndcap; + sm = atoi( ssm.substr(2, ssm.size()-2).c_str() ); + if( sm == -99 ) sm = -1; + if( sm == +99 ) sm = +1; + + if( sm == 7 ) sm = 1; + if( sm == 8 ) sm = 2; + if( sm == 9 ) sm = 3; + if( sm == 1 ) sm = 4; + if( sm == 2 ) sm = 5; + if( sm == 3 ) sm = 6; + if( sm == 4 ) sm = 7; + if( sm == 5 ) sm = 8; + if( sm == 6 ) sm = 9; + + if( sm == -7 ) sm = 10; + if( sm == -8 ) sm = 11; + if( sm == -9 ) sm = 12; + if( sm == -1 ) sm = 13; + if( sm == -2 ) sm = 14; + if( sm == -3 ) sm = 15; + if( sm == -4 ) sm = 16; + if( sm == -5 ) sm = 17; + if( sm == -6 ) sm = 18; + } + else { + subdet = EcalBarrel; + sm = atoi( ssm.c_str() ); + } + + if( ( subdet == EcalBarrel && ( sm < 1 || sm > 36 ) ) || + ( subdet == EcalEndcap && ( sm < 1 || sm > 18 ) ) ) { + std::ostringstream os; + os << "line " << linecount << " --> SM must be a number between 1 and 36 (EB), or between 1 and 18 (EE): " << sm; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + + if( strcmp(s.c_str(), "Crystal") == 0 ) { + int ic; is >> ic; + if( ( subdet == EcalBarrel && ( ic < 1 || ic > 1700 ) ) || + ( subdet == EcalEndcap && ( ic < 1 || ic > 100100 ) ) ) { + std::ostringstream os; + os << "line " << linecount << " --> IC must be a number between 1 and 1700 (EB), or between 1 and 100100 (EE): " << ic; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + std::string shortDesc; is >> shortDesc; + uint64_t bitmask; bitmask = 0; + + for( unsigned int i=0; i This Short Description was not found in the Dictionary: " << shortDesc; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + if( !verifySyntax ) { + EcalLogicID id; + if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_crystal_number", sm, ic ); + if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_crystal_number", sm, ic ); + std::map::iterator i = EcalErrorMask::mapCrystalErrors_.find( id ); + if( i != mapCrystalErrors_.end() ) { + uint64_t oldBitmask = (i->second).getErrorBits(); + oldBitmask |= bitmask; + (i->second).setErrorBits( oldBitmask ); + } + else { + RunCrystalErrorsDat error; + error.setErrorBits(bitmask); + EcalErrorMask::mapCrystalErrors_[ id ] = error; + } + } + } + else if( strcmp(s.c_str(), "TT") == 0 ) { + int it; is >> it; + if( ( subdet == EcalBarrel && ( it < 1 || it > 68 ) ) || + ( subdet == EcalEndcap && ( it < 1 || it > 34 ) ) ) { + std::ostringstream os; + os << "line " << linecount << " --> IT must be a number between 1 and 68 (EB), or between 1 and 34 (EE): " << it; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + std::string shortDesc; is >> shortDesc; + uint64_t bitmask; bitmask = 0; + + for( unsigned int i=0; i This Short Description was not found in the Dictionary: " << shortDesc; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + if( !verifySyntax ) { + EcalLogicID id; + if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_trigger_tower", sm, it ); + if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_readout_tower", sm, it ); + std::map::iterator i = EcalErrorMask::mapTTErrors_.find( id ); + if( i != mapTTErrors_.end() ) { + uint64_t oldBitmask = (i->second).getErrorBits(); + oldBitmask |= bitmask; + (i->second).setErrorBits( oldBitmask ); + } + else { + RunTTErrorsDat error; + error.setErrorBits(bitmask); + EcalErrorMask::mapTTErrors_[ id ] = error; + } + } + } + else if( strcmp(s.c_str(), "PN") == 0 ) { + int ic; is >> ic; + if( ic < 1 || ic > 10 ) { + std::ostringstream os; + os << "line " << linecount << " --> IC must be a number between 1 and 10 (EB/EE): " << ic; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + std::string shortDesc; is >> shortDesc; + uint64_t bitmask; bitmask = 0; + + for( unsigned int i=0; i This Short Description was not found in the Dictionary: " << shortDesc; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + if( !verifySyntax ) { + EcalLogicID id; + if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_LM_PN", sm, ic-1 ); + if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_LM_PN", sm, ic-1 ); + std::map::iterator i = EcalErrorMask::mapPNErrors_.find( id ); + if( i != mapPNErrors_.end() ) { + uint64_t oldBitmask = (i->second).getErrorBits(); + oldBitmask |= bitmask; + (i->second).setErrorBits( oldBitmask ); + } + else { + RunPNErrorsDat error; + error.setErrorBits(bitmask); + EcalErrorMask::mapPNErrors_[ id ] = error; + } + } + } + else if( strcmp(s.c_str(), "MemCh") == 0 ) { + int ic; is >> ic; + if( ic < 1 || ic > 50 ) { + std::ostringstream os; + os << "line " << linecount << " --> IC must be a number between 1 and 50 (EB/EE): " << ic; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + std::string shortDesc; is >> shortDesc; + uint64_t bitmask; bitmask = 0; + + for( unsigned int i=0; i This Short Description was not found in the Dictionary: " << shortDesc; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + if( !verifySyntax ) { + EcalLogicID id; + if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_mem_channel", sm, ic ); + if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_mem_channel", sm, ic ); + std::map::iterator i = EcalErrorMask::mapMemChErrors_.find( id ); + if( i != mapMemChErrors_.end() ) { + uint64_t oldBitmask = (i->second).getErrorBits(); + oldBitmask |= bitmask; + (i->second).setErrorBits( oldBitmask ); + } + else { + RunMemChErrorsDat error; + error.setErrorBits(bitmask); + EcalErrorMask::mapMemChErrors_[ id ] = error; + } + } + } + else if( strcmp(s.c_str(), "MemTT") == 0 ) { + int it; is >> it; + if( it < 69 || it > 70 ) { + std::ostringstream os; + os << "line " << linecount << " --> IT must be 69 or 70 (EB/EE): " << it; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + std::string shortDesc; is >> shortDesc; + uint64_t bitmask; bitmask = 0; + + for( unsigned int i=0; i This Short Description was not found in the Dictionary: " << shortDesc; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + if( !verifySyntax ) { + EcalLogicID id; + if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_mem_TT", sm, it ); + if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_mem_TT", sm, it ); + std::map::iterator i = EcalErrorMask::mapMemTTErrors_.find( id ); + if( i != mapMemTTErrors_.end() ) { + uint64_t oldBitmask = (i->second).getErrorBits(); + oldBitmask |= bitmask; + (i->second).setErrorBits( oldBitmask ); + } + else { + RunMemTTErrorsDat error; + error.setErrorBits(bitmask); + EcalErrorMask::mapMemTTErrors_[ id ] = error; + } + } + } + else { + std::ostringstream os; + os << "line " << linecount << " --> Wrong Table Name: " << s; + if( verifySyntax ) { + std::cerr << os.str() << std::endl; + nerrors++; + } + else { + f.close(); + throw( std::runtime_error( os.str() ) ); + return; + } + } + } + + if( verifySyntax ) { + std::cout << "----------------------------------------------------------------" << std::endl; + if( nerrors > 0 ) { + if( nerrors == 1 ) { + std::cerr << "---> " << inFile << " contains a syntax error, please fix it..." << std::endl; + } + else { + std::cerr << "---> " << inFile << " contains " << nerrors << " syntax errors, please fix them..." << std::endl; + } + } + else { + std::cout << "---> " << inFile << " syntax sounds correct... Good!" << std::endl; + } + std::cout << "----------------------------------------------------------------" << std::endl; + } + + if( debug ) std::cout << "------- End Input Mask File Dump --------" + << std::endl; + + f.close(); + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::writeFile( std::string& outFile ) throw( std::runtime_error ) { + + std::ifstream inf( outFile.c_str() ); + inf.close(); + if( !inf.fail() ) { + std::cout << std::endl; + std::cout << "File "; + std::cout << outFile << " already exists. Should I replace it? [y/N] "; + std::string yesno; + std::cin >> yesno; + std::cout << std::endl; + if( strcmp(yesno.c_str(), "y") != 0 && strcmp(yesno.c_str(), "Y") != 0 ) { + throw( std::runtime_error( outFile + " left unchanged." ) ); + std::cout << std::endl; + return; + } + } + + std::fstream f( outFile.c_str(), std::ios::out ); + if( f.fail() ) { + throw( std::runtime_error( "Error accessing output file " + outFile ) ); + return; + } + + if( EcalErrorMask::runNb_ == -1 ) { + f << "# -------------- Run Number Unknown --------------" << std::endl; + } + else { + f << "# -------------- Run Number " << EcalErrorMask::runNb_ << " --------------" << std::endl; + } + + f << "# Errors on Crystals masks" << std::endl; + for( std::map::iterator i = EcalErrorMask::mapCrystalErrors_.begin(); + i != EcalErrorMask::mapCrystalErrors_.end(); i++ ) { + string type = "Crystal"; + std::string name = (i->first).getName(); + std::vector errors; + EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); + for( unsigned int j=0; jfirst).getID1(), EcalBarrel ) ) << " " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + if(strcmp(name.c_str(), "EE_crystal_number") == 0) f << type << " EE" << (((i->first).getID1()<0)?"-":"+") << "99 " << 1000*(i->first).getID2()+(i->first).getID3() << " " << errors[j].shortDesc << std::endl; + } + } + + f << "# Errors on Trigger Towers masks" << std::endl; + for( std::map::iterator i = EcalErrorMask::mapTTErrors_.begin(); + i != EcalErrorMask::mapTTErrors_.end(); i++ ) { + string type = "TT"; + std::string name = (i->first).getName(); + std::vector errors; + EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); + for( unsigned int j=0; jfirst).getID1(), EcalBarrel ) ) << " " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + if(strcmp(name.c_str(), "EE_crystal_number") == 0) f << type << " EE" << (((i->first).getID1()<0)?"-":"+") << "99 " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + } + } + + f << "# Errors on PN masks" << std::endl; + for( std::map::iterator i = EcalErrorMask::mapPNErrors_.begin(); + i != EcalErrorMask::mapPNErrors_.end(); i++ ) { + string type = "PN"; + std::string name = (i->first).getName(); + std::vector errors; + EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); + for( unsigned int j=0; jfirst).getID1(), EcalBarrel ) ) << " " << 1+(i->first).getID2() << " " << errors[j].shortDesc << std::endl; + if(strcmp(name.c_str(), "EE_crystal_number") == 0) f << type << " EE" << (((i->first).getID1()<0)?"-":"+") << "99 " << 1+(i->first).getID2() << " " << errors[j].shortDesc << std::endl; + } + } + + f << "# Errors on MemCh masks" << std::endl; + for( std::map::iterator i = EcalErrorMask::mapMemChErrors_.begin(); + i != EcalErrorMask::mapMemChErrors_.end(); i++ ) { + string type = "MemCh"; + std::string name = (i->first).getName(); + std::vector errors; + EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); + for( unsigned int j=0; jfirst).getID1(), EcalBarrel ) ) << " " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + if(strcmp(name.c_str(), "EE_crystal_number") == 0) f << type << " EE" << (((i->first).getID1()<0)?"-":"+") << "99 " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + } + } + + f << "# Errors on MemTT masks" << std::endl; + for( std::map::iterator i = EcalErrorMask::mapMemTTErrors_.begin(); + i != EcalErrorMask::mapMemTTErrors_.end(); i++ ) { + string type = "Crystal "; + std::string name = (i->first).getName(); + std::vector errors; + EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); + for( unsigned int j=0; jfirst).getID1(), EcalBarrel ) ) << " " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + if(strcmp(name.c_str(), "EE_crystal_number") == 0) f << type << " EE" << (((i->first).getID1()<0)?"-":"+") << "99 " << 1000*(i->first).getID2()+(i->first).getID3() << " " << (i->first).getID2() << " " << errors[j].shortDesc << std::endl; + } + } + + f.close(); + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::readDB( EcalCondDBInterface* eConn, RunIOV* runIOV ) throw( std::runtime_error ) { + + if( eConn ) { + + RunIOV validIOV; + RunTag runTag = runIOV->getRunTag(); + + string location = runTag.getLocationDef().getLocation(); + + std::cout << std::endl; + std::cout << " RunCrystalErrorsDat: "; + try { + eConn->fetchValidDataSet( &EcalErrorMask::mapCrystalErrors_, &validIOV, location, runIOV->getRunNumber() ); + std::cout << "found" << std::endl; + } catch ( std::runtime_error &e ) { + std::cout << "not found" << std::endl; + throw( std::runtime_error( e.what() ) ); + } + + // use the IOV for CrystalErrors as reference + EcalErrorMask::runNb_ = validIOV.getRunNumber(); + + std::cout << " RunTTErrorsDat: "; + try { + eConn->fetchValidDataSet( &EcalErrorMask::mapTTErrors_, &validIOV, location, runIOV->getRunNumber() ); + std::cout << "found" << std::endl; + } catch ( std::runtime_error &e ) { + std::cout << "not found" << std::endl; + } + std::cout << " RunPNErrorsDat: "; + try { + eConn->fetchValidDataSet( &EcalErrorMask::mapPNErrors_, &validIOV, location, runIOV->getRunNumber() ); + std::cout << "found" << std::endl; + } catch ( std::runtime_error &e ) { + std::cout << "not found" << std::endl; + } + std::cout << " RunMemChErrorsDat: "; + try { + eConn->fetchValidDataSet( &EcalErrorMask::mapMemChErrors_, &validIOV, location, runIOV->getRunNumber() ); + std::cout << "found" << std::endl; + } catch ( std::runtime_error &e ) { + std::cout << "not found" << std::endl; + } + std::cout << " RunMemTTErrorsDat: "; + try { + eConn->fetchValidDataSet( &EcalErrorMask::mapMemTTErrors_, &validIOV, location, runIOV->getRunNumber() ); + std::cout << "found" << std::endl; + } catch ( std::runtime_error &e ) { + std::cout << "not found" << std::endl; + } + + std::cout << std::endl; + + } + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::writeDB( EcalCondDBInterface* eConn, RunIOV* runIOV ) { + + if( eConn ) { + + if (EcalErrorMask::mapCrystalErrors_.size() != 0 ) + eConn->insertDataSet( &EcalErrorMask::mapCrystalErrors_, runIOV ); + if (EcalErrorMask::mapTTErrors_.size() != 0 ) + eConn->insertDataSet( &EcalErrorMask::mapTTErrors_, runIOV ); + if (EcalErrorMask::mapPNErrors_.size() != 0 ) + eConn->insertDataSet( &EcalErrorMask::mapPNErrors_, runIOV ); + if (EcalErrorMask::mapMemChErrors_.size() != 0 ) + eConn->insertDataSet( &EcalErrorMask::mapMemChErrors_, runIOV ); + if (EcalErrorMask::mapMemTTErrors_.size() != 0 ) + eConn->insertDataSet( &EcalErrorMask::mapMemTTErrors_, runIOV ); + + } + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunCrystalErrorsDat>* fillMap ) { + + fillMap->clear(); + *fillMap = EcalErrorMask::mapCrystalErrors_; + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunTTErrorsDat>* fillMap ) { + + fillMap->clear(); + *fillMap = EcalErrorMask::mapTTErrors_; + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunPNErrorsDat>* fillMap ) { + + fillMap->clear(); + *fillMap = EcalErrorMask::mapPNErrors_; + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunMemChErrorsDat>* fillMap ) { + + fillMap->clear(); + *fillMap = EcalErrorMask::mapMemChErrors_; + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunMemTTErrorsDat>* fillMap ) { + + fillMap->clear(); + *fillMap = EcalErrorMask::mapMemTTErrors_; + return; + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::clearComments_( char* line ) { + + // It looks for "#" and replaces it with "\0"... + regex_t rec; + regmatch_t pmc; + + (void) regcomp( &rec, "#", REG_EXTENDED ); + + int i = regexec( &rec, line, (size_t) 1, &pmc, 0 ); + + if( i == 0 ) { + line[pmc.rm_so] = '\0'; + } + + regfree( &rec ); + +} + +//---------------------------------------------------------------------------------- + +void EcalErrorMask::clearFinalBlanks_( char* line ) { + + // From end of string, find last ' ' or '\t' (tab) and replace it with '\0' + int i; + for( i=strlen(line)-1; i>=0 && (line[i]==' '||line[i]=='\t'); i-- ); + if( line[i+1] == ' ' || line[i+1] == '\t' ) line[i+1] = '\0'; + +} diff --git a/trunk/DQM/EcalBarrelMonitorClient/src/LogicID.cc b/trunk/DQM/EcalBarrelMonitorClient/src/LogicID.cc new file mode 100644 index 0000000000000..766ed5e4640a7 --- /dev/null +++ b/trunk/DQM/EcalBarrelMonitorClient/src/LogicID.cc @@ -0,0 +1,98 @@ +// $Id: LogicID.cc,v 1.1 2009/05/12 12:52:49 dellaric Exp $ + +/*! + \file LogicID.cc + \brief Construct EcalLogicIDs + \author G. Della Ricca + \author B. Gobbo + \version $Revision: 1.1 $ + \date $Date: 2009/05/12 12:52:49 $ +*/ + +#include "DQM/EcalCommon/interface/LogicID.h" +#include + +//------------------------------------------------------------------------- + +// WARNING: +// this file depends on the content of +// OnlineDB/EcalCondDB/perl/lib/CondDB/channelView.pm + +//------------------------------------------------------------------------- + +EcalLogicID LogicID::getEcalLogicID( const char* name, + const int id1, + const int id2, + const int id3 ) throw( std::runtime_error ) { + + // EcalBarrel + + if( strcmp(name, "EB") == 0 ) { + return( EcalLogicID( "EB", + 1000000000UL ) ); + } + if( strcmp(name, "EB_crystal_number") == 0 ) { + return( EcalLogicID( "EB_crystal_number", + 1011000000UL+10000*id1+id2, + id1, + id2 ) ); + } + if( strcmp(name, "EB_trigger_tower") == 0 ) { + return( EcalLogicID( "EB_trigger_tower", + 1021000000UL+10000*id1+id2, + id1, + id2 ) ); + } + if( strcmp(name, "EB_mem_channel") == 0 ) { + return( EcalLogicID( "EB_mem_channel", + 1191000000UL+10000*id1+id2, + id1, + id2 ) ); + } + if( strcmp(name, "EB_mem_TT") == 0 ) { + return( EcalLogicID( "EB_mem_TT", + 1181000000UL+10000*id1+id2, + id1, + id2 ) ); + } + if( strcmp(name, "EB_LM_PN") == 0 ) { + return( EcalLogicID( "EB_LM_PN", + 1131000000UL+10000*id1+id2, + id1, + id2 ) ); + } + + // EcalEndcap + + if( strcmp(name, "EE") == 0 ) { + return( EcalLogicID( "EE", + 2000000000UL ) ); + } + if( strcmp(name, "EE_crystal_number") == 0 ) { + return( EcalLogicID( "EE_crystal_number", + 2010000000UL+1000000*((id1>=1&&id1<=9)?2:0)+1000*int(id2/1000)+int(id2%1000), + (id1>=1&&id1<=9)?+1:-1, + int(id2/1000), + int(id2%1000) ) ); + } + if( strcmp(name, "EE_readout_tower") == 0 ) { + return( EcalLogicID( "EE_readout_tower", + 2110000000UL+100*((id1>=1&&id1<=9)?(646+(id1-1)):(601+(id1-9)))+id2, + ((id1>=1&&id1<=9)?(646+(id1-1)):(601+(id1-9))), + id2 ) ); + } + if( strcmp(name, "EE_mem_channel") == 0 ) { + return( EcalLogicID( "EE_mem_channel", EcalLogicID::NULLID ) ); + } + if( strcmp(name, "EE_mem_TT") == 0 ) { + return( EcalLogicID( "EE_mem_TT", EcalLogicID::NULLID ) ); + } + if( strcmp(name, "EE_LM_PN") == 0 ) { + return( EcalLogicID( "EE_mem_TT", EcalLogicID::NULLID ) ); + } + + throw( std::runtime_error( "Unknown 'name': " + std::string( name ) ) ); + return( EcalLogicID( std::string( "" ), EcalLogicID::NULLID ) ); + +} + diff --git a/trunk/DQM/EcalEndcapMonitorClient/BuildFile b/trunk/DQM/EcalEndcapMonitorClient/BuildFile index ace0163020804..59384f7a06dc2 100644 --- a/trunk/DQM/EcalEndcapMonitorClient/BuildFile +++ b/trunk/DQM/EcalEndcapMonitorClient/BuildFile @@ -1,6 +1,6 @@ + -