CMS 3D CMS Logo

Public Member Functions | Protected Attributes

ME_MAP Class Reference

#include <ME_MAP.h>

List of all members.

Public Member Functions

void add (std::string name, MonitorElement *me_p)
 add the ME named "name" to the map
void clean_old (std::string gif_name)
 clean old eps and gif files by the same name
void clear ()
void create_gif (std::string name)
 create the gif file
void divide_canvas (int num_elements, TCanvas &canvas)
 divide the canvas according to the number of elements to display
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"
 ~ME_MAP ()

Protected Attributes

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

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.

    { 
      mymap.clear();
    }
ME_MAP::~ME_MAP ( ) [inline]

Definition at line 25 of file ME_MAP.h.

{}

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().

{
  entry newentry(name, me_p);
  mymap.insert(newentry);
}
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().

{
  ::unlink(gif_name.c_str());
}
void ME_MAP::clear ( void  ) [inline]

Definition at line 55 of file ME_MAP.h.

References mymap.

    {
      mymap.clear();
    }
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().

{ 
  int num_elements = mymap.size();
      
  // If we (still) don't have anything, create empty eps
  if (num_elements == 0) 
    {
      std::string command = "cp empty.eps " + name; 
      ::system(command.c_str());
     // std::cout << "ME_MAP has no elements" << std::endl;
      return;
    }
      
  else
    {
      
     // std::cout << "ME_MAP has " << mymap.size() << " elements" << std::endl;

      TCanvas canvas("display");
                
      divide_canvas(num_elements, canvas);
          
      int i = 0;
      me_map::iterator it;
      for (it = mymap.begin(); it != mymap.end(); it++)
        {
          // move to the next place in the canvas
          TVirtualPad * current_pad = canvas.cd(i + 1);
          Color_t color = TColor::GetColor("000000");
          if (it->second->hasOtherReport()) color = TColor::GetColor ("#FCD116");
          if (it->second->hasWarning()) color = TColor::GetColor ("#FF8000");
          if (it->second->hasError()) color = TColor::GetColor ("#CC0000");
          current_pad->HighLight(color, kTRUE);
          it->second->getRootObject()->Draw();
          i++;
        }
          
      canvas.SaveAs(name.c_str());
    }
}
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().

{
  if (num_elements < 2) 
    {
      canvas.Divide(1, 1);
      return;
    }
  if (num_elements == 2) 
    {
      canvas.Divide(2, 1);
      return;
    }
      
  int columns = static_cast<int>(sqrt(static_cast<float>(num_elements)));
  int rows = static_cast<int>(ceil(static_cast<float>(num_elements) / columns));
  canvas.Divide(columns, rows); 
}
me_map ME_MAP::get_me_map ( ) const [inline]

Definition at line 27 of file ME_MAP.h.

References mymap.

Referenced by operator==().

    {
      return mymap;
    }
int ME_MAP::operator== ( const ME_MAP other) const [inline]

Definition at line 32 of file ME_MAP.h.

References get_me_map().

    {
      return (get_me_map() == other.get_me_map());
    }
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().

{
  std::string gif_name = name + ".gif";
      
  clean_old(gif_name);
      
  create_gif(gif_name);
}

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().