CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Validation/Geometry/src/MonitorElementMgr.cc

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