ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DataQualityInterfaces
src
han_config_print.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
7
8
#include <iostream>
9
#include <string>
10
#include <cstdlib>
11
12
#include <TFile.h>
13
#include <TKey.h>
14
15
#include "
CxxUtils/checker_macros.h
"
16
17
#include "
DataQualityInterfaces/HanConfigGroup.h
"
18
#include "
DataQualityInterfaces/HanConfigMetadata.h
"
19
#include "
DataQualityInterfaces/ConditionsSingleton.h
"
20
21
namespace
{
22
23
int
usage
(
const
std::string& command_name,
int
exit_code );
24
25
struct
CmdLineArgs {
26
int
parse
(
int
argc,
char
*argv[] );
27
28
std::string command;
29
std::string hconfig;
30
std::string conditions;
31
};
32
33
}
// unnamed namespace
34
35
36
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc,
char
*argv[] )
37
{
38
CmdLineArgs arg;
39
int
rc
= arg.parse( argc, argv );
40
if
(
rc
!=0)
return
rc
;
41
42
dqi::ConditionsSingleton::getInstance
().
setCondition
(arg.conditions);
43
//std::cout<<__PRETTY_FUNCTION__<<"Input Conditions="<<dqi::ConditionsSingleton::getInstance().getCondition()
44
// <<std::endl;
45
std::string configName( arg.hconfig );
46
TFile* config = TFile::Open( configName.c_str() );
47
if
( config == 0 ) {
48
std::cerr <<
"Cannot open file \""
<< configName <<
"\"\n"
;
49
return
1;
50
}
51
52
TKey* key = config->FindKey(
"HanMetadata"
);
53
if
(key) {
54
std::cout <<
"Metadata:\n"
;
55
TDirectory* metadatadir =
dynamic_cast<
TDirectory*
>
(key->ReadObj());
56
if
(! metadatadir) {
57
std::cerr <<
"Metadata directory is malformed\n"
;
58
return
1;
59
}
60
dqi::HanConfigMetadata
* hcm(0); TKey* mdkey(0);
61
TIter next(metadatadir->GetListOfKeys());
62
while
((mdkey =
dynamic_cast<
TKey*
>
(next()))) {
63
metadatadir->GetObject(mdkey->GetName(), hcm);
64
if
(hcm) {
65
std::cout << *hcm << std::endl;
66
}
67
}
68
delete
metadatadir;
69
}
70
71
key = config->FindKey(
"top_level"
);
72
if
( key == 0 ) {
73
std::cerr <<
"Cannot find configuration in file \""
<< configName <<
"\"\n"
;
74
return
1;
75
}
76
77
dqi::HanConfigGroup
* g =
dynamic_cast<
dqi::HanConfigGroup
*
>
( key->ReadObj() );
78
if
( g == 0 ) {
79
std::cerr <<
"Cannot find configuration in file \""
<< configName <<
"\"\n"
;
80
return
1;
81
}
82
83
std::cout << g;
84
return
0;
85
}
86
87
88
// ************************************************************
89
// Private Functions
90
// ************************************************************
91
92
namespace
{
93
94
int
CmdLineArgs::parse(
int
argc,
char
*argv[] )
95
{
96
command =
argv
[0];
97
if
( argc > 3 )
return
usage
( command, 1 );
98
if
( argc < 2 )
return
usage
( command, 0 );
99
100
hconfig =
argv
[1];
101
if
(argc==3)conditions =
argv
[2];
102
return
0;
103
}
104
105
106
int
usage
(
const
std::string& command_name,
int
exit_code )
107
{
108
std::string
message
;
109
message
+=
"\n"
;
110
message
+=
"This program takes as an argument the name of a \'han\' configuration\n"
;
111
message
+=
"file and prints the configuration.\n"
;
112
113
std::string::size_type
s
= command_name.size();
114
std::string::size_type
p
= command_name.rfind(
'/'
, s );
115
std::string short_name = command_name.substr( p+1, s );
116
117
std::cout <<
"\n"
;
118
std::cout <<
"Usage: "
<< short_name <<
" <filename>\n"
;
119
std::cout <<
message
<<
"\n"
;
120
return
exit_code;
121
}
122
123
124
}
// unnamed namespace
ConditionsSingleton.h
main
int main(int, char **)
Main class for all the CppUnit test classes.
Definition
CppUnit_SGtestdriver.cxx:141
HanConfigGroup.h
HanConfigMetadata.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::HanConfigGroup
Definition
HanConfigGroup.h:23
dqi::HanConfigMetadata
Definition
HanConfigMetadata.h:22
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
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