Jpp  15.0.1-rc.2-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JRootClass.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "JROOT/JRootClass.hh"
6 
8 #include "JAAnet/JHead.hh"
9 
10 #include "Jeep/JPrint.hh"
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 namespace {
15 
16  using namespace JPP;
17 
18 /**
19  * Print data member.
20  *
21  * \param OUT output stream
22  * \param T data member
23  */
24 #define PRINT(OUT, T) \
25  do { OUT \
26  << std::setw(24) << left << #T << " --> " \
27  << std::setw(16) << left << (getDataMember(T) != NULL ? getDataMember(T)->GetName() : "?") << std::endl; } while (0)
28 
29 
30  /**
31  * Test data member.
32  *
33  * \param OUT output stream
34  * \param T data member
35  */
36 #define TEST(T) \
37  (getClassname(#T) == (getDataMember(T) != NULL ? getDataMember(T)->GetName() : "?"))
38 }
39 
40 /**
41  * \file
42  *
43  * Program to test JROOT::JRootClass.
44  * \author mdejong
45  */
46 int main(int argc, char **argv)
47 {
48  using namespace std;
49  using namespace JPP;
50 
51  int debug;
52 
53  try {
54 
55  JParser<> zap("Program to test JRootClass.");
56 
57  zap['d'] = make_field(debug) = 3;
58 
59  zap(argc, argv);
60  }
61  catch(const exception& error) {
62  FATAL(error.what() << endl);
63  }
64 
65  if (debug >= debug_t) {
66  PRINT(cout, &JHead::start_run);
67  PRINT(cout, &JHead::detector);
68  PRINT(cout, &JHead::physics);
69  PRINT(cout, &JHead::simul);
70  PRINT(cout, &JHead::cut_primary);
71  PRINT(cout, &JHead::cut_seamuon);
72  PRINT(cout, &JHead::spectrum);
73  PRINT(cout, &JHead::can);
74  PRINT(cout, &JHead::genvol);
75  PRINT(cout, &JHead::coord_origin);
76  PRINT(cout, &JHead::livetime);
77  PRINT(cout, &JHead::seabottom);
78  }
79 
80  ASSERT( TEST(&JHead::start_run) );
82  ASSERT( TEST(&JHead::physics) );
83  ASSERT( TEST(&JHead::simul) );
84  ASSERT( TEST(&JHead::cut_primary) );
85  ASSERT( TEST(&JHead::cut_seamuon) );
86  ASSERT( TEST(&JHead::spectrum) );
87  ASSERT( TEST(&JHead::can) );
88  ASSERT( TEST(&JHead::genvol) );
89  ASSERT( TEST(&JHead::coord_origin) );
90  ASSERT( TEST(&JHead::livetime) );
91  ASSERT( TEST(&JHead::seabottom) );
92 
93  return 0;
94 }
Utility class to parse command line options.
Definition: JParser.hh:1500
debug
Definition: JMessage.hh:29
int main(int argc, char *argv[])
Definition: Main.cc:15
#define TEST(T)
Test data member.
Definition: JRootClass.cc:36
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
do set_variable DETECTOR_TXT $WORKDIR detector
#define PRINT(OUT, T)
Print data member.
Definition: JRootClass.cc:24