| The Gaudi Framework v27r1

- 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 virtual ~RCWNTupleCnv() {
33 }
34 protected:
36 virtual StatusCode load(TTree* tree, INTuple*& refpObject);
38 virtual StatusCode book(const std::string& desc, INTuple* pObject, TTree*& tree);
40 virtual StatusCode writeData(TTree* rtree, INTuple* pObject);
42 virtual StatusCode readData(TTree* rtree, INTuple* pObject, long ievt);
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
RootHistCnv::RCWNTupleCnv::readData
virtual StatusCode readData(TTree *rtree, INTuple *pObject, long ievt)
Read N tuple data.
Definition: RCWNTupleCnv.cpp:341
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
virtual StatusCode book(const std::string &desc, INTuple *pObject, TTree *&tree)
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
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::writeData
virtual StatusCode writeData(TTree *rtree, INTuple *pObject)
Write N tuple data.
Definition: RCWNTupleCnv.cpp:283
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::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
RootHistCnv::RCWNTupleCnv::load
virtual StatusCode load(TTree *tree, INTuple *&refpObject)
Create the transient representation of an object.
Definition: RCWNTupleCnv.cpp:415
RootHistCnv::RCWNTupleCnv::~RCWNTupleCnv
virtual ~RCWNTupleCnv()
Standard destructor.
Definition: RCWNTupleCnv.h:32
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
ana.i
list i
Definition: ana.py:128