| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

RCWNTupleCnv.h
Go to the documentation of this file.
1 #ifndef ROOTHISTCNV_RCWNTCNV_H
2 #define ROOTHISTCNV_RCWNTCNV_H 1
3
4
5 // Include files
6 #include "GaudiKernel/Converter.h"
7 #include "RNTupleCnv.h"
8 #include <string>
9
10 #include "TFile.h"
11 #include "TTree.h"
12
13
14 namespace RootHistCnv {
15
22 class RCWNTupleCnv : public RNTupleCnv {
23 public:
25 static const CLID& classID() {
26 return CLID_ColumnWiseTuple;
27 }
29 RCWNTupleCnv( ISvcLocator* svc ) : RNTupleCnv(svc, classID()) {
30 }
32 ~RCWNTupleCnv() override {
33 }
34 protected:
36 StatusCode load(TTree* tree, INTuple*& refpObject) override;
38 StatusCode book(const std::string& desc, INTuple* pObject, TTree*& tree) override;
40 StatusCode writeData(TTree* rtree, INTuple* pObject) override;
42 StatusCode readData(TTree* rtree, INTuple* pObject, long ievt) override;
43
44 template <class T>
45 size_t saveItem(char* target, const T* src, size_t len) {
46 long* tar = (long*)target;
47 for ( size_t i = 0; i < len; i++ ) {
48 *(tar++) = long( *(src++));
49 }
50 return sizeof(long)*len;
51 }
52 template <typename T>
53 size_t saveItem(char* target, T* src, size_t len) {
54 memcpy(target, src, sizeof(T)*len);
55 return sizeof(T)*len;
56 }
57
58 template <class T>
59 size_t loadItem(char* src, T* tar, size_t len) {
60 long* s = (long*)src;
61 for ( size_t i = 0; i < len; i++ ) {
62 *(tar++) = T( *(s++));
63 }
64 return sizeof(long)*len;
65 }
66 size_t loadItem(char* src, bool* tar, size_t len) {
67 long* s = (long*)src;
68 for ( size_t i = 0; i < len; i++ ) {
69 *(tar++) = (*(s++)) ? true : false;
70 }
71 return sizeof(long)*len;
72 }
73 size_t loadItem(char* src, float* target, size_t len) {
74 memcpy(target, src, sizeof(float)*len);
75 return sizeof(float)*len;
76 }
77 size_t loadItem(char* src, double* target, size_t len) {
78 memcpy(target, src, sizeof(double)*len);
79 return sizeof(double)*len;
80 }
81 size_t loadItem(char* src, long* target, size_t len) {
82 memcpy(target, src, sizeof(long)*len);
83 return sizeof(long)*len;
84 }
85 size_t loadItem(char* src, unsigned long* target, size_t len) {
86 memcpy(target, src, sizeof(unsigned long)*len);
87 return sizeof(unsigned long)*len;
88 }
89
90 };
91 } // namespace RootHistCnv
92
93
94 #endif // ROOTHISTCNV_RCWNTCNV_H
RootHistCnv::RNTupleCnv
NTuple converter class definition.
Definition: RNTupleCnv.h:24
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
RootHistCnv::RCWNTupleCnv
Converter of Column-wise NTuple into ROOT format.
Definition: RCWNTupleCnv.h:22
RootHistCnv::RCWNTupleCnv::book
StatusCode book(const std::string &desc, INTuple *pObject, TTree *&tree) override
Book the N tuple.
Definition: RCWNTupleCnv.cpp:86
RootHistCnv::RCWNTupleCnv::RCWNTupleCnv
RCWNTupleCnv(ISvcLocator *svc)
Standard constructor.
Definition: RCWNTupleCnv.h:29
std::string
STL class.
INTuple
NTuple interface class definition.
Definition: INTuple.h:79
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, bool *tar, size_t len)
Definition: RCWNTupleCnv.h:66
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
RootHistCnv::RCWNTupleCnv::load
StatusCode load(TTree *tree, INTuple *&refpObject) override
Create the transient representation of an object.
Definition: RCWNTupleCnv.cpp:415
RootHistCnv
Definition: DirectoryCnv.h:17
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, double *target, size_t len)
Definition: RCWNTupleCnv.h:77
RootHistCnv::RCWNTupleCnv::readData
StatusCode readData(TTree *rtree, INTuple *pObject, long ievt) override
Read N tuple data.
Definition: RCWNTupleCnv.cpp:341
RootHistCnv::RCWNTupleCnv::saveItem
size_t saveItem(char *target, const T *src, size_t len)
Definition: RCWNTupleCnv.h:45
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, long *target, size_t len)
Definition: RCWNTupleCnv.h:81
RootHistCnv::RCWNTupleCnv::~RCWNTupleCnv
~RCWNTupleCnv() override
Standard destructor.
Definition: RCWNTupleCnv.h:32
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, T *tar, size_t len)
Definition: RCWNTupleCnv.h:59
RootHistCnv::RCWNTupleCnv::classID
static const CLID & classID()
Inquire class type.
Definition: RCWNTupleCnv.h:25
RNTupleCnv.h
RootHistCnv::RCWNTupleCnv::saveItem
size_t saveItem(char *target, T *src, size_t len)
Definition: RCWNTupleCnv.h:53
gaudirun.s
string s
Definition: gaudirun.py:245
Converter.h
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, unsigned long *target, size_t len)
Definition: RCWNTupleCnv.h:85
RootHistCnv::RCWNTupleCnv::loadItem
size_t loadItem(char *src, float *target, size_t len)
Definition: RCWNTupleCnv.h:73
RootHistCnv::RCWNTupleCnv::writeData
StatusCode writeData(TTree *rtree, INTuple *pObject) override
Write N tuple data.
Definition: RCWNTupleCnv.cpp:283