|
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
30 #endif // not XAOD_STANDALONE
68 void removeVersionNames( std::string&
name ) {
71 while( (
pos =
name.find(
"_v1" ) ) !=
name.npos ) {
74 while( (
pos =
name.find(
"_v2" ) ) !=
name.npos ) {
77 while( (
pos =
name.find(
"_v3" ) ) !=
name.npos ) {
80 while( (
pos =
name.find(
"_v4" ) ) !=
name.npos ) {
83 while( (
pos =
name.find(
"_v5" ) ) !=
name.npos ) {
86 while( (
pos =
name.find(
"_v6" ) ) !=
name.npos ) {
89 while( (
pos =
name.find(
"_v7" ) ) !=
name.npos ) {
92 while( (
pos =
name.find(
"_v8" ) ) !=
name.npos ) {
109 ForceTrackIndices& xvec =
static_cast< ForceTrackIndices&
>(
vec );
133 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
134 m_inChain( nullptr ), m_inChainTracker( nullptr ),
135 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
136 m_entry( -1 ), m_outTree( nullptr ),
137 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
138 m_inputMetaObjects(), m_outputMetaObjects(),
139 m_inputEventFormat(), m_outputEventFormat( nullptr ),
140 m_auxItemList(), m_listeners(), m_nameRemapping() {
151 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
152 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
153 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
154 ::Info(
"xAOD::TEvent::TEvent",
155 "Using access mode \"%i\" for the unit test",
156 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
166 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
167 m_inChain( nullptr ), m_inChainTracker( nullptr ),
168 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
169 m_entry( -1 ), m_outTree( nullptr ),
170 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
171 m_inputMetaObjects(), m_outputMetaObjects(),
172 m_inputEventFormat(), m_outputEventFormat( nullptr ),
173 m_auxItemList(), m_listeners(), m_nameRemapping() {
184 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
185 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
186 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
187 ::Info(
"xAOD::TEvent::TEvent",
188 "Using access mode \"%i\" for the unit test",
189 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
202 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
203 m_inChain( nullptr ), m_inChainTracker( nullptr ),
204 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
205 m_entry( -1 ), m_outTree( nullptr ),
206 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
207 m_inputMetaObjects(), m_outputMetaObjects(),
208 m_inputEventFormat(), m_outputEventFormat( nullptr ),
209 m_auxItemList(), m_listeners(), m_nameRemapping() {
220 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
221 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
222 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
223 ::Info(
"xAOD::TEvent::TEvent",
224 "Using access mode \"%i\" for the unit test",
225 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
240 for( ; itr !=
end; ++itr ) {
245 for( ; itr !=
end; ++itr ) {
250 for( ; itr !=
end; ++itr ) {
255 for( ; itr !=
end; ++itr ) {
269 #ifndef XAOD_STANDALONE
273 #endif // not XAOD_STANDALONE
295 std::ostringstream
ost;
296 ost <<
"<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
301 for( ; ef_itr != ef_end; ++ef_itr ) {
304 std::string
typeName = ef_itr->second.className();
309 ::TClass::GetClass( ef_itr->second.className().c_str() );
310 const std::type_info* ti = (
cl ?
cl->GetTypeInfo() : nullptr );
311 if( ( !
cl ) || ( !
cl->IsLoaded() ) || ( ! ti ) ) {
312 Warning(
"xAOD::TEvent::dump",
313 "Unknown type (%s) found in the event format",
314 ef_itr->second.className().c_str() );
319 if( !
contains( ef_itr->second.branchName(), *ti ) ) {
324 ost <<
" Hash: 0x" << std::setw( 8 ) << std::setfill(
'0' )
325 << std::hex << ef_itr->second.hash()
326 <<
" Key: \"" << ef_itr->second.branchName() <<
"\"\n";
331 ost <<
" isConst: " << ( isNonConst ?
"No" :
"Yes" ) <<
"\n";
339 ost <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
368 if( !
file )
return StatusCode::SUCCESS;
373 for( ; itr !=
end; ++itr ) {
387 for( ; itr !=
end; ++itr ) {
407 ::Error(
"xAOD::TEvent::readFrom",
408 XAOD_MESSAGE(
"Couldn't find metadata tree on input. Object "
410 return StatusCode::FAILURE;
416 ::Error(
"xAOD::TEvent::readFrom",
417 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
419 return StatusCode::FAILURE;
424 ::Info(
"xAOD::TEvent::readFrom",
425 "Was expecting a metadata tree with size 1, instead of %i.",
427 ::Info(
"xAOD::TEvent::readFrom",
428 "File most probably produced by hadd..." );
434 static const std::string eventFormatTypeName =
436 ::TClass*
cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
438 ::Warning(
"xAOD::TEvent::readFrom",
439 "Couldn't load the EventFormat dictionary" );
443 const std::string eventFormatBranchName =
445 if( !
m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
449 ::Info(
"xAOD::TEvent::readFrom",
"Input file provides no event or "
453 return StatusCode::SUCCESS;
459 m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
462 ::Error(
"xAOD::TEvent::readFrom",
463 XAOD_MESSAGE(
"Failed to connect to EventFormat object" ) );
464 return StatusCode::FAILURE;
481 std::set<std::string> lOtherMetaTreeNames = {};
482 TList *lKeys =
file->GetListOfKeys();
485 for (
int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
487 std::string
keyName = lKeys->At(iKey)->GetName();
492 && (
keyName.find(
"MetaData") != std::string::npos)
493 && !(
keyName.find(
"MetaDataHdr") != std::string::npos)){
495 const char *
className = ((::TKey*)lKeys->At(iKey))->GetClassName();
496 static constexpr Bool_t LOAD = kFALSE;
497 static constexpr Bool_t SILENT = kTRUE;
498 ::TClass*
cl = ::TClass::GetClass(
className, LOAD, SILENT);
499 if ((
cl !=
nullptr) &&
cl->InheritsFrom(::TTree::Class())){
501 lOtherMetaTreeNames.insert(
keyName);
508 for (
const std::string & metaTreeName : lOtherMetaTreeNames){
509 TTree *tmpMetaTree =
dynamic_cast< ::TTree*
>(
file->Get( metaTreeName.c_str() ) );
513 ::Warning(
"xAOD::TEvent::readFrom",
"Could not read metadata tree=%s",metaTreeName.c_str());
519 if ( tmpMetaTree->LoadTree(0) < 0 ){
520 ::Error(
"xAOD::TEvent::readFrom",
521 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
522 tmpMetaTree->GetName() );
523 return StatusCode::FAILURE;
527 const std::string tmpEventFormatBranchName =
529 if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
531 ::Warning(
"xAOD::TEvent::readFrom",
"No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
537 tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
538 &tmpFormat, &tmpBr );
540 ::Error(
"xAOD::TEvent::readFrom",
541 XAOD_MESSAGE(
"Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
542 return StatusCode::FAILURE;
545 tmpBr->GetEntry( 0 );
547 for (
const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
569 m_inTree->SetCacheLearnEntries( 10 );
581 const TIncident beginIncident( IncidentType::BeginInputFile );
583 listener->handle( beginIncident );
590 const TIncident endIncident( IncidentType::EndInputFile );
592 listener->handle( endIncident );
596 return StatusCode::SUCCESS;
619 if( useTreeCache && ( !
m_inChain->GetCacheSize() ) ) {
629 ::Error(
"xAOD::TEvent::readFrom",
630 XAOD_MESSAGE(
"Couldn't get the list of files from the "
632 return StatusCode::FAILURE;
634 if( !
files->GetEntries() ) {
635 ::Error(
"xAOD::TEvent::readFrom",
638 return StatusCode::FAILURE;
640 const ::TChainElement* chEl =
641 dynamic_cast< const ::TChainElement*
>(
files->At( 0 ) );
643 ::Error(
"xAOD::TEvent::readFrom",
644 XAOD_MESSAGE(
"Couldn't cast object to TChainElement" ) );
645 return StatusCode::FAILURE;
647 ::TFile* dummyFile = ::TFile::Open( chEl->GetTitle() );
649 ::Error(
"xAOD::TEvent::readFrom",
652 return StatusCode::FAILURE;
667 return StatusCode::SUCCESS;
678 ::TFile*
file =
tree->GetCurrentFile();
697 ::Error(
"xAOD::TEvent::writeTo",
698 XAOD_MESSAGE(
"Null pointer given to the function!" ) );
699 return StatusCode::FAILURE;
704 ::Error(
"xAOD::TEvent::writeTo",
705 XAOD_MESSAGE(
"Object already writing to a file. Close that "
707 return StatusCode::FAILURE;
725 return StatusCode::SUCCESS;
738 ::Error(
"xAOD::TEvent::finishWritingTo",
739 XAOD_MESSAGE(
"The object doesn't seem to be connected to an "
741 return StatusCode::FAILURE;
749 const TIncident incident( IncidentType::MetaDataStop );
752 for( ; l_itr != l_end; ++l_itr ) {
753 ( *l_itr )->handle( incident );
768 return StatusCode::SUCCESS;
774 metatree->SetAutoSave( 10000 );
775 metatree->SetAutoFlush( -30000000 );
776 metatree->SetDirectory(
file );
779 metatree->Branch(
"EventFormat",
790 for(
auto&
object : outputMetaObjects ) {
795 ::Error(
"xAOD::TEvent::finishWritingTo",
797 return StatusCode::FAILURE;
801 const ::Int_t splitLevel = (
object.first.find(
"Aux." ) ==
802 (
object.first.size() - 4 ) ? 1 : 0 );
804 *(
mgr->branchPtr() ) =
805 metatree->Branch(
object.first.c_str(),
806 mgr->holder()->getClass()->GetName(),
807 mgr->holder()->getPtr(), 32000, splitLevel );
808 if( !
mgr->branch() ) {
809 ::Error(
"xAOD::TEvent::finishWritingTo",
812 mgr->holder()->getClass()->GetName(),
813 object.first.c_str() );
814 return StatusCode::FAILURE;
824 if( metatree->Fill() <= 0 ) {
825 ::Error(
"xAOD::TEvent::finishWritingTo",
826 XAOD_MESSAGE(
"Failed to write event format metadata into "
828 metatree->SetDirectory( 0 );
830 return StatusCode::FAILURE;
835 metatree->SetDirectory( 0 );
840 for( ; obj_itr != obj_end; ++obj_itr ) {
841 delete obj_itr->second;
846 for( ; obj_itr != obj_end; ++obj_itr ) {
847 delete obj_itr->second;
852 return StatusCode::SUCCESS;
867 #ifndef XAOD_STANDALONE
869 #endif // not XAOD_STANDALONE
883 const std::string& itemList ) {
889 if( itemList.size() ) {
890 std::stringstream
ss( itemList );
892 while( std::getline(
ss, attr,
'.' ) ) {
914 ::Error(
"xAOD::TEvent::addListener",
915 XAOD_MESSAGE(
"Received a null pointer for the listener" ) );
916 return StatusCode::FAILURE;
920 bool listenerKnown =
false;
922 if(
l == listener ) {
923 ::Warning(
"xAOD::TEvent::addListener",
924 "Listener %p was added previously already",
925 static_cast< void*
>( listener ) );
926 listenerKnown =
true;
932 if( ! listenerKnown ) {
937 return StatusCode::SUCCESS;
954 ::Error(
"xAOD::TEvent::removeListener",
956 static_cast< void*
>( listener ) );
957 return StatusCode::FAILURE;
964 return StatusCode::SUCCESS;
996 ::Error(
"xAOD::TEvent::addNameRemap",
997 XAOD_MESSAGE(
"Can't use \"%s\" as the target name in the"
998 "\"%s\" -> \"%s\" remapping" ),
1000 return StatusCode::FAILURE;
1006 ::Warning(
"xAOD::TEvent::addNameRemap",
1007 "Overriding existing name remapping \"%s\" -> \"%s\"",
1008 itr->second.c_str(), itr->first.c_str() );
1009 ::Warning(
"xAOD::TEvent::addNameRemap",
" with: \"%s\" -> \"%s\"",
1010 onfile.c_str(),
newName.c_str() );
1017 return StatusCode::SUCCESS;
1036 ::Info(
"xAOD::TEvent::printNameRemap",
"Name remapping rules:" );
1040 ::Info(
"xAOD::TEvent::printNameRemap",
" NONE" );
1047 ::Info(
"xAOD::TEvent::printNameRemap",
" \"%s\" -> \"%s\"",
1048 itr->second.c_str(), itr->first.c_str() );
1068 ::Int_t basketSize, ::Int_t splitLevel ) {
1072 ::Error(
"xAOD::TEvent::recordAux",
1073 XAOD_MESSAGE(
"No output tree given to the object" ) );
1091 ::Error(
"xAOD::TEvent::recordAux",
1093 static_cast< int >(
type ) );
1098 basketSize, splitLevel );
1099 if(
record(
store,
key, basketSize, splitLevel, kTRUE ).isFailure() ) {
1100 ::Error(
"xAOD::TEvent::recordAux",
1101 XAOD_MESSAGE(
"Couldn't connect TAuxStore object to the "
1112 ::Error(
"xAOD::TEvent::recordAux",
1120 ::Error(
"xAOD::TEvent::recordAux",
1121 XAOD_MESSAGE(
"Object of non-TAuxStore type registered "
1122 "with key \"%s\"" ),
key.c_str() );
1144 ::Int_t basketSize, ::Int_t splitLevel ) {
1147 std::string keyToUse =
key;
1152 keyToUse = remap_itr->second;
1159 Object_t::const_iterator vobjMgr =
m_inputObjects.find( keyToUse );
1161 ::Error(
"xAOD::TEvent::copy",
1163 return StatusCode::FAILURE;
1168 ::Error(
"xAOD::TEvent::copy",
1170 return StatusCode::FAILURE;
1174 ::Error(
"xAOD::TEvent::copy",
1176 return StatusCode::FAILURE;
1183 key, basketSize, splitLevel, kTRUE ) );
1186 const std::set< std::string >*
filter = 0;
1189 filter = &( fitr->second );
1193 Object_t::const_iterator vauxMgr =
m_inputObjects.find( keyToUse +
1198 return StatusCode::SUCCESS;
1205 ::Error(
"xAOD::TEvent::copy",
1207 return StatusCode::FAILURE;
1212 key +
"Aux.", basketSize, splitLevel, kTRUE ) );
1217 ::Error(
"xAOD::TEvent::copy",
1219 return StatusCode::FAILURE;
1227 key +
"Aux.", basketSize, splitLevel ) );
1229 ::Fatal(
"xAOD::TEvent::copy",
1234 return StatusCode::SUCCESS;
1250 ::Error(
"xAOD::TEvent::copy",
1252 return StatusCode::FAILURE;
1258 for( ; itr !=
end; ++itr ) {
1277 ::TClass*
cl = ::TClass::GetClass( efe.
className().c_str() );
1278 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
1288 return StatusCode::SUCCESS;
1303 ::Error(
"xAOD::TEvent::getEntries",
1328 ::Error(
"xAOD::TEvent::getEntry",
1338 if( fileEntry < 0 ) {
1339 ::Error(
"xAOD::TEvent::getEntry",
1342 static_cast< int >(
entry ) );
1357 ::Error(
"xAOD::TEvent::getEntry",
1380 ::Error(
"xAOD::TEvent::getEntry",
1381 XAOD_MESSAGE(
"Failure in loading entry %i from the input "
1382 "file" ),
static_cast< int >(
m_entry ) );
1393 const TIncident incident( IncidentType::BeginEvent );
1396 for( ; l_itr != l_end; ++l_itr ) {
1397 ( *l_itr )->handle( incident );
1411 static const std::string dynStorePostfix =
"Aux.Dynamic";
1412 if( inObj.first.find( dynStorePostfix ) ==
1413 ( inObj.first.size() - dynStorePostfix.size() ) ) {
1427 result += inObj.second->getEntry( getall );
1432 const TIncident incident( IncidentType::BeginEvent );
1435 for( ; l_itr != l_end; ++l_itr ) {
1436 ( *l_itr )->handle( incident );
1455 return m_inChain->GetListOfFiles()->GetEntries();
1476 ::Error(
"xAOD::TEvent::getFile",
1477 XAOD_MESSAGE(
"Function called with invalid file number "
1478 "(%i)" ),
static_cast< int >(
file ) );
1493 ::Long64_t
entry = 0;
1494 for( ::Long64_t
i = 0;
i <
file; ++
i ) {
1512 ::Error(
"xAOD::TEvent::fill",
1513 XAOD_MESSAGE(
"Object not connected to an output file!" ) );
1523 ::Error(
"xAOD::TEvent::fill",
1529 ::Error(
"xAOD::TEvent::fill",
1539 std::string unsetObjects;
1541 for(
auto& itr : outputObjectsCopy ) {
1543 if( ! itr.second->create() ) {
1546 if( unsetObjects.size() ) {
1547 unsetObjects.append(
", \"" + itr.first +
"\"" );
1549 unsetObjects.append(
"\"" + itr.first +
"\"" );
1557 ::Error(
"xAOD::TEvent::fill",
1558 XAOD_MESSAGE(
"Failed to put dynamic auxiliary variables "
1559 "in the output for object \"%s\"" ),
1560 itr.first.c_str() );
1566 if( unsetObjects.size() ) {
1567 ::Error(
"xAOD::TEvent::fill",
1568 XAOD_MESSAGE(
"The following objects were not set in the "
1569 "current event: %s" ), unsetObjects.c_str() );
1576 ::Error(
"xAOD::TEvent::fill",
1577 XAOD_MESSAGE(
"Output tree filling failed with return "
1578 "value: %i" ), ret );
1584 for( ; ncitr != ncend; ++ncitr ) {
1585 ncitr->second->reset();
1611 ::Warning(
"xAOD::TEvent::inputEventFormat",
1612 "No input file is connected at the moment" );
1634 ::Warning(
"xAOD::TEvent::outputEventFormat",
1635 "No output file is connected at the moment" );
1652 if(
key ==
"" )
return 0;
1689 for( ; obj_itr != obj_end; ++obj_itr ) {
1692 if( obj_itr->second->object() !=
obj )
continue;
1695 return obj_itr->first;
1701 for( ; obj_itr != obj_end; ++obj_itr ) {
1704 if( obj_itr->second->object() !=
obj )
continue;
1707 return obj_itr->first;
1718 ::Warning(
"xAOD::TEvent::getName",
1719 "Didn't find object with pointer %p in the event",
1721 static const std::string
dummy;
1726 std::vector<std::string>& vkeys,
1729 std::set<std::string>
keys;
1733 std::vector<TObjArray*> fullListOfBranches = {};
1738 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1739 fullListOfBranches.push_back(
m_inMetaTree->GetListOfBranches());
1744 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1746 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
1751 TList *fList =
m_inTree->GetListOfFriends();
1753 for (TObject * feObj : *fList){
1756 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
1758 fullListOfBranches.push_back(friendTree->GetListOfBranches());
1766 for (
const TObjArray * in : fullListOfBranches){
1769 const TObject *
obj = in->At(
index);
1770 if ( !
obj )
continue;
1771 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1773 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1776 std::string objClassName = element->GetClassName();
1777 std::string
key =
obj->GetName();
1778 ::Info(
"xAOD::TEvent::getNames",
1779 "Inspecting %s / %s",
1780 objClassName.c_str(),
key.c_str());
1781 if (objClassName == targetClassName) {
1782 ::Info(
"xAOD::TEvent::getNames",
1783 "Matched %s to key %s",
1784 targetClassName.c_str(),
key.c_str());
1793 ::Info(
"xAOD::TEvent::getNames",
1794 "scanning input Aux objects for %s", targetClassName.c_str());
1795 for(
const auto&
object : inAux ) {
1799 if ( !
mgr )
continue;
1800 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1801 const std::string&
key =
object.first;
1802 ::Info(
"xAOD::TEvent::getNames",
1803 "Inspecting %s / %s",
1804 objClassName.c_str(),
key.c_str());
1805 if (objClassName == targetClassName) {
1806 ::Info(
"xAOD::TEvent::getNames",
1807 "Matched %s to key %s",
1808 targetClassName.c_str(),
key.c_str());
1817 const TObjArray *
out =
tree->GetListOfBranches();
1818 ::Info(
"xAOD::TEvent::getNames",
"scanning output objects");
1822 if ( !
obj )
continue;
1823 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1825 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1828 std::string objClassName = element->GetClassName();
1829 std::string
key =
obj->GetName();
1830 ::Info(
"xAOD::TEvent::getNames",
1831 "Inspecting %s / %s",
1832 objClassName.c_str(),
key.c_str());
1833 if (objClassName == targetClassName) {
1834 ::Info(
"xAOD::TEvent::getNames",
1835 "Matched %s to key %s",
1836 targetClassName.c_str(),
key.c_str());
1841 ::Info(
"xAOD::TEvent::getNames",
"no output tree connected");
1850 ::Info(
"xAOD::TEvent::getNames",
1851 "scanning output Aux objects for %s", targetClassName.c_str());
1852 for(
const auto&
object : outAux ) {
1856 if ( !
mgr )
continue;
1857 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1858 const std::string&
key =
object.first;
1859 ::Info(
"xAOD::TEvent::getNames",
1860 "Inspecting %s / %s",
1861 objClassName.c_str(),
key.c_str());
1862 if (objClassName == targetClassName) {
1863 ::Info(
"xAOD::TEvent::getNames",
1864 "Matched %s to key %s",
1865 targetClassName.c_str(),
key.c_str());
1870 vkeys.insert(vkeys.end(),
keys.begin(),
keys.end());
1900 static const std::string
dummy;
1915 const std::type_info& ti ) {
1919 if( !
name.length() ) {
1939 const std::type_info& ti,
1945 Warning(
"xAOD::TEvent::getInputObject",
1946 "Key 0x%08x unknown",
key );
1965 return StatusCode::SUCCESS;
1970 ::Error(
"xAOD::TEvent::initStats",
1973 return StatusCode::FAILURE;
1982 for( ; itr !=
end; ++itr ) {
1985 const std::string& branchName = itr->second.branchName();
1988 if( branchName.find(
"Aux." ) != std::string::npos ) {
1997 const std::string intName =
1998 branchName.substr( 0, branchName.size() - 4 );
2006 ::Bool_t auxFound = kFALSE;
2009 std::vector<TObjArray*> fullListOfBranches = {};
2011 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
2016 TList *fList =
m_inTree->GetListOfFriends();
2018 for (TObject * feObj : *fList){
2021 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
2023 fullListOfBranches.push_back(friendTree->GetListOfBranches());
2028 for (TObjArray*
branches : fullListOfBranches){
2029 for( Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i ){
2033 if(
name.BeginsWith( branchName ) ||
2034 name.BeginsWith( dynName ) ) {
2041 ::Warning(
"xAOD::TEvent::initStats",
2042 "Couldn't find interface object/container "
2043 "\"%s\" belonging to branch \"%s\"",
2044 intName.c_str(), branchName.c_str() );
2051 ::TClass*
cl = ::TClass::GetClass(
el->className().c_str() );
2052 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
2053 ::Warning(
"xAOD::TEvent::initStats",
2054 "Couldn't find dictionary for type \"%s\"",
2055 el->className().c_str() );
2061 static const std::string baseName =
2063 static ::TClass*
const baseCl = ::TClass::GetClass( baseName.c_str() );
2065 ::Error(
"xAOD::TEvent::initStats",
2067 "\"%s\"" ), baseName.c_str() );
2068 return StatusCode::FAILURE;
2085 const ::TBranch* container =
2086 m_inTree->GetBranch( branchName.c_str() );
2095 return StatusCode::SUCCESS;
2111 const std::type_info& ti,
2119 Object_t::const_iterator itr =
objects.find(
key );
2141 if( ! itr->second->isSet() ) {
2149 ::Error(
"xAOD::TEvent::getOutputObject",
2150 XAOD_MESSAGE(
"Object of wrong type found for key \"%s\"" ),
2156 void*
result =
mgr->holder()->getAs( ti );
2158 ::Warning(
"xAOD::TEvent::getOutputObject",
2159 "Couldn't retrieve object as \"%s\"",
2181 const std::type_info& ti,
2186 std::string keyToUse =
key;
2191 keyToUse = remap_itr->second;
2198 store->isConst( keyToUse, ti ) ) {
2199 const void*
result =
store->getConstObject( keyToUse, ti );
2230 ::Fatal(
"xAOD::TEvent::getInputObject",
2231 XAOD_MESSAGE(
"There is an internal logic error in the "
2240 if(
key == keyToUse ) {
2241 ::Error(
"xAOD::TEvent::getInputObject",
2246 ::Error(
"xAOD::TEvent::getInputObject",
2248 "\"%s\"/\"%s\"" ),
key.c_str(),
2256 if(
mgr->getEntry() ) {
2261 ::Error(
"xAOD::TEvent::getInputObject",
2264 mgr->holder()->getClass()->GetName(),
2275 ::Warning(
"xAOD::TEvent::getInputObject",
2276 "Could not retrieve object with key \"%s\" "
2277 "as \"%s\"", keyToUse.c_str(),
2306 const std::string&
key,
2307 ::Int_t basketSize, ::Int_t splitLevel,
2308 ::Bool_t overwrite, ::Bool_t
metadata,
2309 ::Bool_t isOwner ) {
2313 ::Error(
"xAOD::TEvent::record",
2314 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2315 "call writeTo(...)?" ) );
2316 return StatusCode::FAILURE;
2324 if( ( ! overwrite ) &&
2327 ::Error(
"xAOD::TEvent::record",
2330 return StatusCode::FAILURE;
2333 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2335 ::Error(
"xAOD::TEvent::record",
2338 return StatusCode::FAILURE;
2346 return StatusCode::SUCCESS;
2351 if( ( ! overwrite ) &&
2353 ::Error(
"xAOD::TEvent::record",
2354 XAOD_MESSAGE(
"Object %s/%s already accessed from the input, "
2355 "can't be overwritten in memory" ),
2357 return StatusCode::FAILURE;
2362 if( ( splitLevel == 0 ) &&
2363 (
key.find(
"Aux." ) == (
key.size() - 4 ) ) ) {
2372 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2374 ::Error(
"xAOD::TEvent::record",
2377 return StatusCode::FAILURE;
2393 *(
mgr->branchPtr() ) =
2395 hldr->
getPtr(), basketSize, splitLevel );
2396 if( !
mgr->branch() ) {
2397 ::Error(
"xAOD::TEvent::record",
2400 key.c_str(),
cl->GetName() );
2404 return StatusCode::FAILURE;
2415 return StatusCode::SUCCESS;
2421 ::Error(
"xAOD::TEvent::record",
2424 return StatusCode::FAILURE;
2433 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2434 if( ( !
cl ) || ::strcmp(
cl->GetName(),
2436 ::Error(
"xAOD::TEvent::record",
2437 XAOD_MESSAGE(
"For output key \"%s\" the previous type "
2438 "was \"%s\", the newly requested type is "
2442 return StatusCode::FAILURE;
2470 ::Bool_t ownsStore ) {
2474 ::Error(
"xAOD::TEvent::record",
2475 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2476 "call writeTo(...)?" ) );
2477 return StatusCode::FAILURE;
2481 const std::set< std::string >*
filter = 0;
2484 filter = &( filter_itr->second );
2502 return StatusCode::SUCCESS;
2506 if( vitr->second->object() ==
store ) {
2508 return StatusCode::SUCCESS;
2518 ::Error(
"xAOD::TEvent::record",
2519 XAOD_MESSAGE(
"Output object with key %s already exists, "
2520 "and is not of type TAuxStore" ),
2522 return StatusCode::FAILURE;
2537 return StatusCode::SUCCESS;
2563 ::Error(
"xAOD::TEvent::connectBranch",
2564 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2565 return StatusCode::FAILURE;
2573 return StatusCode::SUCCESS;
2578 ::Warning(
"xAOD::TEvent::connectBranch",
2579 "Branch \"%s\" not available on input",
2582 return StatusCode::RECOVERABLE;
2589 ::Warning(
"xAOD::TEvent::connectBranch",
2590 "No metadata available for branch: %s",
2602 ::Warning(
"xAOD::TEvent::connectBranch",
2603 "Branch \"%s\" not available on input",
2607 return StatusCode::RECOVERABLE;
2611 br->SetMakeClass( 0 );
2622 ::Error(
"xAOD::TEvent::connectBranch",
2623 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2624 "dictionary for branch \"%s\"" ),
2626 return StatusCode::FAILURE;
2629 ::TClass* realClass = ::TClass::GetClass(
className.c_str() );
2630 if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) &&
ef ) {
2635 realClass = ::TClass::GetClass(
className.c_str() );
2637 if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2639 ::Error(
"xAOD::TEvent::connectBranch",
2640 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2641 "dictionary for branch \"%s\"" ),
2643 return StatusCode::FAILURE;
2650 static const ::EDataType
dataType = kOther_t;
2663 ::Error(
"xAOD::TEvent::connectBranch",
2664 XAOD_MESSAGE(
"Couldn't access output manager for: %s" ),
2666 return StatusCode::FAILURE;
2669 ptr =
mgr->holder()->get();
2676 ptr = realClass->New();
2691 ::Error(
"xAOD::TEvent::connectBranch",
2693 "This can only be read in kAthenaAccess mode." ),
2694 key.c_str(),
br->GetSplitLevel() );
2699 return StatusCode::FAILURE;
2709 ::Error(
"xAOD::TEvent::connectBranch",
2710 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2711 "input branch \"%s\". Return code: %i" ),
2717 return StatusCode::FAILURE;
2747 ::Error(
"xAOD::TEvent::connectMetaBranch",
2748 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2749 return StatusCode::FAILURE;
2754 return StatusCode::SUCCESS;
2761 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2762 "Branch \"%s\" not available on input",
2765 return StatusCode::RECOVERABLE;
2769 if( !
br->GetEntries() ) {
2771 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2772 "Branch \"%s\" doesn't hold any data",
2775 return StatusCode::RECOVERABLE;
2779 br->SetMakeClass( 0 );
2783 ::EDataType
dt = kOther_t;
2784 if(
br->GetExpectedType(
cl,
dt ) || ( !
cl ) ) {
2785 ::Error(
"xAOD::TEvent::connectMetaBranch",
2787 "branch %s" ),
key.c_str() );
2788 return StatusCode::FAILURE;
2792 void*
ptr =
cl->New();
2805 ::Error(
"xAOD::TEvent::connectMetaBranch",
2806 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2807 "input branch \"%s\". Return code: %i" ),
2813 return StatusCode::FAILURE;
2817 if(
mgr->getEntry() < 0 ) {
2818 ::Error(
"xAOD::TEvent::connectMetaBranch",
2819 XAOD_MESSAGE(
"Couldn't read in metadata object with key "
2820 "\"%s\"" ),
key.c_str() );
2821 return StatusCode::FAILURE;
2843 return StatusCode::SUCCESS;
2861 ::Error(
"xAOD::TEvent::connectAux",
2863 return StatusCode::FAILURE;
2871 return StatusCode::SUCCESS;
2876 return StatusCode::SUCCESS;
2889 ::Fatal(
"xAOD::TEvent::connectAux",
2895 ::Fatal(
"xAOD::TEvent::connectAux",
2897 return StatusCode::FAILURE;
2901 static const TClass*
const holderClass =
2903 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
2905 return StatusCode::SUCCESS;
2912 if( ! storeHolder ) {
2913 ::Fatal(
"xAOD::TEvent::connectAux",
2924 ::Error(
"xAOD::TEvent::connectAux",
2926 "for: %s" ),
prefix.c_str() );
2927 ::Error(
"xAOD::TEvent::connectAux",
2928 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
2931 return StatusCode::FAILURE;
2935 return StatusCode::SUCCESS;
2956 return StatusCode::SUCCESS;
2960 ::Error(
"xAOD::TEvent::connectAux",
2961 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
2963 return StatusCode::FAILURE;
2980 return StatusCode::SUCCESS;
2985 ::Fatal(
"xAOD::TEvent::connectMetaAux",
2987 return StatusCode::FAILURE;
3001 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3007 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3009 return StatusCode::FAILURE;
3013 static const TClass*
const holderClass =
3015 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
3017 return StatusCode::SUCCESS;
3024 if( ! storeHolder ) {
3025 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3036 ::Error(
"xAOD::TEvent::connectMetaAux",
3037 XAOD_MESSAGE(
"Requested store types inconsistent" ) );
3038 ::Error(
"xAOD::TEvent::connectMetaAux",
3039 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
3042 return StatusCode::FAILURE;
3046 return StatusCode::SUCCESS;
3067 store->getEntry( 0 );
3070 return StatusCode::SUCCESS;
3074 ::Error(
"xAOD::TEvent::connectMetaAux",
3075 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
3077 return StatusCode::FAILURE;
3091 ::TMethodCall setNameCall;
3095 setNameCall.InitWithPrototype(
mgr.holder()->getClass(),
3096 "setName",
"const char*" );
3097 if( setNameCall.IsValid() ) {
3102 const char* charParams =
params.Data();
3103 setNameCall.Execute(
mgr.holder()->get(), charParams );
3106 ::Warning(
"xAOD::TEvent::setUpDynamicStore",
3107 "Couldn't find setName(...) function for container %s "
3109 mgr.branch()->GetName(),
3110 mgr.holder()->getClass()->GetName() );
3115 static const TClass*
const holderClass =
3117 if( !
mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3119 return StatusCode::SUCCESS;
3126 if( ! storeHolder ) {
3127 ::Fatal(
"xAOD::TEvent::setUpDynamicStore",
3129 return StatusCode::FAILURE;
3153 store->getEntry( 0 );
3159 return StatusCode::SUCCESS;
3177 return StatusCode::SUCCESS;
3181 const std::string
key =
mgr.branch()->GetName();
3199 return StatusCode::SUCCESS;
3201 auxMgr = itr->second;
3202 auxKey =
key +
"Aux.";
3207 ::Int_t readBytes = auxMgr->
getEntry();
3211 const std::string dynAuxKey = auxKey +
"Dynamic";
3212 auto dynAuxMgr =
objects.find( dynAuxKey );
3214 if( ( dynAuxMgr !=
objects.end() ) &&
3216 ( auxMgr == &
mgr ) ) ) {
3221 dynAuxMgr->second->getEntry();
3235 auto dynAuxMgr =
objects.find( dynAuxKey );
3236 if( dynAuxMgr ==
objects.end() ) {
3237 ::Error(
"xAOD::TEvent::setAuxStore",
3239 return StatusCode::FAILURE;
3241 dynAuxMgr->second->getEntry();
3247 if( auxMgr == &
mgr ) {
3248 return StatusCode::SUCCESS;
3254 switch(
mgr.holder()->typeKind() ) {
3273 if(
vec && ( !
vec->trackIndices() ) ) {
3274 forceTrackIndices( *
vec );
3278 if( ( !
vec ) && ( ! aux ) ) {
3279 ::Fatal(
"xAOD::TEvent::setAuxStore",
3281 "SG::AuxVectorBase or SG::AuxElement" ),
3282 mgr.holder()->getClass()->GetName() );
3291 ::Fatal(
"xAOD::TEvent::setAuxStore",
3292 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3293 "right type" ), auxKey.c_str() );
3294 return StatusCode::FAILURE;
3310 ::Fatal(
"xAOD::TEvent::setAuxStore",
3311 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3312 "right type" ), auxKey.c_str() );
3313 return StatusCode::FAILURE;
3319 ::Fatal(
"xAOD::TEvent::setAuxStore",
3329 ::Fatal(
"xAOD::TEvent::setAuxStore",
3334 return StatusCode::SUCCESS;
3351 ::Int_t basketSize, ::Int_t splitLevel,
3361 return StatusCode::SUCCESS;
3365 if( !
mgr->holder()->getClass()->InheritsFrom(
"SG::IAuxStoreIO" ) ) {
3366 return StatusCode::SUCCESS;
3374 ::Fatal(
"xAOD::TEvent::putAux",
3375 XAOD_MESSAGE(
"There is a logic error in the code!" ) );
3384 sel.selectAux( item_itr->second );
3394 if( auxids.
empty() ) {
3395 return StatusCode::SUCCESS;
3399 const std::string dynNamePrefix =
3408 typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
3409 std::vector< AuxVarSort_t > varsort;
3410 varsort.reserve( auxids.
size() );
3412 varsort.emplace_back(
r.getName(
id ),
id );
3414 std::sort( varsort.begin(), varsort.end() );
3417 for(
const auto&
p : varsort ) {
3423 const std::string
brName = dynNamePrefix +
p.first;
3432 const std::type_info* brType = aux->
getIOType(
id );
3434 ::Error(
"xAOD::TEvent::putAux",
3437 return StatusCode::FAILURE;
3439 const std::string brTypeName =
3441 std::string brProperTypeName =
"<unknown>";
3447 if( strlen( brType->name() ) == 1 ) {
3450 brProperTypeName = brTypeName;
3455 ::Error(
"xAOD::TEvent::putAux",
3458 brName.c_str(), brTypeName.c_str() );
3459 return StatusCode::FAILURE;
3463 std::ostringstream leaflist;
3475 outTree.Branch(
brName.c_str(), hldr->
get(),
3476 leaflist.str().c_str(),
3478 if( ! auxmgr->
branch() ) {
3479 ::Error(
"xAOD::TEvent::putAux",
3482 brName.c_str(), brProperTypeName.c_str() );
3487 return StatusCode::FAILURE;
3494 TClass*
cl = TClass::GetClass( *brType, kTRUE, kTRUE );
3498 cl = TClass::GetClass( brTypeName.c_str() );
3501 ::Error(
"xAOD::TEvent::putAux",
3503 "variable \"%s\" of type \"%s\"" ),
3504 brName.c_str(), brTypeName.c_str() );
3505 return StatusCode::FAILURE;
3510 brProperTypeName =
cl->GetName();
3519 if (!
cl->CanSplit() && strncmp (
cl->GetName(),
"SG::PackedContainer<", 20) == 0)
3524 outTree.Branch(
brName.c_str(),
3526 hldr->
getPtr(), basketSize, splitLevel );
3527 if( ! auxmgr->
branch() ) {
3528 ::Error(
"xAOD::TEvent::putAux",
3531 brName.c_str(), brProperTypeName.c_str() );
3536 return StatusCode::FAILURE;
3544 if( outTree.GetEntries() ) {
3545 void*
ptr =
br->GetAddress();
3546 br->SetAddress( 0 );
3547 for( ::Long64_t
i = 0;
i < outTree.GetEntries(); ++
i ) {
3550 br->SetAddress(
ptr );
3559 mgr->branch()->GetName(),
3570 ::Fatal(
"xAOD::TEvent::putAux",
3571 XAOD_MESSAGE(
"There is an internal logic error in the "
3577 const_cast< void*
>(
static_cast< const void*
>( aux->
getIOData(
id ) ) );
3578 bmgr->second->setObject( nc_data );
3582 return StatusCode::SUCCESS;
3597 static const TClass*
const dvClass =
3599 static const TClass*
const aeClass =
3603 return (
mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3604 mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3617 static const TClass*
const storeClass =
3619 static const TClass*
const storeHolderClass =
3623 return (
mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3624 mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3641 static const TClass*
const dvClass =
3643 static const TClass*
const aeClass =
3647 if(
mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3649 }
else if(
mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3654 ::Error(
"xAOD::TEvent::isStandalone",
3656 "auxiliary store" ),
3657 mgr.holder()->getClass()->GetName() );
3672 const std::type_info& ti,
3691 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.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
bool contains(const TKEY &key) const
Look up a keyed object in TDS (compare also tryRetrieve) returns false if object not available in TDS...
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.
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.
@ 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.
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
StatusCode setStructMode(EStructMode mode)
Set the structure mode of the object to a new value.
const SG::IConstAuxStore * getConstStore() const
Get a convenience pointer to the managed object.
void printNameRemap() const
Print the current name re-mapping rules.
"ROOT 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.
EStructMode
"Structural" modes of the object
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.
Manage index tracking and synchronization of auxiliary data.
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.
::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.
::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)
@ kObjectStore
The object describes a single object.
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.
StatusCode initStats(::TTree *tree)
Function used for setting up the statistics info about the managed branches.
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.
@ kContainerStore
The object describes an entire container.
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
void upgrade()
Convert the lock from upgrade to exclusive.
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
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.
@ kUndefinedStore
The structure mode is not defined.
StatusCode setUpDynamicStore(TObjectManager &mgr, ::TTree *tree)
Function adding dynamic variable reading capabilities to an auxiliary store object.
virtual void selectAux(const std::set< std::string > &attributes)
Select dynamic auxiliary attributes for writing.
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.
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)
Search for branches, returns search term on no result.
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.
EStructMode structMode() const
Get what structure mode the object was constructed with.
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.
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 print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
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.