Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
Utility class to parse command line options.
Definition: JParser.hh:1711
DAQ key hit.
Definition: JDAQKeyHit.hh:19
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
JTYPELIST< Head, MultiHead, Evt >::typelist JAAnetTypes_t
Type list of Monte Carlo data types for I/O.
ROOT TTree parameter settings.
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:318
Auxiliary class for ROOT class selection.
Acoustic event.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:84
Time-of-arrival data from acoustic piezo sensor or hydrophone.
Definition: JToA.hh:25
Auxiliary class for a type holder.
Definition: JType.hh:19
ROOT TTree parameter settings.
then for NAME in JDAQPreamble JDAQChronometer JDAQModuleIdentifier JDAQPMTIdentifier JDAQFrameStatus JDAQUTCExtended JDAQTimeslice JDAQTimesliceHeader JDAQSuperFrame JDAQSuperFrameHeader JDAQHit JDAQSummaryslice JDAQSummarysliceHeader JDAQSummaryFrame JDAQEvent JDAQEventHeader JDAQTriggerCounter JDAQTriggerMask JDAQKeyHit JDAQTriggeredHit
Acoustic fit parameters.
Monte Carlo run header.
Definition: JHead.hh:1234
Auxiliary class for recursive type list generation.
Definition: JTypeList.hh:351
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Acoustic event fit.
JLANG::JTYPELIST< JCOMPASS::JOrientation, JCOMPASS::JEvt >::typelist JCompassTypes_t
Type list of compass data types for I/O.
General purpose messaging.
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:415
#define FATAL(A)
Definition: JMessage.hh:67
JTYPELIST< JAAnetTypes_t, JTriggerTypes_t >::typelist JAllDataTypes_t
Type list of Monte Carlo, trigger and DAQ data types for I/O.
Acoustic trigger parameters.
Utility class to parse command line options.
JTYPELIST< SPE_TimeSlice, ExtendedSummary_TimeSlice, PhysicsEvent >::typelist JAntaresTypes_t
Type list of Antares DAQ data types for I/O.
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
Compass event data types.
Acoustic event.
Acoustic event fit.
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:41
JLANG::JTYPELIST< JACOUSTICS::JEvent, JACOUSTICS::JEvt, JACOUSTICS::JSuperEvt, JACOUSTICS::JTriggerParameters, JACOUSTICS::JFitParameters >::typelist JAcousticsTypes_t
Type list of acoustics data types for I/O.
int debug
debug level