Loading [MathJax]/extensions/tex2jax.js
 |
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
70 void removeVersionNames( std::string&
name ) {
73 while( (
pos =
name.find(
"_v1" ) ) !=
name.npos ) {
76 while( (
pos =
name.find(
"_v2" ) ) !=
name.npos ) {
79 while( (
pos =
name.find(
"_v3" ) ) !=
name.npos ) {
82 while( (
pos =
name.find(
"_v4" ) ) !=
name.npos ) {
85 while( (
pos =
name.find(
"_v5" ) ) !=
name.npos ) {
88 while( (
pos =
name.find(
"_v6" ) ) !=
name.npos ) {
91 while( (
pos =
name.find(
"_v7" ) ) !=
name.npos ) {
94 while( (
pos =
name.find(
"_v8" ) ) !=
name.npos ) {
111 ForceTrackIndices& xvec =
static_cast< ForceTrackIndices&
>(
vec );
135 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
136 m_inChain( nullptr ), m_inChainTracker( nullptr ),
137 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
138 m_entry( -1 ), m_outTree( nullptr ),
139 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
140 m_inputMetaObjects(), m_outputMetaObjects(),
141 m_inputEventFormat(), m_outputEventFormat( nullptr ),
142 m_auxItemList(), m_listeners(), m_nameRemapping() {
153 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
154 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
155 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
156 ::Info(
"xAOD::TEvent::TEvent",
157 "Using access mode \"%i\" for the unit test",
158 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
168 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
169 m_inChain( nullptr ), m_inChainTracker( nullptr ),
170 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
171 m_entry( -1 ), m_outTree( nullptr ),
172 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
173 m_inputMetaObjects(), m_outputMetaObjects(),
174 m_inputEventFormat(), m_outputEventFormat( nullptr ),
175 m_auxItemList(), m_listeners(), m_nameRemapping() {
186 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
187 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
188 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
189 ::Info(
"xAOD::TEvent::TEvent",
190 "Using access mode \"%i\" for the unit test",
191 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
204 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
205 m_inChain( nullptr ), m_inChainTracker( nullptr ),
206 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
207 m_entry( -1 ), m_outTree( nullptr ),
208 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
209 m_inputMetaObjects(), m_outputMetaObjects(),
210 m_inputEventFormat(), m_outputEventFormat( nullptr ),
211 m_auxItemList(), m_listeners(), m_nameRemapping() {
222 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
223 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
224 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
225 ::Info(
"xAOD::TEvent::TEvent",
226 "Using access mode \"%i\" for the unit test",
227 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
242 for( ; itr !=
end; ++itr ) {
247 for( ; itr !=
end; ++itr ) {
252 for( ; itr !=
end; ++itr ) {
257 for( ; itr !=
end; ++itr ) {
271 #ifndef XAOD_STANDALONE
275 #endif // not XAOD_STANDALONE
297 std::ostringstream
ost;
298 ost <<
"<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
303 for( ; ef_itr != ef_end; ++ef_itr ) {
306 std::string
typeName = ef_itr->second.className();
311 ::TClass::GetClass( ef_itr->second.className().c_str() );
312 const std::type_info* ti = (
cl ?
cl->GetTypeInfo() : nullptr );
313 if( ( !
cl ) || ( !
cl->IsLoaded() ) || ( ! ti ) ) {
314 Warning(
"xAOD::TEvent::dump",
315 "Unknown type (%s) found in the event format",
316 ef_itr->second.className().c_str() );
321 if( !
contains( ef_itr->second.branchName(), *ti ) ) {
326 ost <<
" Hash: 0x" << std::setw( 8 ) << std::setfill(
'0' )
327 << std::hex << ef_itr->second.hash()
328 <<
" Key: \"" << ef_itr->second.branchName() <<
"\"\n";
333 ost <<
" isConst: " << ( isNonConst ?
"No" :
"Yes" ) <<
"\n";
341 ost <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
370 if( !
file )
return StatusCode::SUCCESS;
375 for( ; itr !=
end; ++itr ) {
389 for( ; itr !=
end; ++itr ) {
409 ::Error(
"xAOD::TEvent::readFrom",
410 XAOD_MESSAGE(
"Couldn't find metadata tree on input. Object "
412 return StatusCode::FAILURE;
418 ::Error(
"xAOD::TEvent::readFrom",
419 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
421 return StatusCode::FAILURE;
426 ::Info(
"xAOD::TEvent::readFrom",
427 "Was expecting a metadata tree with size 1, instead of %i.",
429 ::Info(
"xAOD::TEvent::readFrom",
430 "File most probably produced by hadd..." );
436 static const std::string eventFormatTypeName =
438 ::TClass*
cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
440 ::Warning(
"xAOD::TEvent::readFrom",
441 "Couldn't load the EventFormat dictionary" );
445 const std::string eventFormatBranchName =
447 if( !
m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
451 ::Info(
"xAOD::TEvent::readFrom",
"Input file provides no event or "
455 return StatusCode::SUCCESS;
461 m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
464 ::Error(
"xAOD::TEvent::readFrom",
465 XAOD_MESSAGE(
"Failed to connect to EventFormat object" ) );
466 return StatusCode::FAILURE;
483 std::set<std::string> lOtherMetaTreeNames = {};
484 TList *lKeys =
file->GetListOfKeys();
487 for (
int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
489 std::string
keyName = lKeys->At(iKey)->GetName();
494 && (
keyName.find(
"MetaData") != std::string::npos)
495 && !(
keyName.find(
"MetaDataHdr") != std::string::npos)){
497 const char *
className = ((::TKey*)lKeys->At(iKey))->GetClassName();
498 static constexpr Bool_t LOAD = kFALSE;
499 static constexpr Bool_t SILENT = kTRUE;
500 ::TClass*
cl = ::TClass::GetClass(
className, LOAD, SILENT);
501 if ((
cl !=
nullptr) &&
cl->InheritsFrom(::TTree::Class())){
503 lOtherMetaTreeNames.insert(
keyName);
510 for (
const std::string & metaTreeName : lOtherMetaTreeNames){
511 TTree *tmpMetaTree =
dynamic_cast< ::TTree*
>(
file->Get( metaTreeName.c_str() ) );
515 ::Warning(
"xAOD::TEvent::readFrom",
"Could not read metadata tree=%s",metaTreeName.c_str());
521 if ( tmpMetaTree->LoadTree(0) < 0 ){
522 ::Error(
"xAOD::TEvent::readFrom",
523 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
524 tmpMetaTree->GetName() );
525 return StatusCode::FAILURE;
529 const std::string tmpEventFormatBranchName =
531 if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
533 ::Warning(
"xAOD::TEvent::readFrom",
"No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
539 tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
540 &tmpFormat, &tmpBr );
542 ::Error(
"xAOD::TEvent::readFrom",
543 XAOD_MESSAGE(
"Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
544 return StatusCode::FAILURE;
547 tmpBr->GetEntry( 0 );
549 for (
const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
571 m_inTree->SetCacheLearnEntries( 10 );
583 const TIncident beginIncident( IncidentType::BeginInputFile );
585 listener->handle( beginIncident );
592 const TIncident endIncident( IncidentType::EndInputFile );
594 listener->handle( endIncident );
598 return StatusCode::SUCCESS;
621 if( useTreeCache && ( !
m_inChain->GetCacheSize() ) ) {
631 ::Error(
"xAOD::TEvent::readFrom",
632 XAOD_MESSAGE(
"Couldn't get the list of files from the "
634 return StatusCode::FAILURE;
636 if( !
files->GetEntries() ) {
637 ::Error(
"xAOD::TEvent::readFrom",
640 return StatusCode::FAILURE;
642 const ::TChainElement* chEl =
643 dynamic_cast< const ::TChainElement*
>(
files->At( 0 ) );
645 ::Error(
"xAOD::TEvent::readFrom",
646 XAOD_MESSAGE(
"Couldn't cast object to TChainElement" ) );
647 return StatusCode::FAILURE;
649 ::TFile* dummyFile = ::TFile::Open( chEl->GetTitle() );
651 ::Error(
"xAOD::TEvent::readFrom",
654 return StatusCode::FAILURE;
669 return StatusCode::SUCCESS;
680 ::TFile*
file =
tree->GetCurrentFile();
699 ::Error(
"xAOD::TEvent::writeTo",
700 XAOD_MESSAGE(
"Null pointer given to the function!" ) );
701 return StatusCode::FAILURE;
706 ::Error(
"xAOD::TEvent::writeTo",
707 XAOD_MESSAGE(
"Object already writing to a file. Close that "
709 return StatusCode::FAILURE;
727 return StatusCode::SUCCESS;
740 ::Error(
"xAOD::TEvent::finishWritingTo",
741 XAOD_MESSAGE(
"The object doesn't seem to be connected to an "
743 return StatusCode::FAILURE;
751 const TIncident incident( IncidentType::MetaDataStop );
754 for( ; l_itr != l_end; ++l_itr ) {
755 ( *l_itr )->handle( incident );
770 return StatusCode::SUCCESS;
776 metatree->SetAutoSave( 10000 );
777 metatree->SetAutoFlush( -30000000 );
778 metatree->SetDirectory(
file );
781 metatree->Branch(
"EventFormat",
792 for(
auto&
object : outputMetaObjects ) {
797 ::Error(
"xAOD::TEvent::finishWritingTo",
799 return StatusCode::FAILURE;
803 const ::Int_t splitLevel = (
object.first.find(
"Aux." ) ==
804 (
object.first.size() - 4 ) ? 1 : 0 );
806 *(
mgr->branchPtr() ) =
807 metatree->Branch(
object.first.c_str(),
808 mgr->holder()->getClass()->GetName(),
809 mgr->holder()->getPtr(), 32000, splitLevel );
810 if( !
mgr->branch() ) {
811 ::Error(
"xAOD::TEvent::finishWritingTo",
814 mgr->holder()->getClass()->GetName(),
815 object.first.c_str() );
816 return StatusCode::FAILURE;
826 if( metatree->Fill() <= 0 ) {
827 ::Error(
"xAOD::TEvent::finishWritingTo",
828 XAOD_MESSAGE(
"Failed to write event format metadata into "
830 metatree->SetDirectory( 0 );
832 return StatusCode::FAILURE;
837 metatree->SetDirectory( 0 );
842 for( ; obj_itr != obj_end; ++obj_itr ) {
843 delete obj_itr->second;
848 for( ; obj_itr != obj_end; ++obj_itr ) {
849 delete obj_itr->second;
854 return StatusCode::SUCCESS;
869 #ifndef XAOD_STANDALONE
871 #endif // not XAOD_STANDALONE
894 while( std::getline(
ss, attr,
'.' ) ) {
916 ::Error(
"xAOD::TEvent::addListener",
917 XAOD_MESSAGE(
"Received a null pointer for the listener" ) );
918 return StatusCode::FAILURE;
922 bool listenerKnown =
false;
924 if(
l == listener ) {
925 ::Warning(
"xAOD::TEvent::addListener",
926 "Listener %p was added previously already",
927 static_cast< void*
>( listener ) );
928 listenerKnown =
true;
934 if( ! listenerKnown ) {
939 return StatusCode::SUCCESS;
956 ::Error(
"xAOD::TEvent::removeListener",
958 static_cast< void*
>( listener ) );
959 return StatusCode::FAILURE;
966 return StatusCode::SUCCESS;
998 ::Error(
"xAOD::TEvent::addNameRemap",
999 XAOD_MESSAGE(
"Can't use \"%s\" as the target name in the"
1000 "\"%s\" -> \"%s\" remapping" ),
1002 return StatusCode::FAILURE;
1008 ::Warning(
"xAOD::TEvent::addNameRemap",
1009 "Overriding existing name remapping \"%s\" -> \"%s\"",
1010 itr->second.c_str(), itr->first.c_str() );
1011 ::Warning(
"xAOD::TEvent::addNameRemap",
" with: \"%s\" -> \"%s\"",
1012 onfile.c_str(),
newName.c_str() );
1019 return StatusCode::SUCCESS;
1038 ::Info(
"xAOD::TEvent::printNameRemap",
"Name remapping rules:" );
1042 ::Info(
"xAOD::TEvent::printNameRemap",
" NONE" );
1049 ::Info(
"xAOD::TEvent::printNameRemap",
" \"%s\" -> \"%s\"",
1050 itr->second.c_str(), itr->first.c_str() );
1070 ::Int_t basketSize, ::Int_t splitLevel ) {
1074 ::Error(
"xAOD::TEvent::recordAux",
1075 XAOD_MESSAGE(
"No output tree given to the object" ) );
1093 ::Error(
"xAOD::TEvent::recordAux",
1095 static_cast< int >(
type ) );
1100 basketSize, splitLevel );
1101 if(
record(
store,
key, basketSize, splitLevel, kTRUE ).isFailure() ) {
1102 ::Error(
"xAOD::TEvent::recordAux",
1103 XAOD_MESSAGE(
"Couldn't connect TAuxStore object to the "
1114 ::Error(
"xAOD::TEvent::recordAux",
1122 ::Error(
"xAOD::TEvent::recordAux",
1123 XAOD_MESSAGE(
"Object of non-TAuxStore type registered "
1124 "with key \"%s\"" ),
key.c_str() );
1146 ::Int_t basketSize, ::Int_t splitLevel ) {
1149 std::string keyToUse =
key;
1154 keyToUse = remap_itr->second;
1161 Object_t::const_iterator vobjMgr =
m_inputObjects.find( keyToUse );
1163 ::Error(
"xAOD::TEvent::copy",
1165 return StatusCode::FAILURE;
1170 ::Error(
"xAOD::TEvent::copy",
1172 return StatusCode::FAILURE;
1176 ::Error(
"xAOD::TEvent::copy",
1178 return StatusCode::FAILURE;
1185 key, basketSize, splitLevel, kTRUE ) );
1188 const std::set< std::string >*
filter = 0;
1191 filter = &( fitr->second );
1195 Object_t::const_iterator vauxMgr =
m_inputObjects.find( keyToUse +
1200 return StatusCode::SUCCESS;
1207 ::Error(
"xAOD::TEvent::copy",
1209 return StatusCode::FAILURE;
1214 key +
"Aux.", basketSize, splitLevel, kTRUE ) );
1219 ::Error(
"xAOD::TEvent::copy",
1221 return StatusCode::FAILURE;
1229 key +
"Aux.", basketSize, splitLevel ) );
1231 ::Fatal(
"xAOD::TEvent::copy",
1236 return StatusCode::SUCCESS;
1252 ::Error(
"xAOD::TEvent::copy",
1254 return StatusCode::FAILURE;
1260 for( ; itr !=
end; ++itr ) {
1279 ::TClass*
cl = ::TClass::GetClass( efe.
className().c_str() );
1280 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
1290 return StatusCode::SUCCESS;
1305 ::Error(
"xAOD::TEvent::getEntries",
1330 ::Error(
"xAOD::TEvent::getEntry",
1340 if( fileEntry < 0 ) {
1341 ::Error(
"xAOD::TEvent::getEntry",
1344 static_cast< int >(
entry ) );
1359 ::Error(
"xAOD::TEvent::getEntry",
1382 ::Error(
"xAOD::TEvent::getEntry",
1383 XAOD_MESSAGE(
"Failure in loading entry %i from the input "
1384 "file" ),
static_cast< int >(
m_entry ) );
1395 const TIncident incident( IncidentType::BeginEvent );
1398 for( ; l_itr != l_end; ++l_itr ) {
1399 ( *l_itr )->handle( incident );
1413 static const std::string dynStorePostfix =
"Aux.Dynamic";
1414 if( inObj.first.find( dynStorePostfix ) ==
1415 ( inObj.first.size() - dynStorePostfix.size() ) ) {
1429 result += inObj.second->getEntry( getall );
1434 const TIncident incident( IncidentType::BeginEvent );
1437 for( ; l_itr != l_end; ++l_itr ) {
1438 ( *l_itr )->handle( incident );
1457 return m_inChain->GetListOfFiles()->GetEntries();
1478 ::Error(
"xAOD::TEvent::getFile",
1479 XAOD_MESSAGE(
"Function called with invalid file number "
1480 "(%i)" ),
static_cast< int >(
file ) );
1495 ::Long64_t
entry = 0;
1496 for( ::Long64_t
i = 0;
i <
file; ++
i ) {
1514 ::Error(
"xAOD::TEvent::fill",
1515 XAOD_MESSAGE(
"Object not connected to an output file!" ) );
1525 ::Error(
"xAOD::TEvent::fill",
1531 ::Error(
"xAOD::TEvent::fill",
1541 std::string unsetObjects;
1543 for(
auto& itr : outputObjectsCopy ) {
1545 if( ! itr.second->create() ) {
1548 if( unsetObjects.size() ) {
1549 unsetObjects.append(
", \"" + itr.first +
"\"" );
1551 unsetObjects.append(
"\"" + itr.first +
"\"" );
1559 ::Error(
"xAOD::TEvent::fill",
1560 XAOD_MESSAGE(
"Failed to put dynamic auxiliary variables "
1561 "in the output for object \"%s\"" ),
1562 itr.first.c_str() );
1568 if( unsetObjects.size() ) {
1569 ::Error(
"xAOD::TEvent::fill",
1570 XAOD_MESSAGE(
"The following objects were not set in the "
1571 "current event: %s" ), unsetObjects.c_str() );
1578 ::Error(
"xAOD::TEvent::fill",
1579 XAOD_MESSAGE(
"Output tree filling failed with return "
1580 "value: %i" ), ret );
1586 for( ; ncitr != ncend; ++ncitr ) {
1587 ncitr->second->reset();
1613 ::Warning(
"xAOD::TEvent::inputEventFormat",
1614 "No input file is connected at the moment" );
1636 ::Warning(
"xAOD::TEvent::outputEventFormat",
1637 "No output file is connected at the moment" );
1654 if(
key ==
"" )
return 0;
1691 for( ; obj_itr != obj_end; ++obj_itr ) {
1694 if( obj_itr->second->object() !=
obj )
continue;
1697 return obj_itr->first;
1703 for( ; obj_itr != obj_end; ++obj_itr ) {
1706 if( obj_itr->second->object() !=
obj )
continue;
1709 return obj_itr->first;
1720 ::Warning(
"xAOD::TEvent::getName",
1721 "Didn't find object with pointer %p in the event",
1723 static const std::string
dummy;
1728 std::vector<std::string>& vkeys,
1731 std::set<std::string>
keys;
1735 std::vector<TObjArray*> fullListOfBranches = {};
1740 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1741 fullListOfBranches.push_back(
m_inMetaTree->GetListOfBranches());
1746 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1748 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
1753 TList *fList =
m_inTree->GetListOfFriends();
1755 for (TObject * feObj : *fList){
1758 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
1760 fullListOfBranches.push_back(friendTree->GetListOfBranches());
1768 for (
const TObjArray * in : fullListOfBranches){
1771 const TObject *
obj = in->At(
index);
1772 if ( !
obj )
continue;
1773 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1775 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1778 std::string objClassName = element->GetClassName();
1779 std::string
key =
obj->GetName();
1780 ::Info(
"xAOD::TEvent::getNames",
1781 "Inspecting %s / %s",
1782 objClassName.c_str(),
key.c_str());
1783 if (objClassName == targetClassName) {
1784 ::Info(
"xAOD::TEvent::getNames",
1785 "Matched %s to key %s",
1786 targetClassName.c_str(),
key.c_str());
1795 ::Info(
"xAOD::TEvent::getNames",
1796 "scanning input Aux objects for %s", targetClassName.c_str());
1797 for(
const auto&
object : inAux ) {
1801 if ( !
mgr )
continue;
1802 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1803 const std::string&
key =
object.first;
1804 ::Info(
"xAOD::TEvent::getNames",
1805 "Inspecting %s / %s",
1806 objClassName.c_str(),
key.c_str());
1807 if (objClassName == targetClassName) {
1808 ::Info(
"xAOD::TEvent::getNames",
1809 "Matched %s to key %s",
1810 targetClassName.c_str(),
key.c_str());
1819 const TObjArray *
out =
tree->GetListOfBranches();
1820 ::Info(
"xAOD::TEvent::getNames",
"scanning output objects");
1824 if ( !
obj )
continue;
1825 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1827 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1830 std::string objClassName = element->GetClassName();
1831 std::string
key =
obj->GetName();
1832 ::Info(
"xAOD::TEvent::getNames",
1833 "Inspecting %s / %s",
1834 objClassName.c_str(),
key.c_str());
1835 if (objClassName == targetClassName) {
1836 ::Info(
"xAOD::TEvent::getNames",
1837 "Matched %s to key %s",
1838 targetClassName.c_str(),
key.c_str());
1843 ::Info(
"xAOD::TEvent::getNames",
"no output tree connected");
1852 ::Info(
"xAOD::TEvent::getNames",
1853 "scanning output Aux objects for %s", targetClassName.c_str());
1854 for(
const auto&
object : outAux ) {
1858 if ( !
mgr )
continue;
1859 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1860 const std::string&
key =
object.first;
1861 ::Info(
"xAOD::TEvent::getNames",
1862 "Inspecting %s / %s",
1863 objClassName.c_str(),
key.c_str());
1864 if (objClassName == targetClassName) {
1865 ::Info(
"xAOD::TEvent::getNames",
1866 "Matched %s to key %s",
1867 targetClassName.c_str(),
key.c_str());
1872 vkeys.insert(vkeys.end(),
keys.begin(),
keys.end());
1902 static const std::string
dummy;
1917 const std::type_info& ti ) {
1921 if( !
name.length() ) {
1941 const std::type_info& ti,
1947 Warning(
"xAOD::TEvent::getInputObject",
1948 "Key 0x%08x unknown",
key );
1967 return StatusCode::SUCCESS;
1972 ::Error(
"xAOD::TEvent::initStats",
1975 return StatusCode::FAILURE;
1984 for( ; itr !=
end; ++itr ) {
1987 const std::string& branchName = itr->second.branchName();
1990 if( branchName.find(
"Aux." ) != std::string::npos ) {
1999 const std::string intName =
2000 branchName.substr( 0, branchName.size() - 4 );
2008 ::Bool_t auxFound = kFALSE;
2011 std::vector<TObjArray*> fullListOfBranches = {};
2013 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
2018 TList *fList =
m_inTree->GetListOfFriends();
2020 for (TObject * feObj : *fList){
2023 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
2025 fullListOfBranches.push_back(friendTree->GetListOfBranches());
2030 for (TObjArray*
branches : fullListOfBranches){
2031 for( Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i ){
2035 if(
name.BeginsWith( branchName ) ||
2036 name.BeginsWith( dynName ) ) {
2043 ::Warning(
"xAOD::TEvent::initStats",
2044 "Couldn't find interface object/container "
2045 "\"%s\" belonging to branch \"%s\"",
2046 intName.c_str(), branchName.c_str() );
2053 ::TClass*
cl = ::TClass::GetClass(
el->className().c_str() );
2054 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
2055 ::Warning(
"xAOD::TEvent::initStats",
2056 "Couldn't find dictionary for type \"%s\"",
2057 el->className().c_str() );
2063 static const std::string baseName =
2065 static ::TClass*
const baseCl = ::TClass::GetClass( baseName.c_str() );
2067 ::Error(
"xAOD::TEvent::initStats",
2069 "\"%s\"" ), baseName.c_str() );
2070 return StatusCode::FAILURE;
2080 static constexpr
bool TOP_STORE =
true;
2082 static constexpr
bool PRINT_WARNINGS =
false;
2091 stats.branch(branchName,
id);
2100 const ::TBranch* container =
2101 m_inTree->GetBranch( branchName.c_str() );
2110 return StatusCode::SUCCESS;
2126 const std::type_info& ti,
2134 Object_t::const_iterator itr =
objects.find(
key );
2156 if( ! itr->second->isSet() ) {
2164 ::Error(
"xAOD::TEvent::getOutputObject",
2165 XAOD_MESSAGE(
"Object of wrong type found for key \"%s\"" ),
2171 void*
result =
mgr->holder()->getAs( ti );
2173 ::Warning(
"xAOD::TEvent::getOutputObject",
2174 "Couldn't retrieve object as \"%s\"",
2196 const std::type_info& ti,
2201 std::string keyToUse =
key;
2206 keyToUse = remap_itr->second;
2212 if(
store &&
store->contains( keyToUse, ti ) &&
2213 store->isConst( keyToUse, ti ) ) {
2214 const void*
result =
store->getConstObject( keyToUse, ti );
2245 ::Fatal(
"xAOD::TEvent::getInputObject",
2246 XAOD_MESSAGE(
"There is an internal logic error in the "
2255 if(
key == keyToUse ) {
2256 ::Error(
"xAOD::TEvent::getInputObject",
2261 ::Error(
"xAOD::TEvent::getInputObject",
2263 "\"%s\"/\"%s\"" ),
key.c_str(),
2271 if(
mgr->getEntry() ) {
2276 ::Error(
"xAOD::TEvent::getInputObject",
2279 mgr->holder()->getClass()->GetName(),
2290 ::Warning(
"xAOD::TEvent::getInputObject",
2291 "Could not retrieve object with key \"%s\" "
2292 "as \"%s\"", keyToUse.c_str(),
2321 const std::string&
key,
2322 ::Int_t basketSize, ::Int_t splitLevel,
2323 ::Bool_t overwrite, ::Bool_t
metadata,
2324 ::Bool_t isOwner ) {
2328 ::Error(
"xAOD::TEvent::record",
2329 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2330 "call writeTo(...)?" ) );
2331 return StatusCode::FAILURE;
2339 if( ( ! overwrite ) &&
2342 ::Error(
"xAOD::TEvent::record",
2345 return StatusCode::FAILURE;
2348 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2350 ::Error(
"xAOD::TEvent::record",
2353 return StatusCode::FAILURE;
2361 return StatusCode::SUCCESS;
2366 if( ( ! overwrite ) &&
2368 ::Error(
"xAOD::TEvent::record",
2369 XAOD_MESSAGE(
"Object %s/%s already accessed from the input, "
2370 "can't be overwritten in memory" ),
2372 return StatusCode::FAILURE;
2377 if( ( splitLevel == 0 ) &&
2378 (
key.find(
"Aux." ) == (
key.size() - 4 ) ) ) {
2387 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2389 ::Error(
"xAOD::TEvent::record",
2392 return StatusCode::FAILURE;
2408 *(
mgr->branchPtr() ) =
2410 hldr->
getPtr(), basketSize, splitLevel );
2411 if( !
mgr->branch() ) {
2412 ::Error(
"xAOD::TEvent::record",
2415 key.c_str(),
cl->GetName() );
2419 return StatusCode::FAILURE;
2430 return StatusCode::SUCCESS;
2436 ::Error(
"xAOD::TEvent::record",
2439 return StatusCode::FAILURE;
2448 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2449 if( ( !
cl ) || ::strcmp(
cl->GetName(),
2451 ::Error(
"xAOD::TEvent::record",
2452 XAOD_MESSAGE(
"For output key \"%s\" the previous type "
2453 "was \"%s\", the newly requested type is "
2457 return StatusCode::FAILURE;
2485 ::Bool_t ownsStore ) {
2489 ::Error(
"xAOD::TEvent::record",
2490 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2491 "call writeTo(...)?" ) );
2492 return StatusCode::FAILURE;
2496 const std::set< std::string >*
filter = 0;
2499 filter = &( filter_itr->second );
2517 return StatusCode::SUCCESS;
2521 if( vitr->second->object() ==
store ) {
2523 return StatusCode::SUCCESS;
2533 ::Error(
"xAOD::TEvent::record",
2534 XAOD_MESSAGE(
"Output object with key %s already exists, "
2535 "and is not of type TAuxStore" ),
2537 return StatusCode::FAILURE;
2552 return StatusCode::SUCCESS;
2578 ::Error(
"xAOD::TEvent::connectBranch",
2579 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2580 return StatusCode::FAILURE;
2588 return StatusCode::SUCCESS;
2593 ::Warning(
"xAOD::TEvent::connectBranch",
2594 "Branch \"%s\" not available on input",
2597 return StatusCode::RECOVERABLE;
2604 ::Warning(
"xAOD::TEvent::connectBranch",
2605 "No metadata available for branch: %s",
2617 ::Warning(
"xAOD::TEvent::connectBranch",
2618 "Branch \"%s\" not available on input",
2622 return StatusCode::RECOVERABLE;
2626 br->SetMakeClass( 0 );
2637 ::Error(
"xAOD::TEvent::connectBranch",
2638 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2639 "dictionary for branch \"%s\"" ),
2641 return StatusCode::FAILURE;
2644 ::TClass* realClass = ::TClass::GetClass(
className.c_str() );
2645 if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) &&
ef ) {
2650 realClass = ::TClass::GetClass(
className.c_str() );
2652 if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2654 ::Error(
"xAOD::TEvent::connectBranch",
2655 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2656 "dictionary for branch \"%s\"" ),
2658 return StatusCode::FAILURE;
2665 static const ::EDataType
dataType = kOther_t;
2678 ::Error(
"xAOD::TEvent::connectBranch",
2679 XAOD_MESSAGE(
"Couldn't access output manager for: %s" ),
2681 return StatusCode::FAILURE;
2684 ptr =
mgr->holder()->get();
2691 ptr = realClass->New();
2706 ::Error(
"xAOD::TEvent::connectBranch",
2708 "This can only be read in kAthenaAccess mode." ),
2709 key.c_str(),
br->GetSplitLevel() );
2714 return StatusCode::FAILURE;
2724 ::Error(
"xAOD::TEvent::connectBranch",
2725 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2726 "input branch \"%s\". Return code: %i" ),
2732 return StatusCode::FAILURE;
2762 ::Error(
"xAOD::TEvent::connectMetaBranch",
2763 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2764 return StatusCode::FAILURE;
2769 return StatusCode::SUCCESS;
2776 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2777 "Branch \"%s\" not available on input",
2780 return StatusCode::RECOVERABLE;
2784 if( !
br->GetEntries() ) {
2786 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2787 "Branch \"%s\" doesn't hold any data",
2790 return StatusCode::RECOVERABLE;
2794 br->SetMakeClass( 0 );
2798 ::EDataType
dt = kOther_t;
2799 if(
br->GetExpectedType(
cl,
dt ) || ( !
cl ) ) {
2800 ::Error(
"xAOD::TEvent::connectMetaBranch",
2802 "branch %s" ),
key.c_str() );
2803 return StatusCode::FAILURE;
2807 void*
ptr =
cl->New();
2820 ::Error(
"xAOD::TEvent::connectMetaBranch",
2821 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2822 "input branch \"%s\". Return code: %i" ),
2828 return StatusCode::FAILURE;
2832 if(
mgr->getEntry() < 0 ) {
2833 ::Error(
"xAOD::TEvent::connectMetaBranch",
2834 XAOD_MESSAGE(
"Couldn't read in metadata object with key "
2835 "\"%s\"" ),
key.c_str() );
2836 return StatusCode::FAILURE;
2858 return StatusCode::SUCCESS;
2876 ::Error(
"xAOD::TEvent::connectAux",
2878 return StatusCode::FAILURE;
2886 return StatusCode::SUCCESS;
2891 return StatusCode::SUCCESS;
2904 ::Fatal(
"xAOD::TEvent::connectAux",
2910 ::Fatal(
"xAOD::TEvent::connectAux",
2912 return StatusCode::FAILURE;
2916 static const TClass*
const holderClass =
2918 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
2920 return StatusCode::SUCCESS;
2927 if( ! storeHolder ) {
2928 ::Fatal(
"xAOD::TEvent::connectAux",
2939 ::Error(
"xAOD::TEvent::connectAux",
2941 "for: %s" ),
prefix.c_str() );
2942 ::Error(
"xAOD::TEvent::connectAux",
2943 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
2946 return StatusCode::FAILURE;
2950 return StatusCode::SUCCESS;
2971 return StatusCode::SUCCESS;
2975 ::Error(
"xAOD::TEvent::connectAux",
2976 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
2978 return StatusCode::FAILURE;
2995 return StatusCode::SUCCESS;
3000 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3002 return StatusCode::FAILURE;
3016 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3022 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3024 return StatusCode::FAILURE;
3028 static const TClass*
const holderClass =
3030 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
3032 return StatusCode::SUCCESS;
3039 if( ! storeHolder ) {
3040 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3051 ::Error(
"xAOD::TEvent::connectMetaAux",
3052 XAOD_MESSAGE(
"Requested store types inconsistent" ) );
3053 ::Error(
"xAOD::TEvent::connectMetaAux",
3054 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
3057 return StatusCode::FAILURE;
3061 return StatusCode::SUCCESS;
3082 store->getEntry( 0 );
3085 return StatusCode::SUCCESS;
3089 ::Error(
"xAOD::TEvent::connectMetaAux",
3090 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
3092 return StatusCode::FAILURE;
3106 ::TMethodCall setNameCall;
3110 setNameCall.InitWithPrototype(
mgr.holder()->getClass(),
3111 "setName",
"const char*" );
3112 if( setNameCall.IsValid() ) {
3117 const char* charParams =
params.Data();
3118 setNameCall.Execute(
mgr.holder()->get(), charParams );
3121 ::Warning(
"xAOD::TEvent::setUpDynamicStore",
3122 "Couldn't find setName(...) function for container %s "
3124 mgr.branch()->GetName(),
3125 mgr.holder()->getClass()->GetName() );
3130 static const TClass*
const holderClass =
3132 if( !
mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3134 return StatusCode::SUCCESS;
3141 if( ! storeHolder ) {
3142 ::Fatal(
"xAOD::TEvent::setUpDynamicStore",
3144 return StatusCode::FAILURE;
3168 store->getEntry( 0 );
3174 return StatusCode::SUCCESS;
3192 return StatusCode::SUCCESS;
3196 const std::string
key =
mgr.branch()->GetName();
3214 return StatusCode::SUCCESS;
3216 auxMgr = itr->second;
3217 auxKey =
key +
"Aux.";
3222 ::Int_t readBytes = auxMgr->
getEntry();
3226 const std::string dynAuxKey = auxKey +
"Dynamic";
3227 auto dynAuxMgr =
objects.find( dynAuxKey );
3229 if( ( dynAuxMgr !=
objects.end() ) &&
3231 ( auxMgr == &
mgr ) ) ) {
3236 dynAuxMgr->second->getEntry();
3250 auto dynAuxMgr =
objects.find( dynAuxKey );
3251 if( dynAuxMgr ==
objects.end() ) {
3252 ::Error(
"xAOD::TEvent::setAuxStore",
3254 return StatusCode::FAILURE;
3256 dynAuxMgr->second->getEntry();
3262 if( auxMgr == &
mgr ) {
3263 return StatusCode::SUCCESS;
3269 switch(
mgr.holder()->typeKind() ) {
3288 if(
vec && ( !
vec->trackIndices() ) ) {
3289 forceTrackIndices( *
vec );
3293 if( ( !
vec ) && ( ! aux ) ) {
3294 ::Fatal(
"xAOD::TEvent::setAuxStore",
3296 "SG::AuxVectorBase or SG::AuxElement" ),
3297 mgr.holder()->getClass()->GetName() );
3306 ::Fatal(
"xAOD::TEvent::setAuxStore",
3307 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3308 "right type" ), auxKey.c_str() );
3309 return StatusCode::FAILURE;
3324 ::Fatal(
"xAOD::TEvent::setAuxStore",
3325 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3326 "right type" ), auxKey.c_str() );
3327 return StatusCode::FAILURE;
3333 ::Fatal(
"xAOD::TEvent::setAuxStore",
3343 ::Fatal(
"xAOD::TEvent::setAuxStore",
3348 return StatusCode::SUCCESS;
3365 ::Int_t basketSize, ::Int_t splitLevel,
3375 return StatusCode::SUCCESS;
3379 if( !
mgr->holder()->getClass()->InheritsFrom(
"SG::IAuxStoreIO" ) ) {
3380 return StatusCode::SUCCESS;
3388 ::Fatal(
"xAOD::TEvent::putAux",
3389 XAOD_MESSAGE(
"There is a logic error in the code!" ) );
3398 sel.selectAux( item_itr->second );
3408 if( auxids.
empty() ) {
3409 return StatusCode::SUCCESS;
3413 const std::string dynNamePrefix =
3422 typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
3423 std::vector< AuxVarSort_t > varsort;
3424 varsort.reserve( auxids.
size() );
3426 varsort.emplace_back(
r.getName(
id ),
id );
3428 std::sort( varsort.begin(), varsort.end() );
3431 for(
const auto&
p : varsort ) {
3437 const std::string
brName = dynNamePrefix +
p.first;
3446 const std::type_info* brType = aux->
getIOType(
id );
3448 ::Error(
"xAOD::TEvent::putAux",
3451 return StatusCode::FAILURE;
3453 const std::string brTypeName =
3455 std::string brProperTypeName =
"<unknown>";
3461 if( strlen( brType->name() ) == 1 ) {
3464 brProperTypeName = brTypeName;
3469 ::Error(
"xAOD::TEvent::putAux",
3472 brName.c_str(), brTypeName.c_str() );
3473 return StatusCode::FAILURE;
3477 std::ostringstream leaflist;
3489 outTree.Branch(
brName.c_str(), hldr->
get(),
3490 leaflist.str().c_str(),
3492 if( ! auxmgr->
branch() ) {
3493 ::Error(
"xAOD::TEvent::putAux",
3496 brName.c_str(), brProperTypeName.c_str() );
3501 return StatusCode::FAILURE;
3508 TClass*
cl = TClass::GetClass( *brType, kTRUE, kTRUE );
3512 cl = TClass::GetClass( brTypeName.c_str() );
3515 ::Error(
"xAOD::TEvent::putAux",
3517 "variable \"%s\" of type \"%s\"" ),
3518 brName.c_str(), brTypeName.c_str() );
3519 return StatusCode::FAILURE;
3524 brProperTypeName =
cl->GetName();
3533 if (!
cl->CanSplit() && strncmp (
cl->GetName(),
"SG::PackedContainer<", 20) == 0)
3538 outTree.Branch(
brName.c_str(),
3540 hldr->
getPtr(), basketSize, splitLevel );
3541 if( ! auxmgr->
branch() ) {
3542 ::Error(
"xAOD::TEvent::putAux",
3545 brName.c_str(), brProperTypeName.c_str() );
3550 return StatusCode::FAILURE;
3558 if( outTree.GetEntries() ) {
3559 void*
ptr =
br->GetAddress();
3560 br->SetAddress( 0 );
3561 for( ::Long64_t
i = 0;
i < outTree.GetEntries(); ++
i ) {
3564 br->SetAddress(
ptr );
3573 mgr->branch()->GetName(),
3584 ::Fatal(
"xAOD::TEvent::putAux",
3585 XAOD_MESSAGE(
"There is an internal logic error in the "
3591 const_cast< void*
>(
static_cast< const void*
>( aux->
getIOData(
id ) ) );
3592 bmgr->second->setObject( nc_data );
3596 return StatusCode::SUCCESS;
3611 static const TClass*
const dvClass =
3613 static const TClass*
const aeClass =
3617 return (
mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3618 mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3631 static const TClass*
const storeClass =
3633 static const TClass*
const storeHolderClass =
3637 return (
mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3638 mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3655 static const TClass*
const dvClass =
3657 static const TClass*
const aeClass =
3661 if(
mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3663 }
else if(
mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3668 ::Error(
"xAOD::TEvent::isStandalone",
3670 "auxiliary store" ),
3671 mgr.holder()->getClass()->GetName() );
3686 const std::type_info& ti,
3705 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.
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.
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 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.
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.