|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include <TVirtualCollectionProxy.h>
17 #include <TBranchElement.h>
18 #include <TStreamerInfo.h>
19 #include <TStreamerElement.h>
41 TClass* lookupVectorType (TClass *
cl)
43 std::string tname =
cl->GetName();
44 tname +=
"::vector_type";
45 TDataType* typ = gROOT->GetType (tname.c_str());
47 return TClass::GetClass (typ->GetFullTypeName());
60 :
SG::IAuxStore(),
SG::IAuxStoreIO(),
62 m_topStore( topStore ), m_structMode(
mode ), m_basketSize( basketSize ),
63 m_splitLevel( splitLevel ), m_inTree( 0 ), m_outTree( 0 ),
64 m_inputScanned( kFALSE ), m_selection(), m_transientStore( 0 ),
65 m_auxIDs(), m_decorIDs(), m_vecs(), m_size( 0 ), m_locked( kFALSE ), m_isDecoration(),
66 m_mutex1(), m_mutex2(),
67 m_branches(), m_branchesWritten(), m_missingBranches() {
75 for( ; vitr != vend; ++vitr ) {
76 if( *vitr )
delete *vitr;
81 for( ; bitr != bend; ++bitr ) {
82 if( *bitr )
delete *bitr;
104 ::Error(
"xAOD::TAuxStore::setStructMode",
105 XAOD_MESSAGE(
"Trying to change the structure mode of an "
106 "initialised object" ) );
107 return StatusCode::FAILURE;
112 return StatusCode::SUCCESS;
188 return StatusCode::SUCCESS;
193 if( (
br->GetSplitLevel() != 1 ) &&
m_topStore && printWarnings ) {
194 ::Warning(
"xAOD::TAuxStore::readFrom",
195 "Static branch (%s) with split level %i discovered",
197 ::Warning(
"xAOD::TAuxStore::readFrom",
198 "The reading of complex variables from it may/will fail!" );
201 return StatusCode::SUCCESS;
225 return StatusCode::SUCCESS;
259 if( ! getall )
return 0;
262 ::Int_t bytesRead = 0;
265 for( ; itr !=
end; ++itr ) {
267 bytesRead += ( *itr )->getEntry();
279 for( ; itr !=
end; ++itr ) {
280 if( *itr ) ( *itr )->reset();
311 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ||
314 if( ( ! this_nc->setupInputData( auxid ).isSuccess() ) ||
315 ( ! this_nc->setupOutputData( auxid ).isSuccess() ) ) {
321 const ::Int_t readBytes =
m_branches[ auxid ]->getEntry();
322 if( readBytes < 0 ) {
323 ::Error(
"xAOD::TAuxStore::getData",
359 m_vecs[ auxid ]->reserve( capacity );
361 return m_vecs[ auxid ]->toPtr();
453 bool anycleared =
false;
491 if(
id >=
m_vecs.size() )
break;
493 if( !
m_vecs[
id ] ||
m_vecs[
id ]->isLinked() )
continue;
513 auxid_t linked_id =
r.linkedVariable( auxid );
515 if ( linked_id <
m_vecs.size() ) {
516 return m_vecs[ linked_id ];
526 auxid_t linked_id =
r.linkedVariable( auxid );
528 if ( linked_id <
m_vecs.size() ) {
529 return m_vecs[ linked_id ];
577 ::Error(
"xAOD::TAuxStore::getData",
585 ::Error(
"xAOD::TAuxStore::getData",
587 ::Error(
"xAOD::TAuxStore::getData",
590 ::Error(
"xAOD::TAuxStore::getData",
592 static_cast< int >(
size ) );
593 ::Error(
"xAOD::TAuxStore::getData",
599 m_vecs[ auxid ]->reserve( capacity );
603 return m_vecs[ auxid ]->toPtr();
618 ::Error(
"xAOD::TAuxStore::resize",
620 static_cast< int >(
size ) );
629 if(
v && !
v->isLinked()) {
630 if (!
v->resize(
size ))
649 ::Error(
"xAOD::TAuxStore::reserve",
651 static_cast< int >(
size ) );
656 if(
v && !
v->isLinked()) {
675 ::Error(
"xAOD::TAuxStore::shift",
676 XAOD_MESSAGE(
"Should not have been called for single-object "
682 if( (
static_cast< std::size_t
>( std::abs( offs ) ) >
m_size ) &&
690 if(
v && !
v->isLinked()) {
691 v->shift(
pos, offs );
711 ::Error(
"xAOD::TAuxStore::insertMove",
712 XAOD_MESSAGE(
"Should not have been called for single-object "
718 size_t other_size =
other.size();
728 if (
other.getData (
id)) {
729 void* src_ptr =
other.getData (
id, other_size, other_size);
737 const void* orig = v_dst->
toPtr();
739 if (orig != v_dst->
toPtr())
774 if( ! this_nc->setupInputData( auxid ).isSuccess() ) {
789 ::Fatal(
"xAOD::TAuxStore::getIOData",
818 if( ! this_nc->setupInputData( auxid ).isSuccess() ) {
819 ::Error(
"xAOD::TAuxStore::getIOType",
822 static_cast< int >( auxid ),
829 ::Fatal(
"xAOD::TAuxStore::getIOType",
887 stats.setBranchNum(
stats.branchNum() + nbranch );
890 return StatusCode::SUCCESS;
905 return StatusCode::RECOVERABLE;
909 if(
m_vecs.size() <= auxid ) {
910 m_vecs.resize( auxid + 1 );
918 return StatusCode::SUCCESS;
923 ::Error(
"xAOD::TAuxStore::setupInputData",
925 return StatusCode::FAILURE;
930 ::Error(
"xAOD::TAuxStore::setupInputData",
931 XAOD_MESSAGE(
"The internal variables of the object got "
933 return StatusCode::FAILURE;
939 const TString statBrName =
m_prefix +
r.getName( auxid ).c_str();
940 const TString dynBrName =
m_dynPrefix +
r.getName( auxid ).c_str();
943 Bool_t staticBranch = kTRUE;
944 TString
brName = statBrName;
946 TBranch*
br =
m_inTree->GetBranch( statBrName );
958 return StatusCode::RECOVERABLE;
961 staticBranch = kFALSE;
968 const Bool_t containerBranch =
979 ::Error(
"xAOD::TAuxStore::setupInputData",
980 XAOD_MESSAGE(
"Branch type and requested structure mode "
981 "differ for branch: %s" ),
983 return StatusCode::FAILURE;
987 ::TClass* clDummy = 0;
988 ::EDataType dType = kOther_t;
989 if(
br->GetExpectedType( clDummy, dType ) ) {
990 ::Error(
"xAOD::TAuxStore::setupInputData",
992 "\"%s\"" ),
brName.Data() );
993 return StatusCode::FAILURE;
997 const std::type_info* brType = 0;
1002 r.getVecType( auxid ) :
1003 r.getType( auxid ) );
1006 brType = ( clDummy ? clDummy->GetTypeInfo() :
1010 ::Error(
"xAOD::TAuxStore::setupInputData",
1012 brName.Data(), clDummy->GetName() );
1013 return StatusCode::RECOVERABLE;
1018 ::TClass* brClass = 0;
1019 if( ! primitiveBranch ) {
1021 brClass = ::TClass::GetClass( *brType, kTRUE, kTRUE );
1023 brClass = ::TClass::GetClass( brTypeName );
1026 ::Error(
"xAOD::TAuxStore::setupInputData",
1027 XAOD_MESSAGE(
"No dictionary available for class \"%s\"" ),
1028 brTypeName.Data() );
1029 return StatusCode::FAILURE;
1036 r.makeVector( auxid, (
size_t)0, (
size_t)0 ).release();
1037 if( ! containerBranch ) {
1038 m_vecs[ auxid ]->resize( 1 );
1040 if (clDummy && strncmp (clDummy->GetName(),
"SG::PackedContainer<", 20) == 0) {
1046 ::Error(
"xAOD::TAuxStore::setupInputData",
1048 "variable %s (%i)" ),
1050 static_cast< int >( auxid ) );
1051 return StatusCode::FAILURE;
1055 const std::type_info* objType = brType;
1056 if (containerBranch) {
1057 objType =
m_vecs[ auxid ]->objType();
1059 objType =
r.getType( auxid );
1064 m_vecs[ auxid ]->toVector() :
1065 m_vecs[ auxid ]->toPtr() ),
1069 if( staticBranch ) {
1076 ::TString( clDummy->GetName() ).Contains(
"basic_string<char>" ) ) {
1093 ( ( ! staticBranch ) &&
1094 ( ! primitiveBranch ) ) );
1097 ::Error(
"xAOD::TAuxStore::setupInputData",
1100 ::Error(
"xAOD::TAuxStore::setupInputData",
1106 return StatusCode::FAILURE;
1118 const std::string auxname =
r.getName( auxid );
1124 if(
i == auxid )
continue;
1126 const std::string testname =
r.getName(
i );
1128 if( testname != auxname )
continue;
1131 ::Error(
"xAOD::TAuxStore::setupInputData",
1143 if (linked_auxid != SG::null_auxid) {
1148 return StatusCode::SUCCESS;
1161 if( !
m_outTree )
return StatusCode::SUCCESS;
1167 if(
m_vecs.size() <= auxid ) {
1168 m_vecs.resize( auxid + 1 );
1188 ::Fatal(
"xAOD::TAuxStore::setupOutputData",
1190 return StatusCode::FAILURE;
1200 ::Error(
"xAOD::TAuxStore::setupOutputData",
1203 return StatusCode::FAILURE;
1207 const std::type_info*
type = reg.
getType( auxid );
1209 ::Error(
"xAOD::TAuxStore::setupOutputData",
1212 static_cast< int >( auxid ) );
1213 return StatusCode::FAILURE;
1219 ::Error(
"xAOD::TAuxStore::setupOutputData",
1220 XAOD_MESSAGE(
"No factory found for transient variable "
1221 "%i" ),
static_cast< int >( auxid ) );
1222 return StatusCode::FAILURE;
1226 factory->
copy( auxid,
1249 ::Error(
"xAOD::TAuxStore::setupOutputData",
1250 XAOD_MESSAGE(
"Structure mode unknown for variable %s" ),
1252 return StatusCode::FAILURE;
1256 if( !
m_vecs[ auxid ] ) {
1260 m_vecs[ auxid ]->resize( 1 );
1267 const std::type_info* brType =
1272 bool primitiveBranch = (strlen( brType->name() ) == 1);
1274 new TBranchHandle( kFALSE, ( strlen( brType->name() ) == 1 ),
1277 m_vecs[ auxid ]->objType() ),
1279 m_vecs[ auxid ]->toPtr() :
1280 m_vecs[ auxid ]->toVector() ),
1295 br->SetAddress(
m_branches[ auxid ]->outputObjectPtr() );
1301 return StatusCode::SUCCESS;
1305 const std::type_info* brType =
m_branches[ auxid ]->typeInfo();
1307 ::Error(
"xAOD::TAuxStore::setupOutputData",
1308 XAOD_MESSAGE(
"There's an internal logic error in the "
1310 return StatusCode::FAILURE;
1315 const Bool_t primitiveBranch = ( strlen( brType->name() ) == 1 );
1318 if( primitiveBranch ) {
1323 ::Error(
"xAOD::TAuxStore::setupOutputData",
1326 brName.Data(), brTypeName.c_str() );
1327 return StatusCode::FAILURE;
1331 std::ostringstream typeDesc;
1342 TClass*
cl = TClass::GetClass( *brType );
1344 cl = TClass::GetClass( brTypeName.c_str() );
1347 ::Error(
"xAOD::TAuxStore::setupOutputData",
1348 XAOD_MESSAGE(
"Couldn't find dictionary for type: %s" ),
1349 brTypeName.c_str() );
1350 return StatusCode::FAILURE;
1352 if( !
cl->GetStreamerInfo() ) {
1353 ::Error(
"xAOD::TAuxStore::setupOutputData",
1354 XAOD_MESSAGE(
"No streamer info available for type %s" ),
1356 return StatusCode::FAILURE;
1367 ::Error(
"xAOD::TAuxStore::setupOutputData",
1370 brName.Data(), brTypeName.c_str() );
1371 return StatusCode::FAILURE;
1376 for( Long64_t
i = 0;
i <
m_outTree->GetEntries(); ++
i ) {
1387 return StatusCode::SUCCESS;
1410 return StatusCode::SUCCESS;
1415 return StatusCode::SUCCESS;
1422 for( Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i ) {
1428 TBranch*
br =
dynamic_cast< TBranch*
>(
branches->At(
i ) );
1430 ::Fatal(
"xAOD::TAuxStore::scanInputTree",
1442 TObjArray* sbranches =
br->GetListOfBranches();
1445 for( Int_t j = 0; j < sbranches->GetEntriesFast(); ++j ) {
1448 const TString
brName = sbranches->At( j )->GetName();
1451 const TString auxName =
brName(
brName.Index(
"." ) + 1,
1455 if( auxName.BeginsWith(
"xAOD::" ) ||
1456 auxName.BeginsWith(
"SG::" ) ||
1457 ( auxName ==
"ILockable" ) ) {
1463 dynamic_cast< ::TBranch*
>( sbranches->At( j ) );
1465 ::Fatal(
"xAOD::TAuxStore::scanInputTree",
1487 ::Warning(
"xAOD::TAuxStore::scanInputTree",
1488 "Dynamic branch with empty name found on container: %s",
1494 const TString auxName =
brName(
brName.Index(
"." ) + 1,
1507 return StatusCode::SUCCESS;
1511 const std::type_info*
1513 ::Bool_t staticBranch,
1514 std::string* expectedClassName ) {
1517 ::TClass* expectedClass = 0;
1518 ::EDataType expectedType = kOther_t;
1519 if(
br->GetExpectedType( expectedClass, expectedType ) &&
1520 ( ( ! staticBranch ) || ( strncmp( auxName,
"m_", 2 ) != 0 ) ) ) {
1521 ::Warning(
"xAOD::TAuxStore::setupAuxBranch",
1522 "Couldn't get the type of branch \"%s\"",
1530 if (expectedClass) {
1531 if (TBranchElement* bre =
dynamic_cast<TBranchElement*
> (
br)) {
1532 TClass* newClass = bre->GetCurrentClass();
1533 if (newClass && newClass != expectedClass) {
1534 expectedClass = newClass;
1537 if (expectedClassName) {
1538 *expectedClassName = expectedClass->GetName();
1544 if( ( ! expectedClass ) &&
1550 const std::type_info* ti = 0;
1552 if( expectedClass ) {
1553 ti = expectedClass->GetTypeInfo();
1558 if( ! expectedClass ) {
1559 if( ( ! staticBranch ) || ( strncmp( auxName,
"m_", 2 ) != 0 ) ) {
1560 ::Warning(
"xAOD::TAuxStore::setupAuxBranch",
1561 "Couldn't get the type of branch \"%s\"",
1565 ::TVirtualCollectionProxy* prox =
1566 expectedClass->GetCollectionProxy();
1569 TClass* cl2 = lookupVectorType (expectedClass);
1571 prox = cl2->GetCollectionProxy();
1575 if( ( ! staticBranch ) ||
1576 ( strncmp( auxName,
"m_", 2 ) != 0 ) ) {
1577 ::Warning(
"xAOD::TAuxStore::setupAuxBranch",
1578 "Couldn't get the type of branch \"%s\"",
1582 if( prox->GetValueClass() ) {
1583 ti = prox->GetValueClass()->GetTypeInfo();
1610 ::Bool_t staticBranch ) {
1612 std::string expectedClassName;
1614 &expectedClassName );
1623 if( regAuxid != SG::null_auxid ) {
1625 return StatusCode::SUCCESS;
1630 return StatusCode::SUCCESS;
1642 ::TBranch* lbr =
m_inTree->GetBranch( linkedBranch.c_str() );
1643 const std::type_info* lti =
nullptr;
1645 lti =
auxBranchType( lbr, linkedAttr.c_str(), staticBranch );
1648 linked_auxid =
registry.getAuxID( *lti, linkedAttr,
"",
1652 if (linked_auxid == SG::null_auxid) {
1653 ::Error(
"xAOD::TAuxStore::setupAuxBranch",
1654 "Could not find linked variable for %s type %s",
1655 auxName, expectedClassName.c_str() );
1661 flags, linked_auxid );
1664 if( auxid == SG::null_auxid ) {
1672 if (tn.starts_with(
"std::vector<"))
1674 std::string fac_class_name =
"SG::AuxTypeVectorFactory<" +
1675 tn +
",allocator<" + tn;
1676 if( fac_class_name[ fac_class_name.size() - 1 ] ==
'>' ) {
1677 fac_class_name +=
' ';
1679 fac_class_name +=
"> >";
1682 ::TClass* fac_class = TClass::GetClass( fac_class_name.c_str() );
1683 if( fac_class && fac_class->IsLoaded() ) {
1684 ::TClass* base_class =
1685 ::TClass::GetClass(
"SG::IAuxTypeVectorFactory" );
1686 if( base_class && base_class->IsLoaded() ) {
1687 const Int_t offs = fac_class->GetBaseClassOffset( base_class );
1689 void* fac_vp = fac_class->New();
1692 reinterpret_cast< unsigned long >( fac_vp ) + offs;
1695 registry.addFactory( *ti, *fac->
tiAlloc(), std::unique_ptr<SG::IAuxTypeVectorFactory>( fac ) );
1696 auxid =
registry.getAuxID( *ti, auxName,
"",
1697 flags, linked_auxid );
1705 if( auxid == SG::null_auxid && linked_auxid == SG::null_auxid ) {
1708 std::string vec_class_name =
"std::vector<" +
1710 if( vec_class_name[ vec_class_name.size() - 1 ] ==
'>' ) {
1711 vec_class_name +=
' ';
1713 vec_class_name +=
'>';
1716 ::TClass* vec_class = ::TClass::GetClass( vec_class_name.c_str() );
1717 if( vec_class && vec_class->IsLoaded() ) {
1718 auto fac = std::make_unique<TAuxVectorFactory>( vec_class );
1719 if (fac->tiAlloc()) {
1720 const std::type_info* tiAlloc = fac->tiAlloc();
1721 registry.addFactory( *ti, *tiAlloc, std::move( fac ) );
1724 std::string tiAllocName = fac->tiAllocName();
1725 registry.addFactory( *ti, tiAllocName, std::move( fac ) );
1727 auxid =
registry.getAuxID( *ti, auxName,
"",
1730 ::Warning(
"xAOD::TAuxStore::setupAuxBranch",
1731 "Couldn't find dictionary for type: %s",
1732 vec_class_name.c_str() );
1737 if( auxid == SG::null_auxid ) {
1738 if ( linked_auxid != SG::null_auxid ) {
1739 ::Error(
"xAOD::TAuxStore::setupAuxBranch",
1740 XAOD_MESSAGE(
"Dynamic ROOT vector factory not implemented for linked types; branch "
1745 ::Error(
"xAOD::TAuxStore::setupAuxBranch",
1746 XAOD_MESSAGE(
"Couldn't assign auxiliary ID to branch "
1750 return StatusCode::FAILURE;
1755 return StatusCode::SUCCESS;
1787 ::EDataType dType = kOther_t;
1790 if(
br->GetExpectedType(
cl, dType ) ) {
1791 ::Error(
"xAOD::TAuxStore::isPrimitiveBranch",
1793 "\"%s\"" ),
br->GetName() );
1798 return ( ( dType != kOther_t ) && ( dType != kNoType_t ) &&
1799 ( dType != kVoid_t ) );
1825 ::EDataType dType = kOther_t;
1828 if(
br->GetExpectedType(
cl, dType ) ) {
1829 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1831 "\"%s\"" ),
br->GetName() );
1843 const std::type_info* root_ti =
cl->GetTypeInfo();
1851 typeName.ReplaceAll(
"basic_string<char>",
"string" );
1852 ::TClass* newCl = ::TClass::GetClass(
typeName );
1854 root_ti = newCl->GetTypeInfo();
1858 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1859 XAOD_MESSAGE(
"Couldn't get an std::type_info object out of "
1860 "branch \"%s\" of type \"%s\"" ),
1861 br->GetName(),
cl->GetName() );
1866 const std::type_info* aux_obj_ti =
1868 if( ! aux_obj_ti ) {
1869 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1870 XAOD_MESSAGE(
"Couldn't get std::type_info object for "
1871 "auxiliary id: %i" ),
1872 static_cast< int >( auxid ) );
1875 const std::type_info* aux_vec_ti =
1877 if( ! aux_vec_ti ) {
1878 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1879 XAOD_MESSAGE(
"Couldn't get std::type_info object for "
1880 "auxiliary id: %i" ),
1881 static_cast< int >( auxid ) );
1886 if( *root_ti == *aux_obj_ti ) {
1889 }
else if( *root_ti == *aux_vec_ti ) {
1897 if(
cl->GetCollectionProxy() &&
1898 ( *aux_vec_ti ==
typeid( std::vector< int > ) ) ) {
1902 TClass* cl2 = lookupVectorType (
cl);
1904 if (*cl2->GetTypeInfo() == *aux_vec_ti)
1916 TClass* aux_vec_cl =
1918 if( aux_vec_cl && aux_vec_cl->GetConversionStreamerInfo(
cl,
cl->GetClassVersion() ) ) {
1921 TClass* aux_obj_cl =
1923 if( aux_obj_cl && aux_obj_cl->GetConversionStreamerInfo(
cl,
cl->GetClassVersion() ) ) {
1928 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1929 XAOD_MESSAGE(
"Couldn't determine if branch describes a single "
1930 "object or a container" ) );
1931 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1934 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1937 ::Error(
"xAOD::TAuxStore::isContainerBranch",
1956 static const std::type_info*
const sti =
registry.getVecType( sauxid );
1959 return ( *sti != *(
registry.getVecType( auxid ) ) );
1963 ::Bool_t primitiveBranch,
1964 const std::type_info* ti,
1966 const std::string*
prefix )
1967 : m_branch( 0 ), m_entry( 0 ) , m_object(
obj ), m_static( staticBranch ),
1968 m_primitive( primitiveBranch ),
1969 m_typeInfo( ti ), m_needsRead( kTRUE ), m_auxid( auxid ),
1992 if (!m_branch->GetTree()){
1993 Error(
"xAOD::TAuxStore::TBranchHandle::getEntry",
1994 XAOD_MESSAGE(
"Branch=%s is not associated to any tree while reading of branches within this class relies on that"),
1995 m_branch->GetName());
2004 ::Long64_t
entry = m_branch->GetTree()->GetReadEntry();
2012 Error(
"xAOD::TAuxStore::TBranchHandle::getEntry",
2013 XAOD_MESSAGE(
"Entry to read is not set for branch=%s from tree=%s. "
2014 "It is either because TTree::LoadTree(entry) was not called "
2015 "beforehand in the TEvent class OR "
2016 "the entry requested to be read for the main tree is not corresponding to an event for the friend tree"),
2017 m_branch->GetName(),
2018 m_branch->GetTree()->GetName());
2023 if( (
entry == m_entry ) && ( ! m_needsRead ) ) {
2028 if( ! m_primitive ) {
2029 if( ( m_branch->GetMakeClass() != m_static ) &&
2030 ( ! m_branch->SetMakeClass( m_static ) ) ) {
2031 ::Error(
"xAOD::TAuxStore::TBranchHandle::getEntry",
2034 static_cast< int >( m_static ), m_branch->GetName() );
2040 const ::Int_t nbytes = m_branch->GetEntry(
entry );
2046 m_needsRead = kFALSE;
2092 if( m_static || m_primitive ) {
2136 m_needsRead = kTRUE;
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
virtual void reserve(size_t sz) override
Change the capacity of all aux data vectors.
JetConstituentVector::iterator iterator
void setTopStore(Bool_t value=kTRUE)
Set whether the object should behave as a "top store" or not.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
bool isLinked() const
Return true if this variable is linked from another one.
std::vector< bool > m_missingBranches
Mark branches we've found to be missing.
virtual auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected aux variables.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
const std::type_info * typeInfo() const
Get the type of the variable in memory.
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
void reset()
Tell the object that the branch contents need to be re-read.
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
Int_t basketSize() const
Get the size of the baskets created for the output branches.
StatusCode readFrom(::TTree *tree, ::Bool_t printWarnings=kTRUE)
Connect the object to an input TTree.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
ReadStats & stats()
Access the object belonging to the current thread.
virtual const void * getData(SG::auxid_t auxid) const override
Return the data vector for one aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Make an AuxVectorData object from either a raw vector or an aux store.
std::vector< ::Bool_t > m_isDecoration
Flags items as decorations.
std::string m_prefix
Static prefix for the branch names.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Exception — Attempted to modify auxiliary data in a locked store.
Bool_t isTopStore() const
Check if the object is a "top store", or not.
Exceptions that can be thrown from AthContainers.
::Int_t m_splitLevel
The split level for the output branches.
Helper for getting a const version of a pointer.
auxid_set_t m_auxIDs
Internal list of variable IDs handled currently by the object.
void setBasketSize(Int_t value)
Set the size of the baskets created for the output branches.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
StatusCode setStructMode(EStructMode mode)
Set the structure mode of the object to a new value.
"ROOT implementation" of IAuxStore
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
EStructMode
"Structural" modes of the object
::Int_t m_basketSize
The basket size for the output branches.
static bool classNameHasLink(const std::string &className)
Test to see if a class name corresponds to a class with a linked variable.
::Bool_t m_locked
Is this container locked?
ConcurrentBitset & clear()
Clear all bits in the set.
StatusCode scanInputTree()
Scan the input TTree for auxiliary branches.
std::string dynBranchPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary branches coming from a container c...
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
virtual const SG::auxid_set_t & getAuxIDs() const override
Return a set of identifiers for existing data items in this store.
Handle mappings between names and auxid_t.
::TTree * m_inTree
The TTree being read from.
std::string m_dynPrefix
Dynamic prefix for the branch names.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
AthContainers_detail::lock_guard< mutex_t > guard_t
Guard type for multithreaded synchronisation.
void reset()
Tell the object that all branches will need to be re-read.
@ Linked
Mark that this variable is linked to another one.
size_t auxid_t
Identifier for a particular aux data item.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
H5::CompType packed(H5::CompType in)
const std::type_info * auxBranchType(::TBranch *br, const char *auxName, ::Bool_t staticBranch, std::string *expectedClassName=nullptr)
Find the type_info to use as the aux type for a given branch.
virtual void lock() override
Lock the object, and don't let decorations be added.
bit_t size() const
Count the number of 1 bits in the set.
::TTree * m_outTree
The TTree being written to.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
::Bool_t isRegisteredType(auxid_t auxid)
Check if the auxiliary variable has a registered type.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual bool clearDecorations() override
Clear all decorations.
virtual const std::type_info * getIOType(auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
Interface for factory objects that create vectors.
@ kObjectStore
The object describes a single object.
StatusCode writeTo(::TTree *tree)
Connect the object to an output TTree.
::Bool_t isAuxIDSelected(auxid_t auxid) const
Check if this auxiliary variable needs to go to the output.
virtual void lock() override
Lock the container.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
virtual const std::type_info * tiAlloc() const =0
Return the type_info of the vector allocator.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
::Bool_t isContainerBranch(TBranch *br, auxid_t auxid)
Check if a branch describes a container or a single object.
mutex_t m_mutex1
Mutexes object used for multithreaded synchronisation.
Int_t splitLevel() const
Get the split level of the output branches.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.
Used as type_info when we read an aux data item but it doesn't exist in the registry.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t(0)) override
Move all elements from other to this store.
static bool isLinkedName(const std::string &name)
Test if a variable name corresponds to a linked variable.
SG::AuxStoreInternal * m_transientStore
Store for the in-memory-only variables.
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
virtual size_t size() const override
Return the number of elements in the store.
static IOStats & instance()
Singleton object accessor.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Int_t getEntry(Int_t getall=0)
Read the values from the TTree entry that was loaded with TTree::LoadTree()
AuxVarFlags
Additional flags to qualify an auxiliary variable.
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
StatusCode initStats(::TTree *tree)
Function used for setting up the statistics info about the managed branches.
virtual const void * getIOData(SG::auxid_t auxid) const override
Return a pointer to the data to be stored for one aux data item.
@ kContainerStore
The object describes an entire container.
EStructMode m_structMode
The "structural" mode of the object.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, creating the array if necessary.
std::vector< SG::IAuxTypeVector * > m_vecs
Variables handled currently by the object.
std::unique_ptr< IAuxTypeVector > makeVector(SG::auxid_t auxid, size_t size, size_t capacity) const
Construct a new vector to hold an aux item.
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
::Bool_t m_inputScanned
"Scan status" of the input TTree
void * inputObjectPtr()
Get a pointer to the object (or its pointer) in memory for reading.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
void setSplitLevel(Int_t value)
Set the split level of the output branches.
const std::type_info & getTypeInfo(EDataType type)
This function is used when reading a primitive branch from an input file without the user explicitly ...
An auxiliary data store that holds data internally.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Make an AuxVectorData object from either a raw array or an aux store.
::Bool_t m_topStore
Flag stating whether this is a "top store".
@ kUndefinedStore
The structure mode is not defined.
virtual void selectAux(const std::set< std::string > &attributes)
Select dynamic auxiliary attributes for writing.
SG::auxid_t auxid_t
Convenience type declaration.
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
void * objectPtr()
Get a pointer to the object.
::Int_t getEntry()
Get entry from the branch that was loaded with TTree::LoadTree()
virtual bool isDecoration(auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
::TBranch ** branchPtr()
Get a pointer to the branch being held.
virtual size_t size() const override
Return the number of elements in the store.
Abstract interface for manipulating vectors of arbitrary types.
std::size_t m_size
The current size of the container being described.
TAuxStore(const char *prefix="", Bool_t topStore=kTRUE, EStructMode mode=kUndefinedStore, Int_t basketSize=2048, Int_t splitLevel=0)
Default constructor.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
EStructMode structMode() const
Get what structure mode the object was constructed with.
Handle mappings between names and auxid_t.
StatusCode setupAuxBranch(::TBranch *br, const char *auxName, ::Bool_t staticBranch)
Register one input branch as an available auxiliary variable.
std::vector< TBranchHandle * > m_branches
Branches reading the various auxiliary variables.
virtual bool resize(size_t sz) override
Change the size of all aux data vectors.
virtual const SG::auxid_set_t & getDecorIDs() const override
Return a set of identifiers for decorations in this store.
TBranchHandle(::Bool_t staticBranch, ::Bool_t primitiveBranch, const std::type_info *ti, void *obj, SG::auxid_t auxid, const std::string *prefix)
Constructor.
A set of aux data identifiers.
void * outputObjectPtr()
Get a pointer to the object (or its pointer) in memory for writing.
#define ATLAS_THREAD_SAFE
StatusCode setupOutputData(auxid_t auxid)
Connect a variable to the output tree.
virtual void selectAux(const std::set< std::string > &attributes)
Select which variables should be written out.
virtual bool clearDecorations() override
Remove the decorations added so far.
Class describing the access statistics of a collection of branches.
ConcurrentBitset & erase(bit_t bit)
Turn off one bit.
virtual SG::auxid_set_t getSelectedAuxIDs(const SG::auxid_set_t &fullset) const
Return which variables were selected to be written out.
::Bool_t isPrimitiveBranch(TBranch *br)
Check if a branch holds a primitive variable or not.
Define macros for attributes used to control the static checker.
An auxiliary data store that holds data internally.
StatusCode setupInputData(auxid_t auxid)
Connect a variable to the input tree.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
char rootType(char typeidType)
This function is used internally in the code when creating primitive dynamic auxiliary branches.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
Class used internally to implement just-in-time reading.
void setPrefix(const char *prefix)
Set the branch name prefix.
std::vector< bool > m_branchesWritten
"Write status" of the different variables
const char * prefix() const
Get the currently configured branch name prefix.
AuxSelection m_selection
Object helping to select which auxiliary variables to write.
bool test(bit_t bit) const
Test to see if a bit is set.