test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
uGTrates.cc File Reference
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include "TFile.h"
#include "TTree.h"
#include "TList.h"
#include "TIterator.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void print_rates (TFile *file)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file uGTrates.cc.

References mergeVDriftHistosByStation::file, and print_rates().

33  {
34  if (argc < 2)
35  return 0;
36 
37  TFile * file = TFile::Open(argv[1]);
38  print_rates(file);
39 }
void print_rates(TFile *file)
Definition: uGTrates.cc:12
tuple argc
Definition: dir2webdir.py:38
void print_rates ( TFile *  file)

Definition at line 12 of file uGTrates.cc.

References HLT_25ns10e33_v2_cff::alias, autoCond::aliases, gather_cfg::cout, dqm-mbProfile::log, mergeVDriftHistosByStation::name, cscdqm::h::names, and MainPageGenerator::tree.

Referenced by main().

12  {
13  TTree * tree = (TTree *) file->Get("l1uGTTree/L1uGTTree");
14 
15  // extract the list of Aliases
16  std::vector<std::string> names;
17  TList * aliases = tree->GetListOfAliases();
18  TIter iter(aliases);
19  std::for_each(iter.Begin(), TIter::End(), [&](TObject* alias){ names.push_back(alias->GetName()); } );
20 
21  unsigned long long entries = tree->GetEntries();
22  if (entries == 0)
23  return;
24 
25  int digits = std::log(entries) / std::log(10) + 1;
26  for (auto const & name: names) {
27  unsigned long long counts = tree->GetEntries(name.c_str());
28  std::cout << std::setw(digits) << counts << " / " << std::setw(digits) << entries << " " << name << std::endl;
29  }
30 }
dictionary aliases
Definition: autoCond.py:46
static const HistoName names[]
tuple cout
Definition: gather_cfg.py:145