Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JAAnetDictionary.hh
Go to the documentation of this file.
1#ifndef __JAANET__JAANETDICTIONARY__
2#define __JAANET__JAANETDICTIONARY__
3
5
8#include "JAAnet/JHead.hh"
9
10
11/**
12 * \author mdejong
13 */
14
15namespace JAANET {
16
20
21
22 /**
23 * Auxiliary class for reading multiple entries in Monte Carlo header with same tag into single std::vector.
24 */
25 template<class JElement_t>
27 /**
28 * Read object.
29 *
30 * \param reader ROOT reader
31 * \param object object
32 * \return ROOT reader
33 */
35 {
36 JElement_t element;
37
38 reader.getObject(element);
39 object.push_back(element);
40
41 return reader;
42 }
43
44
45 /**
46 * Write object.
47 *
48 * \param writer ROOT writer
49 * \param object object
50 * \return ROOT writer
51 */
53 {
54 return writer.putObject(object);
55 }
56
57
58 /**
59 * Write given key and value according equation format.
60 *
61 * \param writer ROOT writer
62 * \param key key
63 * \param value value
64 * \return ROOT writer
65 */
66 static JRootWriter& put(JRootWriter& writer, const std::string& key, const std::vector<JElement_t>& value)
67 {
68 for (typename std::vector<JElement_t>::const_iterator i = value.begin(); i != value.end(); ++i) {
69 writer.put(key, *i);
70 }
71
72 return writer;
73 }
74 };
75
76
77 /**
78 * Simple wrapper class around JROOT::JRootDictionary so that other classes are included by construction,
79 */
81 public JRootDictionary
82 {
83 private:
84 /**
85 * Default constructor.
86 */
100
101 public:
102 /**
103 * Get reference to unique instance of this class object.
104 * This JROOT::JRootDictionary object includes the various Monte Carlo data types.
105 *
106 * \return reference to this class object
107 */
109 {
110 static JAAnetDictionary dictionary;
111
112 return dictionary;
113 }
114 };
115}
116
117namespace JROOT {
118
120
121 /**
122 * Specialisation of JROOT::JRootStreamer for JAANET::JHead::detector.
123 */
124 template<>
125 struct JRootStreamer< std::vector<JAANET::detector> > :
126 public JMultipleTagsStreamer<JAANET::detector>
127 {};
128
129
130 /**
131 * Specialisation of JROOT::JRootStreamer for JAANET::JHead::physics.
132 */
133 template<>
134 struct JRootStreamer< std::vector<JAANET::physics> > :
135 public JMultipleTagsStreamer<JAANET::physics>
136 {};
137
138
139 /**
140 * Specialisation of JROOT::JRootStreamer for JAANET::JHead::simul.
141 */
142 template<>
143 struct JRootStreamer< std::vector<JAANET::simul> > :
144 public JMultipleTagsStreamer<JAANET::simul>
145 {};
146
147
148 /**
149 * Specialisation of JROOT::JRootStreamer for JAANET::JHead::flux.
150 */
151 template<>
152 struct JRootStreamer< std::vector<JAANET::flux> > :
153 public JMultipleTagsStreamer<JAANET::flux>
154 {};
155}
156
157#endif
ASCII I/O of objects with ROOT dictionary.
Simple wrapper class around JROOT::JRootDictionary so that other classes are included by construction...
static JRootDictionary & getInstance()
Get reference to unique instance of this class object.
JAAnetDictionary()
Default constructor.
Default implementation of ROOT based dictionary for ASCII I/O.
void add()
Addition of class and container classes.
Implementation for ASCII input of objects with ROOT dictionary.
JRootReader & getObject(T &object)
Read object.
Implementation for ASCII output of objects with ROOT dictionary.
JRootWriter & putObject(const T &object)
Write object.
JRootWriter & put(const T &object)
Write object according equation format.
Extensions to Evt data format.
Auxiliary classes and methods for ROOT I/O.
Auxiliary class for reading multiple entries in Monte Carlo header with same tag into single std::vec...
static JRootWriter & put(JRootWriter &writer, const std::string &key, const std::vector< JElement_t > &value)
Write given key and value according equation format.
static JRootWriter & putObject(JRootWriter &writer, const std::vector< JElement_t > &object)
Write object.
static JRootReader & getObject(JRootReader &reader, std::vector< JElement_t > &object)
Read object.
Auxiliary template class to define default implementation of the ROOT streamer.