ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
HeavyIonPhys
HIClusterGeoWeights
util
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
}
h
Header file for AthHistogramAlgorithm.
main
int main()
Definition
hello.cxx:18
run
Definition
run.py:1
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
Generated on
for ATLAS Offline Software by
1.14.0