Jpp  master_rocky
the software that should make you happy
JPrintRootClass.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
9 
10 #include "JAAnet/JHead.hh"
11 
12 #include "JDAQ/JDAQTimesliceIO.hh"
13 #include "JDAQ/JDAQEventIO.hh"
15 
17 
20 
21 #include "JAcoustics/JToA.hh"
22 #include "JAcoustics/JEvent.hh"
23 #include "JAcoustics/JEvt.hh"
24 #include "JAcoustics/JSuperEvt.hh"
27 #include "JAcoustics/JSupport.hh"
28 
29 #include "JCompass/JEvt.hh"
30 #include "JCompass/JSupport.hh"
31 
32 #include "JSupport/JSupport.hh"
33 
34 #include "JROOT/JRootClass.hh"
36 
37 #include "Jeep/JParser.hh"
38 #include "Jeep/JMessage.hh"
39 
40 namespace {
41 
42  using namespace JPP;
43 
44  /**
45  * Auxiliary class for printing class information.
46  */
47  struct JPrinter_t :
48  public JROOTClassSelection
49  {
50  /**
51  * Constructor.
52  *
53  * \param out output stream
54  * \param selection selection
55  */
56  JPrinter_t(std::ostream& out, const JROOTClassSelection& selection) :
57  JROOTClassSelection(selection),
58  out(out)
59  {}
60 
61 
62  /**
63  * Print class infomration.
64  *
65  * \param type data type
66  * \return this printer
67  */
68  template<class T>
69  void operator()(const JType<T>& type) const
70  {
71  using namespace std;
72  using namespace JPP;
73 
74  if (static_cast<const JROOTClassSelection&>(*this)(type)) {
75  JRootClass(type).print(out);
76  }
77  }
78 
79  protected:
80  std::ostream& out;
81  };
82 }
83 
84 
85 /**
86  * \file
87  * Auxiliary program to print ROOT class information.
88  *
89  * The name of the data structure following option -C should be preceded by a '+' or '-'
90  * to add or remove data types in the output, respectively.\n
91  * In this, ROOT wildcards are accepted (e.g. <tt>-C -\\\.\\*</tt> will remove all data types).
92  * \author mdejong
93  */
94 int main(int argc, char **argv)
95 {
96  using namespace std;
97  using namespace JPP;
98 
99  typedef JTYPELIST<JAllDataTypes_t,
109  JCOMPASS::JQuaternion>::typelist typelist;
110 
111  JPrinter_t printer(cout, getROOTClassSelection<typelist>(true));
112  int debug;
113 
114  try {
115 
116  JParser<> zap("Auxiliary program to print ROOT class information.");
117 
118  zap['C'] = make_field(printer,
119  "Precede name of data structure by a '+' or '-' "
120  "to add or remove data types in the output, respectively."
121  "\nROOT wildcards are accepted.") = JPARSER::initialised();
122  zap['d'] = make_field(debug) = 1;
123 
124  zap(argc, argv);
125  }
126  catch(const exception& error) {
127  FATAL(error.what() << endl);
128  }
129 
130  for_each(printer, JType<typelist>());
131 }
Acoustic event.
Acoustic event fit.
ROOT TTree parameter settings.
JLANG::JTYPELIST< JACOUSTICS::JEvent, JACOUSTICS::JEvt, JACOUSTICS::JSuperEvt, JACOUSTICS::JTriggerParameters, JACOUSTICS::JFitParameters >::typelist JAcousticsTypes_t
Type list of acoustics data types for I/O.
Acoustic trigger parameters.
Compass event data types.
ROOT TTree parameter settings.
JLANG::JTYPELIST< JCOMPASS::JOrientation, JCOMPASS::JEvt >::typelist JCompassTypes_t
Type list of compass data types for I/O.
Acoustic fit parameters.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
int main(int argc, char **argv)
Acoustic event fit.
ROOT TTree parameter settings of various packages.
JTYPELIST< JAAnetTypes_t, JTriggerTypes_t >::typelist JAllDataTypes_t
Type list of Monte Carlo, trigger and DAQ data types for I/O.
JTYPELIST< SPE_TimeSlice, ExtendedSummary_TimeSlice, PhysicsEvent >::typelist JAntaresTypes_t
Type list of Antares DAQ data types for I/O.
JTYPELIST< Head, MultiHead, Evt >::typelist JAAnetTypes_t
Type list of Monte Carlo data types for I/O.
Acoustic event.
Monte Carlo run header.
Definition: JHead.hh:1236
Utility class to parse command line options.
Definition: JParser.hh:1698
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:415
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Time-of-arrival data from acoustic piezo sensor or hydrophone.
Definition: JToA.hh:26
Auxiliary class for recursive type list generation.
Definition: JTypeList.hh:351
Auxiliary class for a type holder.
Definition: JType.hh:19
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68
Auxiliary class for ROOT class selection.
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:43
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:318