Commit 1cf499c8 authored by Rachid Mazini's avatar Rachid Mazini
Browse files

Merge branch 'rtic-mc16a' into '21.0-mc16a'

For Forward-Compatibility port reading of RootTreeIndexContainer, MC16a

See merge request !37702
parents 7690df0c 4a370671
......@@ -15,6 +15,7 @@
#include "RootDomain.h"
#include "RootKeyContainer.h"
#include "RootTreeContainer.h"
#include "RootTreeIndexContainer.h"
#include "StorageSvc/DbInstanceCount.h"
using namespace pool;
......@@ -52,6 +53,9 @@ IDbContainer* RootOODb::createContainer(const DbType& typ) {
else if ( typ.match(ROOTTREE_StorageType) ) {
return new RootTreeContainer(this);
}
else if ( typ.match(ROOTTREEINDEX_StorageType) ) {
return new RootTreeIndexContainer(this);
}
else if ( typ.match(ROOT_StorageType) ) {
return new RootTreeContainer(this);
}
......
......@@ -62,6 +62,13 @@ namespace pool {
/// Create Root Container object
IDbContainer* createContainer(const DbType& typ);
};
class RootOOKey : public RootOODb {
public:
/// Standard Constructor
RootOOKey(void* ctxt) : RootOODb(ctxt, ROOTKEY_StorageType) { }
/// Label of the specific class
static const char* catalogLabel() { return "ROOT_Key"; }
};
class RootOOTree : public RootOODb {
public:
/// Standard Constructor
......@@ -69,12 +76,12 @@ namespace pool {
/// Label of the specific class
static const char* catalogLabel() { return "ROOT_Tree"; }
};
class RootOOKey : public RootOODb {
class RootOOTreeIndex : public RootOODb {
public:
/// Standard Constructor
RootOOKey(void* ctxt) : RootOODb(ctxt, ROOTKEY_StorageType) { }
RootOOTreeIndex(void* ctxt) : RootOODb(ctxt,ROOTTREEINDEX_StorageType) { }
/// Label of the specific class
static const char* catalogLabel() { return "ROOT_Key"; }
static const char* catalogLabel() { return "ROOT_TreeIndex"; }
};
} // end namespace pool
......
......@@ -104,6 +104,8 @@ namespace pool {
/// Definition of the branch container
typedef std::vector<BranchDesc> Branches;
protected:
/// Reference to the root tree object
TTree* m_tree;
/// reference to exact type description
......
/*
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
* */
// Local implementation files
#include "RootTreeIndexContainer.h"
#include "StorageSvc/Transaction.h"
#include "RootDataPtr.h"
#include "RootDatabase.h"
// Root include files
#include "TTree.h"
#include "TBranch.h"
using namespace pool;
using namespace std;
RootTreeIndexContainer::RootTreeIndexContainer(IOODatabase* idb) : RootTreeContainer(idb) {
}
/// Standard destructor
RootTreeIndexContainer::~RootTreeIndexContainer() {
}
DbStatus RootTreeIndexContainer::loadObject(DataCallBack* call, Token::OID_t& oid, DbAccessMode mode) {
if ((oid.second >> 32) > 0) {
long long int evt_id = m_tree->GetEntryNumberWithIndex(oid.second);
if (evt_id == -1) {
m_tree->BuildIndex("index_ref");
evt_id = m_tree->GetEntryNumberWithIndex(oid.second);
}
if (evt_id >= 0) {
oid.second = evt_id;
}
}
return RootTreeContainer::loadObject(call, oid, mode);
}
/*
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
* */
#ifndef POOL_ROOTTREEINDEXCONTAINER_H
#define POOL_ROOTTREEINDEXCONTAINER_H 1
#include "RootTreeContainer.h"
// Forward declarations
class TTree;
class TBranch;
namespace pool {
/** @class RootTreeIndexContainer RootTreeIndexContainer.h src/RootTreeIndexContainer.h
*
* Description:
* Spezialization of RootTreeContainer, Read only port for R21!
* ROOT specific implementation of Database container.
* Since objects in root are stored in "trees with branches",
* this object corresponds to a tuple (Tree/Branch), where
* each object type (determined by the location of the transient
* object within the data store) is accessed by an index number
* stored inside its tree.
*
* @author N.Dulin, P.v.Gemmeren
* @date 8/1/2018
* @version 1.0
*/
class RootTreeIndexContainer : public RootTreeContainer {
public:
/// Standard constructor
RootTreeIndexContainer(IOODatabase* idb);
/// Standard destructor
virtual ~RootTreeIndexContainer();
/// Find object by object identifier and load it into memory
/** @param call [IN] Callback to load data
* @param oid [OUT] Object OID
* @param mode [IN] Object access mode
*
* @return Status code indicating success or failure.
*/
virtual DbStatus loadObject(DataCallBack* call,
Token::OID_t& oid,
DbAccessMode mode);
};
}
#endif //POOL_ROOTTREEINDEXCONTAINER_H
......@@ -100,6 +100,7 @@ namespace pool {
static const DbType ROOT_StorageType = makeTechnology(2,0);
static const DbType ROOTKEY_StorageType = makeTechnology(2,1);
static const DbType ROOTTREE_StorageType = makeTechnology(2,2);
static const DbType ROOTTREEINDEX_StorageType = makeTechnology(2,3);
static const DbType OBJY_StorageType = makeTechnology(3,0);
static const DbType ACCESS_StorageType = makeTechnology(4,0);
static const DbType EXCEL_StorageType = makeTechnology(5,0);
......
......@@ -20,6 +20,8 @@ DbType DbType::getType(const std::string& name) {
return ROOTKEY_StorageType;
else if ( "ROOT_Tree" == name )
return ROOTTREE_StorageType;
else if ( "ROOT_TreeIndex" == name )
return ROOTTREEINDEX_StorageType;
else if ( "ROOT_All" == name )
return ROOT_StorageType;
else if ( "POOL_RDBMS" == name )
......@@ -61,6 +63,8 @@ const std::string DbType::storageName() const {
return "ROOT_Key";
else if ( match(ROOTTREE_StorageType) )
return "ROOT_Tree";
else if ( match(ROOTTREEINDEX_StorageType) )
return "ROOT_TreeIndex";
else if ( *this == ROOT_StorageType )
return "ROOT_All";
else if ( match( POOL_RDBMS_HOMOGENEOUS_StorageType ) )
......
......@@ -108,14 +108,7 @@ const Token* DataHeaderElement::getToken() const {
}
//_____________________________________________________________________________
long DataHeaderElement::getStorageType() const {
const long technology = m_token->technology();
if (technology == POOL_StorageType
|| technology == POOL_ROOT_StorageType
|| technology == POOL_ROOTKEY_StorageType
|| technology == POOL_ROOTTREE_StorageType) {
return(POOL_StorageType);
}
return(TEST_StorageType);
return(POOL_StorageType);
}
//_____________________________________________________________________________
const std::vector<unsigned int>& DataHeaderElement::getHashes() const {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment