CMS Web-Based Monitoring

CMS Web-Based Monitoring (WBM):

You can also find trigger rate vs. PU plots:

Update: WBM has been succeeded by OMS (Online Monitoring System):

If needed, you can still access the offline edition of WBM:


Concatenate two C++ maps of vectors

To concatenate two C++ std::vectors, it is as simple as:

vec2.insert(vec2.end(), vec1.begin(), vec1.end());

Likewise, to concatenate two std::maps:

map2.insert(map1.begin(), map1.end());

Note that when a key is present in both maps, the old value is overwritten by the new value. What if you have two maps of vectors, and when the same key exists in both maps, you want to keep all the values? The following is my implementation:

// Check type for map of vector
template<typename>
struct is_map_of_vectors : public std::false_type { };

template<typename T1, typename T2>
struct is_map_of_vectors<std::map<T1, std::vector<T2> > > : public std::true_type { };

// Merge a map of vectors (map1) into another map of vectors (map2)
template<typename Map>
void concatenate_maps_of_vectors(Map& map1, Map& map2) {
  typedef typename Map::iterator Iterator;
  typedef typename Map::mapped_type Container;

  Iterator first = map1.begin();
  Iterator last = map1.end();

  for (; first != last; ++first) {
    std::pair<Iterator, bool> ins = map2.insert(*first);
    if (!ins.second) {  // if insertion into map2 was not successful
      if (is_map_of_vectors<Map>::value) {  // special case for map of vectors
        Container* vec1 = &(first->second);
        Container* vec2 = &(ins.first->second);
        vec2->insert(vec2->end(), vec1->begin(), vec1->end());
      } else {
        // do nothing
      }
    }
  }
}

CMS Plot Styles

Instructions for CMS plot styles:

To use the ROOT .C macros in pyROOT, the simplest way is:

from ROOT import gROOT

# Set TDR styles
gROOT.LoadMacro("tdrstyle.C")
gROOT.ProcessLine("setTDRStyle();")

# Add CMS text
gROOT.LoadMacro("CMS_lumi.C")
gROOT.ProcessLine("CMS_lumi(c1);")