HGCal Test Beam  03a93d6239a951948e06fb3ef8dae4cbdebfad30
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
29 
30  if (!mapfile_in.empty()) {
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()) {
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 }
bool store(const std::string &filename, const HGCalCondObjectContainer< float > &)
saves condition to file
static const HGCalCondObjectNumberingScheme * scheme()
bool load(const std::string &filename, HGCalCondObjectContainer< float > &)
load conditions from file
int main(int argc, char *argv[])
provides the conversion between electronics Id to DetId