#include <ErrorCorrelationMgr.h>
Public Member Functions | |
ErrorCorrelation * | getCorrelation (ALIint ii) |
ALIint | getNumberOfCorrelations () |
void | readFromReportFile (const ALIstring &filename) |
Static Public Member Functions | |
static ErrorCorrelationMgr * | getInstance () |
Private Member Functions | |
ErrorCorrelationMgr () | |
std::vector< ErrorCorrelation * > ::iterator | findErrorCorrelation (pss &entry1, pss &entry2) |
Private Attributes | |
std::vector< ErrorCorrelation * > | theCorrs |
Static Private Attributes | |
static ErrorCorrelationMgr * | theInstance = 0 |
Definition at line 19 of file ErrorCorrelationMgr.h.
ErrorCorrelationMgr::ErrorCorrelationMgr | ( | ) | [inline, private] |
std::vector< ErrorCorrelation * >::iterator ErrorCorrelationMgr::findErrorCorrelation | ( | pss & | entry1, |
pss & | entry2 | ||
) | [private] |
Definition at line 102 of file ErrorCorrelationMgr.cc.
References theCorrs.
Referenced by readFromReportFile().
ErrorCorrelation * ErrorCorrelationMgr::getCorrelation | ( | ALIint | ii | ) |
Definition at line 91 of file ErrorCorrelationMgr.cc.
References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, and theCorrs.
Referenced by Fit::setCorrelationsInWMatrix().
ErrorCorrelationMgr * ErrorCorrelationMgr::getInstance | ( | ) | [static] |
Definition at line 15 of file ErrorCorrelationMgr.cc.
References ErrorCorrelationMgr(), and theInstance.
Referenced by readFromReportFile(), and Model::readSystemDescription().
{ if( !theInstance ) { theInstance = new ErrorCorrelationMgr; } return theInstance; }
ALIint ErrorCorrelationMgr::getNumberOfCorrelations | ( | ) | [inline] |
Definition at line 30 of file ErrorCorrelationMgr.h.
Referenced by Fit::setCorrelationsInWMatrix().
:
void ErrorCorrelationMgr::readFromReportFile | ( | const ALIstring & | filename | ) |
Definition at line 27 of file ErrorCorrelationMgr.cc.
References dtNoiseDBValidation_cfg::cerr, corr, gather_cfg::cout, ALIUtils::debug, ALIUtils::dumpVS(), exception, groupFilesInBlocks::fin, findErrorCorrelation(), ALIUtils::getFloat(), getInstance(), getInt(), ALIFileIn::getWordsInLine(), p1, p2, and theCorrs.
Referenced by Model::readSystemDescription().
{ if( ALIUtils::debug >= 4 ) std::cout << " ErrorCorrelationMgr::readFromReportFile " << std::endl; //------ Open the file ALIFileIn fin = ALIFileIn::getInstance( filename ); //------ Read the file std::vector<ALIstring> wl; typedef std::map< ALIint, std::pair<ALIstring,ALIstring>, std::less<ALIint> > miss; miss theEntries; miss::iterator missite; for(;;) { if( fin.getWordsInLine( wl ) == 0 ) break; // build the list of entries if( wl[0] == "CAL:" || wl[0] == "UNK:" ) { if( ALIUtils::debug >= 4 ) ALIUtils::dumpVS( wl, " ErrorCorrelationMgr: reading entry "); theEntries[ALIUtils::getInt( wl[1] )] = std::pair<ALIstring,ALIstring>( wl[2], wl[3] ); // } else if( wl[0][0] == '(' ) { } else if( wl[0].substr(0,5) == "CORR:" ) { // find the two entries int p1 = wl[1].find('('); int p2 = wl[1].find(')'); // std::cout << "( found " << p1 << " " << p2 << " = " << wl[1].substr(p1+1,p2-p1-1) << std::endl; if( p2 == -1 ) { std::cerr << "!!!ERROR: ErrorCorrelationMgr::readFromReportFile. Word found that starts with '(' but has no ')'" << wl[1] << std::endl; std::exception(); } ALIint nent = ALIUtils::getInt( wl[1].substr(p1+1,p2-p1-1)); missite = theEntries.find( nent ); std::pair<ALIstring,ALIstring> entry1 = (*missite).second; p1 = wl[2].find('('); p2 = wl[2].find(')'); // std::cout << "( found " << p1 << " " << p2 << " = " << wl[2].substr(p1+1,p2-p1-1) << std::endl; if( p2 == -1 ){ std::cerr << "!!!ERROR: ErrorCorrelationMgr::readFromReportFile. Word found that starts with '(' but has no ')'" << wl[2] << std::endl; std::exception(); } nent = ALIUtils::getInt( wl[2].substr(p1+1,p2-p1-1)); missite = theEntries.find( nent ); std::pair<ALIstring,ALIstring> entry2 = (*missite).second; // build an ErrorCorrelation or update it if it exists std::vector<ErrorCorrelation*>::iterator itecorr = findErrorCorrelation( entry1, entry2 ); if( itecorr == theCorrs.end() ){ ErrorCorrelation* corr = new ErrorCorrelation( entry1, entry2, ALIUtils::getFloat( wl[3] ) ); if( ALIUtils::debug >= 4 ) { std::cout << " ErrorCorrelationMgr: correlation created " << entry1.first << " " << entry1.second << " " << entry2.first << " " << entry2.second << " " << wl[3] << std::endl; } theCorrs.push_back( corr ); } else { (*itecorr)->update( ALIUtils::getFloat( wl[3] ) ); if( ALIUtils::debug >= 4 ) { std::cout << " ErrorCorrelationMgr: correlation updated " << entry1.first << " " << entry1.second << " " << entry2.first << " " << entry2.second << " " << wl[3] << std::endl; } } } } }
std::vector<ErrorCorrelation*> ErrorCorrelationMgr::theCorrs [private] |
Definition at line 38 of file ErrorCorrelationMgr.h.
Referenced by findErrorCorrelation(), getCorrelation(), and readFromReportFile().
ErrorCorrelationMgr * ErrorCorrelationMgr::theInstance = 0 [static, private] |
Definition at line 37 of file ErrorCorrelationMgr.h.
Referenced by getInstance().