The Gaudi Framework  v37r1 (a7f61348)
RootCnvSvc.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 //====================================================================
12 // RootCnvSvc implementation
13 //--------------------------------------------------------------------
14 //
15 // Description: Implementation of the ROOT data storage
16 //
17 // Author : M.Frank
18 //
19 //====================================================================
20 
21 // Framework include files
22 #include "RootCnv/RootCnvSvc.h"
27 #include "GaudiKernel/IRegistry.h"
29 #include "GaudiKernel/Incident.h"
32 #include "GaudiKernel/MsgStream.h"
33 #include "GaudiKernel/System.h"
34 #include "RootCnv/RootAddress.h"
35 #include "RootCnv/RootConverter.h"
39 #include "RootCnv/RootNTupleCnv.h"
40 #include "RootCnv/RootRefs.h"
41 #include "RootUtils.h"
42 
43 using namespace std;
44 using namespace Gaudi;
45 typedef const string& CSTR;
46 
47 #define S_OK StatusCode::SUCCESS
48 #define S_FAIL StatusCode::FAILURE
49 namespace GaudiRoot {
50  bool patchStreamers( MsgStream& log );
51 }
52 
53 namespace {
54  static map<string, TClass*> s_classesNames;
55  static map<CLID, TClass*> s_classesClids;
56 } // namespace
57 #define MBYTE ( 1024 * 1024 )
58 #define kBYTE 1024
59 // Standard constructor
60 RootCnvSvc::RootCnvSvc( CSTR nam, ISvcLocator* svc )
61  : ConversionSvc( nam, svc, ROOT_StorageType ), m_setup{ new RootConnectionSetup() } {
62  m_setup->cacheBranches.push_back( "*" );
63  declareProperty( "LoadSection", m_setup->loadSection = "Event" );
64 
65  // ROOT Read parameters: must be shared for the entire file!
66  declareProperty( "CacheSize", m_setup->cacheSize = 10 * MBYTE );
67  declareProperty( "LearnEntries", m_setup->learnEntries = 10 );
68  declareProperty( "CacheBranches", m_setup->cacheBranches );
69  declareProperty( "VetoBranches", m_setup->vetoBranches );
70 
71  declareProperty( m_setup->produceReproducibleFiles );
72  m_setup->produceReproducibleFiles.setOwnerType<RootCnvSvc>();
73 }
74 
75 // Small routine to issue exceptions
77  if ( m_log ) {
78  log() << MSG::ERROR << "Error: " << msg << endmsg;
79  return S_FAIL;
80  }
81  MsgStream m( msgSvc(), name() );
82  m << MSG::ERROR << "Error: " << msg << endmsg;
83  return S_FAIL;
84 }
85 
86 // Initialize the Db data persistency service
88  string cname;
90  if ( !status.isSuccess() ) { return error( "Failed to initialize ConversionSvc base class." ); }
91  m_log.reset( new MsgStream( msgSvc(), name() ) );
92  if ( !m_compression.empty() ) {
93  log() << MSG::INFO << "Setting global ROOT compression to:" << m_compression.value() << endmsg;
94  if ( !( status = RootConnectionSetup::setCompression( m_compression.value() ) ).isSuccess() ) {
95  return error( "Unable to interprete ROOT compression encoding:" + m_compression );
96  }
97  }
98  m_ioMgr = service( "IODataManager" );
99  if ( !m_ioMgr ) return error( "Unable to localize interface from service:IODataManager" );
100  m_incidentSvc = service( "IncidentSvc" );
101  if ( !m_incidentSvc ) return error( "Unable to localize interface from service:IncidentSvc" );
102  m_setup->setMessageSvc( new MsgStream( msgSvc(), name() ) );
103  m_setup->setIncidentSvc( m_incidentSvc.get() );
105  cname = System::typeinfoName( typeid( DataObject ) );
106  m_classDO = TClass::GetClass( cname.c_str() );
107  if ( !m_classDO ) return error( "Unable to load class description for DataObject" );
108  cname = System::typeinfoName( typeid( RootObjectRefs ) );
109  m_classRefs = TClass::GetClass( cname.c_str() );
110  if ( !m_classRefs ) return error( "Unable to load class description for ObjectRefs" );
111  return S_OK;
112 }
113 
114 // Finalize the Db data persistency service
116  log() << MSG::INFO;
117  if ( m_ioMgr ) {
118  IIODataManager::Connections cons = m_ioMgr->connections( nullptr );
119  for ( auto& i : cons ) {
120  auto pc = dynamic_cast<RootDataConnection*>( i );
121  if ( pc ) {
122  if ( pc->owner() == this && !m_ioPerfStats.empty() ) { pc->saveStatistics( m_ioPerfStats.value() ); }
123  if ( pc->lookupClient( this ) ) {
124  size_t num_clients = pc->removeClient( this );
125  if ( num_clients == 0 ) {
126  if ( m_ioMgr->disconnect( pc ).isSuccess() ) {
127  log() << "Disconnected data IO:" << pc->fid() << " [" << pc->pfn() << "]" << endmsg;
128  delete pc;
129  }
130  }
131  }
132  }
133  }
134  m_ioMgr.reset();
135  }
136  m_log.reset();
138  m_setup->setIncidentSvc( nullptr );
139  return ConversionSvc::finalize();
140 }
141 
142 // ConversionSvc overload: Create new Converter using factory
143 IConverter* RootCnvSvc::createConverter( long typ, const CLID& wanted, const ICnvFactory* ) {
144  if ( wanted == CLID_StatisticsFile )
145  return new RootDatabaseCnv( typ, wanted, serviceLocator().get(), this );
146  else if ( wanted == CLID_StatisticsDirectory )
147  return new RootDirectoryCnv( typ, wanted, serviceLocator().get(), this );
148  else if ( wanted == CLID_RowWiseTuple )
149  return new RootNTupleCnv( typ, wanted, serviceLocator().get(), this );
150  else if ( wanted == CLID_ColumnWiseTuple )
151  return new RootNTupleCnv( typ, wanted, serviceLocator().get(), this );
152  else
153  return new RootConverter( typ, wanted, serviceLocator().get(), this );
154 }
155 
156 // ConversionSvc overload: Load the class (dictionary) for the converter
158  if ( pObject ) {
159  string cname = System::typeinfoName( typeid( *pObject ) );
160  if ( log().level() <= MSG::DEBUG )
161  log() << MSG::DEBUG << "Trying to 'Autoload' dictionary for class " << cname << endmsg;
162  TClass* cl = s_classesNames[cname];
163  if ( nullptr == cl ) {
164  cl = TClass::GetClass( cname.c_str() );
165  if ( cl ) {
166  s_classesNames[cname] = cl;
167  s_classesClids[pObject->clID()] = cl;
168  }
169  }
170  }
171 }
172 
173 // Helper: Get TClass for a given DataObject pointer
174 TClass* RootCnvSvc::getClass( DataObject* pObject ) {
175  auto i = s_classesClids.find( pObject->clID() );
176  if ( i != s_classesClids.end() ) return i->second;
177  loadConverter( pObject );
178  i = s_classesClids.find( pObject->clID() );
179  if ( i != s_classesClids.end() ) return i->second;
180 
181  string cname = System::typeinfoName( typeid( *pObject ) );
182  throw runtime_error( "Unknown ROOT class for object:" + cname );
183  return nullptr;
184 }
185 
186 // Connect the output file to the service with open mode.
188  StatusCode sc = S_FAIL;
189  m_current = nullptr;
191  if ( ::strncasecmp( openMode.c_str(), "RECREATE", 3 ) == 0 )
193  else if ( ::strncasecmp( openMode.c_str(), "NEW", 1 ) == 0 )
195  else if ( ::strncasecmp( openMode.c_str(), "CREATE", 1 ) == 0 )
197  else if ( ::strncasecmp( openMode.c_str(), "UPDATE", 1 ) == 0 )
199  if ( sc.isSuccess() && m_current && m_current->isConnected() ) { return S_OK; }
200  m_incidentSvc->fireIncident( Incident( dsn, IncidentType::FailOutputFile ) );
201  log() << MSG::ERROR << "The dataset " << dsn << " cannot be opened in mode " << openMode << ". [Invalid mode]"
202  << endmsg;
203  return sc;
204 }
205 
206 // Connect the output file to the service with open mode.
208  try {
209  IDataConnection* c = m_ioMgr->connection( dataset );
210  bool fire_incident = false;
211  *con = nullptr;
212  if ( !c ) {
213  auto connection = std::make_unique<RootDataConnection>( this, dataset, m_setup );
214  StatusCode sc = ( mode != IDataConnection::READ )
215  ? m_ioMgr->connectWrite( connection.get(), IDataConnection::IoType( mode ), "ROOT" )
216  : m_ioMgr->connectRead( false, connection.get() );
217  c = sc.isSuccess() ? m_ioMgr->connection( dataset ) : nullptr;
218  if ( c ) {
219  bool writable = 0 != ( mode & ( IDataConnection::UPDATE | IDataConnection::RECREATE ) );
220  fire_incident = m_incidentEnabled && ( 0 != ( mode & ( IDataConnection::UPDATE | IDataConnection::READ ) ) );
221  if ( writable ) {
222  m_incidentSvc->fireIncident(
223  ContextIncident<TFile*>( connection->pfn(), "CONNECTED_OUTPUT", connection->file() ) );
224  }
225  if ( 0 != ( mode & IDataConnection::READ ) ) {
226  m_incidentSvc->fireIncident(
227  ContextIncident<TFile*>( connection->pfn(), "CONNECTED_INPUT", connection->file() ) );
228  if ( !m_ioPerfStats.empty() ) { connection->enableStatistics( m_setup->loadSection ); }
229  }
230  connection.release();
231  } else {
232  m_incidentSvc->fireIncident( Incident(
233  dataset, mode == IDataConnection::READ ? IncidentType::FailInputFile : IncidentType::FailOutputFile ) );
234  // An error message was already printed by the IODataManager. no need to do it here!
235  return StatusCode::FAILURE;
236  }
237  }
238  RootDataConnection* pc = dynamic_cast<RootDataConnection*>( c );
239  if ( pc ) {
240  if ( !pc->isConnected() )
241  if ( auto sc = pc->connectRead(); !sc ) return sc;
242  *con = pc;
243  pc->resetAge();
244  pc->addClient( this );
245  }
246  if ( *con ) {
247  if ( fire_incident ) {
248  IOpaqueAddress* pAddr = nullptr;
249  string fid = pc->fid();
250  string section = m_recordName[0] == '/' ? m_recordName.value().substr( 1 ) : m_recordName.value();
251  TBranch* b = pc->getBranch( section, m_recordName.value() );
252  if ( b ) {
253  const string par[2] = { fid, m_recordName };
254  unsigned long ipar[2] = { (unsigned long)( *con ), (unsigned long)b->GetEntries() - 1 };
255  for ( int i = 0; i < b->GetEntries(); ++i ) {
256  ipar[1] = i;
257  if ( !pc->mergeFIDs().empty() ) fid = pc->mergeFIDs()[i];
258  if ( !createAddress( repSvcType(), CLID_DataObject, par, ipar, pAddr ).isSuccess() ) {
259  if ( log().level() <= MSG::VERBOSE )
260  log() << MSG::VERBOSE << "Failed to create address for " << m_recordName << " in:" << fid << " ["
261  << pc->fid() << "][" << i << "]" << endmsg;
262  continue;
263  }
264  if ( log().level() <= MSG::VERBOSE )
265  log() << MSG::VERBOSE << "Prepare " << m_recordName << " " << fid << " [" << par[0] << "][" << i << "]"
266  << endmsg;
267  m_incidentSvc->fireIncident( ContextIncident<IOpaqueAddress*>( fid, "FILE_OPEN_READ", pAddr ) );
268  }
269  } else {
270  if ( log().level() <= MSG::VERBOSE )
271  log() << MSG::VERBOSE << "No valid Records " << m_recordName << " present in:" << pc->fid() << endmsg;
272  }
273  }
274 
275  // We can remove retired connections, which are no longer used....
276  for ( auto& i : m_ioMgr->connections( this ) ) {
277  if ( i != *con && !i->isConnected() ) {
278  RootDataConnection* pc = dynamic_cast<RootDataConnection*>( i );
279  if ( pc && pc->lookupClient( this ) ) {
280  size_t num_client = pc->removeClient( this );
281  if ( num_client == 0 ) {
282  if ( m_ioMgr->disconnect( pc ).isSuccess() ) {
283  log() << MSG::INFO << "Removed disconnected IO stream:" << pc->fid() << " [" << pc->pfn() << "]"
284  << endmsg;
285  delete pc;
286  }
287  }
288  }
289  }
290  }
291  return S_OK;
292  }
293  m_incidentSvc->fireIncident( Incident( dataset, IncidentType::FailOutputFile ) );
294  return S_FAIL;
295  } catch ( exception& e ) {
296  m_incidentSvc->fireIncident( Incident( dataset, IncidentType::FailOutputFile ) );
297  return error( string( "connectDatabase> Caught exception:" ) + e.what() );
298  } catch ( ... ) {
299  m_incidentSvc->fireIncident( Incident( dataset, IncidentType::FailOutputFile ) );
300  return error( "connectDatabase> Unknown Fatal Exception for " + dataset );
301  }
302 }
303 
304 // Conect output stream (valid until overwritten)
305 StatusCode RootCnvSvc::connectOutput( CSTR db_name ) { return connectOutput( db_name, "NEW" ); }
306 
307 // Commit pending output on open container
308 StatusCode RootCnvSvc::commitOutput( CSTR dsn, bool /* doCommit */ ) {
309  if ( m_current ) {
310  size_t len = m_currSection.find( '/', 1 );
311  string section = m_currSection.substr( 1, len == string::npos ? string::npos : len - 1 );
312  TBranch* b = m_current->getBranch( section, m_currSection );
313  if ( b ) {
314  Long64_t evt = b->GetEntries();
315  TTree* t = b->GetTree();
316  TObjArray* a = t->GetListOfBranches();
317  Int_t nb = a->GetEntriesFast();
319  for ( Int_t i = 0; i < nb; ++i ) {
320  TBranch* br_ptr = (TBranch*)a->UncheckedAt( i );
321  Long64_t br_evt = br_ptr->GetEntries();
322  if ( br_evt < evt ) {
323  Long64_t num = evt - br_evt;
324  br_ptr->SetAddress( nullptr );
325  while ( num > 0 ) {
326  br_ptr->Fill();
327  --num;
328  }
329  if ( log().level() <= MSG::DEBUG )
330  log() << MSG::DEBUG << "commit: Added " << long( evt - br_evt ) << " Section: " << evt
331  << " Branch: " << br_ptr->GetEntries() << " RefNo: " << br_ptr->GetEntries() - 1
332  << " NULL entries to:" << br_ptr->GetName() << endmsg;
333  }
334  }
335 
336  b->GetTree()->SetEntries( evt );
337  if ( log().level() <= MSG::DEBUG )
338  log() << MSG::DEBUG << "Set section entries of " << m_currSection << " to " << long( evt ) << " entries."
339  << endmsg;
340  } else {
341  return error( "commitOutput> Failed to update entry numbers on " + dsn );
342  }
343  }
344  return S_OK;
345 }
346 
347 // Disconnect from an existing data stream.
349  IDataConnection* c = m_ioMgr->connection( dataset );
350  return c ? m_ioMgr->disconnect( c ) : S_FAIL;
351 }
352 
353 // IAddressCreator implementation: Address creation
354 StatusCode RootCnvSvc::createAddress( long typ, const CLID& clid, const string* par, const unsigned long* ip,
355  IOpaqueAddress*& refpAddress ) {
356  refpAddress = new RootAddress( typ, clid, par[0], par[1], ip[0], ip[1] );
357  return S_OK;
358 }
359 
360 // Insert null marker for not existent transient object
362  size_t len = path.find( '/', 1 );
363  string section = path.substr( 1, len == string::npos ? string::npos : len - 1 );
365  m_splitLevel );
366  return S_OK;
367 }
368 
369 // Insert null marker for not existent transient object
371  RootObjectRefs* refs = nullptr;
372  size_t len = path.find( '/', 1 );
373  string section = path.substr( 1, len == string::npos ? string::npos : len - 1 );
374  pair<int, unsigned long> ret = m_current->save( section, path + "#R", nullptr, refs, m_minBufferSize, m_maxBufferSize,
376  if ( log().level() <= MSG::VERBOSE )
377  log() << MSG::VERBOSE << "Writing object:" << path << " " << ret.first << " " << hex << ret.second << dec
378  << " [NULL]" << endmsg;
379  return S_OK;
380 }
381 
382 // Mark an object for write given an object reference
384  refpAddr = nullptr;
385  if ( !pObj ) return error( "createRep> Current Database is invalid!" );
386  CLID clid = pObj->clID();
387  IRegistry* pR = pObj->registry();
388  string p[2] = { m_current->fid(), pR->identifier() };
389  TClass* cl = ( clid == CLID_DataObject ) ? m_classDO : getClass( pObj );
390  size_t len = p[1].find( '/', 1 );
391  string sect = p[1].substr( 1, len == string::npos ? string::npos : len - 1 );
394  if ( ret.first > 1 || ( clid == CLID_DataObject && ret.first == 1 ) ) {
395  unsigned long ip[2] = { 0, ret.second };
396  if ( m_currSection.empty() ) m_currSection = p[1];
397  return createAddress( repSvcType(), clid, p, ip, refpAddr );
398  }
399  return error( "Failed to write object data for:" + p[1] );
400 }
401 
402 // Save object references to data file
404  if ( pObj ) {
405  typedef vector<IRegistry*> Leaves;
406  Leaves leaves;
407  RootObjectRefs refs;
408  IRegistry* pR = pObj->registry();
409  auto dataMgr = SmartIF<IDataManagerSvc>{ pR->dataSvc() };
410  if ( dataMgr ) {
411  StatusCode status = dataMgr->objectLeaves( pObj, leaves );
412  if ( status.isSuccess() ) {
413  RootRef ref;
414  const string& id = pR->identifier();
415  size_t len = id.find( '/', 1 );
416  string sect = id.substr( 1, len == string::npos ? string::npos : len - 1 );
417  LinkManager* pLinks = pObj->linkMgr();
418  for ( auto& i : leaves ) {
419  if ( i->address() ) {
420  m_current->makeRef( *i, ref );
421  ref.entry = i->address()->ipar()[1];
422  refs.refs.push_back( ref );
423  }
424  }
425  for ( int i = 0, n = pLinks->size(); i < n; ++i ) {
426  const LinkManager::Link* lnk = pLinks->link( i );
427  int link_id = m_current->makeLink( lnk->path() );
428  refs.links.push_back( link_id );
429  }
430  pair<int, unsigned long> ret = m_current->save( sect, id + "#R", m_classRefs, &refs, m_minBufferSize,
432  if ( ret.first > 1 ) {
433  if ( log().level() <= MSG::DEBUG )
434  log() << MSG::DEBUG << "Writing object:" << id << " " << ret.first << " " << hex << ret.second << dec
435  << endmsg;
436  return S_OK;
437  }
438  }
439  }
440  }
441  return S_FAIL;
442 }
443 
444 // Read existing object. Open transaction in read mode if not active
446  refpObj = nullptr;
447  if ( !pA ) return S_FAIL;
448  RootDataConnection* con = nullptr;
449  const string* par = pA->par();
450  unsigned long* ipar = const_cast<unsigned long*>( pA->ipar() );
452  if ( sc.isSuccess() ) {
453  ipar[0] = (unsigned long)con;
454  DataObject* pObj = nullptr;
455  size_t len = par[1].find( '/', 1 );
456  string section = par[1].substr( 1, len == string::npos ? string::npos : len - 1 );
457 
458  int nb = con->loadObj( section, par[1], ipar[1], pObj );
459  if ( nb > 1 || ( nb == 1 && pObj->clID() == CLID_DataObject ) ) {
460  refpObj = pObj;
461  return S_OK;
462  }
463  delete pObj;
464  }
465  string tag = par[0] + ":" + par[1];
466  if ( m_badFiles.find( tag ) == m_badFiles.end() ) {
467  m_badFiles.insert( tag );
468  return error( "createObj> Cannot access the object:" + tag );
469  }
470  return S_FAIL;
471 }
472 
473 // Resolve the references of the created transient object.
475  if ( !pA || !pObj ) return error( "read> Cannot read object -- no valid object address present " );
476 
477  const unsigned long* ipar = pA->ipar();
478  RootDataConnection* con = (RootDataConnection*)ipar[0];
479  if ( con ) {
480  RootObjectRefs refs;
481  const string* par = pA->par();
482  size_t len = par[1].find( '/', 1 );
483  string section = par[1].substr( 1, len == string::npos ? string::npos : len - 1 );
484  int nb = con->loadRefs( section, par[1], ipar[1], refs );
485  if ( nb >= 1 ) {
486  string npar[3];
487  unsigned long nipar[2];
488  IRegistry* pR = pObj->registry();
489  auto dataMgr = SmartIF<IDataManagerSvc>{ pR->dataSvc() };
490  LinkManager* mgr = pObj->linkMgr();
491  for ( const auto& i : refs.links ) mgr->addLink( con->getLink( i ), nullptr );
492  for ( auto& r : refs.refs ) {
493  npar[0] = con->getDb( r.dbase );
494  npar[1] = con->getCont( r.container );
495  npar[2] = con->getLink( r.link );
496  nipar[0] = 0;
497  nipar[1] = r.entry;
498  IOpaqueAddress* nPA = nullptr;
499  StatusCode sc = addressCreator()->createAddress( r.svc, r.clid, npar, nipar, nPA );
500  if ( sc.isSuccess() ) {
501  if ( log().level() <= MSG::VERBOSE )
502  log() << MSG::VERBOSE << dataMgr.as<IService>()->name() << " -> Register:" << pA->registry()->identifier()
503  << "#" << npar[2] << "[" << r.entry << "]" << endmsg;
504  sc = dataMgr->registerAddress( pA->registry(), npar[2], nPA );
505  if ( sc.isSuccess() ) continue;
506  }
507  log() << MSG::ERROR << con->fid() << ": Failed to create address!!!!" << endmsg;
508  return S_FAIL;
509  }
510  return pObj->update();
511  } else if ( nb < 0 ) {
512  string tag = par[0] + ":" + par[1];
513  if ( m_badFiles.find( tag ) == m_badFiles.end() ) {
514  m_badFiles.insert( tag );
515  return error( "createObj> Cannot access the object:" + tag + " [Corrupted file]" );
516  }
517  }
518  }
519  return S_FAIL;
520 }
IOTest.evt
evt
Definition: IOTest.py:105
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
IService
Definition: IService.h:28
ConversionSvc
Definition: ConversionSvc.h:55
Gaudi::RootCnvSvc::finalize
StatusCode finalize() override
ConversionSvc overload: Finalize Db service.
Definition: RootCnvSvc.cpp:115
Gaudi::RootCnvSvc::m_maxBufferSize
Gaudi::Property< int > m_maxBufferSize
Definition: RootCnvSvc.h:75
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:282
GaudiRoot
Definition: RootCnvSvc.cpp:49
Gaudi::RootDataConnection::isConnected
bool isConnected() const override
Check if connected to data source.
Definition: RootDataConnection.h:259
Gaudi::Units::pc
constexpr double pc
Definition: SystemOfUnits.h:116
Gaudi::RootCnvSvc::loadConverter
void loadConverter(DataObject *pObj) override
ConversionSvc overload: Load the class (dictionary) for the converter.
Definition: RootCnvSvc.cpp:157
std::string
STL class.
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
std::exception
STL class.
Gaudi::RootConnectionSetup::cacheBranches
StringVec cacheBranches
Vector of strings with branches to be cached for input files.
Definition: RootDataConnection.h:67
GaudiAlg.HistoUtils.path
path
Definition: HistoUtils.py:961
Gaudi::RootCnvSvc::initialize
StatusCode initialize() override
ConversionSvc overload: initialize Db service.
Definition: RootCnvSvc.cpp:87
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
Gaudi::RootCnvSvc::connectDatabase
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:207
Gaudi::IDataConnection
Definition: IIODataManager.h:34
System.h
Gaudi::RootCnvSvc::error
StatusCode error(const std::string &msg)
Standard way to print errors.
Definition: RootCnvSvc.cpp:76
std::pair
Gaudi::RootCnvSvc
Definition: RootCnvSvc.h:62
Properties.long
long
(c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations # # This software i...
Definition: Properties.py:15
IOpaqueAddress
Definition: IOpaqueAddress.h:33
Gaudi::RootCnvSvc::m_minBufferSize
Gaudi::Property< int > m_minBufferSize
Definition: RootCnvSvc.h:73
MBYTE
#define MBYTE
Definition: RootCnvSvc.cpp:57
std::vector
STL class.
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:96
std::string::find
T find(T... args)
Gaudi::RootDatabaseCnv
Definition: RootDatabaseCnv.h:38
Gaudi::RootDataConnection::getLink
const std::string & getLink(int which) const
Access link name from saved index.
Definition: RootDataConnection.h:344
ISvcLocator
Definition: ISvcLocator.h:46
IConverter
Definition: IConverter.h:68
Gaudi::IDataConnection::RECREATE
@ RECREATE
Definition: IIODataManager.h:49
Gaudi::RootCnvSvc::m_incidentEnabled
Gaudi::Property< bool > m_incidentEnabled
Definition: RootCnvSvc.h:68
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
ContextIncident
Definition: DataIncident.h:26
RootDirectoryCnv.h
Gaudi::RootDataConnection::saveObj
std::pair< int, unsigned long > saveObj(std::string_view section, std::string_view cnt, TClass *cl, DataObject *pObj, int minBufferSize, int maxBufferSize, int approxEventsPerBasket, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
Definition: RootDataConnection.cpp:480
DataIncident.h
Gaudi::RootCnvSvc::m_log
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootCnvSvc.h:102
gaudirun.c
c
Definition: gaudirun.py:527
IRegistry
Definition: IRegistry.h:32
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:313
KeyedContainer.h
RootDataConnection.h
RootDatabaseCnv.h
std::unique_ptr::reset
T reset(T... args)
IDataProviderSvc.h
Gaudi::RootConverter
Definition: RootConverter.h:42
std::string::clear
T clear(T... args)
Gaudi::RootObjectRefs
Definition: RootRefs.h:68
Gaudi::RootDataConnection
Definition: RootDataConnection.h:107
Gaudi::RootCnvSvc::createNullRef
virtual StatusCode createNullRef(const std::string &path)
Insert null marker for not existent transient object.
Definition: RootCnvSvc.cpp:370
IIncidentSvc.h
std::vector::push_back
T push_back(T... args)
compareOutputFiles.par
par
Definition: compareOutputFiles.py:477
Gaudi::RootCnvSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:86
bug_34121.t
t
Definition: bug_34121.py:30
Gaudi::IDataConnection::CREATE
@ CREATE
Definition: IIODataManager.h:49
Gaudi::RootCnvSvc::m_badFiles
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition: RootCnvSvc.h:99
Gaudi::RootCnvSvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:354
Gaudi::RootDataConnection::getDb
const std::string & getDb(int which) const
Access database/file name from saved index.
Definition: RootDataConnection.cpp:468
Gaudi::Functional::details::get
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition: details.h:440
S_OK
#define S_OK
Definition: RootCnvSvc.cpp:47
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
Gaudi::RootNTupleCnv
Definition: RootNTupleCnv.h:45
std::log
T log(T... args)
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:108
MSG::dec
MsgStream & dec(MsgStream &log)
Definition: MsgStream.h:278
Gaudi::RootCnvSvc::commitOutput
StatusCode commitOutput(const std::string &outputFile, bool do_commit) override
Commit pending output.
Definition: RootCnvSvc.cpp:308
std::string::c_str
T c_str(T... args)
Gaudi::RootCnvSvc::createConverter
IConverter * createConverter(long typ, const CLID &wanted, const ICnvFactory *fac) override
ConversionSvc overload: Create new Converter using factory.
Definition: RootCnvSvc.cpp:143
Gaudi::RootDataConnection::getCont
const std::string & getCont(int which) const
Access container name from saved index.
Definition: RootDataConnection.h:339
Gaudi::RootCnvSvc::log
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:107
Gaudi::RootObjectRefs::links
std::vector< int > links
The links of the link manager.
Definition: RootRefs.h:70
Gaudi::IDataConnection::UPDATE
@ UPDATE
Definition: IIODataManager.h:49
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:239
Gaudi::IDataConnection::READ
@ READ
Definition: IIODataManager.h:49
GaudiRoot::patchStreamers
bool patchStreamers(MsgStream &log)
Definition: RootIOHandler.cpp:211
RootNTupleCnv.h
Gaudi::RootRef
Definition: RootRefs.h:40
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:88
Gaudi::RootConnectionSetup::setCompression
static StatusCode setCompression(std::string_view compression)
Set the global compression level.
Definition: RootDataConnection.cpp:122
Gaudi::IDataConnection::IoType
IoType
I/O Connection types.
Definition: IIODataManager.h:49
RootCnvSvc.h
DataObject::update
virtual StatusCode update()
Provide empty placeholder for internal object reconfiguration callback.
Definition: DataObject.cpp:75
std::runtime_error
STL class.
Gaudi::RootCnvSvc::m_ioMgr
SmartIF< Gaudi::IIODataManager > m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:84
Gaudi::RootCnvSvc::m_splitLevel
Gaudi::Property< int > m_splitLevel
Definition: RootCnvSvc.h:79
SmartIF< IDataManagerSvc >
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
Gaudi::RootDataConnection::makeRef
void makeRef(const IRegistry &pA, RootRef &ref)
Create reference object from registry entry.
Definition: RootDataConnection.cpp:628
ROOT_StorageType
const long ROOT_StorageType
Definition: ClassID.h:62
std::map
STL class.
Gaudi::RootDirectoryCnv
Definition: RootDirectoryCnv.h:40
gaudirun.level
level
Definition: gaudirun.py:366
IRegistry.h
MsgStream
Definition: MsgStream.h:34
IOpaqueAddress::registry
virtual IRegistry * registry() const =0
Update branch name.
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:235
Gaudi::RootCnvSvc::m_ioPerfStats
Gaudi::Property< std::string > m_ioPerfStats
Definition: RootCnvSvc.h:64
Gaudi::RootCnvSvc::i__fillObjRefs
virtual StatusCode i__fillObjRefs(IOpaqueAddress *pAddr, DataObject *pObj)
Resolve the references of the created transient object.
Definition: RootCnvSvc.cpp:474
Gaudi::RootDataConnection::makeLink
int makeLink(std::string_view p)
Convert path string to path index.
Definition: RootDataConnection.cpp:460
std::string::substr
T substr(T... args)
Gaudi::RootCnvSvc::i__createRep
virtual StatusCode i__createRep(DataObject *pObj, IOpaqueAddress *&refpAddr)
Convert the transient object to the requested persistent representation.
Definition: RootCnvSvc.cpp:383
MSG::VERBOSE
@ VERBOSE
Definition: IMessageSvc.h:25
ConversionSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: ConversionSvc.cpp:237
Gaudi::RootConnectionSetup
Definition: RootDataConnection.h:55
Gaudi::RootCnvSvc::connectOutput
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
RootRefs.h
Gaudi::RootCnvSvc::m_classDO
TClass * m_classDO
TClass pointer to DataObject class.
Definition: RootCnvSvc.h:92
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
Gaudi::RootCnvSvc::i__createObj
virtual StatusCode i__createObj(IOpaqueAddress *pAddr, DataObject *&refpObj)
Create transient object from persistent data.
Definition: RootCnvSvc.cpp:445
Gaudi::RootDataConnection::loadRefs
int loadRefs(std::string_view section, std::string_view cnt, unsigned long entry, RootObjectRefs &refs)
Load references object.
Definition: RootDataConnection.cpp:585
Gaudi::RootCnvSvc::m_current
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection::save
std::pair< int, unsigned long > save(std::string_view section, std::string_view cnt, TClass *cl, void *pObj, int minBufferSize, int maxBufferSize, int approxEventsPerBasket, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
Definition: RootDataConnection.cpp:488
Gaudi::RootCnvSvc::getClass
TClass * getClass(DataObject *pObject)
Helper: Get TClass for a given DataObject pointer.
Definition: RootCnvSvc.cpp:174
CSTR
const string & CSTR
Definition: RootCnvSvc.cpp:45
Gaudi::RootCnvSvc::m_classRefs
TClass * m_classRefs
TClass pointer to reference class.
Definition: RootCnvSvc.h:90
ConversionSvc::finalize
StatusCode finalize() override
stop the service.
Definition: ConversionSvc.cpp:240
std
STL namespace.
std::set::insert
T insert(T... args)
RootConverter.h
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
DataObject
Definition: DataObject.h:40
Gaudi::RootCnvSvc::disconnect
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:348
Gaudi::IDataConnection::fid
const std::string & fid() const
Access file id.
Definition: IIODataManager.h:63
RootUtils.h
std::string::empty
T empty(T... args)
IUpdateable.h
RootAddress.h
Gaudi::RootCnvSvc::m_currSection
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:96
Gaudi::RootCnvSvc::m_approxEventsPerBasket
Gaudi::Property< int > m_approxEventsPerBasket
Definition: RootCnvSvc.h:77
Gaudi::RootDataConnection::loadObj
int loadObj(std::string_view section, std::string_view cnt, unsigned long entry, DataObject *&pObj)
Load object.
Definition: RootDataConnection.cpp:535
std::set::end
T end(T... args)
Gaudi::RootObjectRefs::refs
std::vector< RootRef > refs
The references corresponding to the next layer of items in the data store.
Definition: RootRefs.h:72
Gaudi::RootCnvSvc::m_recordName
Gaudi::Property< std::string > m_recordName
Definition: RootCnvSvc.h:69
AsyncIncidents.msgSvc
msgSvc
Definition: AsyncIncidents.py:34
compareRootHistos.ref
ref
Definition: compareRootHistos.py:28
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
ConversionSvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: ConversionSvc.cpp:181
DataObject::linkMgr
LinkManager * linkMgr()
Retrieve Link manager.
Definition: DataObject.h:84
Incident.h
Gaudi::RootDataConnection::getBranch
TBranch * getBranch(std::string_view section, std::string_view branch_name)
Access data branch by name: Get existing branch in read only mode.
Definition: RootDataConnection.h:319
Incident
Definition: Incident.h:27
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:66
ConversionSvc::repSvcType
long repSvcType() const override
Retrieve the class type of the data store the converter uses.
Definition: ConversionSvc.cpp:286
Gaudi::RootCnvSvc::i__fillRepRefs
virtual StatusCode i__fillRepRefs(IOpaqueAddress *pAddr, DataObject *pObj)
Resolve the references of the converted object.
Definition: RootCnvSvc.cpp:403
Gaudi::RootCnvSvc::createNullRep
virtual StatusCode createNullRep(const std::string &path)
Insert null marker for not existent transient object.
Definition: RootCnvSvc.cpp:361
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:88
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
Gaudi::RootCnvSvc::m_setup
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:94
MsgStream::level
MSG::Level level() const
Retrieve output level.
Definition: MsgStream.h:113
IRegistry::dataSvc
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
IDataManagerSvc.h
std::exception::what
T what(T... args)
S_FAIL
#define S_FAIL
Definition: RootCnvSvc.cpp:48
MsgStream.h
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335
Gaudi::RootCnvSvc::m_compression
Gaudi::Property< std::string > m_compression
Definition: RootCnvSvc.h:80
Gaudi::RootAddress
Definition: RootAddress.h:46