ATLAS Offline Software
Functions
makeHIRunIndex.cxx File Reference
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <memory>
#include <vector>
#include "TFile.h"
#include "TH1I.h"
Include dependency graph for makeHIRunIndex.cxx:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file makeHIRunIndex.cxx.

14  {
15  if (argc != 2) {
16  std::cout << "Syntax: " << argv[0] << " GoodRunList.xml" << std::endl;
17  return -1;
18  }
19 
20  // get rid of everything except that one line with all the run numbers
21  FILE *runList =
22  popen(Form("grep '<Metadata Name=\"RunList\">' %s | sed -e 's/<Metadata "
23  "Name=\"RunList\">//' -e 's/<\\/Metadata>//' | sed 's/,/ /g' ",
24  argv[1]),
25  "r");
26 
27  if (!runList) {
28  return -1;
29  }
30 
31  int run;
32  std::vector<int> runs;
33  while (fscanf(runList, "%d", &run) != EOF) {
34  runs.push_back(run);
35  }
36  pclose(runList);
37 
38  std::sort(runs.begin(), runs.end());
39  unsigned int size = runs.size();
40 
41  std::unique_ptr<TFile> f(TFile::Open("cluster.geo.RUNINDEX.root", "recreate"));
42  auto h=std::make_unique<TH1I>("h1_run_index", "h1_run_index", size, 0, size);
43  for (unsigned int i = 0; i < size; i++) {
44  h->SetBinContent(i + 1, runs.at(i));
45  }
46  h->Write();
47 
48  std::cout << "Created output file cluster.geo.RUNINDEX.root" << std::endl;
49  return 0;
50 }
find_tgc_unfilled_channelids.runs
int runs
Definition: find_tgc_unfilled_channelids.py:10
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
hist_file_dump.f
f
Definition: hist_file_dump.py:140
run
Definition: run.py:1
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:19
h
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623