CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
ME_MAP Class Reference

#include <ME_MAP.h>

Public Member Functions

void add (std::string name, MonitorElement *me_p)
 add the ME named "name" to the map More...
 
void clean_old (std::string gif_name)
 clean old eps and gif files by the same name More...
 
void clear ()
 
void create_gif (std::string name)
 create the gif file More...
 
void divide_canvas (int num_elements, TCanvas &canvas)
 divide the canvas according to the number of elements to display More...
 
me_map get_me_map () const
 
 ME_MAP ()
 
int operator== (const ME_MAP &other) const
 
void print (std::string name)
 print the map into a gif named "name" More...
 
 ~ME_MAP ()
 

Protected Attributes

me_map mymap
 a map of pointers to a subset of the MEs in contents: More...
 

Detailed Description

Definition at line 11 of file ME_MAP.h.

Constructor & Destructor Documentation

ME_MAP::ME_MAP ( )
inline

Definition at line 20 of file ME_MAP.h.

References mymap.

21  {
22  mymap.clear();
23  }
me_map mymap
a map of pointers to a subset of the MEs in contents:
Definition: ME_MAP.h:16
ME_MAP::~ME_MAP ( )
inline

Definition at line 25 of file ME_MAP.h.

25 {}

Member Function Documentation

void ME_MAP::add ( std::string  name,
MonitorElement me_p 
)

add the ME named "name" to the map

Definition at line 9 of file ME_MAP.cc.

References mymap.

Referenced by WebInterface::DrawGif().

10 {
11  entry newentry(name, me_p);
12  mymap.insert(newentry);
13 }
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
me_map mymap
a map of pointers to a subset of the MEs in contents:
Definition: ME_MAP.h:16
void ME_MAP::clean_old ( std::string  gif_name)

clean old eps and gif files by the same name

Definition at line 32 of file ME_MAP.cc.

Referenced by print().

33 {
34  ::unlink(gif_name.c_str());
35 }
void ME_MAP::clear ( void  )
inline
void ME_MAP::create_gif ( std::string  name)

create the gif file

Definition at line 55 of file ME_MAP.cc.

References svgfig::canvas(), create_public_lumi_plots::color, edmPickEvents::command, divide_canvas(), i, mymap, and mergeVDriftHistosByStation::name.

Referenced by print().

56 {
57  int num_elements = mymap.size();
58 
59  // If we (still) don't have anything, create empty eps
60  if (num_elements == 0)
61  {
62  std::string command = "cp empty.eps " + name;
63  ::system(command.c_str());
64  // std::cout << "ME_MAP has no elements" << std::endl;
65  return;
66  }
67 
68  else
69  {
70 
71  // std::cout << "ME_MAP has " << mymap.size() << " elements" << std::endl;
72 
73  TCanvas canvas("display");
74 
75  divide_canvas(num_elements, canvas);
76 
77  int i = 0;
78  me_map::iterator it;
79  for (it = mymap.begin(); it != mymap.end(); it++)
80  {
81  // move to the next place in the canvas
82  TVirtualPad * current_pad = canvas.cd(i + 1);
83  Color_t color = TColor::GetColor("000000");
84  if (it->second->hasOtherReport()) color = TColor::GetColor ("#FCD116");
85  if (it->second->hasWarning()) color = TColor::GetColor ("#FF8000");
86  if (it->second->hasError()) color = TColor::GetColor ("#CC0000");
87  current_pad->HighLight(color, kTRUE);
88  it->second->getRootObject()->Draw();
89  i++;
90  }
91 
92  canvas.SaveAs(name.c_str());
93  }
94 }
int i
Definition: DBlmapReader.cc:9
def canvas
Definition: svgfig.py:481
me_map mymap
a map of pointers to a subset of the MEs in contents:
Definition: ME_MAP.h:16
void divide_canvas(int num_elements, TCanvas &canvas)
divide the canvas according to the number of elements to display
Definition: ME_MAP.cc:37
void ME_MAP::divide_canvas ( int  num_elements,
TCanvas &  canvas 
)

divide the canvas according to the number of elements to display

Definition at line 37 of file ME_MAP.cc.

References tablePrinter::rows, and mathSSE::sqrt().

Referenced by create_gif().

38 {
39  if (num_elements < 2)
40  {
41  canvas.Divide(1, 1);
42  return;
43  }
44  if (num_elements == 2)
45  {
46  canvas.Divide(2, 1);
47  return;
48  }
49 
50  int columns = static_cast<int>(sqrt(static_cast<float>(num_elements)));
51  int rows = static_cast<int>(ceil(static_cast<float>(num_elements) / columns));
52  canvas.Divide(columns, rows);
53 }
def canvas
Definition: svgfig.py:481
T sqrt(T t)
Definition: SSEVec.h:46
me_map ME_MAP::get_me_map ( ) const
inline

Definition at line 27 of file ME_MAP.h.

References mymap.

Referenced by operator==().

28  {
29  return mymap;
30  }
me_map mymap
a map of pointers to a subset of the MEs in contents:
Definition: ME_MAP.h:16
int ME_MAP::operator== ( const ME_MAP other) const
inline

Definition at line 32 of file ME_MAP.h.

References get_me_map().

33  {
34  return (get_me_map() == other.get_me_map());
35  }
me_map get_me_map() const
Definition: ME_MAP.h:27
void ME_MAP::print ( std::string  name)

print the map into a gif named "name"

remove the ME named "name" from the map void remove(std::string name);

Definition at line 23 of file ME_MAP.cc.

References clean_old(), and create_gif().

Referenced by WebInterface::printMap().

24 {
25  std::string gif_name = name + ".gif";
26 
27  clean_old(gif_name);
28 
29  create_gif(gif_name);
30 }
void create_gif(std::string name)
create the gif file
Definition: ME_MAP.cc:55
void clean_old(std::string gif_name)
clean old eps and gif files by the same name
Definition: ME_MAP.cc:32

Member Data Documentation

me_map ME_MAP::mymap
protected

a map of pointers to a subset of the MEs in contents:

Definition at line 16 of file ME_MAP.h.

Referenced by add(), clear(), create_gif(), get_me_map(), and ME_MAP().