| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
RootHistCnv::RCWNTupleCnv Class Reference

Converter of Column-wise NTuple into ROOT format. More...

`#include <src/RCWNTupleCnv.h>`

Inheritance diagram for RootHistCnv::RCWNTupleCnv:
[legend]
Collaboration diagram for RootHistCnv::RCWNTupleCnv:
[legend]

## Public Member Functions
| RCWNTupleCnv (ISvcLocator *svc)
| Standard constructor. More...
Public Member Functions inherited from RootHistCnv::RNTupleCnv
StatusCode | initialize () override
| Initialize the converter. More...
StatusCode | finalize () override
| Finalize the converter. More...
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
| Create the transient representation of an object. More...
StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *refpObj) override
| Update the transient object from the other representation. More...
StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
| Convert the transient object to the requested representation. More...
StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObj) override
| Update the converted representation of a transient object. More...
Public Member Functions inherited from RootHistCnv::RConverter
StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
| Convert the transient object to the requested representation. More...
long | repSvcType () const override
StatusCode | error (const std::string &msg)
StatusCode | regTFile (const std::string, const TFile *)
StatusCode | findTFile (const std::string, TFile *&)
std::string | diskDirectory (const std::string &loc)
std::string | directory (const std::string &loc)
void | setDirectory (const std::string &loc)
void | setDiskDirectory (const std::string &loc)
StatusCode | createDirectory (const std::string &loc)
StatusCode | createDiskDirectory (const std::string &loc)
std::string | getDirectory ()
std::string | convertId (const std::string &) const
Public Member Functions inherited from Converter
StatusCode | initialize () override
| Initialize the converter. More...
StatusCode | finalize () override
| Initialize the converter. More...
StatusCode | setDataProvider (IDataProviderSvc *svc) override
| Set Data provider service. More...
SmartIF< IDataProviderSvc > & | dataProvider () const override
| Get Data provider service. More...
StatusCode | setConversionSvc (IConversionSvc *svc) override
| Set conversion service the converter is connected to. More...
SmartIF< IConversionSvc > & | conversionSvc () const override
| Get conversion service the converter is connected to. More...
StatusCode | setAddressCreator (IAddressCreator *creator) override
| Set address creator facility. More...
SmartIF< IAddressCreator > & | addressCreator () const override
| Retrieve address creator facility. More...
const CLID & | objType () const override
| Retrieve the class type of objects the converter produces. More...
virtual long | i_repSvcType () const
| Retrieve the class type of the data store the converter uses. More...
StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
| Create the transient representation of an object. More...
StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Resolve the references of the created transient object. More...
StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
| Update the transient object from the other representation. More...
StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the references of an updated transient object. More...
StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
| Convert the transient object to the requested representation. More...
StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Resolve the references of the converted object. More...
StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the converted representation of a transient object. More...
StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the references of an already converted object. More...
| Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
| Standard Constructor. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=false) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &type, const std::string &name, T *&psvc) const
| Access a service by name, type creating it if it doesn't already exist. More...
SmartIF< IService > | service (const std::string &name, const bool createIf=true) const
| Return a pointer to the service identified by name (or "type/name") More...
Public Member Functions inherited from implements< IConverter >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| implements ()=default
| Default constructor. More...
| implements (const implements &)
| Copy constructor (zero the reference count) More...
implements & | operator= (const implements &)
| Assignment operator (do not touch the reference count). More...
unsigned long | addRef () override
| Reference Interface instance. More...
unsigned long | release () override
| Release Interface instance. More...
unsigned long | refCount () const override
| Current reference count. More...

## Static Public Member Functions
static const CLID & | classID ()
| Inquire class type. More...
Static Public Member Functions inherited from RootHistCnv::RConverter
static long | storageType ()
| Inquire storage type. More...

## Protected Member Functions
StatusCode | load (TTree *tree, INTuple *&refpObject) override
| Create the transient representation of an object. More...
StatusCode | book (const std::string &desc, INTuple *pObject, TTree *&tree) override
| Book the N tuple. More...
StatusCode | writeData (TTree *rtree, INTuple *pObject) override
| Write N tuple data. More...
StatusCode | readData (TTree *rtree, INTuple *pObject, long ievt) override
| Read N tuple data. More...
Protected Member Functions inherited from RootHistCnv::RNTupleCnv
| RNTupleCnv (ISvcLocator *svc, const CLID &clid)
| Standard constructor. More...
virtual std::string | rootVarType (int)
| Return ROOT type info: More...
Protected Member Functions inherited from RootHistCnv::RConverter
| RConverter (const CLID &clid, ISvcLocator *svc)
| Standard constructor. More...
virtual StatusCode | readObject (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Create the transient representation of an object. More...
virtual TObject * | createPersistent (DataObject *pObj)
| Create the persistent representation of an object. More...
StatusCode | createAddress (DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
| Create address of the transient object according to the requested representation. More...
StatusCode | createAddress (const std::string &rzdir, const CLID &clid, long id, TObject *pTobj, IOpaqueAddress *&refpAddress)
StatusCode | createAddress (const std::string &rzdir, const CLID &clid, const std::string &title, TObject *pTobj, IOpaqueAddress *&refpAddress)
TDirectory * | changeDirectory (DataObject *pObject)
| Switch to object directory (=Parent directory) More...
Protected Member Functions inherited from Converter
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator. More...
SmartIF< IMessageSvc > & | msgSvc () const
| Retrieve pointer to message service. More...
SmartIF< IDataManagerSvc > & | dataManager () const
| Get Data Manager service. More...

## Additional Inherited Members
Public Types inherited from Converter
using | Factory = Gaudi::PluginService::Factory< IConverter *(ISvcLocator *)>
Public Types inherited from implements< IConverter >
using | base_class = implements< Interfaces... >
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
using | iids = typename extend_interfaces_base::ext_iids
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Attributes inherited from RootHistCnv::RNTupleCnv
SmartIF< INTupleSvc > | m_ntupleSvc
| Reference to N tuple service. More...
Protected Attributes inherited from implements< IConverter >
std::atomic_ulong | m_refCount
| Reference counter. More...

## Detailed Description

Converter of Column-wise NTuple into ROOT format.

Author
  Charles Leggett

Definition at line 20 of file RCWNTupleCnv.h.

## Constructor & Destructor Documentation

## ◆ RCWNTupleCnv()

RootHistCnv::RCWNTupleCnv::RCWNTupleCnv | ( | ISvcLocator * | svc | ) |
| inline

Standard constructor.

Definition at line 25 of file RCWNTupleCnv.h.

25 : RNTupleCnv( svc, classID() ) {}
RootHistCnv::RNTupleCnv::RNTupleCnv
RNTupleCnv(ISvcLocator *svc, const CLID &clid)
Standard constructor.
Definition: RNTupleCnv.cpp:34
RootHistCnv::RCWNTupleCnv::classID
static const CLID & classID()
Inquire class type.
Definition: RCWNTupleCnv.h:23

## Member Function Documentation

## ◆ book()

StatusCode RootHistCnv::RCWNTupleCnv::book | ( | const std::string & | desc,
|  | INTuple * | pObject,
|  | TTree *& | tree
| ) |  |
| override protected virtual

Book the N tuple.

Implements RootHistCnv::RNTupleCnv.

Definition at line 127 of file RCWNTupleCnv.cpp.

129 {
130 MsgStream log( msgSvc(), "RCWNTupleCnv" );
131 rtree = new TTree( desc.c_str(), nt->title().c_str() );
132 log << MSG::VERBOSE << "created tree id: " << rtree->GetName() << " title: " << nt->title() << " desc: " << desc
133 << endmsg;
134
135 // Loop over the items
136
137 std::string block_name, var_name;
138 long lowerRange, upperRange;
139 long size = 0;
140 long cursize, oldsize = 0;
141 std::vector<std::string> item_fullname;
142 // std::vector<long> item_size,item_size2;
143 std::vector<long> item_buf_pos, item_buf_len, item_buf_end;
144 std::vector<long> item_range_lower, item_range_upper;
145 std::vector<std::pair<std::string, std::string>> item_name;
146
147 for ( const auto& i : nt->items() ) {
148 std::string item;
149
150 visit( *i, [&]( const auto& data ) {
151 analyzeItem( this->rootVarType( data.type() ), &data, item, block_name, var_name, lowerRange, upperRange, size );
152 } );
153
154 item_name.emplace_back( block_name, item );
155 cursize = size - oldsize;
156
157 log << MSG::VERBOSE << "item: " << item << " type " << i->type() << " blk: " << block_name << " var: " << var_name
158 << " rng: " << lowerRange << " " << upperRange << " sz: " << size << " " << cursize
159 << " buf_pos: " << size - cursize << endmsg;
160
161 item_fullname.push_back( var_name );
162 item_buf_pos.push_back( size - cursize );
163 item_buf_len.push_back( cursize );
164 item_buf_end.push_back( size );
165 item_range_lower.push_back( lowerRange );
166 item_range_upper.push_back( upperRange );
167
168 oldsize = size;
169 }
170
171 // Make a new buffer, and tell the ntuple where it is
172 char* buff = nt->setBuffer( new char[size] );
173
174 log << MSG::VERBOSE << "Created buffer size: " << size << " at " << (void*)buff << endmsg;
175
176 // Zero out the buffer to make ROOT happy
177 std::fill_n( buff, size, 0 );
178
179 char* buf_pos = buff;
180
181 auto end = item_name.cend();
182
183 // Loop over items, creating a new branch for each one;
184 unsigned int i_item = 0;
185 for ( auto itr = item_name.cbegin(); itr != end; ++itr, ++i_item ) {
186
187 buf_pos = buff + item_buf_pos[i_item];
188
189 // log << MSG::WARNING << "adding TBranch " << i_item << " "
190 // << item_fullname[i_item]
191 // << " format: " << itr->second.c_str() << " at "
192 // << (void*) buf_pos << " (" << (void*) buff << "+"
193 // << (void*)item_buf_pos[i_item] << ")"
194 // << endmsg;
195
196 #if ROOT_VERSION_CODE >= ROOT_VERSION( 5, 15, 0 )
197 auto br = new TBranch( rtree,
198 #else
199 TBranch* br = new TBranch(
200 #endif
201 item_fullname[i_item].c_str(), buf_pos, itr->second.c_str() );
202
203 if ( itr->first != "AUTO_BLK" ) {
204 std::string title = itr->first;
205 title = itr->first + "::" + br->GetTitle();
206 br->SetTitle( title.c_str() );
207 }
208
209 log << MSG::DEBUG << "adding TBranch " << br->GetTitle() << " at " << (void*)buf_pos << endmsg;
210
211 // for index items with a limited range. Must be a TLeafI!
212 if ( item_range_lower[i_item] < item_range_upper[i_item] ) {
213 // log << MSG::VERBOSE << "\"" << item_fullname[i_item]
214 // << "\" is range limited " << item_range_lower[i_item] << " "
215 // << item_range_upper[i_item] << endmsg;
216 TLeafI* index = nullptr;
217 TObject* tobj = br->GetListOfLeaves()->FindObject( item_fullname[i_item].c_str() );
218 if ( tobj->IsA()->InheritsFrom( "TLeafI" ) ) {
219 index = dynamic_cast<TLeafI*>( tobj );
220
221 if ( index ) {
222 index->SetMaximum( item_range_upper[i_item] );
223 // FIXME -- add for next version of ROOT
224 // index->SetMinimum( item_range_lower[i_item] );
225 } else {
226 log << MSG::ERROR << "Could dynamic cast to TLeafI: " << item_fullname[i_item] << endmsg;
227 }
228 }
229 }
230
231 rtree->GetListOfBranches()->Add( br );
232 }
233
234 log << MSG::INFO << "Booked TTree with ID: " << desc << " \"" << nt->title() << "\" in directory " << getDirectory()
235 << endmsg;
236
237 return StatusCode::SUCCESS;
238 }
RootHistCnv::RConverter::getDirectory
std::string getDirectory()
Definition: RConverter.cpp:148
details::size
constexpr auto size(const T &, Args &&...) noexcept
Definition: AnyDataWrapper.h:14
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MSG::DEBUG
Definition: IMessageSvc.h:15
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector::cend
T cend(T... args)
MSG::VERBOSE
Definition: IMessageSvc.h:15
std::string
STL class.
Converter::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:95
std::vector::push_back
T push_back(T... args)
IOTest.end
def end
Definition: IOTest.py:112
std::vector< std::string >
std::vector::cbegin
T cbegin(T... args)
std::string::c_str
T c_str(T... args)
std::fill_n
T fill_n(T... args)
MSG::ERROR
Definition: IMessageSvc.h:15
MSG::INFO
Definition: IMessageSvc.h:15
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
RootHistCnv::RNTupleCnv::rootVarType
virtual std::string rootVarType(int)
Return ROOT type info:
Definition: RNTupleCnv.cpp:200
Gaudi.Configuration.log
log
Definition: Configuration.py:13
std::vector::emplace_back
T emplace_back(T... args)

## ◆ classID()

static const CLID& RootHistCnv::RCWNTupleCnv::classID | ( |  | ) |
| inline static

Inquire class type.

Definition at line 23 of file RCWNTupleCnv.h.

23 { return CLID_ColumnWiseTuple; }

## ◆ load()

StatusCode RootHistCnv::RCWNTupleCnv::load | ( | TTree * | tree,
|  | INTuple *& | refpObject
| ) |  |
| override protected virtual

Create the transient representation of an object.

Implements RootHistCnv::RNTupleCnv.

Definition at line 282 of file RCWNTupleCnv.cpp.

284 {
285 MsgStream log( msgSvc(), "RCWNTupleCnv::load" );
286
287 StatusCode status;
288
289 NTuple::Tuple* pObj = nullptr;
290
291 std::string title = tree->GetTitle();
292 log << MSG::VERBOSE << "loading CWNT " << title << " at: " << tree << endmsg;
293
294 status = m_ntupleSvc->create( CLID_ColumnWiseTuple, title, pObj );
295 INTuple* ntup = dynamic_cast<INTuple*>( pObj );
296
297 INTupleItem* item = nullptr;
298
299 std::string itemName, indexName, item_type, itemTitle, blockName;
300 // long numEnt, numVar;
301 long size, totsize = 0;
302 std::vector<std::pair<TLeaf*, int>> itemList;
303
304 // numEnt = (int)tree->GetEntries();
305 // numVar = tree->GetNbranches();
306
307 // loop over all branches (==leaves)
308 TObjArray* lbr = tree->GetListOfBranches();
309 TIter bitr( lbr );
310 while ( TObject* tobjb = bitr() ) {
311
312 TBranch* br = (TBranch*)tobjb;
313 itemTitle = br->GetTitle();
314
315 int ipos = itemTitle.find( "::" );
316 if ( ipos >= 0 ) {
317 blockName = itemTitle.substr( 0, ipos );
318 } else {
319 blockName = "";
320 }
321
322 TObjArray* lf = br->GetListOfLeaves();
323
324 TIter litr( lf );
325 while ( TObject* tobj = litr() ) {
326
327 bool hasRange = false;
328 int indexRange = 0;
329 int itemSize;
330 item = nullptr;
331
332 // TLeaf* tl = (TLeaf*)tobj;
333 TLeaf* tl = dynamic_cast<TLeaf*>( tobj );
334 itemName = tl->GetName();
335
336 // char* buf_pos = (char*)tl->GetValuePointer();
337 // cout << " " << itemName << " " << blockName << " "
338 // << (void*)buf_pos;
339
340 if ( blockName != "" ) {
341 log << MSG::DEBUG << "loading NTuple item " << blockName << "/" << itemName;
342 } else {
343 log << MSG::DEBUG << "loading NTuple item " << itemName;
344 }
345
346 int arraySize;
347 TLeaf* indexLeaf = tl->GetLeafCounter( arraySize );
348
349 if ( arraySize == 0 ) { log << MSG::ERROR << "TLeaf counter size = 0. This should not happen!" << endmsg; }
350
351 if ( indexLeaf ) {
352 // index Arrays and Matrices
353
354 indexName = indexLeaf->GetName();
355 // indexRange = tl->GetNdata();
356 indexRange = indexLeaf->GetMaximum();
357 itemSize = indexRange * tl->GetLenType() * arraySize;
358
359 log << "[" << indexName;
360
361 // Just for Matrices
362 if ( arraySize != 1 ) { log << "][" << arraySize; }
363 log << "]";
364
365 } else {
366 itemSize = tl->GetLenType() * arraySize;
367
368 indexName = "";
369
370 if ( arraySize == 1 ) {
371 // Simple items
372 } else {
373 // Arrays of constant size
374 log << "[" << arraySize << "]";
375 }
376 }
377
378 log << endmsg;
379
380 // cout << " index: " << indexName << endl;
381
382 // size = tl->GetNdata() * tl->GetLenType();
383 size = itemSize;
384 totsize += size;
385
386 hasRange = tl->IsRange();
387
388 itemList.emplace_back( tl, itemSize );
389
390 // Integer
391 if ( tobj->IsA()->InheritsFrom( "TLeafI" ) ) {
392
393 TLeafI* tli = dynamic_cast<TLeafI*>( tobj );
394 if ( tli->IsUnsigned() ) {
395 unsigned long min = 0, max = 0;
396 if ( hasRange ) {
397 min = tli->GetMinimum();
398 max = tli->GetMaximum();
399 }
400
401 item = createNTupleItem( itemName, blockName, indexName, indexRange, arraySize, min, max, ntup );
402 } else {
403 long min = 0, max = 0;
404 if ( hasRange ) {
405 min = tli->GetMinimum();
406 max = tli->GetMaximum();
407 }
408
409 item = createNTupleItem( itemName, blockName, indexName, indexRange, arraySize, min, max, ntup );
410 }
411
412 // Float
413 } else if ( tobj->IsA()->InheritsFrom( "TLeafF" ) ) {
414 float min = 0., max = 0.;
415
416 TLeafF* tlf = dynamic_cast<TLeafF*>( tobj );
417 if ( hasRange ) {
418 min = float( tlf->GetMinimum() );
419 max = float( tlf->GetMaximum() );
420 }
421
422 item = createNTupleItem( itemName, blockName, indexName, indexRange, arraySize, min, max, ntup );
423
424 // Double
425 } else if ( tobj->IsA()->InheritsFrom( "TLeafD" ) ) {
426 double min = 0., max = 0.;
427
428 TLeafD* tld = dynamic_cast<TLeafD*>( tobj );
429 if ( hasRange ) {
430 min = tld->GetMinimum();
431 max = tld->GetMaximum();
432 }
433
434 item = createNTupleItem( itemName, blockName, indexName, indexRange, arraySize, min, max, ntup );
435
436 } else {
437 log << MSG::ERROR << "Uknown data type" << endmsg;
438 }
439
440 if ( item ) {
441 ntup->add( item );
442 } else {
443 log << MSG::ERROR << "Unable to create ntuple item \"" << itemName << "\"" << endmsg;
444 }
445
446 } // end litr
447 } // end bitr
448
449 log << MSG::DEBUG << "Total buffer size of NTuple: " << totsize << " Bytes." << endmsg;
450
451 char* buf = ntup->setBuffer( new char[totsize] );
452 char* bufpos = buf;
453
454 int ts = 0;
455 for ( const auto& iitr : itemList ) {
456 TLeaf* leaf = iitr.first;
457 int isize = iitr.second;
458
459 log << MSG::VERBOSE << "setting TBranch " << leaf->GetBranch()->GetName() << " buffer at " << (void*)bufpos
460 << endmsg;
461
462 leaf->GetBranch()->SetAddress( (void*)bufpos );
463
464 // //testing
465 // if (leaf->IsA()->InheritsFrom("TLeafI")) {
466 // for (int ievt=0; ievt<5; ievt++) {
467 // leaf->GetBranch()->GetEvent(ievt);
468 // int *idat = (int*)bufpos;
469 // log << MSG::WARNING << leaf->GetName() << ": " << ievt << " "
470 // << *idat << endmsg;
471
472 // }
473 // }
474
475 ts += isize;
476
477 bufpos += isize;
478 }
479
480 if ( totsize != ts ) { log << MSG::ERROR << "buffer size mismatch: " << ts << " " << totsize << endmsg; }
481
482 refpObject = ntup;
483
484 return StatusCode::SUCCESS;
485 }
details::size
constexpr auto size(const T &, Args &&...) noexcept
Definition: AnyDataWrapper.h:14
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
min
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:202
INTuple::add
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
MSG::DEBUG
Definition: IMessageSvc.h:15
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
max
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215
MSG::VERBOSE
Definition: IMessageSvc.h:15
std::string
STL class.
INTuple
NTuple interface class definition.
Definition: INTuple.h:81
Converter::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:95
compareRootHistos.ts
tuple ts
Definition: compareRootHistos.py:447
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:27
INTupleSvc::create
virtual StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)=0
Create requested N tuple (Hide constructor)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:375
std::string::find
T find(T... args)
std::vector
STL class.
INTuple::setBuffer
virtual char * setBuffer(char *buff)=0
Attach data buffer.
MSG::ERROR
Definition: IMessageSvc.h:15
std::string::substr
T substr(T... args)
RootHistCnv::createNTupleItem
INTupleItem * createNTupleItem(std::string itemName, std::string blockName, std::string indexName, int indexRange, int arraySize, TYP min, TYP max, INTuple *ntup)
Add an item of a given type to the N tuple.
Definition: RNTupleCnv.cpp:261
RootHistCnv::RNTupleCnv::m_ntupleSvc
SmartIF< INTupleSvc > m_ntupleSvc
Reference to N tuple service.
Definition: RNTupleCnv.h:54
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
Gaudi.Configuration.log
log
Definition: Configuration.py:13
std::vector::emplace_back
T emplace_back(T... args)

## ◆ readData()

StatusCode RootHistCnv::RCWNTupleCnv::readData | ( | TTree * | rtree,
|  | INTuple * | pObject,
|  | long | ievt
| ) |  |
| override protected virtual

Read N tuple data.

Implements RootHistCnv::RNTupleCnv.

Definition at line 258 of file RCWNTupleCnv.cpp.

260 {
261 if ( ievt >= rtree->GetEntries() ) {
262 MsgStream log( msgSvc(), "RCWNTupleCnv::readData" );
263 log << MSG::ERROR << "no more entries in tree to read. max: " << rtree->GetEntries() << " current: " << ievt
264 << endmsg;
265 return StatusCode::FAILURE;
266 }
267
268 rtree->GetEvent( ievt );
269 ievt++;
270
271 // copy data from ntup->buffer() to ntup->items()->buffer()
272 auto& items = ntup->items();
273 std::accumulate( begin( items ), end( items ), const_cast<const char*>( ntup->buffer() ),
274 []( const char* src, INTupleItem* i ) {
275 return src + visit( *i, [src]( auto& item ) { return loadItem( src, item ); } );
276 } );
277
278 return StatusCode::SUCCESS;
279 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Converter::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:95
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:27
IOTest.end
def end
Definition: IOTest.py:112
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MSG::ERROR
Definition: IMessageSvc.h:15
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
std::accumulate
T accumulate(T... args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
Gaudi.Configuration.log
log
Definition: Configuration.py:13

## ◆ writeData()

StatusCode RootHistCnv::RCWNTupleCnv::writeData | ( | TTree * | rtree,
|  | INTuple * | pObject
| ) |  |
| override protected virtual

Write N tuple data.

Implements RootHistCnv::RNTupleCnv.

Definition at line 243 of file RCWNTupleCnv.cpp.

245 {
246 // Fill the tree;
247 const auto& items = nt->items();
248 std::accumulate( begin( items ), end( items ), nt->buffer(), []( char* dest, const INTupleItem* i ) {
249 return dest + visit( *i, [dest]( const auto& item ) { return saveItem( dest, item ); } );
250 } );
251
252 rtree->Fill();
253 nt->reset();
254 return StatusCode::SUCCESS;
255 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:27
gaudirun.dest
dest
Definition: gaudirun.py:201
IOTest.end
def end
Definition: IOTest.py:112
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
std::accumulate
T accumulate(T... args)

The documentation for this class was generated from the following files:

- RootHistCnv/src/RCWNTupleCnv.h
- RootHistCnv/src/RCWNTupleCnv.cpp