The Gaudi Framework  master (37c0b60a)
RNTupleCnv.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef ROOTHISTCNV_RNTUPLECNV_H
12 #define ROOTHISTCNV_RNTUPLECNV_H 1
13 
14 // Include files
15 #include "RConverter.h"
16 
17 // Forward declarations
18 class ISvcLocator;
19 class INTupleItem;
20 class INTupleSvc;
21 class INTuple;
22 class TTree;
23 
24 namespace RootHistCnv {
25 
33  class RNTupleCnv : public RConverter {
34  public:
36  StatusCode initialize() override;
38  StatusCode finalize() override;
39 
41  StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& refpObj ) override;
43  StatusCode updateObj( IOpaqueAddress* pAddr, DataObject* refpObj ) override;
45  StatusCode createRep( DataObject* pObj, IOpaqueAddress*& refpAddr ) override;
47  StatusCode updateRep( IOpaqueAddress* pAddr, DataObject* pObj ) override;
48 
49  protected:
51  RNTupleCnv( ISvcLocator* svc, const CLID& clid );
52 
54  virtual StatusCode load( TTree* tree, INTuple*& refpObj ) = 0;
56  virtual StatusCode book( const std::string& desc, INTuple* pObj, TTree*& tree ) = 0;
58  virtual StatusCode writeData( TTree* rtree, INTuple* pObj ) = 0;
60  virtual StatusCode readData( TTree* rtree, INTuple* pObj, long ievt ) = 0;
61 
62  protected:
65 
66  virtual std::string rootVarType( int );
67  };
68 
70  template <class TYP>
71  INTupleItem* createNTupleItem( const std::string& itemName, const std::string& blockName,
72  const std::string& indexName, int indexRange, int arraySize, TYP minimum, TYP maximum,
73  INTuple* tuple, bool hasRange );
74 
75  bool parseName( const std::string& full, std::string& blk, std::string& var );
76 
77 } // namespace RootHistCnv
78 
79 #endif // RootHistCnv_RNTupleCnv_H
RConverter.h
std::string
STL class.
RootHistCnv::RNTupleCnv::createRep
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
Definition: RNTupleCnv.cpp:124
RootHistCnv::createNTupleItem
INTupleItem * createNTupleItem(const std::string &itemName, const std::string &blockName, const std::string &indexName, int indexRange, int arraySize, TYP min, TYP max, INTuple *ntup, bool hasRange)
Add an item of a given type to the N tuple.
Definition: RNTupleCnv.cpp:265
IOpaqueAddress
Definition: IOpaqueAddress.h:33
ISvcLocator
Definition: ISvcLocator.h:46
RootHistCnv::RNTupleCnv::createObj
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&refpObj) override
Create the transient representation of an object.
Definition: RNTupleCnv.cpp:89
RootHistCnv
Definition: DirectoryCnv.h:27
RootHistCnv::RNTupleCnv::updateObj
StatusCode updateObj(IOpaqueAddress *pAddr, DataObject *refpObj) override
Update the transient object from the other representation.
Definition: RNTupleCnv.cpp:63
StatusCode
Definition: StatusCode.h:65
RootHistCnv::RNTupleCnv::finalize
StatusCode finalize() override
Finalize the converter.
Definition: RNTupleCnv.cpp:55
RootHistCnv::parseName
bool parseName(const std::string &full, std::string &blk, std::string &var)
Definition: RNTupleCnv.cpp:240
RootHistCnv::RNTupleCnv::m_ntupleSvc
SmartIF< INTupleSvc > m_ntupleSvc
Reference to N tuple service.
Definition: RNTupleCnv.h:64
INTuple
Definition: INTuple.h:91
RootHistCnv::RConverter
Definition: RConverter.h:41
SmartIF< INTupleSvc >
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
RootHistCnv::RNTupleCnv::writeData
virtual StatusCode writeData(TTree *rtree, INTuple *pObj)=0
Write N tuple data.
INTupleItem
Definition: INTuple.h:37
RootHistCnv::RNTupleCnv::initialize
StatusCode initialize() override
Initialize the converter.
Definition: RNTupleCnv.cpp:43
RootHistCnv::RNTupleCnv
Definition: RNTupleCnv.h:33
DataObject
Definition: DataObject.h:36
INTupleSvc
Definition: INTupleSvc.h:46
RootHistCnv::RNTupleCnv::updateRep
StatusCode updateRep(IOpaqueAddress *pAddr, DataObject *pObj) override
Update the converted representation of a transient object.
Definition: RNTupleCnv.cpp:176
RootHistCnv::RNTupleCnv::rootVarType
virtual std::string rootVarType(int)
Return ROOT type info:
Definition: RNTupleCnv.cpp:204
RootHistCnv::RNTupleCnv::readData
virtual StatusCode readData(TTree *rtree, INTuple *pObj, long ievt)=0
Read N tuple data.
RootHistCnv::RNTupleCnv::RNTupleCnv
RNTupleCnv(ISvcLocator *svc, const CLID &clid)
Standard constructor.
Definition: RNTupleCnv.cpp:38
RootHistCnv::RNTupleCnv::load
virtual StatusCode load(TTree *tree, INTuple *&refpObj)=0
Create the transient representation of an object.
RootHistCnv::RNTupleCnv::book
virtual StatusCode book(const std::string &desc, INTuple *pObj, TTree *&tree)=0
Book a new N tuple.