CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MonitorElementMgr.cc
Go to the documentation of this file.
2 #include "CLHEP/Units/GlobalSystemOfUnits.h"
3 #ifdef StatTesting
4 #include "Validation/SimG4GeometryValidation/interface/StatisticsComparator.h"
5 #include "StatisticsTesting/Chi2ComparisonAlgorithm.h"
6 #endif
7 
8 #ifdef PI121
9 #include "StatisticsTesting/ComparisonResult.h"
10 #endif
11 #include <iostream>
13 #include <cstdlib>
14 
15 //----------------------------------------------------------------------
17 {
18 
19 }
20 
21 //----------------------------------------------------------------------
23 {
24  //~MonitorElement is protected => delete doesnt work...
25  /*
26  mime::const_iterator iter;
27  for( iter = theMonitorElements.begin(); iter != theMonitorElements.end(); iter++ ){
28  delete (*iter).second;
29  }
30  */
31 }
32 
33 //----------------------------------------------------------------------
34 void MonitorElementMgr::save( const std::string& name )
35 {
36 
37  std::cout << "=== save user histos ===" << std::endl;
38  TFile fout(name.c_str(),"recreate");
39  // write out the histos
40 mime::const_iterator iter;
41  std::cout << "Should save " << theMonitorElements.size() << " MEs" << std::endl;
42  /*
43  for( iter = theMonitorElements.begin(); iter != theMonitorElements.end(); iter++ ){
44  delete (*iter).second;
45  }
46  */
47 }
48 
49 void MonitorElementMgr::openSecondFile( const std::string& name )
50 {
51 
52  theFileRef = new TFile(name.c_str());
53 
54  /* std::vector<std::string> objectNames = theStoreIn->listObjectNames();
55  std::vector<std::string> objectTypes = theStoreIn->listObjectTypes();
56  unsigned int siz = objectNames.size();
57  for( unsigned int ii = 0; ii < siz; ii++ ) {
58  // std::cout << " HISTOS IN FILE " << std::endl;
59 
60  // std::cout << " HISTO: " << objectNames[ii] << " " << objectTypes[ii] << std::endl;
61  }*/
62 }
63 
65 {
66  //still to be implemented for MonitorElements
67 }
68 
70 {
71  const char* str = const_cast<char *>((sih->getName()).c_str());
72  int ih = atoi(str);
73  theMonitorElements[ih] = sih;
74  std::cout << " addME " << sih->getName() << " = " << ih << std::endl;
75 
76  return true;
77 }
78 
80 {
81  MonitorElement* me = 0;
82  mime::const_iterator ite = theMonitorElements.find( ime );
83  if( ite != theMonitorElements.end() ) {
84  me = (*ite).second;
85  } else {
86  std::cerr << "!!!! FATAL ERROR MonitorElement does not exist " << ime << std::endl;
88  }
89  return me;
90 }
91 
93 {
94  std::cout << "still to be added for ME" << std::endl;
95  MonitorElement* me = 0;
96  std::cerr << "!!!! FATAL ERROR MonitorElement does not exist " << std::endl;
98  return me;
99 }
const std::string & getName(void) const
get name of ME
MonitorElement * getMEFromSecondFile(const char *hnam)
bool addME(MonitorElement *ime)
MonitorElement * getME(int ime)
void save(const std::string &name)
void printComparisonResult(int ime)
void openSecondFile(const std::string &name)
tuple cout
Definition: gather_cfg.py:121