HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
testcfg.cxx
Go to the documentation of this file.
1 /*
2  * Test HoarpoConfig and interface to libconfig++8
3  */
4 #include <cstdlib>
5 #include <cstdio>
6 #include <iostream>
7 
8 #include "HarpoConfig.h"
9 #include "HarpoReader.h"
10 #include "HarpoRunHeader.h"
11 #include "HarpoEvent.h"
12 
13 int main(int argc, char **argv)
14 {
15  HarpoConfig *cfg = new HarpoConfig(argc,argv);
16 
17  cfg->Init(); // Do work
18 
19  cfg->print();
20 
21  Double_t pi = 4.0;
22  Long64_t twoa = 2;
23  Long64_t twos = 2;
24 
25  if ( ! cfg->Lookup("analyse.two",twoa) ) std::cout << "No analyse.two" << std::endl;
26  if ( ! cfg->Lookup("analyse.misc.pi",pi) ) std::cout << "No analyse pi" << std::endl;
27  if ( ! cfg->Lookup("sym.two",twos) ) std::cout << "No sym.two" << std::endl;
28  if ( ! cfg->Lookup("sym.four",twos) ) std::cout << "No sym.four" << std::endl;
29 
30  std::cout << "Two some times " << twoa << ", even raise to " << twos
31  << ", but Pi rest " << pi << std::endl;
32 
33  delete cfg;
34  return 0;
35 }
36 
37 
38 
int main(int argc, char **argv)
Definition: testcfg.cxx:13
void Init()
Definition: HarpoConfig.h:63
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
void print() const
Read config file in libconfig format.
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50