ATLAS Offline Software
makeHIRunIndex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <algorithm>
6 #include <cstdio>
7 #include <iostream>
8 #include <memory>
9 #include <vector>
10 
11 #include "TFile.h"
12 #include "TH1I.h"
13 
14 int main(int argc, char **argv) {
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 }
main
int main(int argc, char **argv)
Definition: makeHIRunIndex.cxx:14
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