00001 #include "Validation/Geometry/interface/MonitorElementMgr.h" 00002 #include "CLHEP/Units/SystemOfUnits.h" 00003 #ifdef StatTesting 00004 #include "Validation/SimG4GeometryValidation/interface/StatisticsComparator.h" 00005 #include "StatisticsTesting/Chi2ComparisonAlgorithm.h" 00006 #endif 00007 00008 #ifdef PI121 00009 #include "StatisticsTesting/ComparisonResult.h" 00010 #endif 00011 #include <iostream> 00012 #include "DQMServices/Core/interface/MonitorElement.h" 00013 00014 //---------------------------------------------------------------------- 00015 MonitorElementMgr::MonitorElementMgr() 00016 { 00017 00018 } 00019 00020 //---------------------------------------------------------------------- 00021 MonitorElementMgr::~MonitorElementMgr() 00022 { 00023 //~MonitorElement is protected => delete doesnt work... 00024 /* 00025 mime::const_iterator iter; 00026 for( iter = theMonitorElements.begin(); iter != theMonitorElements.end(); iter++ ){ 00027 delete (*iter).second; 00028 } 00029 */ 00030 } 00031 00032 //---------------------------------------------------------------------- 00033 void MonitorElementMgr::save( const std::string& name ) 00034 { 00035 00036 std::cout << "=== save user histos ===" << std::endl; 00037 TFile fout(name.c_str(),"recreate"); 00038 // write out the histos 00039 mime::const_iterator iter; 00040 std::cout << "Should save " << theMonitorElements.size() << " MEs" << std::endl; 00041 /* 00042 for( iter = theMonitorElements.begin(); iter != theMonitorElements.end(); iter++ ){ 00043 delete (*iter).second; 00044 } 00045 */ 00046 } 00047 00048 void MonitorElementMgr::openSecondFile( const std::string& name ) 00049 { 00050 00051 theFileRef = new TFile(name.c_str()); 00052 00053 /* std::vector<std::string> objectNames = theStoreIn->listObjectNames(); 00054 std::vector<std::string> objectTypes = theStoreIn->listObjectTypes(); 00055 uint siz = objectNames.size(); 00056 for( uint ii = 0; ii < siz; ii++ ) { 00057 // std::cout << " HISTOS IN FILE " << std::endl; 00058 00059 // std::cout << " HISTO: " << objectNames[ii] << " " << objectTypes[ii] << std::endl; 00060 }*/ 00061 } 00062 00063 void MonitorElementMgr::printComparisonResult( int ih ) 00064 { 00065 //still to be implemented for MonitorElements 00066 } 00067 00068 bool MonitorElementMgr::addME( MonitorElement* sih ) 00069 { 00070 const char* str = const_cast<char *>((sih->getName()).c_str()); 00071 int ih = atoi(str); 00072 theMonitorElements[ih] = sih; 00073 std::cout << " addME " << sih->getName() << " = " << ih << std::endl; 00074 00075 return true; 00076 } 00077 00078 MonitorElement* MonitorElementMgr::getME( int ime ) 00079 { 00080 MonitorElement* me = 0; 00081 mime::const_iterator ite = theMonitorElements.find( ime ); 00082 if( ite != theMonitorElements.end() ) { 00083 me = (*ite).second; 00084 } else { 00085 std::cerr << "!!!! FATAL ERROR MonitorElement does not exist " << ime << std::endl; 00086 std::exception(); 00087 } 00088 return me; 00089 } 00090 00091 MonitorElement* MonitorElementMgr::getMEFromSecondFile( const char* hnam ) 00092 { 00093 std::cout << "still to be added for ME" << std::endl; 00094 MonitorElement* me = 0; 00095 std::cerr << "!!!! FATAL ERROR MonitorElement does not exist " << std::endl; 00096 std::exception(); 00097 return me; 00098 }