The Gaudi Framework  master (7cfdc4e8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages Concepts
RNTupleCnv.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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#pragma once
12
13// Include files
14#include "RConverter.h"
15
16// Forward declarations
17class ISvcLocator;
18class INTupleItem;
19class INTupleSvc;
20class INTuple;
21class TTree;
22
23namespace RootHistCnv {
24
32 class RNTupleCnv : public RConverter {
33 public:
35 StatusCode initialize() override;
37 StatusCode finalize() override;
38
40 StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& refpObj ) override;
42 StatusCode updateObj( IOpaqueAddress* pAddr, DataObject* refpObj ) override;
44 StatusCode createRep( DataObject* pObj, IOpaqueAddress*& refpAddr ) override;
46 StatusCode updateRep( IOpaqueAddress* pAddr, DataObject* pObj ) override;
47
48 protected:
50 RNTupleCnv( ISvcLocator* svc, const CLID& clid );
51
53 virtual StatusCode load( TTree* tree, INTuple*& refpObj ) = 0;
55 virtual StatusCode book( const std::string& desc, INTuple* pObj, TTree*& tree ) = 0;
57 virtual StatusCode writeData( TTree* rtree, INTuple* pObj ) = 0;
59 virtual StatusCode readData( TTree* rtree, INTuple* pObj, long ievt ) = 0;
60
61 protected:
64
65 virtual std::string rootVarType( int );
66 };
67
69 template <class TYP>
70 INTupleItem* createNTupleItem( const std::string& itemName, const std::string& blockName,
71 const std::string& indexName, int indexRange, int arraySize, TYP minimum, TYP maximum,
72 INTuple* tuple, bool hasRange );
73
74 bool parseName( const std::string& full, std::string& blk, std::string& var );
75
76} // namespace RootHistCnv
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
NTuple interface class definition.
Definition INTuple.h:86
NTuple interface class definition.
Definition INTuple.h:32
Opaque address interface definition.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
RConverter(const CLID &clid, ISvcLocator *svc)
Standard constructor.
Definition RConverter.h:64
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&refpObj) override
Create the transient representation of an object.
StatusCode updateObj(IOpaqueAddress *pAddr, DataObject *refpObj) override
Update the transient object from the other representation.
virtual StatusCode writeData(TTree *rtree, INTuple *pObj)=0
Write N tuple data.
RNTupleCnv(ISvcLocator *svc, const CLID &clid)
Standard constructor.
virtual StatusCode load(TTree *tree, INTuple *&refpObj)=0
Create the transient representation of an object.
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
virtual StatusCode book(const std::string &desc, INTuple *pObj, TTree *&tree)=0
Book a new N tuple.
StatusCode initialize() override
Initialize the converter.
virtual StatusCode readData(TTree *rtree, INTuple *pObj, long ievt)=0
Read N tuple data.
virtual std::string rootVarType(int)
Return ROOT type info:
StatusCode updateRep(IOpaqueAddress *pAddr, DataObject *pObj) override
Update the converted representation of a transient object.
SmartIF< INTupleSvc > m_ntupleSvc
Reference to N tuple service.
Definition RNTupleCnv.h:63
StatusCode finalize() override
Finalize the converter.
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool parseName(const std::string &full, std::string &blk, std::string &var)
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.