 |
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include <TFriendElement.h>
15 #include <TChainElement.h>
18 #include <TMethodCall.h>
28 #ifndef XAOD_STANDALONE
31 #endif // not XAOD_STANDALONE
71 void removeVersionNames( std::string&
name ) {
74 while( (
pos =
name.find(
"_v1" ) ) !=
name.npos ) {
77 while( (
pos =
name.find(
"_v2" ) ) !=
name.npos ) {
80 while( (
pos =
name.find(
"_v3" ) ) !=
name.npos ) {
83 while( (
pos =
name.find(
"_v4" ) ) !=
name.npos ) {
86 while( (
pos =
name.find(
"_v5" ) ) !=
name.npos ) {
89 while( (
pos =
name.find(
"_v6" ) ) !=
name.npos ) {
92 while( (
pos =
name.find(
"_v7" ) ) !=
name.npos ) {
95 while( (
pos =
name.find(
"_v8" ) ) !=
name.npos ) {
112 ForceTrackIndices& xvec =
static_cast< ForceTrackIndices&
>(
vec );
136 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
137 m_inChain( nullptr ), m_inChainTracker( nullptr ),
138 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
139 m_entry( -1 ), m_outTree( nullptr ),
140 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
141 m_inputMetaObjects(), m_outputMetaObjects(),
142 m_inputEventFormat(), m_outputEventFormat( nullptr ),
143 m_auxItemList(), m_listeners(), m_nameRemapping() {
154 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
155 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
156 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
157 ::Info(
"xAOD::TEvent::TEvent",
158 "Using access mode \"%i\" for the unit test",
159 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
169 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
170 m_inChain( nullptr ), m_inChainTracker( nullptr ),
171 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
172 m_entry( -1 ), m_outTree( nullptr ),
173 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
174 m_inputMetaObjects(), m_outputMetaObjects(),
175 m_inputEventFormat(), m_outputEventFormat( nullptr ),
176 m_auxItemList(), m_listeners(), m_nameRemapping() {
187 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
188 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
189 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
190 ::Info(
"xAOD::TEvent::TEvent",
191 "Using access mode \"%i\" for the unit test",
192 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
205 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
206 m_inChain( nullptr ), m_inChainTracker( nullptr ),
207 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
208 m_entry( -1 ), m_outTree( nullptr ),
209 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
210 m_inputMetaObjects(), m_outputMetaObjects(),
211 m_inputEventFormat(), m_outputEventFormat( nullptr ),
212 m_auxItemList(), m_listeners(), m_nameRemapping() {
223 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
224 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
225 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
226 ::Info(
"xAOD::TEvent::TEvent",
227 "Using access mode \"%i\" for the unit test",
228 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
243 for( ; itr !=
end; ++itr ) {
248 for( ; itr !=
end; ++itr ) {
253 for( ; itr !=
end; ++itr ) {
258 for( ; itr !=
end; ++itr ) {
272 #ifndef XAOD_STANDALONE
276 #endif // not XAOD_STANDALONE
298 std::ostringstream
ost;
299 ost <<
"<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
304 for( ; ef_itr != ef_end; ++ef_itr ) {
307 std::string
typeName = ef_itr->second.className();
312 ::TClass::GetClass( ef_itr->second.className().c_str() );
313 const std::type_info* ti = (
cl ?
cl->GetTypeInfo() : nullptr );
314 if( ( !
cl ) || ( !
cl->IsLoaded() ) || ( ! ti ) ) {
315 Warning(
"xAOD::TEvent::dump",
316 "Unknown type (%s) found in the event format",
317 ef_itr->second.className().c_str() );
322 if( !
contains( ef_itr->second.branchName(), *ti ) ) {
327 ost <<
" Hash: 0x" << std::setw( 8 ) << std::setfill(
'0' )
328 << std::hex << ef_itr->second.hash()
329 <<
" Key: \"" << ef_itr->second.branchName() <<
"\"\n";
334 ost <<
" isConst: " << ( isNonConst ?
"No" :
"Yes" ) <<
"\n";
342 ost <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
371 if( !
file )
return StatusCode::SUCCESS;
376 for( ; itr !=
end; ++itr ) {
390 for( ; itr !=
end; ++itr ) {
410 ::Error(
"xAOD::TEvent::readFrom",
411 XAOD_MESSAGE(
"Couldn't find metadata tree on input. Object "
413 return StatusCode::FAILURE;
419 ::Error(
"xAOD::TEvent::readFrom",
420 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
422 return StatusCode::FAILURE;
427 ::Info(
"xAOD::TEvent::readFrom",
428 "Was expecting a metadata tree with size 1, instead of %i.",
430 ::Info(
"xAOD::TEvent::readFrom",
431 "File most probably produced by hadd..." );
437 static const std::string eventFormatTypeName =
439 ::TClass*
cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
441 ::Warning(
"xAOD::TEvent::readFrom",
442 "Couldn't load the EventFormat dictionary" );
446 const std::string eventFormatBranchName =
448 if( !
m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
452 ::Info(
"xAOD::TEvent::readFrom",
"Input file provides no event or "
456 return StatusCode::SUCCESS;
462 m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
465 ::Error(
"xAOD::TEvent::readFrom",
466 XAOD_MESSAGE(
"Failed to connect to EventFormat object" ) );
467 return StatusCode::FAILURE;
484 std::set<std::string> lOtherMetaTreeNames = {};
485 TList *lKeys =
file->GetListOfKeys();
488 for (
int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
490 std::string
keyName = lKeys->At(iKey)->GetName();
495 && (
keyName.find(
"MetaData") != std::string::npos)
496 && !(
keyName.find(
"MetaDataHdr") != std::string::npos)){
498 const char *
className = ((::TKey*)lKeys->At(iKey))->GetClassName();
499 static constexpr Bool_t LOAD = kFALSE;
500 static constexpr Bool_t SILENT = kTRUE;
501 ::TClass*
cl = ::TClass::GetClass(
className, LOAD, SILENT);
502 if ((
cl !=
nullptr) &&
cl->InheritsFrom(::TTree::Class())){
504 lOtherMetaTreeNames.insert(std::move(
keyName));
511 for (
const std::string & metaTreeName : lOtherMetaTreeNames){
512 TTree *tmpMetaTree =
dynamic_cast< ::TTree*
>(
file->Get( metaTreeName.c_str() ) );
516 ::Warning(
"xAOD::TEvent::readFrom",
"Could not read metadata tree=%s",metaTreeName.c_str());
522 if ( tmpMetaTree->LoadTree(0) < 0 ){
523 ::Error(
"xAOD::TEvent::readFrom",
524 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
525 tmpMetaTree->GetName() );
526 return StatusCode::FAILURE;
530 const std::string tmpEventFormatBranchName =
532 if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
534 ::Warning(
"xAOD::TEvent::readFrom",
"No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
540 tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
541 &tmpFormat, &tmpBr );
543 ::Error(
"xAOD::TEvent::readFrom",
544 XAOD_MESSAGE(
"Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
545 return StatusCode::FAILURE;
548 tmpBr->GetEntry( 0 );
550 for (
const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
572 m_inTree->SetCacheLearnEntries( 10 );
584 const TIncident beginIncident( IncidentType::BeginInputFile );
586 listener->handle( beginIncident );
593 const TIncident endIncident( IncidentType::EndInputFile );
595 listener->handle( endIncident );
599 return StatusCode::SUCCESS;
622 if( useTreeCache && ( !
m_inChain->GetCacheSize() ) ) {
632 ::Error(
"xAOD::TEvent::readFrom",
633 XAOD_MESSAGE(
"Couldn't get the list of files from the "
635 return StatusCode::FAILURE;
637 if( !
files->GetEntries() ) {
638 ::Error(
"xAOD::TEvent::readFrom",
641 return StatusCode::FAILURE;
643 const ::TChainElement* chEl =
644 dynamic_cast< const ::TChainElement*
>(
files->At( 0 ) );
646 ::Error(
"xAOD::TEvent::readFrom",
647 XAOD_MESSAGE(
"Couldn't cast object to TChainElement" ) );
648 return StatusCode::FAILURE;
650 ::TFile* dummyFile = ::TFile::Open( chEl->GetTitle() );
652 ::Error(
"xAOD::TEvent::readFrom",
655 return StatusCode::FAILURE;
670 return StatusCode::SUCCESS;
681 ::TFile*
file =
tree->GetCurrentFile();
700 ::Error(
"xAOD::TEvent::writeTo",
701 XAOD_MESSAGE(
"Null pointer given to the function!" ) );
702 return StatusCode::FAILURE;
707 ::Error(
"xAOD::TEvent::writeTo",
708 XAOD_MESSAGE(
"Object already writing to a file. Close that "
710 return StatusCode::FAILURE;
728 return StatusCode::SUCCESS;
741 ::Error(
"xAOD::TEvent::finishWritingTo",
742 XAOD_MESSAGE(
"The object doesn't seem to be connected to an "
744 return StatusCode::FAILURE;
752 const TIncident incident( IncidentType::MetaDataStop );
755 for( ; l_itr != l_end; ++l_itr ) {
756 ( *l_itr )->handle( incident );
771 return StatusCode::SUCCESS;
777 metatree->SetAutoSave( 10000 );
778 metatree->SetAutoFlush( -30000000 );
779 metatree->SetDirectory(
file );
783 metatree->Branch(
"EventFormat",
788 ::Error(
"xAOD::TEvent::finishWritingTo",
791 return StatusCode::FAILURE;
801 for(
auto&
object : outputMetaObjects ) {
806 ::Error(
"xAOD::TEvent::finishWritingTo",
808 return StatusCode::FAILURE;
812 const ::Int_t splitLevel = (
object.first.find(
"Aux." ) ==
813 (
object.first.size() - 4 ) ? 1 : 0 );
815 *(
mgr->branchPtr() ) =
816 metatree->Branch(
object.first.c_str(),
817 mgr->holder()->getClass()->GetName(),
818 mgr->holder()->getPtr(), 32000, splitLevel );
819 if( !
mgr->branch() ) {
820 ::Error(
"xAOD::TEvent::finishWritingTo",
823 mgr->holder()->getClass()->GetName(),
824 object.first.c_str() );
825 return StatusCode::FAILURE;
835 if( metatree->Fill() <= 0 ) {
836 ::Error(
"xAOD::TEvent::finishWritingTo",
837 XAOD_MESSAGE(
"Failed to write event format metadata into "
839 metatree->SetDirectory( 0 );
841 return StatusCode::FAILURE;
846 metatree->SetDirectory( 0 );
851 for( ; obj_itr != obj_end; ++obj_itr ) {
852 delete obj_itr->second;
857 for( ; obj_itr != obj_end; ++obj_itr ) {
858 delete obj_itr->second;
863 return StatusCode::SUCCESS;
878 #ifndef XAOD_STANDALONE
880 #endif // not XAOD_STANDALONE
903 while( std::getline(
ss, attr,
'.' ) ) {
925 ::Error(
"xAOD::TEvent::addListener",
926 XAOD_MESSAGE(
"Received a null pointer for the listener" ) );
927 return StatusCode::FAILURE;
931 bool listenerKnown =
false;
933 if(
l == listener ) {
934 ::Warning(
"xAOD::TEvent::addListener",
935 "Listener %p was added previously already",
936 static_cast< void*
>( listener ) );
937 listenerKnown =
true;
943 if( ! listenerKnown ) {
948 return StatusCode::SUCCESS;
965 ::Error(
"xAOD::TEvent::removeListener",
967 static_cast< void*
>( listener ) );
968 return StatusCode::FAILURE;
975 return StatusCode::SUCCESS;
1002 const std::string&
newName ) {
1007 ::Error(
"xAOD::TEvent::addNameRemap",
1008 XAOD_MESSAGE(
"Can't use \"%s\" as the target name in the"
1009 "\"%s\" -> \"%s\" remapping" ),
1011 return StatusCode::FAILURE;
1017 ::Warning(
"xAOD::TEvent::addNameRemap",
1018 "Overriding existing name remapping \"%s\" -> \"%s\"",
1019 itr->second.c_str(), itr->first.c_str() );
1020 ::Warning(
"xAOD::TEvent::addNameRemap",
" with: \"%s\" -> \"%s\"",
1021 onfile.c_str(),
newName.c_str() );
1028 return StatusCode::SUCCESS;
1047 ::Info(
"xAOD::TEvent::printNameRemap",
"Name remapping rules:" );
1051 ::Info(
"xAOD::TEvent::printNameRemap",
" NONE" );
1058 ::Info(
"xAOD::TEvent::printNameRemap",
" \"%s\" -> \"%s\"",
1059 itr->second.c_str(), itr->first.c_str() );
1079 ::Int_t basketSize, ::Int_t splitLevel ) {
1083 ::Error(
"xAOD::TEvent::recordAux",
1084 XAOD_MESSAGE(
"No output tree given to the object" ) );
1102 ::Error(
"xAOD::TEvent::recordAux",
1104 static_cast< int >(
type ) );
1109 basketSize, splitLevel );
1110 if(
record(
store,
key, basketSize, splitLevel, kTRUE ).isFailure() ) {
1111 ::Error(
"xAOD::TEvent::recordAux",
1112 XAOD_MESSAGE(
"Couldn't connect TAuxStore object to the "
1123 ::Error(
"xAOD::TEvent::recordAux",
1131 ::Error(
"xAOD::TEvent::recordAux",
1132 XAOD_MESSAGE(
"Object of non-TAuxStore type registered "
1133 "with key \"%s\"" ),
key.c_str() );
1155 ::Int_t basketSize, ::Int_t splitLevel ) {
1158 std::string keyToUse =
key;
1163 keyToUse = remap_itr->second;
1170 Object_t::const_iterator vobjMgr =
m_inputObjects.find( keyToUse );
1172 ::Error(
"xAOD::TEvent::copy",
1174 return StatusCode::FAILURE;
1179 ::Error(
"xAOD::TEvent::copy",
1181 return StatusCode::FAILURE;
1185 ::Error(
"xAOD::TEvent::copy",
1187 return StatusCode::FAILURE;
1194 key, basketSize, splitLevel, kTRUE ) );
1197 const std::set< std::string >*
filter = 0;
1200 filter = &( fitr->second );
1204 Object_t::const_iterator vauxMgr =
m_inputObjects.find( keyToUse +
1209 return StatusCode::SUCCESS;
1216 ::Error(
"xAOD::TEvent::copy",
1218 return StatusCode::FAILURE;
1223 key +
"Aux.", basketSize, splitLevel, kTRUE ) );
1228 ::Error(
"xAOD::TEvent::copy",
1230 return StatusCode::FAILURE;
1238 key +
"Aux.", basketSize, splitLevel ) );
1240 ::Fatal(
"xAOD::TEvent::copy",
1245 return StatusCode::SUCCESS;
1261 ::Error(
"xAOD::TEvent::copy",
1263 return StatusCode::FAILURE;
1269 for( ; itr !=
end; ++itr ) {
1288 ::TClass*
cl = ::TClass::GetClass( efe.
className().c_str() );
1289 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
1299 return StatusCode::SUCCESS;
1314 ::Error(
"xAOD::TEvent::getEntries",
1339 ::Error(
"xAOD::TEvent::getEntry",
1349 if( fileEntry < 0 ) {
1350 ::Error(
"xAOD::TEvent::getEntry",
1353 static_cast< int >(
entry ) );
1368 ::Error(
"xAOD::TEvent::getEntry",
1391 ::Error(
"xAOD::TEvent::getEntry",
1392 XAOD_MESSAGE(
"Failure in loading entry %i from the input "
1393 "file" ),
static_cast< int >(
m_entry ) );
1404 const TIncident incident( IncidentType::BeginEvent );
1407 for( ; l_itr != l_end; ++l_itr ) {
1408 ( *l_itr )->handle( incident );
1422 static const std::string dynStorePostfix =
"Aux.Dynamic";
1423 if( inObj.first.find( dynStorePostfix ) ==
1424 ( inObj.first.size() - dynStorePostfix.size() ) ) {
1438 result += inObj.second->getEntry( getall );
1443 const TIncident incident( IncidentType::BeginEvent );
1446 for( ; l_itr != l_end; ++l_itr ) {
1447 ( *l_itr )->handle( incident );
1466 return m_inChain->GetListOfFiles()->GetEntries();
1487 ::Error(
"xAOD::TEvent::getFile",
1488 XAOD_MESSAGE(
"Function called with invalid file number "
1489 "(%i)" ),
static_cast< int >(
file ) );
1504 ::Long64_t
entry = 0;
1505 for( ::Long64_t
i = 0;
i <
file; ++
i ) {
1523 ::Error(
"xAOD::TEvent::fill",
1524 XAOD_MESSAGE(
"Object not connected to an output file!" ) );
1534 ::Error(
"xAOD::TEvent::fill",
1540 ::Error(
"xAOD::TEvent::fill",
1550 std::string unsetObjects;
1552 for(
auto& itr : outputObjectsCopy ) {
1554 if( ! itr.second->create() ) {
1557 if( unsetObjects.size() ) {
1558 unsetObjects.append(
", \"" + itr.first +
"\"" );
1560 unsetObjects.append(
"\"" + itr.first +
"\"" );
1568 ::Error(
"xAOD::TEvent::fill",
1569 XAOD_MESSAGE(
"Failed to put dynamic auxiliary variables "
1570 "in the output for object \"%s\"" ),
1571 itr.first.c_str() );
1577 if( unsetObjects.size() ) {
1578 ::Error(
"xAOD::TEvent::fill",
1579 XAOD_MESSAGE(
"The following objects were not set in the "
1580 "current event: %s" ), unsetObjects.c_str() );
1587 ::Error(
"xAOD::TEvent::fill",
1588 XAOD_MESSAGE(
"Output tree filling failed with return "
1589 "value: %i" ), ret );
1595 for( ; ncitr != ncend; ++ncitr ) {
1596 ncitr->second->reset();
1622 ::Warning(
"xAOD::TEvent::inputEventFormat",
1623 "No input file is connected at the moment" );
1645 ::Warning(
"xAOD::TEvent::outputEventFormat",
1646 "No output file is connected at the moment" );
1663 if(
key ==
"" )
return 0;
1700 for( ; obj_itr != obj_end; ++obj_itr ) {
1703 if( obj_itr->second->object() !=
obj )
continue;
1706 return obj_itr->first;
1712 for( ; obj_itr != obj_end; ++obj_itr ) {
1715 if( obj_itr->second->object() !=
obj )
continue;
1718 return obj_itr->first;
1729 ::Warning(
"xAOD::TEvent::getName",
1730 "Didn't find object with pointer %p in the event",
1732 static const std::string
dummy;
1737 std::vector<std::string>& vkeys,
1740 std::set<std::string>
keys;
1744 std::vector<TObjArray*> fullListOfBranches = {};
1749 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1750 fullListOfBranches.push_back(
m_inMetaTree->GetListOfBranches());
1755 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1757 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
1762 TList *fList =
m_inTree->GetListOfFriends();
1764 for (TObject * feObj : *fList){
1767 auto * pElement =
dynamic_cast<TFriendElement*
>(feObj);
1768 if (not pElement)
continue;
1769 TTree *friendTree = pElement->GetTree();
1771 fullListOfBranches.push_back(friendTree->GetListOfBranches());
1779 for (
const TObjArray * in : fullListOfBranches){
1782 const TObject *
obj = in->At(
index);
1783 if ( !
obj )
continue;
1784 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1786 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1789 std::string objClassName = element->GetClassName();
1790 std::string
key =
obj->GetName();
1791 ::Info(
"xAOD::TEvent::getNames",
1792 "Inspecting %s / %s",
1793 objClassName.c_str(),
key.c_str());
1794 if (objClassName == targetClassName) {
1795 ::Info(
"xAOD::TEvent::getNames",
1796 "Matched %s to key %s",
1797 targetClassName.c_str(),
key.c_str());
1806 ::Info(
"xAOD::TEvent::getNames",
1807 "scanning input Aux objects for %s", targetClassName.c_str());
1808 for(
const auto&
object : inAux ) {
1812 if ( !
mgr )
continue;
1813 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1814 const std::string&
key =
object.first;
1815 ::Info(
"xAOD::TEvent::getNames",
1816 "Inspecting %s / %s",
1817 objClassName.c_str(),
key.c_str());
1818 if (objClassName == targetClassName) {
1819 ::Info(
"xAOD::TEvent::getNames",
1820 "Matched %s to key %s",
1821 targetClassName.c_str(),
key.c_str());
1830 const TObjArray *
out =
tree->GetListOfBranches();
1831 ::Info(
"xAOD::TEvent::getNames",
"scanning output objects");
1835 if ( !
obj )
continue;
1836 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1838 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1841 std::string objClassName = element->GetClassName();
1842 std::string
key =
obj->GetName();
1843 ::Info(
"xAOD::TEvent::getNames",
1844 "Inspecting %s / %s",
1845 objClassName.c_str(),
key.c_str());
1846 if (objClassName == targetClassName) {
1847 ::Info(
"xAOD::TEvent::getNames",
1848 "Matched %s to key %s",
1849 targetClassName.c_str(),
key.c_str());
1854 ::Info(
"xAOD::TEvent::getNames",
"no output tree connected");
1863 ::Info(
"xAOD::TEvent::getNames",
1864 "scanning output Aux objects for %s", targetClassName.c_str());
1865 for(
const auto&
object : outAux ) {
1869 if ( !
mgr )
continue;
1870 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1871 const std::string&
key =
object.first;
1872 ::Info(
"xAOD::TEvent::getNames",
1873 "Inspecting %s / %s",
1874 objClassName.c_str(),
key.c_str());
1875 if (objClassName == targetClassName) {
1876 ::Info(
"xAOD::TEvent::getNames",
1877 "Matched %s to key %s",
1878 targetClassName.c_str(),
key.c_str());
1883 vkeys.insert(vkeys.end(),
keys.begin(),
keys.end());
1913 static const std::string
dummy;
1928 const std::type_info& ti ) {
1932 if( !
name.length() ) {
1952 const std::type_info& ti,
1958 Warning(
"xAOD::TEvent::getInputObject",
1959 "Key 0x%08x unknown",
key );
1978 return StatusCode::SUCCESS;
1983 ::Error(
"xAOD::TEvent::initStats",
1986 return StatusCode::FAILURE;
1995 for( ; itr !=
end; ++itr ) {
1998 const std::string& branchName = itr->second.branchName();
2001 if( branchName.find(
"Aux." ) != std::string::npos ) {
2010 const std::string intName =
2011 branchName.substr( 0, branchName.size() - 4 );
2019 ::Bool_t auxFound = kFALSE;
2022 std::vector<TObjArray*> fullListOfBranches = {};
2024 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
2029 TList *fList =
m_inTree->GetListOfFriends();
2031 for (TObject * feObj : *fList){
2034 auto * pElement =
dynamic_cast<TFriendElement*
>(feObj);
2035 if (not pElement)
continue;
2036 TTree *friendTree = pElement->GetTree();
2038 fullListOfBranches.push_back(friendTree->GetListOfBranches());
2043 for (TObjArray*
branches : fullListOfBranches){
2044 for( Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i ){
2048 if(
name.BeginsWith( branchName ) ||
2049 name.BeginsWith( dynName ) ) {
2056 ::Warning(
"xAOD::TEvent::initStats",
2057 "Couldn't find interface object/container "
2058 "\"%s\" belonging to branch \"%s\"",
2059 intName.c_str(), branchName.c_str() );
2066 ::TClass*
cl = ::TClass::GetClass(
el->className().c_str() );
2067 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
2068 ::Warning(
"xAOD::TEvent::initStats",
2069 "Couldn't find dictionary for type \"%s\"",
2070 el->className().c_str() );
2076 static const std::string baseName =
2078 static ::TClass*
const baseCl = ::TClass::GetClass( baseName.c_str() );
2080 ::Error(
"xAOD::TEvent::initStats",
2082 "\"%s\"" ), baseName.c_str() );
2083 return StatusCode::FAILURE;
2093 static constexpr
bool TOP_STORE =
true;
2095 static constexpr
bool PRINT_WARNINGS =
false;
2104 stats.branch(branchName,
id);
2113 const ::TBranch* container =
2114 m_inTree->GetBranch( branchName.c_str() );
2123 return StatusCode::SUCCESS;
2139 const std::type_info& ti,
2147 Object_t::const_iterator itr =
objects.find(
key );
2169 if( ! itr->second->isSet() ) {
2177 ::Error(
"xAOD::TEvent::getOutputObject",
2178 XAOD_MESSAGE(
"Object of wrong type found for key \"%s\"" ),
2184 void*
result =
mgr->holder()->getAs( ti );
2186 ::Warning(
"xAOD::TEvent::getOutputObject",
2187 "Couldn't retrieve object as \"%s\"",
2209 const std::type_info& ti,
2214 std::string keyToUse =
key;
2219 keyToUse = remap_itr->second;
2225 if(
store &&
store->contains( keyToUse, ti ) &&
2226 store->isConst( keyToUse, ti ) ) {
2227 const void*
result =
store->getConstObject( keyToUse, ti );
2258 ::Fatal(
"xAOD::TEvent::getInputObject",
2259 XAOD_MESSAGE(
"There is an internal logic error in the "
2268 if(
key == keyToUse ) {
2269 ::Error(
"xAOD::TEvent::getInputObject",
2274 ::Error(
"xAOD::TEvent::getInputObject",
2276 "\"%s\"/\"%s\"" ),
key.c_str(),
2284 if(
mgr->getEntry() ) {
2289 ::Error(
"xAOD::TEvent::getInputObject",
2292 mgr->holder()->getClass()->GetName(),
2303 ::Warning(
"xAOD::TEvent::getInputObject",
2304 "Could not retrieve object with key \"%s\" "
2305 "as \"%s\"", keyToUse.c_str(),
2334 const std::string&
key,
2335 ::Int_t basketSize, ::Int_t splitLevel,
2336 ::Bool_t overwrite, ::Bool_t
metadata,
2337 ::Bool_t isOwner ) {
2341 ::Error(
"xAOD::TEvent::record",
2342 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2343 "call writeTo(...)?" ) );
2344 return StatusCode::FAILURE;
2352 if( ( ! overwrite ) &&
2355 ::Error(
"xAOD::TEvent::record",
2358 return StatusCode::FAILURE;
2361 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2363 ::Error(
"xAOD::TEvent::record",
2366 return StatusCode::FAILURE;
2374 return StatusCode::SUCCESS;
2379 if( ( ! overwrite ) &&
2381 ::Error(
"xAOD::TEvent::record",
2382 XAOD_MESSAGE(
"Object %s/%s already accessed from the input, "
2383 "can't be overwritten in memory" ),
2385 return StatusCode::FAILURE;
2390 if( ( splitLevel == 0 ) &&
2391 (
key.find(
"Aux." ) == (
key.size() - 4 ) ) ) {
2400 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2402 ::Error(
"xAOD::TEvent::record",
2405 return StatusCode::FAILURE;
2421 *(
mgr->branchPtr() ) =
2423 hldr->
getPtr(), basketSize, splitLevel );
2424 if( !
mgr->branch() ) {
2425 ::Error(
"xAOD::TEvent::record",
2428 key.c_str(),
cl->GetName() );
2432 return StatusCode::FAILURE;
2443 return StatusCode::SUCCESS;
2449 ::Error(
"xAOD::TEvent::record",
2452 return StatusCode::FAILURE;
2461 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2462 if( ( !
cl ) || ::strcmp(
cl->GetName(),
2464 ::Error(
"xAOD::TEvent::record",
2465 XAOD_MESSAGE(
"For output key \"%s\" the previous type "
2466 "was \"%s\", the newly requested type is "
2470 return StatusCode::FAILURE;
2498 ::Bool_t ownsStore ) {
2502 ::Error(
"xAOD::TEvent::record",
2503 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2504 "call writeTo(...)?" ) );
2505 return StatusCode::FAILURE;
2509 const std::set< std::string >*
filter = 0;
2512 filter = &( filter_itr->second );
2530 return StatusCode::SUCCESS;
2534 if( vitr->second->object() ==
store ) {
2536 return StatusCode::SUCCESS;
2546 ::Error(
"xAOD::TEvent::record",
2547 XAOD_MESSAGE(
"Output object with key %s already exists, "
2548 "and is not of type TAuxStore" ),
2550 return StatusCode::FAILURE;
2565 return StatusCode::SUCCESS;
2591 ::Error(
"xAOD::TEvent::connectBranch",
2592 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2593 return StatusCode::FAILURE;
2601 return StatusCode::SUCCESS;
2606 ::Warning(
"xAOD::TEvent::connectBranch",
2607 "Branch \"%s\" not available on input",
2610 return StatusCode::RECOVERABLE;
2617 ::Warning(
"xAOD::TEvent::connectBranch",
2618 "No metadata available for branch: %s",
2630 ::Warning(
"xAOD::TEvent::connectBranch",
2631 "Branch \"%s\" not available on input",
2635 return StatusCode::RECOVERABLE;
2639 br->SetMakeClass( 0 );
2650 ::Error(
"xAOD::TEvent::connectBranch",
2651 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2652 "dictionary for branch \"%s\"" ),
2654 return StatusCode::FAILURE;
2657 ::TClass* realClass = ::TClass::GetClass(
className.c_str() );
2658 if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) &&
ef ) {
2663 realClass = ::TClass::GetClass(
className.c_str() );
2665 if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2667 ::Error(
"xAOD::TEvent::connectBranch",
2668 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2669 "dictionary for branch \"%s\"" ),
2671 return StatusCode::FAILURE;
2678 static const ::EDataType
dataType = kOther_t;
2691 ::Error(
"xAOD::TEvent::connectBranch",
2692 XAOD_MESSAGE(
"Couldn't access output manager for: %s" ),
2694 return StatusCode::FAILURE;
2697 ptr =
mgr->holder()->get();
2704 ptr = realClass->New();
2719 ::Error(
"xAOD::TEvent::connectBranch",
2721 "This can only be read in kAthenaAccess mode." ),
2722 key.c_str(),
br->GetSplitLevel() );
2727 return StatusCode::FAILURE;
2737 ::Error(
"xAOD::TEvent::connectBranch",
2738 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2739 "input branch \"%s\". Return code: %i" ),
2745 return StatusCode::FAILURE;
2775 ::Error(
"xAOD::TEvent::connectMetaBranch",
2776 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2777 return StatusCode::FAILURE;
2782 return StatusCode::SUCCESS;
2789 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2790 "Branch \"%s\" not available on input",
2793 return StatusCode::RECOVERABLE;
2797 if( !
br->GetEntries() ) {
2799 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2800 "Branch \"%s\" doesn't hold any data",
2803 return StatusCode::RECOVERABLE;
2807 br->SetMakeClass( 0 );
2811 ::EDataType
dt = kOther_t;
2812 if(
br->GetExpectedType(
cl,
dt ) || ( !
cl ) ) {
2813 ::Error(
"xAOD::TEvent::connectMetaBranch",
2815 "branch %s" ),
key.c_str() );
2816 return StatusCode::FAILURE;
2820 void*
ptr =
cl->New();
2833 ::Error(
"xAOD::TEvent::connectMetaBranch",
2834 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2835 "input branch \"%s\". Return code: %i" ),
2841 return StatusCode::FAILURE;
2845 if(
mgr->getEntry() < 0 ) {
2846 ::Error(
"xAOD::TEvent::connectMetaBranch",
2847 XAOD_MESSAGE(
"Couldn't read in metadata object with key "
2848 "\"%s\"" ),
key.c_str() );
2849 return StatusCode::FAILURE;
2871 return StatusCode::SUCCESS;
2889 ::Error(
"xAOD::TEvent::connectAux",
2891 return StatusCode::FAILURE;
2899 return StatusCode::SUCCESS;
2904 return StatusCode::SUCCESS;
2917 ::Fatal(
"xAOD::TEvent::connectAux",
2923 ::Fatal(
"xAOD::TEvent::connectAux",
2925 return StatusCode::FAILURE;
2929 static const TClass*
const holderClass =
2931 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
2933 return StatusCode::SUCCESS;
2940 if( ! storeHolder ) {
2941 ::Fatal(
"xAOD::TEvent::connectAux",
2952 ::Error(
"xAOD::TEvent::connectAux",
2954 "for: %s" ),
prefix.c_str() );
2955 ::Error(
"xAOD::TEvent::connectAux",
2956 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
2959 return StatusCode::FAILURE;
2963 return StatusCode::SUCCESS;
2984 return StatusCode::SUCCESS;
2988 ::Error(
"xAOD::TEvent::connectAux",
2989 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
2991 return StatusCode::FAILURE;
3008 return StatusCode::SUCCESS;
3013 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3015 return StatusCode::FAILURE;
3029 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3035 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3037 return StatusCode::FAILURE;
3041 static const TClass*
const holderClass =
3043 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
3045 return StatusCode::SUCCESS;
3052 if( ! storeHolder ) {
3053 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3064 ::Error(
"xAOD::TEvent::connectMetaAux",
3065 XAOD_MESSAGE(
"Requested store types inconsistent" ) );
3066 ::Error(
"xAOD::TEvent::connectMetaAux",
3067 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
3070 return StatusCode::FAILURE;
3074 return StatusCode::SUCCESS;
3095 store->getEntry( 0 );
3098 return StatusCode::SUCCESS;
3102 ::Error(
"xAOD::TEvent::connectMetaAux",
3103 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
3105 return StatusCode::FAILURE;
3119 ::TMethodCall setNameCall;
3123 setNameCall.InitWithPrototype(
mgr.holder()->getClass(),
3124 "setName",
"const char*" );
3125 if( setNameCall.IsValid() ) {
3130 const char* charParams =
params.Data();
3131 setNameCall.Execute(
mgr.holder()->get(), charParams );
3134 ::Warning(
"xAOD::TEvent::setUpDynamicStore",
3135 "Couldn't find setName(...) function for container %s "
3137 mgr.branch()->GetName(),
3138 mgr.holder()->getClass()->GetName() );
3143 static const TClass*
const holderClass =
3145 if( !
mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3147 return StatusCode::SUCCESS;
3154 if( ! storeHolder ) {
3155 ::Fatal(
"xAOD::TEvent::setUpDynamicStore",
3157 return StatusCode::FAILURE;
3181 store->getEntry( 0 );
3187 return StatusCode::SUCCESS;
3205 return StatusCode::SUCCESS;
3209 const std::string
key =
mgr.branch()->GetName();
3221 auxKey = std::move(
key);
3227 return StatusCode::SUCCESS;
3229 auxMgr = itr->second;
3230 auxKey =
key +
"Aux.";
3235 ::Int_t readBytes = auxMgr->
getEntry();
3239 const std::string dynAuxKey = auxKey +
"Dynamic";
3240 auto dynAuxMgr =
objects.find( dynAuxKey );
3242 if( ( dynAuxMgr !=
objects.end() ) &&
3244 ( auxMgr == &
mgr ) ) ) {
3249 dynAuxMgr->second->getEntry();
3263 auto dynAuxMgr =
objects.find( dynAuxKey );
3264 if( dynAuxMgr ==
objects.end() ) {
3265 ::Error(
"xAOD::TEvent::setAuxStore",
3267 return StatusCode::FAILURE;
3269 dynAuxMgr->second->getEntry();
3275 if( auxMgr == &
mgr ) {
3276 return StatusCode::SUCCESS;
3282 switch(
mgr.holder()->typeKind() ) {
3301 if(
vec && ( !
vec->trackIndices() ) ) {
3302 forceTrackIndices( *
vec );
3306 if( ( !
vec ) && ( ! aux ) ) {
3307 ::Fatal(
"xAOD::TEvent::setAuxStore",
3309 "SG::AuxVectorBase or SG::AuxElement" ),
3310 mgr.holder()->getClass()->GetName() );
3319 ::Fatal(
"xAOD::TEvent::setAuxStore",
3320 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3321 "right type" ), auxKey.c_str() );
3322 return StatusCode::FAILURE;
3337 ::Fatal(
"xAOD::TEvent::setAuxStore",
3338 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3339 "right type" ), auxKey.c_str() );
3340 return StatusCode::FAILURE;
3346 ::Fatal(
"xAOD::TEvent::setAuxStore",
3356 ::Fatal(
"xAOD::TEvent::setAuxStore",
3361 return StatusCode::SUCCESS;
3378 ::Int_t basketSize, ::Int_t splitLevel,
3388 return StatusCode::SUCCESS;
3392 if( !
mgr->holder()->getClass()->InheritsFrom(
"SG::IAuxStoreIO" ) ) {
3393 return StatusCode::SUCCESS;
3401 ::Fatal(
"xAOD::TEvent::putAux",
3402 XAOD_MESSAGE(
"There is a logic error in the code!" ) );
3411 sel.selectAux( item_itr->second );
3421 if( auxids.
empty() ) {
3422 return StatusCode::SUCCESS;
3426 const std::string dynNamePrefix =
3435 typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
3436 std::vector< AuxVarSort_t > varsort;
3437 varsort.reserve( auxids.
size() );
3439 varsort.emplace_back(
r.getName(
id ),
id );
3441 std::sort( varsort.begin(), varsort.end() );
3444 for(
const auto&
p : varsort ) {
3450 const std::string
brName = dynNamePrefix +
p.first;
3459 const std::type_info* brType = aux->
getIOType(
id );
3461 ::Error(
"xAOD::TEvent::putAux",
3464 return StatusCode::FAILURE;
3466 const std::string brTypeName =
3468 std::string brProperTypeName =
"<unknown>";
3474 if( strlen( brType->name() ) == 1 ) {
3477 brProperTypeName = brTypeName;
3482 ::Error(
"xAOD::TEvent::putAux",
3485 brName.c_str(), brTypeName.c_str() );
3486 return StatusCode::FAILURE;
3490 std::ostringstream leaflist;
3502 outTree.Branch(
brName.c_str(), hldr->
get(),
3503 leaflist.str().c_str(),
3505 if( ! auxmgr->
branch() ) {
3506 ::Error(
"xAOD::TEvent::putAux",
3509 brName.c_str(), brProperTypeName.c_str() );
3514 return StatusCode::FAILURE;
3521 TClass*
cl = TClass::GetClass( *brType, kTRUE, kTRUE );
3525 cl = TClass::GetClass( brTypeName.c_str() );
3528 ::Error(
"xAOD::TEvent::putAux",
3530 "variable \"%s\" of type \"%s\"" ),
3531 brName.c_str(), brTypeName.c_str() );
3532 return StatusCode::FAILURE;
3537 brProperTypeName =
cl->GetName();
3546 if (!
cl->CanSplit() && strncmp (
cl->GetName(),
"SG::PackedContainer<", 20) == 0)
3551 outTree.Branch(
brName.c_str(),
3553 hldr->
getPtr(), basketSize, splitLevel );
3554 if( ! auxmgr->
branch() ) {
3555 ::Error(
"xAOD::TEvent::putAux",
3558 brName.c_str(), brProperTypeName.c_str() );
3563 return StatusCode::FAILURE;
3571 if( outTree.GetEntries() ) {
3572 void*
ptr =
br->GetAddress();
3573 br->SetAddress( 0 );
3574 for( ::Long64_t
i = 0;
i < outTree.GetEntries(); ++
i ) {
3577 br->SetAddress(
ptr );
3586 mgr->branch()->GetName(),
3597 ::Fatal(
"xAOD::TEvent::putAux",
3598 XAOD_MESSAGE(
"There is an internal logic error in the "
3604 const_cast< void*
>(
static_cast< const void*
>( aux->
getIOData(
id ) ) );
3605 bmgr->second->setObject( nc_data );
3609 return StatusCode::SUCCESS;
3624 static const TClass*
const dvClass =
3626 static const TClass*
const aeClass =
3630 return (
mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3631 mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3644 static const TClass*
const storeClass =
3646 static const TClass*
const storeHolderClass =
3650 return (
mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3651 mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3668 static const TClass*
const dvClass =
3670 static const TClass*
const aeClass =
3674 if(
mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3676 }
else if(
mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3681 ::Error(
"xAOD::TEvent::isStandalone",
3683 "auxiliary store" ),
3684 mgr.holder()->getClass()->GetName() );
3699 const std::type_info& ti,
3718 const std::type_info& ti,
::Int_t m_inTreeNumber
The number of the currently open tree in the input chain.
JetConstituentVector::iterator iterator
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
StatusCode addListener(TVirtualIncidentListener *listener)
Register an incident listener object.
Base interface for getting objects out of the input file.
StatusCode finishWritingTo(::TFile *file)
Finish writing to an output file.
::TBranch ** branchPtr()
Pointer to the branch's pointer.
@ AUXELEMENT
A type inheriting from SG::AuxElement.
Recursively separate out template arguments in a C++ class name.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
const std::string & name() const override
Get the name of the instance.
void initAuxVectorBase(SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy indexTrackingPolicy)
Initialize index tracking mode.
EAuxMode m_auxMode
The auxiliary access mode.
@ kUndefinedAccess
Undefined, to be selected by the object.
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent=false) override
Function for retrieving an input object in a non-template way.
std::string find(const std::string &s)
return a remapped string
ReadStats & stats()
Access the object belonging to the current thread.
TAuxStore * getStore()
Get a type-specific pointer to the managed object.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Manager for auxiliary branches created dynamically.
virtual const SG::auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
void setOwner(::Bool_t state=kTRUE)
Set whether the holder should own its object.
static void setEvent(TVirtualEvent *ptr)
Set the active event pointer.
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Base class for elements of a container that can have aux data.
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
Function for retrieving an output object in a non-template way.
@ DATAVECTOR
A DataVector container.
virtual void * getAs(const std::type_info &tid, ::Bool_t silent=kFALSE) const
Return the object as a specific pointer.
This class takes care of holding EDM objects in memory.
virtual void selectAux(const std::set< std::string > &attributes)
Select dynamic auxiliary attributes for writing.
@ kAthenaAccess
Access containers/objects like Athena does.
::TTree * m_outTree
The tree that we are writing to.
::Int_t getFile(::Long64_t file, ::Int_t getall=0)
Load the first event for a given file from the input TChain.
::TChain * m_inChain
The (optional) chain provided as input.
StatusCode putAux(::TTree &outTree, TVirtualManager &mgr, ::Int_t basketSize=32000, ::Int_t splitLevel=0, ::Bool_t metadata=kFALSE)
Function saving the dynamically created auxiliary properties.
virtual ::Int_t getEntry(::Int_t getall=0)=0
Function for updating the object in memory if needed.
void Print(::Option_t *option="") const
Print information about the collected statistics.
EStructMode
"Structural" modes of the object
void ** getPtr()
Return a typeless pointer to the held object's pointer.
const void * get() const
Return a typeless const pointer to the held object.
@ ALWAYS_TRACK_INDICES
Always track indices, regardless of the setting of the ownership policy.
Object_t m_inputObjects
Collection of all the managed input objects.
static IProxyDict * setStore(IProxyDict *store)
Set the current store.
Helper class for making sure the current directory is preserved.
#define NO_SANITIZE_UNDEFINED
const SG::IConstAuxStore * getConstStore() const
Get a convenience pointer to the managed object.
void printNameRemap() const
Print the current name re-mapping rules.
"ROOT @c TTree implementation" of IAuxStore
static TStore * store()
Access the currently active TStore object.
SG::IAuxStore * recordAux(const std::string &key, SG::IAuxStoreHolder::AuxStoreType type=SG::IAuxStoreHolder::AST_ContainerStore, Int_t basketSize=32000, Int_t splitLevel=0)
Add an auxiliary store object to the output.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
static IProxyDict * store()
Fetch the current store.
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
Class providing an interface for classes listening to xAOD incidents.
StatusCode copy(const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Copy an object directly from the input to the output.
std::vector< size_t > vec
virtual ~TEvent()
Destructor.
Interface class for the "manager classes".
SG::sgkey_t getKey(const void *obj) const override
Function returning the hash describing a known object.
@ kClassAccess
Access auxiliary data using the aux containers.
std::string dump()
Function creating a user-readable dump of the current input.
Manager for primitive auxiliary branches created dynamically.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
const EventFormat * outputEventFormat() const
Get information about the output objects.
@ kObjectStore
The object describes a single object.
EStructMode structMode() const
Get what structure mode the object was constructed with.
Manage index tracking and synchronization of auxiliary data.
@ kContainerStore
The object describes an entire container.
Manage index tracking and synchronization of auxiliary data.
::TTree * m_inMetaTree
Pointer to the metadata tree in the input file.
Interface providing I/O for a generic auxiliary store.
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...
void clearNameRemap()
Clear the current name re-mapping.
void nextEvent()
Function incrementing the processed event counter.
const ::TClass * getClass() const
Handle mappings between names and auxid_t.
EAuxMode auxMode() const
Get what auxiliary access mode the object was constructed with.
static TVirtualEvent * event()
Access the currently active TVirtualEvent object.
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
AuxStoreType
Type of the auxiliary store.
size_t auxid_t
Identifier for a particular aux data item.
Bool_t m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
bit_t size() const
Count the number of 1 bits in the set.
void setStructMode(EStructMode mode)
Set the structure mode of the object to a new value.
::TTree * m_inTree
The main tree that we are reading from.
::TBranch * branch()
Accessor to the branch.
void getNames(const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata=false) const override
Function determining the list keys associated with a type name.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
@ OWN_ELEMENTS
this data object owns its elements
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
StatusCode readFrom(::TTree &tree, bool printWarnings=true)
Connect the object to an input TTree.
::Long64_t getEntries() const
Get how many entries are available from the current input file(s)
Interface providing I/O for a generic auxiliary store.
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
::StatusCode StatusCode
StatusCode definition for legacy code.
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0)
Function loading a given entry of the input TTree.
Class describing a certain "incident" that is communicated to user code.
Class helping with tracking the state of TChain objects.
::Bool_t isStandalone(const TObjectManager &mgr)
Function checking if an object is standalone (not a container)
virtual SG::auxid_set_t getSelectedAuxIDs() const
Get a list of dynamic variables that need to be written out.
void reset()
Reset the object.
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
EventFormat m_inputEventFormat
Format of the current input file.
bool empty() const
Return true if there are no 1 bits in the set.
::Bool_t contains(const std::string &key)
Function checking if an object is available from the store.
static IOStats & instance()
Singleton object accessor.
void setPrintEventProxyWarnings(bool)
Function to silence warnings associated with broken element links.
Listener_t m_listeners
Listeners who should be notified when certain incidents happen.
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
static const ::Int_t CACHE_SIZE
Size of a possible TTreeCache (30 MB)
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
static const char *const EVENT_TREE_NAME
Name of the event tree.
Object_t m_outputObjects
Collection of all the managed output object.
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
void print(char *figname, TCanvas *c1)
void keys(std::vector< std::string > &vkeys, bool metadata=false) const
provide list of all keys associated with provided type.
upgrade_mutex_t m_branchesMutex
Class helping in dealing with dynamic branch selection.
static const char *const METADATA_TREE_NAME
Name of the metadata tree.
::Bool_t internalStateChanged() const
Check whether there was an internal state change without us knowing.
StatusCode record(T *obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Add an output object to the event.
TEvent(EAuxMode mode=kUndefinedAccess)
Default constructor.
::Bool_t m_inTreeMissing
Internal status flag showing that an input file is open, but it doesn't contain an event tree.
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.
Helper class keeping track of the files that got accessed.
StatusCode initStats()
Function to initialise the statistics for all Tree content.
Manager for EDM objects created by ROOT.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
Manager for TAuxStore objects.
::Int_t fill()
Function filling one event into the output tree.
static PerfStats & instance()
Function accessing the singleton instance.
::Bool_t transientContains(const std::string &key) const
Function checking if an object is already in memory.
StatusCode removeListener(TVirtualIncidentListener *listener)
Remove an incident listener object.
::Bool_t isAuxStore(const TObjectManager &mgr)
Function checking if a given object may be an auxiliary store.
StatusCode connectAux(const std::string &prefix, ::Bool_t standalone)
Function setting up access to a set of auxiliary branches.
Interface for non-const operations on an auxiliary store.
EventFormat * m_outputEventFormat
Format of the current output file.
StatusCode setUpDynamicStore(TObjectManager &mgr, ::TTree *tree)
Function adding dynamic variable reading capabilities to an auxiliary store object.
EAuxMode
Auxiliary store "mode".
::Long64_t getFiles() const
Get how many files are available on the currently defined input.
A relatively simple transient store for objects created in analysis.
StatusCode addNameRemap(const std::string &onfile, const std::string &newName)
Add a name re-mapping rule.
Exception to signal a malformed class name.
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
::Bool_t hasAuxStore(const TObjectManager &mgr)
Function checking if a given object may have an auxiliary store.
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
This function is used to search for a branch in a TTree that contains a given substring.
StatusCode connectBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a particular branch.
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.
const THolder * holder() const
Accessor to the Holder object.
::Long64_t m_entry
The entry to look at from the input tree.
const EventFormat * inputEventFormat() const
Get information about the input objects.
Handle mappings between names and auxid_t.
::TBranch * branch()
Accessor to the branch.
::TBranch ** branchPtr()
Pointer to the branch's pointer.
TChainStateTracker * m_inChainTracker
Optional object for tracking the state changes of an input TChain.
StatusCode writeTo(::TFile *file, Int_t autoFlush=200, const char *treeName=EVENT_TREE_NAME)
Connect the object to an output file.
@ kUndefinedStore
The structure mode is not defined.
StatusCode readFrom(::TFile *file, Bool_t useTreeCache=kTRUE, const char *treeName=EVENT_TREE_NAME)
Connect the object to a new input file.
A set of aux data identifiers.
Lock object for taking out upgradable locks.
std::unordered_map< std::string, TVirtualManager * > Object_t
Definition of the internal data structure type.
@ kBranchAccess
Access auxiliary data branch-by-branch.
Helper to disable undefined behavior sanitizer for a function.
void setAuxItemList(const std::string &containerKey, const std::string &itemList)
Configure which dynamic variables to write out for a given store.
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
Class describing the access statistics of a collection of branches.
Interface for const operations on an auxiliary store.
void setActive() const
Set this event object as the currently active one.
@ AST_ObjectStore
The store describes a single object.
Interface for objects taking part in direct ROOT I/O.
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...
virtual void setObject(void *obj) override
Function replacing the object being handled.
StatusCode connectMetaBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a branch in the metadata tree.
void printIOStats() const
Function printing the I/O statistics of the current process.
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.
const THolder * holder() const
Accessor to the Holder object (constant version)
Tool for accessing xAOD files outside of Athena.
const THolder * holder() const
Accessor to the Holder object (constant version)
virtual const void * object() const override
Function getting a const pointer to the object being handled.
Base class for elements of a container that can have aux data.
std::set< std::string > m_inputMissingObjects
Objects that have been asked for, but were found to be missing in the current input.
@ AST_ContainerStore
The store describes a container.
StatusCode connectMetaAux(const std::string &prefix, ::Bool_t standalone)
Function setting up access to a set of auxiliary branches for a metadata object.
StatusCode setAuxStore(TObjectManager &mgr, ::Bool_t metadata=kFALSE)
Function connecting a DV object to its auxiliary store.
void clearListeners()
Remove all listeners from the object.