ATLAS Offline Software
Trigger
TrigConfiguration
TrigConfHLTUtils
util
trigconf_string2hash.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <chrono>
6
#include <iostream>
7
#include <thread>
8
#include <utility>
9
#include <vector>
10
#include "
TrigConfHLTUtils/HLTUtils.h
"
11
12
using namespace
std::chrono;
13
using namespace
TrigConf
;
14
15
int
main
(
int
argc
,
char
*
argv
[]) {
16
if
(
argc
<= 1 ||
argv
[1]==std::string(
"-h"
)) {
17
std::cout <<
"Usage: trigconf_string2hash [IDENT] [-f FILE] [-t THREADS] [-r REPEAT]"
<< std::endl;
18
std::cout <<
" convert identifier to hash"
<< std::endl;
19
std::cout <<
" -f file with hashes produced by hashes2file"
<< std::endl;
20
std::cout <<
" -t number of threads"
<< std::endl;
21
std::cout <<
" -r number of times the file should be processed"
<< std::endl;
22
return
1;
23
}
24
25
// Command line parsing
26
std::string
filename
;
27
size_t
nthreads = 0;
28
size_t
N
= 1;
29
for
(
int
i
=1;
i
<
argc
; ++
i
) {
30
if
(std::string(
argv
[
i
])==
"-f"
) {
31
filename
=
argv
[
i
+1];
32
}
33
else
if
(std::string(
argv
[
i
])==
"-t"
) {
34
nthreads =
std::atoi
(
argv
[
i
+1]);
35
}
36
else
if
(std::string(
argv
[
i
])==
"-r"
) {
37
N
=
std::atoi
(
argv
[
i
+1]);
38
}
39
}
40
41
// Convert string to hash
42
if
(
argc
== 2) {
43
std::cout <<
HLTUtils::string2hash
(
argv
[1]) << std::endl;
44
return
0;
45
}
46
47
// Performance measurement
48
auto
t1
=
high_resolution_clock::now
();
49
if
(!
filename
.empty()) {
50
auto
run
= [&]() {
51
for
(
size_t
i
=0;
i
<
N
;
i
++) HLTUtils::file2hashes(
filename
);
52
};
53
if
(nthreads==0) {
54
run
();
55
}
56
else
{
57
std::cout <<
"Launching "
<< nthreads <<
" threads reading file each "
58
<<
N
<<
" times"
<< std::endl;
59
std::vector<std::thread>
threads
;
60
for
(
size_t
i
= 0;
i
<nthreads; ++
i
)
threads
.emplace_back(
run
);
61
for
(
auto
& thr :
threads
) thr.join();
62
}
63
}
64
auto
t2
=
high_resolution_clock::now
();
65
std::cout << duration_cast<milliseconds>(
t2
-
t1
).count() <<
" ms"
<< std::endl;
66
67
return
0;
68
}
Run3DQTestingDriver.threads
threads
Definition:
Run3DQTestingDriver.py:34
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition:
ALFA_EventTPCnvDict.h:43
run
int run(int argc, char *argv[])
Definition:
ttree2hdf5.cxx:28
JetTiledMap::N
@ N
Definition:
TiledEtaPhiMap.h:44
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition:
Config.h:22
python.handimod.now
now
Definition:
handimod.py:675
HLTUtils.h
lumiFormat.i
int i
Definition:
lumiFormat.py:85
LArCellNtuple.argv
argv
Definition:
LArCellNtuple.py:152
run
Definition:
run.py:1
DQHistogramMergeRegExp.argc
argc
Definition:
DQHistogramMergeRegExp.py:20
main
int main(int argc, char *argv[])
Definition:
trigconf_string2hash.cxx:15
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition:
ALFA_EventTPCnvDict.h:44
HLTUtils.string2hash
def string2hash(string)
Definition:
HLTUtils.py:5
CaloCellTimeCorrFiller.filename
filename
Definition:
CaloCellTimeCorrFiller.py:24
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition:
Control/CxxUtils/Root/StringUtils.cxx:85
Generated on Mon Dec 23 2024 21:21:01 for ATLAS Offline Software by
1.8.18