#include <DQM/EcalCommon/interface/EcalErrorMask.h>
Static Public Member Functions | |
static void | fetchDataSet (std::map< EcalLogicID, RunMemTTErrorsDat > *fillMap) |
static void | fetchDataSet (std::map< EcalLogicID, RunMemChErrorsDat > *fillMap) |
static void | fetchDataSet (std::map< EcalLogicID, RunPNErrorsDat > *fillMap) |
static void | fetchDataSet (std::map< EcalLogicID, RunTTErrorsDat > *fillMap) |
static void | fetchDataSet (std::map< EcalLogicID, RunCrystalErrorsDat > *fillMap) |
static void | readDB (EcalCondDBInterface *eConn, RunIOV *runIOV) throw ( std::runtime_error ) |
static void | readFile (std::string &inFile, bool debug=false, bool verifySyntax=false) throw ( std::runtime_error ) |
static void | writeDB (EcalCondDBInterface *eConn, RunIOV *runIOV) |
static void | writeFile (std::string &outFile) throw ( std::runtime_error ) |
Static Private Member Functions | |
static void | clearComments_ (char *line) |
static void | clearFinalBlanks_ (char *line) |
Static Private Attributes | |
static std::map< EcalLogicID, RunCrystalErrorsDat > | mapCrystalErrors_ |
static std::map< EcalLogicID, RunMemChErrorsDat > | mapMemChErrors_ |
static std::map< EcalLogicID, RunMemTTErrorsDat > | mapMemTTErrors_ |
static std::map< EcalLogicID, RunPNErrorsDat > | mapPNErrors_ |
static std::map< EcalLogicID, RunTTErrorsDat > | mapTTErrors_ |
static int | runNb_ = -1 |
Definition at line 29 of file EcalErrorMask.h.
void EcalErrorMask::clearComments_ | ( | char * | line | ) | [static, private] |
Definition at line 714 of file EcalErrorMask.cc.
Referenced by readFile().
00714 { 00715 00716 // It looks for "#" and replaces it with "\0"... 00717 regex_t rec; 00718 regmatch_t pmc; 00719 00720 (void) regcomp( &rec, "#", REG_EXTENDED ); 00721 00722 int i = regexec( &rec, line, (size_t) 1, &pmc, 0 ); 00723 00724 if( i == 0 ) { 00725 line[pmc.rm_so] = '\0'; 00726 } 00727 00728 regfree( &rec ); 00729 00730 }
void EcalErrorMask::clearFinalBlanks_ | ( | char * | line | ) | [static, private] |
Definition at line 734 of file EcalErrorMask.cc.
References i.
Referenced by readFile().
00734 { 00735 00736 // From end of string, find last ' ' or '\t' (tab) and replace it with '\0' 00737 int i; 00738 for( i=strlen(line)-1; i>=0 && (line[i]==' '||line[i]=='\t'); i-- ); 00739 if( line[i+1] == ' ' || line[i+1] == '\t' ) line[i+1] = '\0'; 00740 00741 }
void EcalErrorMask::fetchDataSet | ( | std::map< EcalLogicID, RunMemTTErrorsDat > * | fillMap | ) | [static] |
Definition at line 704 of file EcalErrorMask.cc.
References mapMemTTErrors_.
00704 { 00705 00706 fillMap->clear(); 00707 *fillMap = EcalErrorMask::mapMemTTErrors_; 00708 return; 00709 00710 }
void EcalErrorMask::fetchDataSet | ( | std::map< EcalLogicID, RunMemChErrorsDat > * | fillMap | ) | [static] |
Definition at line 694 of file EcalErrorMask.cc.
References mapMemChErrors_.
00694 { 00695 00696 fillMap->clear(); 00697 *fillMap = EcalErrorMask::mapMemChErrors_; 00698 return; 00699 00700 }
void EcalErrorMask::fetchDataSet | ( | std::map< EcalLogicID, RunPNErrorsDat > * | fillMap | ) | [static] |
Definition at line 684 of file EcalErrorMask.cc.
References mapPNErrors_.
00684 { 00685 00686 fillMap->clear(); 00687 *fillMap = EcalErrorMask::mapPNErrors_; 00688 return; 00689 00690 }
void EcalErrorMask::fetchDataSet | ( | std::map< EcalLogicID, RunTTErrorsDat > * | fillMap | ) | [static] |
Definition at line 674 of file EcalErrorMask.cc.
References mapTTErrors_.
00674 { 00675 00676 fillMap->clear(); 00677 *fillMap = EcalErrorMask::mapTTErrors_; 00678 return; 00679 00680 }
void EcalErrorMask::fetchDataSet | ( | std::map< EcalLogicID, RunCrystalErrorsDat > * | fillMap | ) | [static] |
Definition at line 664 of file EcalErrorMask.cc.
References mapCrystalErrors_.
Referenced by EEPedestalClient::analyze(), EETimingClient::analyze(), EBTimingClient::analyze(), EELaserClient::analyze(), EEIntegrityClient::analyze(), EETestPulseClient::analyze(), EEPedestalOnlineClient::analyze(), EBLaserClient::analyze(), EBTestPulseClient::analyze(), EELedClient::analyze(), EBIntegrityClient::analyze(), EBPedestalClient::analyze(), and EBPedestalOnlineClient::analyze().
00664 { 00665 00666 fillMap->clear(); 00667 *fillMap = EcalErrorMask::mapCrystalErrors_; 00668 return; 00669 00670 }
void EcalErrorMask::readDB | ( | EcalCondDBInterface * | eConn, | |
RunIOV * | runIOV | |||
) | throw ( std::runtime_error ) [static] |
Definition at line 540 of file EcalErrorMask.cc.
References GenMuonPlsPt100GeV_cfg::cout, e, lat::endl(), LocationDef::getLocation(), RunTag::getLocationDef(), RunIOV::getRunNumber(), mapCrystalErrors_, mapMemChErrors_, mapMemTTErrors_, mapPNErrors_, mapTTErrors_, and runNb_.
Referenced by EcalEndcapMonitorClient::beginRunDb(), and EcalBarrelMonitorClient::beginRunDb().
00540 { 00541 00542 if( eConn ) { 00543 00544 RunIOV validIOV; 00545 RunTag runTag = runIOV->getRunTag(); 00546 00547 /* 00548 std::cout << std::endl; 00549 std::cout << " RunCrystalErrorsDat: "; 00550 try { 00551 eConn->fetchValidDataSet( &EcalErrorMask::mapCrystalErrors_, &validIOV, &runTag, runIOV->getRunNumber() ); 00552 std::cout << "found" << std::endl; 00553 } catch ( std::runtime_error &e ) { 00554 std::cout << "not found" << std::endl; 00555 throw( std::runtime_error( e.what() ) ); 00556 } 00557 00558 // use the IOV for CrystalErrors as reference 00559 EcalErrorMask::runNb_ = validIOV.getRunNumber(); 00560 00561 std::cout << " RunTTErrorsDat: "; 00562 try { 00563 eConn->fetchValidDataSet( &EcalErrorMask::mapTTErrors_, &validIOV, &runTag, runIOV->getRunNumber() ); 00564 std::cout << "found" << std::endl; 00565 } catch ( std::runtime_error &e ) { 00566 std::cout << "not found" << std::endl; 00567 } 00568 std::cout << " RunPNErrorsDat: "; 00569 try { 00570 eConn->fetchValidDataSet( &EcalErrorMask::mapPNErrors_, &validIOV, &runTag, runIOV->getRunNumber() ); 00571 std::cout << "found" << std::endl; 00572 } catch ( std::runtime_error &e ) { 00573 std::cout << "not found" << std::endl; 00574 } 00575 std::cout << " RunMemChErrorsDat: "; 00576 try { 00577 eConn->fetchValidDataSet( &EcalErrorMask::mapMemChErrors_, &validIOV, &runTag, runIOV->getRunNumber() ); 00578 std::cout << "found" << std::endl; 00579 } catch ( std::runtime_error &e ) { 00580 std::cout << "not found" << std::endl; 00581 } 00582 std::cout << " RunMemTTErrorsDat: "; 00583 try { 00584 eConn->fetchValidDataSet( &EcalErrorMask::mapMemTTErrors_, &validIOV, &runTag, runIOV->getRunNumber() ); 00585 std::cout << "found" << std::endl; 00586 } catch ( std::runtime_error &e ) { 00587 std::cout << "not found" << std::endl; 00588 } 00589 */ 00590 00591 string location = runTag.getLocationDef().getLocation(); 00592 00593 std::cout << std::endl; 00594 std::cout << " RunCrystalErrorsDat: "; 00595 try { 00596 eConn->fetchValidDataSet( &EcalErrorMask::mapCrystalErrors_, &validIOV, location, runIOV->getRunNumber() ); 00597 std::cout << "found" << std::endl; 00598 } catch ( std::runtime_error &e ) { 00599 std::cout << "not found" << std::endl; 00600 throw( std::runtime_error( e.what() ) ); 00601 } 00602 00603 // use the IOV for CrystalErrors as reference 00604 EcalErrorMask::runNb_ = validIOV.getRunNumber(); 00605 00606 std::cout << " RunTTErrorsDat: "; 00607 try { 00608 eConn->fetchValidDataSet( &EcalErrorMask::mapTTErrors_, &validIOV, location, runIOV->getRunNumber() ); 00609 std::cout << "found" << std::endl; 00610 } catch ( std::runtime_error &e ) { 00611 std::cout << "not found" << std::endl; 00612 } 00613 std::cout << " RunPNErrorsDat: "; 00614 try { 00615 eConn->fetchValidDataSet( &EcalErrorMask::mapPNErrors_, &validIOV, location, runIOV->getRunNumber() ); 00616 std::cout << "found" << std::endl; 00617 } catch ( std::runtime_error &e ) { 00618 std::cout << "not found" << std::endl; 00619 } 00620 std::cout << " RunMemChErrorsDat: "; 00621 try { 00622 eConn->fetchValidDataSet( &EcalErrorMask::mapMemChErrors_, &validIOV, location, runIOV->getRunNumber() ); 00623 std::cout << "found" << std::endl; 00624 } catch ( std::runtime_error &e ) { 00625 std::cout << "not found" << std::endl; 00626 } 00627 std::cout << " RunMemTTErrorsDat: "; 00628 try { 00629 eConn->fetchValidDataSet( &EcalErrorMask::mapMemTTErrors_, &validIOV, location, runIOV->getRunNumber() ); 00630 std::cout << "found" << std::endl; 00631 } catch ( std::runtime_error &e ) { 00632 std::cout << "not found" << std::endl; 00633 } 00634 00635 std::cout << std::endl; 00636 00637 } 00638 00639 }
void EcalErrorMask::readFile | ( | std::string & | inFile, | |
bool | debug = false , |
|||
bool | verifySyntax = false | |||
) | throw ( std::runtime_error ) [static] |
Definition at line 46 of file EcalErrorMask.cc.
References TestMuL1L2Filter_cff::cerr, clearComments_(), clearFinalBlanks_(), GenMuonPlsPt100GeV_cfg::cout, debug, EcalBarrel, EcalEndcap, lat::endl(), error, HLT_VtxMuL3::errors, f, EcalErrorDictionary::getDictionary(), LogicID::getEcalLogicID(), i, id, in, it, parsecf::pyparsing::line(), mapCrystalErrors_, mapMemChErrors_, mapMemTTErrors_, mapPNErrors_, mapTTErrors_, s, RunTTErrorsDat::setErrorBits(), RunCrystalErrorsDat::setErrorBits(), RunMemChErrorsDat::setErrorBits(), RunMemTTErrorsDat::setErrorBits(), and RunPNErrorsDat::setErrorBits().
Referenced by EcalEndcapMonitorClient::beginRunDb(), and EcalBarrelMonitorClient::beginRunDb().
00046 { 00047 00048 if( verifySyntax ) { 00049 std::cout << "----------------------------------------------------------------" << std::endl 00050 << "---> Verifying syntax in " << inFile << std::endl 00051 << "----------------------------------------------------------------" << std::endl; 00052 } 00053 00054 const unsigned int lineSize = 512; 00055 char line[lineSize]; 00056 00057 std::fstream f( inFile.c_str(), std::ios::in ); 00058 if( f.fail() ) { 00059 throw( std::runtime_error( "Error accessing input file " + inFile ) ); 00060 return; 00061 } 00062 00063 int linecount = 0; 00064 int nerrors = 0; 00065 00066 // Local copy of error dictionary 00067 std::vector<EcalErrorDictionary::errorDef_t> errors; 00068 EcalErrorDictionary::getDictionary( errors ); 00069 00070 if( debug ) std::cout << std::endl 00071 << "--------- Input Mask File Dump ----------" 00072 << std::endl; 00073 00074 while( f.getline( line, lineSize ) ) { 00075 00076 linecount++; 00077 00078 EcalErrorMask::clearComments_( line ); 00079 EcalErrorMask::clearFinalBlanks_( line ); 00080 00081 std::istringstream is( line ); 00082 std::string s; 00083 is >> s; 00084 if( s.size() == 0 ) continue; 00085 00086 if( debug ) std::cout << is.str() << std::endl; 00087 00088 int subdet = 0; 00089 00090 // get SM number (1...36 or EB-18...EB+18 or EE-09...EE+09) 00091 00092 std::string ssm; is >> ssm; 00093 int sm; 00094 00095 if( strncmp(ssm.c_str(), "EB", 2) == 0 ) { 00096 subdet = EcalBarrel; 00097 sm = atoi( ssm.substr(2, ssm.size()-2).c_str() ); 00098 sm = (sm>0) ? sm : 18-sm; 00099 } 00100 else if( strncmp(ssm.c_str(), "EE", 2) == 0 ) { 00101 subdet = EcalEndcap; 00102 sm = atoi( ssm.substr(2, ssm.size()-2).c_str() ); 00103 sm = (sm>0) ? sm : 18-sm; 00104 } 00105 else { 00106 subdet = EcalBarrel; 00107 sm = atoi( ssm.c_str() ); 00108 } 00109 00110 if( ( subdet == EcalBarrel && ( sm < 1 || sm > 36 ) ) || 00111 ( subdet == EcalEndcap && ( sm < 1 || sm > 18 ) ) ) { 00112 std::ostringstream os; 00113 os << "line " << linecount << " --> SM must be a number between 1 and 36 (EB), or between 1 and 18 (EE): " << sm; 00114 if( verifySyntax ) { 00115 std::cerr << os.str() << std::endl; 00116 nerrors++; 00117 } 00118 else { 00119 f.close(); 00120 throw( std::runtime_error( os.str() ) ); 00121 return; 00122 } 00123 } 00124 00125 if( strcmp(s.c_str(), "Crystal") == 0 ) { 00126 int ic; is >> ic; 00127 if( ( subdet == EcalBarrel && ( ic < 1 || ic > 1700 ) ) || 00128 ( subdet == EcalEndcap && ( ic < 1 || ic > 100000 ) ) ) { 00129 std::ostringstream os; 00130 os << "line " << linecount << " --> IC must be a number between 1 and 1700 (EB), or between 1 and 100000 (EE): " << ic; 00131 if( verifySyntax ) { 00132 std::cerr << os.str() << std::endl; 00133 nerrors++; 00134 } 00135 else { 00136 f.close(); 00137 throw( std::runtime_error( os.str() ) ); 00138 return; 00139 } 00140 } 00141 std::string shortDesc; is >> shortDesc; 00142 uint64_t bitmask; bitmask = 0; 00143 00144 for( unsigned int i=0; i<errors.size(); i++ ) { 00145 if( shortDesc == errors[i].shortDesc ) { 00146 bitmask = errors[i].bitmask; 00147 } 00148 } 00149 if( bitmask == 0 ) { 00150 std::ostringstream os; 00151 os << "line " << linecount << " --> This Short Description was not found in the Dictionary: " << shortDesc; 00152 if( verifySyntax ) { 00153 std::cerr << os.str() << std::endl; 00154 nerrors++; 00155 } 00156 else { 00157 f.close(); 00158 throw( std::runtime_error( os.str() ) ); 00159 return; 00160 } 00161 } 00162 if( !verifySyntax ) { 00163 EcalLogicID id; 00164 if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_crystal_number", sm, ic ); 00165 if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_crystal_number", sm, ic ); 00166 std::map<EcalLogicID, RunCrystalErrorsDat>::iterator i = EcalErrorMask::mapCrystalErrors_.find( id ); 00167 if( i != mapCrystalErrors_.end() ) { 00168 uint64_t oldBitmask = (i->second).getErrorBits(); 00169 oldBitmask |= bitmask; 00170 (i->second).setErrorBits( oldBitmask ); 00171 } 00172 else { 00173 RunCrystalErrorsDat error; 00174 error.setErrorBits(bitmask); 00175 EcalErrorMask::mapCrystalErrors_[ id ] = error; 00176 } 00177 } 00178 } 00179 else if( strcmp(s.c_str(), "TT") == 0 ) { 00180 int it; is >> it; 00181 if( ( subdet == EcalBarrel && ( it < 1 || it > 68 ) ) || 00182 ( subdet == EcalEndcap && ( it < 1 || it > 34 ) ) ) { 00183 std::ostringstream os; 00184 os << "line " << linecount << " --> IT must be a number between 1 and 68 (EB), or between 1 and 34 (EE): " << it; 00185 if( verifySyntax ) { 00186 std::cerr << os.str() << std::endl; 00187 nerrors++; 00188 } 00189 else { 00190 f.close(); 00191 throw( std::runtime_error( os.str() ) ); 00192 return; 00193 } 00194 } 00195 std::string shortDesc; is >> shortDesc; 00196 uint64_t bitmask; bitmask = 0; 00197 00198 for( unsigned int i=0; i<errors.size(); i++ ) { 00199 if( shortDesc == errors[i].shortDesc ) { 00200 bitmask = errors[i].bitmask; 00201 } 00202 } 00203 if( bitmask == 0 ) { 00204 std::ostringstream os; 00205 os << "line " << linecount << " --> This Short Description was not found in the Dictionary: " << shortDesc; 00206 if( verifySyntax ) { 00207 std::cerr << os.str() << std::endl; 00208 nerrors++; 00209 } 00210 else { 00211 f.close(); 00212 throw( std::runtime_error( os.str() ) ); 00213 return; 00214 } 00215 } 00216 if( !verifySyntax ) { 00217 EcalLogicID id; 00218 if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_trigger_tower", sm, it ); 00219 if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_readout_tower", sm, it ); 00220 std::map<EcalLogicID, RunTTErrorsDat>::iterator i = EcalErrorMask::mapTTErrors_.find( id ); 00221 if( i != mapTTErrors_.end() ) { 00222 uint64_t oldBitmask = (i->second).getErrorBits(); 00223 oldBitmask |= bitmask; 00224 (i->second).setErrorBits( oldBitmask ); 00225 } 00226 else { 00227 RunTTErrorsDat error; 00228 error.setErrorBits(bitmask); 00229 EcalErrorMask::mapTTErrors_[ id ] = error; 00230 } 00231 } 00232 } 00233 else if( strcmp(s.c_str(), "PN") == 0 ) { 00234 int ic; is >> ic; 00235 if( ic < 1 || ic > 10 ) { 00236 std::ostringstream os; 00237 os << "line " << linecount << " --> IC must be a number between 1 and 10 (EB/EE): " << ic; 00238 if( verifySyntax ) { 00239 std::cerr << os.str() << std::endl; 00240 nerrors++; 00241 } 00242 else { 00243 f.close(); 00244 throw( std::runtime_error( os.str() ) ); 00245 return; 00246 } 00247 } 00248 std::string shortDesc; is >> shortDesc; 00249 uint64_t bitmask; bitmask = 0; 00250 00251 for( unsigned int i=0; i<errors.size(); i++ ) { 00252 if( shortDesc == errors[i].shortDesc ) { 00253 bitmask = errors[i].bitmask; 00254 } 00255 } 00256 if( bitmask == 0 ) { 00257 std::ostringstream os; 00258 os << "line " << linecount << " --> This Short Description was not found in the Dictionary: " << shortDesc; 00259 if( verifySyntax ) { 00260 std::cerr << os.str() << std::endl; 00261 nerrors++; 00262 } 00263 else { 00264 f.close(); 00265 throw( std::runtime_error( os.str() ) ); 00266 return; 00267 } 00268 } 00269 if( !verifySyntax ) { 00270 EcalLogicID id; 00271 if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_LM_PN", sm, ic-1 ); 00272 if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_LM_PN", sm, ic-1 ); 00273 std::map<EcalLogicID, RunPNErrorsDat>::iterator i = EcalErrorMask::mapPNErrors_.find( id ); 00274 if( i != mapPNErrors_.end() ) { 00275 uint64_t oldBitmask = (i->second).getErrorBits(); 00276 oldBitmask |= bitmask; 00277 (i->second).setErrorBits( oldBitmask ); 00278 } 00279 else { 00280 RunPNErrorsDat error; 00281 error.setErrorBits(bitmask); 00282 EcalErrorMask::mapPNErrors_[ id ] = error; 00283 } 00284 } 00285 } 00286 else if( strcmp(s.c_str(), "MemCh") == 0 ) { 00287 int ic; is >> ic; 00288 if( ic < 1 || ic > 50 ) { 00289 std::ostringstream os; 00290 os << "line " << linecount << " --> IC must be a number between 1 and 50 (EB/EE): " << ic; 00291 if( verifySyntax ) { 00292 std::cerr << os.str() << std::endl; 00293 nerrors++; 00294 } 00295 else { 00296 f.close(); 00297 throw( std::runtime_error( os.str() ) ); 00298 return; 00299 } 00300 } 00301 std::string shortDesc; is >> shortDesc; 00302 uint64_t bitmask; bitmask = 0; 00303 00304 for( unsigned int i=0; i<errors.size(); i++ ) { 00305 if( shortDesc == errors[i].shortDesc ) { 00306 bitmask = errors[i].bitmask; 00307 } 00308 } 00309 if( bitmask == 0 ) { 00310 std::ostringstream os; 00311 os << "line " << linecount << " --> This Short Description was not found in the Dictionary: " << shortDesc; 00312 if( verifySyntax ) { 00313 std::cerr << os.str() << std::endl; 00314 nerrors++; 00315 } 00316 else { 00317 f.close(); 00318 throw( std::runtime_error( os.str() ) ); 00319 return; 00320 } 00321 } 00322 if( !verifySyntax ) { 00323 EcalLogicID id; 00324 if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_mem_channel", sm, ic ); 00325 if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_mem_channel", sm, ic ); 00326 std::map<EcalLogicID, RunMemChErrorsDat>::iterator i = EcalErrorMask::mapMemChErrors_.find( id ); 00327 if( i != mapMemChErrors_.end() ) { 00328 uint64_t oldBitmask = (i->second).getErrorBits(); 00329 oldBitmask |= bitmask; 00330 (i->second).setErrorBits( oldBitmask ); 00331 } 00332 else { 00333 RunMemChErrorsDat error; 00334 error.setErrorBits(bitmask); 00335 EcalErrorMask::mapMemChErrors_[ id ] = error; 00336 } 00337 } 00338 } 00339 else if( strcmp(s.c_str(), "MemTT") == 0 ) { 00340 int it; is >> it; 00341 if( it < 69 || it > 70 ) { 00342 std::ostringstream os; 00343 os << "line " << linecount << " --> IT must be 69 or 70 (EB/EE): " << it; 00344 if( verifySyntax ) { 00345 std::cerr << os.str() << std::endl; 00346 nerrors++; 00347 } 00348 else { 00349 f.close(); 00350 throw( std::runtime_error( os.str() ) ); 00351 return; 00352 } 00353 } 00354 std::string shortDesc; is >> shortDesc; 00355 uint64_t bitmask; bitmask = 0; 00356 00357 for( unsigned int i=0; i<errors.size(); i++ ) { 00358 if( shortDesc == errors[i].shortDesc ) { 00359 bitmask = errors[i].bitmask; 00360 } 00361 } 00362 if( bitmask == 0 ) { 00363 std::ostringstream os; 00364 os << "line " << linecount << " --> This Short Description was not found in the Dictionary: " << shortDesc; 00365 if( verifySyntax ) { 00366 std::cerr << os.str() << std::endl; 00367 nerrors++; 00368 } 00369 else { 00370 f.close(); 00371 throw( std::runtime_error( os.str() ) ); 00372 return; 00373 } 00374 } 00375 if( !verifySyntax ) { 00376 EcalLogicID id; 00377 if(subdet == EcalBarrel) id = LogicID::getEcalLogicID( "EB_mem_TT", sm, it ); 00378 if(subdet == EcalEndcap) id = LogicID::getEcalLogicID( "EE_mem_TT", sm, it ); 00379 std::map<EcalLogicID, RunMemTTErrorsDat>::iterator i = EcalErrorMask::mapMemTTErrors_.find( id ); 00380 if( i != mapMemTTErrors_.end() ) { 00381 uint64_t oldBitmask = (i->second).getErrorBits(); 00382 oldBitmask |= bitmask; 00383 (i->second).setErrorBits( oldBitmask ); 00384 } 00385 else { 00386 RunMemTTErrorsDat error; 00387 error.setErrorBits(bitmask); 00388 EcalErrorMask::mapMemTTErrors_[ id ] = error; 00389 } 00390 } 00391 } 00392 else { 00393 std::ostringstream os; 00394 os << "line " << linecount << " --> Wrong Table Name: " << s; 00395 if( verifySyntax ) { 00396 std::cerr << os.str() << std::endl; 00397 nerrors++; 00398 } 00399 else { 00400 f.close(); 00401 throw( std::runtime_error( os.str() ) ); 00402 return; 00403 } 00404 } 00405 } 00406 00407 if( verifySyntax ) { 00408 std::cout << "----------------------------------------------------------------" << std::endl; 00409 if( nerrors > 0 ) { 00410 if( nerrors == 1 ) { 00411 std::cerr << "---> " << inFile << " contains a syntax error, please fix it..." << std::endl; 00412 } 00413 else { 00414 std::cerr << "---> " << inFile << " contains " << nerrors << " syntax errors, please fix them..." << std::endl; 00415 } 00416 } 00417 else { 00418 std::cout << "---> " << inFile << " syntax sounds correct... Good!" << std::endl; 00419 } 00420 std::cout << "----------------------------------------------------------------" << std::endl; 00421 } 00422 00423 if( debug ) std::cout << "------- End Input Mask File Dump --------" 00424 << std::endl; 00425 00426 f.close(); 00427 return; 00428 00429 }
void EcalErrorMask::writeDB | ( | EcalCondDBInterface * | eConn, | |
RunIOV * | runIOV | |||
) | [static] |
Definition at line 643 of file EcalErrorMask.cc.
References EcalCondDBInterface::insertDataSet(), mapCrystalErrors_, mapMemChErrors_, mapMemTTErrors_, mapPNErrors_, mapTTErrors_, and size.
00643 { 00644 00645 if( eConn ) { 00646 00647 if (EcalErrorMask::mapCrystalErrors_.size() != 0 ) 00648 eConn->insertDataSet( &EcalErrorMask::mapCrystalErrors_, runIOV ); 00649 if (EcalErrorMask::mapTTErrors_.size() != 0 ) 00650 eConn->insertDataSet( &EcalErrorMask::mapTTErrors_, runIOV ); 00651 if (EcalErrorMask::mapPNErrors_.size() != 0 ) 00652 eConn->insertDataSet( &EcalErrorMask::mapPNErrors_, runIOV ); 00653 if (EcalErrorMask::mapMemChErrors_.size() != 0 ) 00654 eConn->insertDataSet( &EcalErrorMask::mapMemChErrors_, runIOV ); 00655 if (EcalErrorMask::mapMemTTErrors_.size() != 0 ) 00656 eConn->insertDataSet( &EcalErrorMask::mapMemTTErrors_, runIOV ); 00657 00658 } 00659 00660 }
void EcalErrorMask::writeFile | ( | std::string & | outFile | ) | throw ( std::runtime_error ) [static] |
Definition at line 433 of file EcalErrorMask.cc.
References begin, GenMuonPlsPt100GeV_cfg::cout, EcalBarrel, lat::endl(), HLT_VtxMuL3::errors, f, EcalErrorDictionary::getErrors(), i, Numbers::iSM(), it, j, mapCrystalErrors_, mapMemChErrors_, mapMemTTErrors_, mapPNErrors_, mapTTErrors_, out, runNb_, and Numbers::sEB().
00433 { 00434 00435 std::ifstream inf( outFile.c_str() ); 00436 inf.close(); 00437 if( !inf.fail() ) { 00438 std::cout << std::endl; 00439 std::cout << "File "; 00440 std::cout << outFile << " already exists. Should I replace it? [y/N] "; 00441 std::string yesno; 00442 std::cin >> yesno; 00443 std::cout << std::endl; 00444 if( strcmp(yesno.c_str(), "y") != 0 && strcmp(yesno.c_str(), "Y") != 0 ) { 00445 throw( std::runtime_error( outFile + " left unchanged." ) ); 00446 std::cout << std::endl; 00447 return; 00448 } 00449 } 00450 00451 std::fstream f( outFile.c_str(), std::ios::out ); 00452 if( f.fail() ) { 00453 throw( std::runtime_error( "Error accessing output file " + outFile ) ); 00454 return; 00455 } 00456 00457 if( EcalErrorMask::runNb_ == -1 ) { 00458 f << "# -------------- Run Number Unknown --------------" << std::endl; 00459 } 00460 else { 00461 f << "# -------------- Run Number " << EcalErrorMask::runNb_ << " --------------" << std::endl; 00462 } 00463 00464 f << "# Errors on Crystals masks" << std::endl; 00465 for( std::map<EcalLogicID, RunCrystalErrorsDat>::iterator i = EcalErrorMask::mapCrystalErrors_.begin(); 00466 i != EcalErrorMask::mapCrystalErrors_.end(); i++ ) { 00467 string type = "Crystal"; 00468 int sm = (i->first).getID1(); 00469 int ic = (i->first).getID2(); 00470 std::vector<EcalErrorDictionary::errorDef_t> errors; 00471 EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); 00472 for( unsigned int j=0; j<errors.size(); j++ ) { 00473 if(sm >= 1 && sm <= 36) f << type << " " << Numbers::sEB( Numbers::iSM( sm, EcalBarrel ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00474 // if(sm >= 1 && sm <= 18) f << type << " " << Numbers::sEE( Numbers::iSM( sm, EcalEndcap ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00475 } 00476 } 00477 00478 f << "# Errors on Trigger Towers masks" << std::endl; 00479 for( std::map<EcalLogicID, RunTTErrorsDat>::iterator i = EcalErrorMask::mapTTErrors_.begin(); 00480 i != EcalErrorMask::mapTTErrors_.end(); i++ ) { 00481 string type = "TT"; 00482 int sm = (i->first).getID1(); 00483 int it = (i->first).getID2(); 00484 std::vector<EcalErrorDictionary::errorDef_t> errors; 00485 EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); 00486 for( unsigned int j=0; j<errors.size(); j++ ) { 00487 if(sm >= 1 && sm <= 36) f << type << " " << Numbers::sEB( Numbers::iSM( sm, EcalBarrel ) ) << " " << it << " " << errors[j].shortDesc << std::endl; 00488 // if(sm >= 1 && sm <= 18) f << type << " " << Numbers::sEE( Numbers::iSM( sm, EcalEndcap ) ) << " " << it << " " << errors[j].shortDesc << std::endl; 00489 } 00490 } 00491 00492 f << "# Errors on PN masks" << std::endl; 00493 for( std::map<EcalLogicID, RunPNErrorsDat>::iterator i = EcalErrorMask::mapPNErrors_.begin(); 00494 i != EcalErrorMask::mapPNErrors_.end(); i++ ) { 00495 string type = "PN"; 00496 int sm = (i->first).getID1(); 00497 int ic = 1+(i->first).getID2(); 00498 std::vector<EcalErrorDictionary::errorDef_t> errors; 00499 EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); 00500 for( unsigned int j=0; j<errors.size(); j++ ) { 00501 if(sm >= 1 && sm <= 36) f << type << " " << Numbers::sEB( Numbers::iSM( sm, EcalBarrel ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00502 // if(sm >= 1 && sm <= 18) f << type << " " << Numbers::sEE( Numbers::iSM( sm, EcalEndcap ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00503 } 00504 } 00505 00506 f << "# Errors on MemCh masks" << std::endl; 00507 for( std::map<EcalLogicID, RunMemChErrorsDat>::iterator i = EcalErrorMask::mapMemChErrors_.begin(); 00508 i != EcalErrorMask::mapMemChErrors_.end(); i++ ) { 00509 string type = "MemCh"; 00510 int sm = (i->first).getID1(); 00511 int ic = (i->first).getID2(); 00512 std::vector<EcalErrorDictionary::errorDef_t> errors; 00513 EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); 00514 for( unsigned int j=0; j<errors.size(); j++ ) { 00515 if(sm >= 1 && sm <= 36) f << type << " " << Numbers::sEB( Numbers::iSM( sm, EcalBarrel ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00516 // if(sm >= 1 && sm <= 18) f << type << " " << Numbers::sEE( Numbers::iSM( sm, EcalEndcap ) ) << " " << ic << " " << errors[j].shortDesc << std::endl; 00517 } 00518 } 00519 00520 f << "# Errors on MemTT masks" << std::endl; 00521 for( std::map<EcalLogicID, RunMemTTErrorsDat>::iterator i = EcalErrorMask::mapMemTTErrors_.begin(); 00522 i != EcalErrorMask::mapMemTTErrors_.end(); i++ ) { 00523 string type = "Crystal "; 00524 int sm = (i->first).getID1(); 00525 int it = (i->first).getID2(); 00526 std::vector<EcalErrorDictionary::errorDef_t> errors; 00527 EcalErrorDictionary::getErrors( errors, (i->second).getErrorBits() ); 00528 for( unsigned int j=0; j<errors.size(); j++ ) { 00529 if(sm >= 1 && sm <= 36) f << type << " " << Numbers::sEB( Numbers::iSM( sm, EcalBarrel ) ) << " " << it << " " << errors[j].shortDesc << std::endl; 00530 // if(sm >= 1 && sm <= 18) f << type << " " << Numbers::sEE( Numbers::iSM( sm, EcalEndcap ) ) << " " << it << " " << errors[j].shortDesc << std::endl; 00531 } 00532 } 00533 00534 f.close(); 00535 00536 }
std::map< EcalLogicID, RunCrystalErrorsDat > EcalErrorMask::mapCrystalErrors_ [static, private] |
Definition at line 49 of file EcalErrorMask.h.
Referenced by fetchDataSet(), readDB(), readFile(), writeDB(), and writeFile().
std::map< EcalLogicID, RunMemChErrorsDat > EcalErrorMask::mapMemChErrors_ [static, private] |
Definition at line 52 of file EcalErrorMask.h.
Referenced by fetchDataSet(), readDB(), readFile(), writeDB(), and writeFile().
std::map< EcalLogicID, RunMemTTErrorsDat > EcalErrorMask::mapMemTTErrors_ [static, private] |
Definition at line 53 of file EcalErrorMask.h.
Referenced by fetchDataSet(), readDB(), readFile(), writeDB(), and writeFile().
std::map< EcalLogicID, RunPNErrorsDat > EcalErrorMask::mapPNErrors_ [static, private] |
Definition at line 51 of file EcalErrorMask.h.
Referenced by fetchDataSet(), readDB(), readFile(), writeDB(), and writeFile().
std::map< EcalLogicID, RunTTErrorsDat > EcalErrorMask::mapTTErrors_ [static, private] |
Definition at line 50 of file EcalErrorMask.h.
Referenced by fetchDataSet(), readDB(), readFile(), writeDB(), and writeFile().
int EcalErrorMask::runNb_ = -1 [static, private] |