CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/CondTools/Ecal/src/EcalErrorMask.cc

Go to the documentation of this file.
00001 
00002 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00003 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00004 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00005 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00006 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00007 #include "OnlineDB/EcalCondDB/interface/RunMemChErrorsDat.h"
00008 #include "OnlineDB/EcalCondDB/interface/RunMemTTErrorsDat.h"
00009 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
00010 
00011 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00012 
00013 #include "CondTools/Ecal/interface/EcalErrorDictionary.h"
00014 
00015 #include "CondTools/Ecal/interface/EcalErrorMask.h"
00016 
00017 #include <iostream>
00018 
00019 int  EcalErrorMask::runNb_ = -1;
00020 std::map<EcalLogicID, RunCrystalErrorsDat> EcalErrorMask::mapCrystalErrors_;
00021 std::map<EcalLogicID, RunTTErrorsDat>      EcalErrorMask::mapTTErrors_;
00022 std::map<EcalLogicID, RunPNErrorsDat>      EcalErrorMask::mapPNErrors_;
00023 std::map<EcalLogicID, RunMemChErrorsDat>   EcalErrorMask::mapMemChErrors_;
00024 std::map<EcalLogicID, RunMemTTErrorsDat>   EcalErrorMask::mapMemTTErrors_;
00025 
00026 void EcalErrorMask::readDB( EcalCondDBInterface* eConn, RunIOV* runIOV ) throw( std::runtime_error ) {
00027 
00028   if( eConn ) {
00029 
00030     RunIOV validIOV;
00031     RunTag runTag = runIOV->getRunTag();
00032 
00033     std::string location = runTag.getLocationDef().getLocation();
00034 
00035     std::cout << std::endl;
00036     std::cout << " RunCrystalErrorsDat: ";
00037     try {
00038       eConn->fetchValidDataSet( &EcalErrorMask::mapCrystalErrors_, &validIOV, location, runIOV->getRunNumber() );
00039       std::cout << "found" << std::endl;
00040     } catch ( std::runtime_error &e ) {
00041       std::cout << "not found" << std::endl;
00042       throw( std::runtime_error( e.what() ) );
00043     }
00044 
00045     // use the IOV for CrystalErrors as reference
00046     EcalErrorMask::runNb_ = validIOV.getRunNumber();
00047 
00048     std::cout << " RunTTErrorsDat:      ";
00049     try {
00050       eConn->fetchValidDataSet( &EcalErrorMask::mapTTErrors_,      &validIOV, location, runIOV->getRunNumber() );
00051       std::cout << "found" << std::endl;
00052     } catch ( std::runtime_error &e ) {
00053       std::cout << "not found" << std::endl;
00054     }
00055     std::cout << " RunPNErrorsDat:      ";
00056     try {
00057       eConn->fetchValidDataSet( &EcalErrorMask::mapPNErrors_,      &validIOV, location, runIOV->getRunNumber() );
00058       std::cout << "found" << std::endl;
00059     } catch ( std::runtime_error &e ) {
00060       std::cout << "not found" << std::endl;
00061     }
00062     std::cout << " RunMemChErrorsDat:   ";
00063     try {
00064       eConn->fetchValidDataSet( &EcalErrorMask::mapMemChErrors_,   &validIOV, location, runIOV->getRunNumber() );
00065       std::cout << "found" << std::endl;
00066     } catch ( std::runtime_error &e ) {
00067       std::cout << "not found" << std::endl;
00068     }
00069     std::cout << " RunMemTTErrorsDat:   ";
00070     try {
00071       eConn->fetchValidDataSet( &EcalErrorMask::mapMemTTErrors_,   &validIOV, location, runIOV->getRunNumber() );
00072       std::cout << "found" << std::endl;
00073     } catch ( std::runtime_error &e ) {
00074       std::cout << "not found" << std::endl;
00075     }
00076 
00077     std::cout << std::endl;
00078 
00079   }
00080 
00081 }
00082 
00083 void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunCrystalErrorsDat>* fillMap ) {
00084 
00085   fillMap->clear();
00086   *fillMap = EcalErrorMask::mapCrystalErrors_;
00087   return;
00088 
00089 }
00090 
00091 void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunTTErrorsDat>* fillMap ) {
00092 
00093   fillMap->clear();
00094   *fillMap = EcalErrorMask::mapTTErrors_;
00095   return;
00096 
00097 }
00098 
00099 void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunPNErrorsDat>* fillMap ) {
00100 
00101   fillMap->clear();
00102   *fillMap = EcalErrorMask::mapPNErrors_;
00103   return;
00104 
00105 }
00106 
00107 void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunMemChErrorsDat>* fillMap ) {
00108 
00109   fillMap->clear();
00110   *fillMap = EcalErrorMask::mapMemChErrors_;
00111   return;
00112 
00113 }
00114 
00115 void EcalErrorMask::fetchDataSet( std::map< EcalLogicID, RunMemTTErrorsDat>* fillMap ) {
00116 
00117   fillMap->clear();
00118   *fillMap = EcalErrorMask::mapMemTTErrors_;
00119   return;
00120 
00121 }
00122