Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JHeadWriter.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JHEADWRITER__
2 #define __JAANET__JHEADWRITER__
3 
5 
6 #include "JLang/JNullStream.hh"
8 #include "JROOT/JRootStreamer.hh"
9 #include "JAAnet/JHead.hh"
10 #include "JAAnet/JAAnetDictionary.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JAANET {
18 
19  using JLANG::JEquation;
22  using JROOT::JRootWriter;
23 
24 
25  /**
26  * Implementation for Head output of JHead objects with ROOT dictionary.
27  */
28  struct JHeadWriter :
29  public JRootWriter
30  {
31  using JRootWriter::put;
32 
33  /**
34  * Constructor.
35  *
36  * \param header header output
37  * \param parameters equation parameters
38  * \param dictionary dictionary
39  */
43  JRootWriter(JLANG::null, parameters, dictionary),
44  header(header)
45  {}
46 
47 
48  /**
49  * Write equation.
50  *
51  * \param equation equation
52  * \return this ROOT writer
53  */
54  virtual JRootWriter& put(const JEquation& equation) override
55  {
56  using namespace std;
57 
58  string key = equation.getKey();
59 
60  for (int i = 1; header.find(key) != header.end(); ++i) {
61  key = getTag(equation.getKey(), i);
62  }
63 
64  header[key] = equation.getValue();
65 
66  return *this;
67  }
68 
69  private:
71  };
72 }
73 
74 #endif
const std::string & getKey() const
Get key.
Definition: JEquation.hh:163
const std::string & getValue() const
Get value.
Definition: JEquation.hh:185
Implementation for ASCII output of objects with ROOT dictionary.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Simple data structure to support I/O of equations (see class JLANG::JEquation).
General purpose equation class.
Definition: JEquation.hh:47
ASCII I/O of objects with ROOT dictionary.
JHeadWriter(Head &header, const JEquationParameters &parameters, const JRootDictionary_t &dictionary)
Constructor.
Definition: JHeadWriter.hh:40
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
Type definition of ROOT based dictionary for ASCII I/O.
virtual JRootWriter & put(const JEquation &equation) override
Write equation.
Definition: JHeadWriter.hh:54
const JRootDictionary_t & dictionary
JRootWriter & put(const T &object)
Write object according equation format.
Implementation for Head output of JHead objects with ROOT dictionary.
Definition: JHeadWriter.hh:28
std::string getTag(const std::string &tag)
Get tag without aanet extension "_<counter>" for identical tags.
Definition: JHead.hh:94
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null