ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DataQualityInterfaces
src
han_config_gen.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 <iostream>
6
#include <string>
7
#include <cstdlib>
8
9
#include "
DataQualityInterfaces/HanConfig.h
"
10
#include "
DataQualityInterfaces/ConditionsSingleton.h
"
11
12
#include "
CxxUtils/checker_macros.h
"
13
#include "
CxxUtils/ubsan_suppress.h
"
14
#include "TInterpreter.h"
15
16
namespace
{
17
18
int
usage
(
const
std::string& command_name,
int
exit_code );
19
20
struct
CmdLineArgs {
21
int
parse
(
int
argc,
char
*argv[] );
22
23
std::string m_connectionString =
"sqlite://;schema=/afs/cern.ch/user/a/atlasdqm/dqmdisk1/cherrypy-devel/RefDB.db;dbname=REFDB"
;
24
long
m_runNumber = 2147483646;
25
bool
m_bulk =
false
;
26
27
std::string command;
28
std::string mconfig;
29
std::string conds;
30
};
31
32
}
// unnamed namespace
33
34
35
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc,
char
*argv[] )
36
{
37
CxxUtils::ubsan_suppress
([]() { TInterpreter::Instance(); });
38
39
CmdLineArgs arg;
40
int
rc
= arg.parse( argc, argv );
41
if
(
rc
!=0)
return
rc
;
42
43
std::string infileName( arg.mconfig );
44
dqi::ConditionsSingleton::getInstance
().
setCondition
(arg.conds);
45
//std::cout<<__PRETTY_FUNCTION__<<"Input Conditions="<<dqi::ConditionsSingleton::getInstance().getCondition()
46
//<<std::endl;
47
std::string outfileName;
48
49
std::string::size_type s = infileName.size();
50
std::string::size_type p = infileName.rfind(
'.'
, s );
51
outfileName = infileName.substr( 0, p );
52
outfileName +=
".hcfg"
;
53
54
dqi::HanConfig
config;
55
config.AssembleAndSave( infileName, outfileName, arg.m_connectionString, arg.m_runNumber, arg.m_bulk);
56
return
0;
57
}
58
59
60
// ************************************************************
61
// Private Functions
62
// ************************************************************
63
64
namespace
{
65
66
int
CmdLineArgs::parse(
int
argc,
char
*argv[] )
67
{
68
command =
argv
[0];
69
if
( argc > 10 )
return
usage
( command, 1 );
70
if
( argc < 2 )
return
usage
( command, 0 );
71
72
mconfig =
argv
[1];
73
74
if
(argc >= 3) {
75
int
ic
= 2;
76
while
(ic < argc) {
77
int
ir
=
argc
-
ic
;
78
std::string par0 =
argv
[
ic
];
79
if
(par0 ==
"-c"
) {
80
if
(
ir
> 1) {
81
m_connectionString =
argv
[
ic
+ 1];
82
std::cout <<
"Setting DB connection string to "
<< m_connectionString << std::endl;
83
++
ic
;
84
}
85
}
else
if
(par0 ==
"-r"
) {
86
if
(
ir
> 1) {
87
try
{
88
m_runNumber = std::stol(argv[ic + 1]);
89
std::cout <<
"Setting run number to "
<< m_runNumber << std::endl;
90
++
ic
;
91
}
catch
(std::exception& e) {
92
std::cout <<
"Error with input arguments, specified run "
<<
argv
[
ic
+1] <<
" not a long"
<<
'\n'
;
93
}
94
}
95
}
else
if
(par0 ==
"-b"
) {
96
if
(
ir
> 1) {
97
m_bulk = (strcmp(argv[ic+1],
"true"
) == 0);
98
std::cout <<
"Setting bulk processing mode to "
<< (m_bulk ?
"true"
:
"false"
) << std::endl;
99
++
ic
;
100
}
101
}
else
{
102
conds =
argv
[
ic
];
103
}
104
++
ic
;
105
}
106
}
107
return
0;
108
}
109
110
111
int
usage
(
const
std::string& command_name,
int
exit_code )
112
{
113
std::string
message
;
114
message
+=
"\n"
;
115
message
+=
"This program takes as an argument the name of a file containing\n"
;
116
message
+=
"a MiniConfig configuration and produces a similarly named Root file\n"
;
117
message
+=
"containing a configuration for the \'han\' application\n"
;
118
119
std::string::size_type
s
= command_name.size();
120
std::string::size_type
p
= command_name.rfind(
'/'
, s );
121
std::string short_name = command_name.substr( p+1, s );
122
123
std::cout <<
"\n"
;
124
std::cout <<
"Usage: "
<< short_name <<
" <filename>\n"
;
125
std::cout <<
message
<<
"\n"
;
126
return
exit_code;
127
}
128
129
130
}
// unnamed namespace
ConditionsSingleton.h
main
int main(int, char **)
Main class for all the CppUnit test classes.
Definition
CppUnit_SGtestdriver.cxx:141
HanConfig.h
rc
static Double_t rc
Definition
LArPhysWaveHECTool.cxx:37
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition
checker_macros.h:212
dqi::ConditionsSingleton::getInstance
static ConditionsSingleton & getInstance()
Definition
ConditionsSingleton.cxx:23
dqi::ConditionsSingleton::setCondition
void setCondition(const std::string &c)
Definition
ConditionsSingleton.cxx:28
dqi::HanConfig
Definition
HanConfig.h:48
parse
std::map< std::string, std::string, std::less<> > parse(const std::string &list)
Definition
egammaLayerRecalibTool.cxx:1180
ir
int ir
counter of the current depth
Definition
fastadd.cxx:49
usage
StatusCode usage()
Definition
fbtTestToyMC.cxx:1168
CxxUtils::ubsan_suppress
void ubsan_suppress(void(*func)())
Helper for suppressing ubsan warnings.
Definition
ubsan_suppress.cxx:69
DQHistogramMergeRegExp.argc
argc
Definition
DQHistogramMergeRegExp.py:19
LArCellNtuple.argv
argv
Definition
LArCellNtuple.py:167
ReweightUtils.message
message
Definition
ReweightUtils.py:15
grepfile.ic
int ic
Definition
grepfile.py:33
python.SystemOfUnits.s
float s
Definition
SystemOfUnits.py:147
python.utils.AtlRunQueryDQUtils.p
p
Definition
AtlRunQueryDQUtils.py:209
ubsan_suppress.h
Helper for suppressing ubsan warnings.
Generated on
for ATLAS Offline Software by
1.17.0