Jpp  18.6.0-rc.1
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/JEvent.hh"
22 #include "JAcoustics/JEvt.hh"
23 #include "JAcoustics/JSuperEvt.hh"
26 #include "JAcoustics/JSupport.hh"
27 
28 #include "JCompass/JEvt.hh"
29 #include "JCompass/JSupport.hh"
30 
31 #include "JSupport/JSupport.hh"
32 
33 #include "JROOT/JRootClass.hh"
35 
36 #include "Jeep/JParser.hh"
37 #include "Jeep/JMessage.hh"
38 
39 namespace {
40 
41  using namespace JPP;
42 
43  /**
44  * Auxiliary class for printing class information.
45  */
46  struct JPrinter_t :
47  public JROOTClassSelection
48  {
49  /**
50  * Constructor.
51  *
52  * \param out output stream
53  * \param selection selection
54  */
55  JPrinter_t(std::ostream& out, const JROOTClassSelection& selection) :
56  JROOTClassSelection(selection),
57  out(out)
58  {}
59 
60 
61  /**
62  * Print class infomration.
63  *
64  * \param type data type
65  * \return this printer
66  */
67  template<class T>
68  void operator()(const JType<T>& type) const
69  {
70  using namespace std;
71  using namespace JPP;
72 
73  if (static_cast<const JROOTClassSelection&>(*this)(type)) {
74  JRootClass(type).print(out);
75  }
76  }
77 
78  protected:
79  std::ostream& out;
80  };
81 }
82 
83 
84 /**
85  * \file
86  * Auxiliary program to print ROOT class information.
87  *
88  * The name of the data structure following option -C should be preceded by a '+' or '-'
89  * to add or remove data types in the output, respectively.\n
90  * In this, ROOT wildcards are accepted (e.g. <tt>-C -\\\.\\*</tt> will remove all data types).
91  * \author mdejong
92  */
93 int main(int argc, char **argv)
94 {
95  using namespace std;
96  using namespace JPP;
97 
98  typedef JTYPELIST<JAllDataTypes_t,
107  JCOMPASS::JQuaternion>::typelist typelist;
108 
109  JPrinter_t printer(cout, getROOTClassSelection<typelist>(true));
110  int debug;
111 
112  try {
113 
114  JParser<> zap("Auxiliary program to print ROOT class information.");
115 
116  zap['C'] = make_field(printer,
117  "Precede name of data structure by a '+' or '-' "
118  "to add or remove data types in the output, respectively."
119  "\nROOT wildcards are accepted.") = JPARSER::initialised();
120  zap['d'] = make_field(debug) = 1;
121 
122  zap(argc, argv);
123  }
124  catch(const exception& error) {
125  FATAL(error.what() << endl);
126  }
127 
128  for_each(printer, JType<typelist>());
129 }
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:309
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
Auxiliary class for a type holder.
Definition: JType.hh:19
ROOT TTree parameter settings.
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
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.
Compass event data types.
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