ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DataQualityInterfaces
src
han.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
9
10
#include <iostream>
11
#include <string>
12
#include <cstdlib>
13
14
#include "TPython.h"
15
#include "
CxxUtils/checker_macros.h
"
16
#include "
DataQualityInterfaces/HanApp.h
"
17
#include "
DataQualityInterfaces/ConditionsSingleton.h
"
18
19
namespace
{
20
21
int
usage
(
const
std::string& command_name,
int
exit_code );
22
23
struct
CmdLineArgs {
24
int
parse
(
int
argc,
char
*argv[] );
25
26
std::string command;
27
std::string hconfig;
28
std::string data;
29
std::string path;
30
std::string output;
31
std::string cmdlineConditions;
32
};
33
34
}
// unnamed namespace
35
36
37
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc,
char
*argv[] )
38
{
39
TPython::Exec(
"import logging; logging.basicConfig()"
);
40
CmdLineArgs arg;
41
int
rc
= arg.parse( argc, argv );
42
if
(
rc
!=0)
return
rc
;
43
44
std::string inputName( arg.data );
45
std::string configName( arg.hconfig );
46
std::string pathName( arg.path );
47
std::string outputName;
48
if
( arg.output !=
""
) {
49
outputName = arg.output;
50
}
51
else
{
52
std::string::size_type s = inputName.size();
53
std::string::size_type p = inputName.rfind(
'.'
, s );
54
outputName = inputName.substr( 0, p );
55
outputName +=
"_han.root"
;
56
}
57
58
dqi::ConditionsSingleton::getInstance
().
setCondition
(arg.cmdlineConditions);
59
if
(arg.cmdlineConditions !=
""
) {
60
std::cout<<
"Input Conditions="
<<
dqi::ConditionsSingleton::getInstance
().
getCondition
()
61
<<std::endl;
62
}
63
dqi::HanApp
app;
64
return
app.
Analyze
( configName, inputName, outputName, pathName );
65
}
66
67
68
// ************************************************************
69
// Private Functions
70
// ************************************************************
71
72
namespace
{
73
74
int
usage
(
const
std::string& command_name,
int
exit_code )
75
{
76
std::string
message
;
77
message
+=
"\n"
;
78
message
+=
"This program takes as arguments the name of a configuration\n"
;
79
message
+=
"file and the name of the data file to be analyzed.\n"
;
80
message
+=
"One may optionally specify a path within the data file to analyze\n"
;
81
message
+=
"and additionally the name of the file with the output results.\n"
;
82
message
+=
"If no output file is specified, a name based on the input is used.\n"
;
83
84
std::string::size_type
s
= command_name.size();
85
std::string::size_type
p
= command_name.rfind(
'/'
, s );
86
std::string short_name = command_name.substr( p+1, s );
87
88
std::cout <<
"\n"
;
89
std::cout <<
"Usage: "
<< short_name <<
" <config_file> <data_file> [path [results_file]]\n"
;
90
std::cout <<
message
<<
"\n"
;
91
return
exit_code;
92
}
93
94
95
int
CmdLineArgs::parse(
int
argc,
char
*argv[] )
96
{
97
command =
argv
[0];
98
if
( argc > 6 )
return
usage
( command, 1 );
99
if
( argc < 3 )
return
usage
( command, 0 );
100
101
hconfig =
argv
[1];
102
data =
argv
[2];
103
path = (
argc
== 4 ||
argc
== 5 ||
argc
==6) ? argv[3] :
""
;
104
output = (
argc
== 5 ||
argc
== 6) ? argv[4] :
""
;
105
cmdlineConditions = (
argc
== 6) ? argv[5] :
""
;
106
return
0;
107
}
108
109
}
// unnamed namespace
110
ConditionsSingleton.h
main
int main(int, char **)
Main class for all the CppUnit test classes.
Definition
CppUnit_SGtestdriver.cxx:141
HanApp.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::ConditionsSingleton::getCondition
const std::string & getCondition() const
Definition
ConditionsSingleton.cxx:32
dqi::HanApp
Definition
HanApp.h:21
dqi::HanApp::Analyze
virtual int Analyze(const std::string &configName_, const std::string &inputName_, const std::string &outputName_, const std::string &path_="")
Definition
HanApp.cxx:86
parse
std::map< std::string, std::string, std::less<> > parse(const std::string &list)
Definition
egammaLayerRecalibTool.cxx:1180
usage
StatusCode usage()
Definition
fbtTestToyMC.cxx:1168
DQHistogramMergeRegExp.argc
argc
Definition
DQHistogramMergeRegExp.py:19
LArCellNtuple.argv
argv
Definition
LArCellNtuple.py:167
ReweightUtils.message
message
Definition
ReweightUtils.py:15
python.SystemOfUnits.s
float s
Definition
SystemOfUnits.py:147
python.utils.AtlRunQueryDQUtils.p
p
Definition
AtlRunQueryDQUtils.py:209
Generated on
for ATLAS Offline Software by
1.17.0