HGCal Test Beam
03a93d6239a951948e06fb3ef8dae4cbdebfad30
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
CondObjects
test
testHGCalCondObjectTextIO.cc
Go to the documentation of this file.
1
#include "HGCal/CondObjects/interface/HGCalCondObjectTextIO.h"
2
#include "HGCal/CondObjects/interface/HGCalTBNumberingScheme.h"
3
#include <stdio.h>
4
#include <stdlib.h>
5
6
#include <unistd.h>
7
8
int
main
(
int
argc,
char
*argv[])
9
{
10
std::string mapfile_in, valuefile_in;
11
int
opt;
12
13
while
((opt = getopt(argc, argv,
"m:v:"
)) != -1) {
14
switch
(opt) {
15
case
'm'
:
16
mapfile_in = optarg;
17
break
;
18
case
'v'
:
19
valuefile_in = optarg;
20
break
;
21
default
:
/* '?' */
22
fprintf(stderr,
"Usage: %s [-m mapfile] [-v single_value_file]\n"
,
23
argv[0]);
24
exit(EXIT_FAILURE);
25
}
26
}
27
28
HGCalCondObjectTextIO
io(
HGCalTBNumberingScheme::scheme
());
29
30
if
(!mapfile_in.empty()) {
31
HGCalElectronicsMap
emap;
32
printf(
"Reading electronics map from '%s'..."
, mapfile_in.c_str());
33
fflush(stdout);
34
bool
ok = io.
load
(mapfile_in, emap);
35
if
(ok) printf(
"OK\n"
);
36
else
printf(
"ERROR\n"
);
37
printf(
"Rewriting electronics map to '%s.out'..."
, mapfile_in.c_str());
38
fflush(stdout);
39
ok = io.
store
(mapfile_in +
".out"
, emap);
40
if
(ok) printf(
"OK\n"
);
41
else
printf(
"ERROR\n"
);
42
}
43
44
if
(!valuefile_in.empty()) {
45
HGCalCondObjectContainer<float>
values;
46
printf(
"Reading single values from '%s'..."
, valuefile_in.c_str());
47
fflush(stdout);
48
bool
ok = io.
load
(valuefile_in, values);
49
if
(ok) printf(
"OK\n"
);
50
else
printf(
"ERROR\n"
);
51
printf(
"Rewriting single values to '%s.out'..."
, valuefile_in.c_str());
52
fflush(stdout);
53
ok = io.
store
(valuefile_in +
".out"
, values);
54
if
(ok) printf(
"OK\n"
);
55
else
printf(
"ERROR\n"
);
56
}
57
58
59
return
0;
60
}
HGCalCondObjectTextIO::store
bool store(const std::string &filename, const HGCalCondObjectContainer< float > &)
saves condition to file
Definition:
HGCalCondObjectTextIO.cc:67
HGCalTBNumberingScheme::scheme
static const HGCalCondObjectNumberingScheme * scheme()
Definition:
HGCalTBNumberingScheme.h:20
HGCalCondObjectTextIO
Definition:
HGCalCondObjectTextIO.h:16
HGCalCondObjectTextIO::load
bool load(const std::string &filename, HGCalCondObjectContainer< float > &)
load conditions from file
Definition:
HGCalCondObjectTextIO.cc:21
HGCalCondObjectContainer
Definition:
HGCalCondObjectContainer.h:69
main
int main(int argc, char *argv[])
Definition:
testHGCalCondObjectTextIO.cc:8
HGCalElectronicsMap
provides the conversion between electronics Id to DetId
Definition:
HGCalElectronicsMap.h:17
Generated on Mon Aug 29 2016 11:29:32 for HGCal Test Beam by
1.8.5