CMS 3D CMS Logo

uGTrates.cc
Go to the documentation of this file.
1 #include <vector>
2 #include <string>
3 #include <algorithm>
4 #include <iostream>
5 #include <iomanip>
6 
7 #include "TFile.h"
8 #include "TTree.h"
9 #include "TList.h"
10 #include "TIterator.h"
11 
12 void print_rates(TFile * file) {
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 }
31 
32 
33 int main(int argc, char** argv) {
34  if (argc < 2)
35  return 0;
36 
37  TFile * file = TFile::Open(argv[1]);
39 }
cmsBatch.argv
argv
Definition: cmsBatch.py:279
dir2webdir.argc
argc
Definition: dir2webdir.py:39
print_rates
void print_rates(TFile *file)
Definition: uGTrates.cc:12
tree
Definition: tree.py:1
gather_cfg.cout
cout
Definition: gather_cfg.py:144
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
main
int main(int argc, char **argv)
Definition: uGTrates.cc:33
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:129
dqmiodumpmetadata.counts
counts
Definition: dqmiodumpmetadata.py:25
PixelRegions::End
Definition: PixelRegionContainers.h:43
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17