|
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
69 void removeVersionNames( std::string&
name ) {
72 while( (
pos =
name.find(
"_v1" ) ) !=
name.npos ) {
75 while( (
pos =
name.find(
"_v2" ) ) !=
name.npos ) {
78 while( (
pos =
name.find(
"_v3" ) ) !=
name.npos ) {
81 while( (
pos =
name.find(
"_v4" ) ) !=
name.npos ) {
84 while( (
pos =
name.find(
"_v5" ) ) !=
name.npos ) {
87 while( (
pos =
name.find(
"_v6" ) ) !=
name.npos ) {
90 while( (
pos =
name.find(
"_v7" ) ) !=
name.npos ) {
93 while( (
pos =
name.find(
"_v8" ) ) !=
name.npos ) {
110 ForceTrackIndices& xvec =
static_cast< ForceTrackIndices&
>(
vec );
134 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
135 m_inChain( nullptr ), m_inChainTracker( nullptr ),
136 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
137 m_entry( -1 ), m_outTree( nullptr ),
138 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
139 m_inputMetaObjects(), m_outputMetaObjects(),
140 m_inputEventFormat(), m_outputEventFormat( nullptr ),
141 m_auxItemList(), m_listeners(), m_nameRemapping() {
152 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
153 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
154 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
155 ::Info(
"xAOD::TEvent::TEvent",
156 "Using access mode \"%i\" for the unit test",
157 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
167 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
168 m_inChain( nullptr ), m_inChainTracker( nullptr ),
169 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
170 m_entry( -1 ), m_outTree( nullptr ),
171 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
172 m_inputMetaObjects(), m_outputMetaObjects(),
173 m_inputEventFormat(), m_outputEventFormat( nullptr ),
174 m_auxItemList(), m_listeners(), m_nameRemapping() {
185 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
186 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
187 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
188 ::Info(
"xAOD::TEvent::TEvent",
189 "Using access mode \"%i\" for the unit test",
190 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
203 m_inTree( nullptr ), m_inTreeMissing( kFALSE ),
204 m_inChain( nullptr ), m_inChainTracker( nullptr ),
205 m_inTreeNumber( -1 ), m_inMetaTree( nullptr ),
206 m_entry( -1 ), m_outTree( nullptr ),
207 m_inputObjects(), m_inputMissingObjects(), m_outputObjects(),
208 m_inputMetaObjects(), m_outputMetaObjects(),
209 m_inputEventFormat(), m_outputEventFormat( nullptr ),
210 m_auxItemList(), m_listeners(), m_nameRemapping() {
221 if( gSystem->Getenv(
"ROOTCORE_AUTO_UT" ) ||
222 gSystem->Getenv(
"ROOTCORE_FAST_UT" ) ||
223 gSystem->Getenv(
"ROOTCORE_SLOW_UT" ) ) {
224 ::Info(
"xAOD::TEvent::TEvent",
225 "Using access mode \"%i\" for the unit test",
226 static_cast< int >( UNIT_TEST_ACCESS_MODE ) );
241 for( ; itr !=
end; ++itr ) {
246 for( ; itr !=
end; ++itr ) {
251 for( ; itr !=
end; ++itr ) {
256 for( ; itr !=
end; ++itr ) {
270 #ifndef XAOD_STANDALONE
274 #endif // not XAOD_STANDALONE
296 std::ostringstream
ost;
297 ost <<
"<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
302 for( ; ef_itr != ef_end; ++ef_itr ) {
305 std::string
typeName = ef_itr->second.className();
310 ::TClass::GetClass( ef_itr->second.className().c_str() );
311 const std::type_info* ti = (
cl ?
cl->GetTypeInfo() : nullptr );
312 if( ( !
cl ) || ( !
cl->IsLoaded() ) || ( ! ti ) ) {
313 Warning(
"xAOD::TEvent::dump",
314 "Unknown type (%s) found in the event format",
315 ef_itr->second.className().c_str() );
320 if( !
contains( ef_itr->second.branchName(), *ti ) ) {
325 ost <<
" Hash: 0x" << std::setw( 8 ) << std::setfill(
'0' )
326 << std::hex << ef_itr->second.hash()
327 <<
" Key: \"" << ef_itr->second.branchName() <<
"\"\n";
332 ost <<
" isConst: " << ( isNonConst ?
"No" :
"Yes" ) <<
"\n";
340 ost <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
369 if( !
file )
return StatusCode::SUCCESS;
374 for( ; itr !=
end; ++itr ) {
388 for( ; itr !=
end; ++itr ) {
408 ::Error(
"xAOD::TEvent::readFrom",
409 XAOD_MESSAGE(
"Couldn't find metadata tree on input. Object "
411 return StatusCode::FAILURE;
417 ::Error(
"xAOD::TEvent::readFrom",
418 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
420 return StatusCode::FAILURE;
425 ::Info(
"xAOD::TEvent::readFrom",
426 "Was expecting a metadata tree with size 1, instead of %i.",
428 ::Info(
"xAOD::TEvent::readFrom",
429 "File most probably produced by hadd..." );
435 static const std::string eventFormatTypeName =
437 ::TClass*
cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
439 ::Warning(
"xAOD::TEvent::readFrom",
440 "Couldn't load the EventFormat dictionary" );
444 const std::string eventFormatBranchName =
446 if( !
m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
450 ::Info(
"xAOD::TEvent::readFrom",
"Input file provides no event or "
454 return StatusCode::SUCCESS;
460 m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
463 ::Error(
"xAOD::TEvent::readFrom",
464 XAOD_MESSAGE(
"Failed to connect to EventFormat object" ) );
465 return StatusCode::FAILURE;
482 std::set<std::string> lOtherMetaTreeNames = {};
483 TList *lKeys =
file->GetListOfKeys();
486 for (
int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
488 std::string
keyName = lKeys->At(iKey)->GetName();
493 && (
keyName.find(
"MetaData") != std::string::npos)
494 && !(
keyName.find(
"MetaDataHdr") != std::string::npos)){
496 const char *
className = ((::TKey*)lKeys->At(iKey))->GetClassName();
497 static constexpr Bool_t LOAD = kFALSE;
498 static constexpr Bool_t SILENT = kTRUE;
499 ::TClass*
cl = ::TClass::GetClass(
className, LOAD, SILENT);
500 if ((
cl !=
nullptr) &&
cl->InheritsFrom(::TTree::Class())){
502 lOtherMetaTreeNames.insert(
keyName);
509 for (
const std::string & metaTreeName : lOtherMetaTreeNames){
510 TTree *tmpMetaTree =
dynamic_cast< ::TTree*
>(
file->Get( metaTreeName.c_str() ) );
514 ::Warning(
"xAOD::TEvent::readFrom",
"Could not read metadata tree=%s",metaTreeName.c_str());
520 if ( tmpMetaTree->LoadTree(0) < 0 ){
521 ::Error(
"xAOD::TEvent::readFrom",
522 XAOD_MESSAGE(
"Failed to load entry for metadata tree=%s" ),
523 tmpMetaTree->GetName() );
524 return StatusCode::FAILURE;
528 const std::string tmpEventFormatBranchName =
530 if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
532 ::Warning(
"xAOD::TEvent::readFrom",
"No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
538 tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
539 &tmpFormat, &tmpBr );
541 ::Error(
"xAOD::TEvent::readFrom",
542 XAOD_MESSAGE(
"Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
543 return StatusCode::FAILURE;
546 tmpBr->GetEntry( 0 );
548 for (
const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
570 m_inTree->SetCacheLearnEntries( 10 );
582 const TIncident beginIncident( IncidentType::BeginInputFile );
584 listener->handle( beginIncident );
591 const TIncident endIncident( IncidentType::EndInputFile );
593 listener->handle( endIncident );
597 return StatusCode::SUCCESS;
620 if( useTreeCache && ( !
m_inChain->GetCacheSize() ) ) {
630 ::Error(
"xAOD::TEvent::readFrom",
631 XAOD_MESSAGE(
"Couldn't get the list of files from the "
633 return StatusCode::FAILURE;
635 if( !
files->GetEntries() ) {
636 ::Error(
"xAOD::TEvent::readFrom",
639 return StatusCode::FAILURE;
641 const ::TChainElement* chEl =
642 dynamic_cast< const ::TChainElement*
>(
files->At( 0 ) );
644 ::Error(
"xAOD::TEvent::readFrom",
645 XAOD_MESSAGE(
"Couldn't cast object to TChainElement" ) );
646 return StatusCode::FAILURE;
648 ::TFile* dummyFile = ::TFile::Open( chEl->GetTitle() );
650 ::Error(
"xAOD::TEvent::readFrom",
653 return StatusCode::FAILURE;
668 return StatusCode::SUCCESS;
679 ::TFile*
file =
tree->GetCurrentFile();
698 ::Error(
"xAOD::TEvent::writeTo",
699 XAOD_MESSAGE(
"Null pointer given to the function!" ) );
700 return StatusCode::FAILURE;
705 ::Error(
"xAOD::TEvent::writeTo",
706 XAOD_MESSAGE(
"Object already writing to a file. Close that "
708 return StatusCode::FAILURE;
726 return StatusCode::SUCCESS;
739 ::Error(
"xAOD::TEvent::finishWritingTo",
740 XAOD_MESSAGE(
"The object doesn't seem to be connected to an "
742 return StatusCode::FAILURE;
750 const TIncident incident( IncidentType::MetaDataStop );
753 for( ; l_itr != l_end; ++l_itr ) {
754 ( *l_itr )->handle( incident );
769 return StatusCode::SUCCESS;
775 metatree->SetAutoSave( 10000 );
776 metatree->SetAutoFlush( -30000000 );
777 metatree->SetDirectory(
file );
780 metatree->Branch(
"EventFormat",
791 for(
auto&
object : outputMetaObjects ) {
796 ::Error(
"xAOD::TEvent::finishWritingTo",
798 return StatusCode::FAILURE;
802 const ::Int_t splitLevel = (
object.first.find(
"Aux." ) ==
803 (
object.first.size() - 4 ) ? 1 : 0 );
805 *(
mgr->branchPtr() ) =
806 metatree->Branch(
object.first.c_str(),
807 mgr->holder()->getClass()->GetName(),
808 mgr->holder()->getPtr(), 32000, splitLevel );
809 if( !
mgr->branch() ) {
810 ::Error(
"xAOD::TEvent::finishWritingTo",
813 mgr->holder()->getClass()->GetName(),
814 object.first.c_str() );
815 return StatusCode::FAILURE;
825 if( metatree->Fill() <= 0 ) {
826 ::Error(
"xAOD::TEvent::finishWritingTo",
827 XAOD_MESSAGE(
"Failed to write event format metadata into "
829 metatree->SetDirectory( 0 );
831 return StatusCode::FAILURE;
836 metatree->SetDirectory( 0 );
841 for( ; obj_itr != obj_end; ++obj_itr ) {
842 delete obj_itr->second;
847 for( ; obj_itr != obj_end; ++obj_itr ) {
848 delete obj_itr->second;
853 return StatusCode::SUCCESS;
868 #ifndef XAOD_STANDALONE
870 #endif // not XAOD_STANDALONE
884 const std::string& itemList ) {
890 if( itemList.size() ) {
891 std::stringstream
ss( itemList );
893 while( std::getline(
ss, attr,
'.' ) ) {
915 ::Error(
"xAOD::TEvent::addListener",
916 XAOD_MESSAGE(
"Received a null pointer for the listener" ) );
917 return StatusCode::FAILURE;
921 bool listenerKnown =
false;
923 if(
l == listener ) {
924 ::Warning(
"xAOD::TEvent::addListener",
925 "Listener %p was added previously already",
926 static_cast< void*
>( listener ) );
927 listenerKnown =
true;
933 if( ! listenerKnown ) {
938 return StatusCode::SUCCESS;
955 ::Error(
"xAOD::TEvent::removeListener",
957 static_cast< void*
>( listener ) );
958 return StatusCode::FAILURE;
965 return StatusCode::SUCCESS;
997 ::Error(
"xAOD::TEvent::addNameRemap",
998 XAOD_MESSAGE(
"Can't use \"%s\" as the target name in the"
999 "\"%s\" -> \"%s\" remapping" ),
1001 return StatusCode::FAILURE;
1007 ::Warning(
"xAOD::TEvent::addNameRemap",
1008 "Overriding existing name remapping \"%s\" -> \"%s\"",
1009 itr->second.c_str(), itr->first.c_str() );
1010 ::Warning(
"xAOD::TEvent::addNameRemap",
" with: \"%s\" -> \"%s\"",
1011 onfile.c_str(),
newName.c_str() );
1018 return StatusCode::SUCCESS;
1037 ::Info(
"xAOD::TEvent::printNameRemap",
"Name remapping rules:" );
1041 ::Info(
"xAOD::TEvent::printNameRemap",
" NONE" );
1048 ::Info(
"xAOD::TEvent::printNameRemap",
" \"%s\" -> \"%s\"",
1049 itr->second.c_str(), itr->first.c_str() );
1069 ::Int_t basketSize, ::Int_t splitLevel ) {
1073 ::Error(
"xAOD::TEvent::recordAux",
1074 XAOD_MESSAGE(
"No output tree given to the object" ) );
1092 ::Error(
"xAOD::TEvent::recordAux",
1094 static_cast< int >(
type ) );
1099 basketSize, splitLevel );
1100 if(
record(
store,
key, basketSize, splitLevel, kTRUE ).isFailure() ) {
1101 ::Error(
"xAOD::TEvent::recordAux",
1102 XAOD_MESSAGE(
"Couldn't connect TAuxStore object to the "
1113 ::Error(
"xAOD::TEvent::recordAux",
1121 ::Error(
"xAOD::TEvent::recordAux",
1122 XAOD_MESSAGE(
"Object of non-TAuxStore type registered "
1123 "with key \"%s\"" ),
key.c_str() );
1145 ::Int_t basketSize, ::Int_t splitLevel ) {
1148 std::string keyToUse =
key;
1153 keyToUse = remap_itr->second;
1160 Object_t::const_iterator vobjMgr =
m_inputObjects.find( keyToUse );
1162 ::Error(
"xAOD::TEvent::copy",
1164 return StatusCode::FAILURE;
1169 ::Error(
"xAOD::TEvent::copy",
1171 return StatusCode::FAILURE;
1175 ::Error(
"xAOD::TEvent::copy",
1177 return StatusCode::FAILURE;
1184 key, basketSize, splitLevel, kTRUE ) );
1187 const std::set< std::string >*
filter = 0;
1190 filter = &( fitr->second );
1194 Object_t::const_iterator vauxMgr =
m_inputObjects.find( keyToUse +
1199 return StatusCode::SUCCESS;
1206 ::Error(
"xAOD::TEvent::copy",
1208 return StatusCode::FAILURE;
1213 key +
"Aux.", basketSize, splitLevel, kTRUE ) );
1218 ::Error(
"xAOD::TEvent::copy",
1220 return StatusCode::FAILURE;
1228 key +
"Aux.", basketSize, splitLevel ) );
1230 ::Fatal(
"xAOD::TEvent::copy",
1235 return StatusCode::SUCCESS;
1251 ::Error(
"xAOD::TEvent::copy",
1253 return StatusCode::FAILURE;
1259 for( ; itr !=
end; ++itr ) {
1278 ::TClass*
cl = ::TClass::GetClass( efe.
className().c_str() );
1279 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
1289 return StatusCode::SUCCESS;
1304 ::Error(
"xAOD::TEvent::getEntries",
1329 ::Error(
"xAOD::TEvent::getEntry",
1339 if( fileEntry < 0 ) {
1340 ::Error(
"xAOD::TEvent::getEntry",
1343 static_cast< int >(
entry ) );
1358 ::Error(
"xAOD::TEvent::getEntry",
1381 ::Error(
"xAOD::TEvent::getEntry",
1382 XAOD_MESSAGE(
"Failure in loading entry %i from the input "
1383 "file" ),
static_cast< int >(
m_entry ) );
1394 const TIncident incident( IncidentType::BeginEvent );
1397 for( ; l_itr != l_end; ++l_itr ) {
1398 ( *l_itr )->handle( incident );
1412 static const std::string dynStorePostfix =
"Aux.Dynamic";
1413 if( inObj.first.find( dynStorePostfix ) ==
1414 ( inObj.first.size() - dynStorePostfix.size() ) ) {
1428 result += inObj.second->getEntry( getall );
1433 const TIncident incident( IncidentType::BeginEvent );
1436 for( ; l_itr != l_end; ++l_itr ) {
1437 ( *l_itr )->handle( incident );
1456 return m_inChain->GetListOfFiles()->GetEntries();
1477 ::Error(
"xAOD::TEvent::getFile",
1478 XAOD_MESSAGE(
"Function called with invalid file number "
1479 "(%i)" ),
static_cast< int >(
file ) );
1494 ::Long64_t
entry = 0;
1495 for( ::Long64_t
i = 0;
i <
file; ++
i ) {
1513 ::Error(
"xAOD::TEvent::fill",
1514 XAOD_MESSAGE(
"Object not connected to an output file!" ) );
1524 ::Error(
"xAOD::TEvent::fill",
1530 ::Error(
"xAOD::TEvent::fill",
1540 std::string unsetObjects;
1542 for(
auto& itr : outputObjectsCopy ) {
1544 if( ! itr.second->create() ) {
1547 if( unsetObjects.size() ) {
1548 unsetObjects.append(
", \"" + itr.first +
"\"" );
1550 unsetObjects.append(
"\"" + itr.first +
"\"" );
1558 ::Error(
"xAOD::TEvent::fill",
1559 XAOD_MESSAGE(
"Failed to put dynamic auxiliary variables "
1560 "in the output for object \"%s\"" ),
1561 itr.first.c_str() );
1567 if( unsetObjects.size() ) {
1568 ::Error(
"xAOD::TEvent::fill",
1569 XAOD_MESSAGE(
"The following objects were not set in the "
1570 "current event: %s" ), unsetObjects.c_str() );
1577 ::Error(
"xAOD::TEvent::fill",
1578 XAOD_MESSAGE(
"Output tree filling failed with return "
1579 "value: %i" ), ret );
1585 for( ; ncitr != ncend; ++ncitr ) {
1586 ncitr->second->reset();
1612 ::Warning(
"xAOD::TEvent::inputEventFormat",
1613 "No input file is connected at the moment" );
1635 ::Warning(
"xAOD::TEvent::outputEventFormat",
1636 "No output file is connected at the moment" );
1653 if(
key ==
"" )
return 0;
1690 for( ; obj_itr != obj_end; ++obj_itr ) {
1693 if( obj_itr->second->object() !=
obj )
continue;
1696 return obj_itr->first;
1702 for( ; obj_itr != obj_end; ++obj_itr ) {
1705 if( obj_itr->second->object() !=
obj )
continue;
1708 return obj_itr->first;
1719 ::Warning(
"xAOD::TEvent::getName",
1720 "Didn't find object with pointer %p in the event",
1722 static const std::string
dummy;
1727 std::vector<std::string>& vkeys,
1730 std::set<std::string>
keys;
1734 std::vector<TObjArray*> fullListOfBranches = {};
1739 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1740 fullListOfBranches.push_back(
m_inMetaTree->GetListOfBranches());
1745 ::Info(
"xAOD::TEvent::getNames",
"scanning input objects");
1747 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
1752 TList *fList =
m_inTree->GetListOfFriends();
1754 for (TObject * feObj : *fList){
1757 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
1759 fullListOfBranches.push_back(friendTree->GetListOfBranches());
1767 for (
const TObjArray * in : fullListOfBranches){
1770 const TObject *
obj = in->At(
index);
1771 if ( !
obj )
continue;
1772 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1774 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1777 std::string objClassName = element->GetClassName();
1778 std::string
key =
obj->GetName();
1779 ::Info(
"xAOD::TEvent::getNames",
1780 "Inspecting %s / %s",
1781 objClassName.c_str(),
key.c_str());
1782 if (objClassName == targetClassName) {
1783 ::Info(
"xAOD::TEvent::getNames",
1784 "Matched %s to key %s",
1785 targetClassName.c_str(),
key.c_str());
1794 ::Info(
"xAOD::TEvent::getNames",
1795 "scanning input Aux objects for %s", targetClassName.c_str());
1796 for(
const auto&
object : inAux ) {
1800 if ( !
mgr )
continue;
1801 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1802 const std::string&
key =
object.first;
1803 ::Info(
"xAOD::TEvent::getNames",
1804 "Inspecting %s / %s",
1805 objClassName.c_str(),
key.c_str());
1806 if (objClassName == targetClassName) {
1807 ::Info(
"xAOD::TEvent::getNames",
1808 "Matched %s to key %s",
1809 targetClassName.c_str(),
key.c_str());
1818 const TObjArray *
out =
tree->GetListOfBranches();
1819 ::Info(
"xAOD::TEvent::getNames",
"scanning output objects");
1823 if ( !
obj )
continue;
1824 const TBranch * element =
dynamic_cast<const TBranch*
>(
obj);
1826 ::Error(
"xAOD::TEvent::getNames",
"Failure inspecting input objects");
1829 std::string objClassName = element->GetClassName();
1830 std::string
key =
obj->GetName();
1831 ::Info(
"xAOD::TEvent::getNames",
1832 "Inspecting %s / %s",
1833 objClassName.c_str(),
key.c_str());
1834 if (objClassName == targetClassName) {
1835 ::Info(
"xAOD::TEvent::getNames",
1836 "Matched %s to key %s",
1837 targetClassName.c_str(),
key.c_str());
1842 ::Info(
"xAOD::TEvent::getNames",
"no output tree connected");
1851 ::Info(
"xAOD::TEvent::getNames",
1852 "scanning output Aux objects for %s", targetClassName.c_str());
1853 for(
const auto&
object : outAux ) {
1857 if ( !
mgr )
continue;
1858 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1859 const std::string&
key =
object.first;
1860 ::Info(
"xAOD::TEvent::getNames",
1861 "Inspecting %s / %s",
1862 objClassName.c_str(),
key.c_str());
1863 if (objClassName == targetClassName) {
1864 ::Info(
"xAOD::TEvent::getNames",
1865 "Matched %s to key %s",
1866 targetClassName.c_str(),
key.c_str());
1871 vkeys.insert(vkeys.end(),
keys.begin(),
keys.end());
1901 static const std::string
dummy;
1916 const std::type_info& ti ) {
1920 if( !
name.length() ) {
1940 const std::type_info& ti,
1946 Warning(
"xAOD::TEvent::getInputObject",
1947 "Key 0x%08x unknown",
key );
1966 return StatusCode::SUCCESS;
1971 ::Error(
"xAOD::TEvent::initStats",
1974 return StatusCode::FAILURE;
1983 for( ; itr !=
end; ++itr ) {
1986 const std::string& branchName = itr->second.branchName();
1989 if( branchName.find(
"Aux." ) != std::string::npos ) {
1998 const std::string intName =
1999 branchName.substr( 0, branchName.size() - 4 );
2007 ::Bool_t auxFound = kFALSE;
2010 std::vector<TObjArray*> fullListOfBranches = {};
2012 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
2017 TList *fList =
m_inTree->GetListOfFriends();
2019 for (TObject * feObj : *fList){
2022 TTree *friendTree =
dynamic_cast<TFriendElement*
>(feObj)->GetTree();
2024 fullListOfBranches.push_back(friendTree->GetListOfBranches());
2029 for (TObjArray*
branches : fullListOfBranches){
2030 for( Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i ){
2034 if(
name.BeginsWith( branchName ) ||
2035 name.BeginsWith( dynName ) ) {
2042 ::Warning(
"xAOD::TEvent::initStats",
2043 "Couldn't find interface object/container "
2044 "\"%s\" belonging to branch \"%s\"",
2045 intName.c_str(), branchName.c_str() );
2052 ::TClass*
cl = ::TClass::GetClass(
el->className().c_str() );
2053 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
2054 ::Warning(
"xAOD::TEvent::initStats",
2055 "Couldn't find dictionary for type \"%s\"",
2056 el->className().c_str() );
2062 static const std::string baseName =
2064 static ::TClass*
const baseCl = ::TClass::GetClass( baseName.c_str() );
2066 ::Error(
"xAOD::TEvent::initStats",
2068 "\"%s\"" ), baseName.c_str() );
2069 return StatusCode::FAILURE;
2086 const ::TBranch* container =
2087 m_inTree->GetBranch( branchName.c_str() );
2096 return StatusCode::SUCCESS;
2112 const std::type_info& ti,
2120 Object_t::const_iterator itr =
objects.find(
key );
2142 if( ! itr->second->isSet() ) {
2150 ::Error(
"xAOD::TEvent::getOutputObject",
2151 XAOD_MESSAGE(
"Object of wrong type found for key \"%s\"" ),
2157 void*
result =
mgr->holder()->getAs( ti );
2159 ::Warning(
"xAOD::TEvent::getOutputObject",
2160 "Couldn't retrieve object as \"%s\"",
2182 const std::type_info& ti,
2187 std::string keyToUse =
key;
2192 keyToUse = remap_itr->second;
2198 if(
store &&
store->contains( keyToUse, ti ) &&
2199 store->isConst( keyToUse, ti ) ) {
2200 const void*
result =
store->getConstObject( keyToUse, ti );
2231 ::Fatal(
"xAOD::TEvent::getInputObject",
2232 XAOD_MESSAGE(
"There is an internal logic error in the "
2241 if(
key == keyToUse ) {
2242 ::Error(
"xAOD::TEvent::getInputObject",
2247 ::Error(
"xAOD::TEvent::getInputObject",
2249 "\"%s\"/\"%s\"" ),
key.c_str(),
2257 if(
mgr->getEntry() ) {
2262 ::Error(
"xAOD::TEvent::getInputObject",
2265 mgr->holder()->getClass()->GetName(),
2276 ::Warning(
"xAOD::TEvent::getInputObject",
2277 "Could not retrieve object with key \"%s\" "
2278 "as \"%s\"", keyToUse.c_str(),
2307 const std::string&
key,
2308 ::Int_t basketSize, ::Int_t splitLevel,
2309 ::Bool_t overwrite, ::Bool_t
metadata,
2310 ::Bool_t isOwner ) {
2314 ::Error(
"xAOD::TEvent::record",
2315 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2316 "call writeTo(...)?" ) );
2317 return StatusCode::FAILURE;
2325 if( ( ! overwrite ) &&
2328 ::Error(
"xAOD::TEvent::record",
2331 return StatusCode::FAILURE;
2334 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2336 ::Error(
"xAOD::TEvent::record",
2339 return StatusCode::FAILURE;
2347 return StatusCode::SUCCESS;
2352 if( ( ! overwrite ) &&
2354 ::Error(
"xAOD::TEvent::record",
2355 XAOD_MESSAGE(
"Object %s/%s already accessed from the input, "
2356 "can't be overwritten in memory" ),
2358 return StatusCode::FAILURE;
2363 if( ( splitLevel == 0 ) &&
2364 (
key.find(
"Aux." ) == (
key.size() - 4 ) ) ) {
2373 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2375 ::Error(
"xAOD::TEvent::record",
2378 return StatusCode::FAILURE;
2394 *(
mgr->branchPtr() ) =
2396 hldr->
getPtr(), basketSize, splitLevel );
2397 if( !
mgr->branch() ) {
2398 ::Error(
"xAOD::TEvent::record",
2401 key.c_str(),
cl->GetName() );
2405 return StatusCode::FAILURE;
2416 return StatusCode::SUCCESS;
2422 ::Error(
"xAOD::TEvent::record",
2425 return StatusCode::FAILURE;
2434 TClass*
cl = TClass::GetClass(
typeName.c_str() );
2435 if( ( !
cl ) || ::strcmp(
cl->GetName(),
2437 ::Error(
"xAOD::TEvent::record",
2438 XAOD_MESSAGE(
"For output key \"%s\" the previous type "
2439 "was \"%s\", the newly requested type is "
2443 return StatusCode::FAILURE;
2471 ::Bool_t ownsStore ) {
2475 ::Error(
"xAOD::TEvent::record",
2476 XAOD_MESSAGE(
"No output tree defined. Did you forget to "
2477 "call writeTo(...)?" ) );
2478 return StatusCode::FAILURE;
2482 const std::set< std::string >*
filter = 0;
2485 filter = &( filter_itr->second );
2503 return StatusCode::SUCCESS;
2507 if( vitr->second->object() ==
store ) {
2509 return StatusCode::SUCCESS;
2519 ::Error(
"xAOD::TEvent::record",
2520 XAOD_MESSAGE(
"Output object with key %s already exists, "
2521 "and is not of type TAuxStore" ),
2523 return StatusCode::FAILURE;
2538 return StatusCode::SUCCESS;
2564 ::Error(
"xAOD::TEvent::connectBranch",
2565 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2566 return StatusCode::FAILURE;
2574 return StatusCode::SUCCESS;
2579 ::Warning(
"xAOD::TEvent::connectBranch",
2580 "Branch \"%s\" not available on input",
2583 return StatusCode::RECOVERABLE;
2590 ::Warning(
"xAOD::TEvent::connectBranch",
2591 "No metadata available for branch: %s",
2603 ::Warning(
"xAOD::TEvent::connectBranch",
2604 "Branch \"%s\" not available on input",
2608 return StatusCode::RECOVERABLE;
2612 br->SetMakeClass( 0 );
2623 ::Error(
"xAOD::TEvent::connectBranch",
2624 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2625 "dictionary for branch \"%s\"" ),
2627 return StatusCode::FAILURE;
2630 ::TClass* realClass = ::TClass::GetClass(
className.c_str() );
2631 if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) &&
ef ) {
2636 realClass = ::TClass::GetClass(
className.c_str() );
2638 if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2640 ::Error(
"xAOD::TEvent::connectBranch",
2641 XAOD_MESSAGE(
"Couldn't find an appropriate type with a "
2642 "dictionary for branch \"%s\"" ),
2644 return StatusCode::FAILURE;
2651 static const ::EDataType
dataType = kOther_t;
2664 ::Error(
"xAOD::TEvent::connectBranch",
2665 XAOD_MESSAGE(
"Couldn't access output manager for: %s" ),
2667 return StatusCode::FAILURE;
2670 ptr =
mgr->holder()->get();
2677 ptr = realClass->New();
2692 ::Error(
"xAOD::TEvent::connectBranch",
2694 "This can only be read in kAthenaAccess mode." ),
2695 key.c_str(),
br->GetSplitLevel() );
2700 return StatusCode::FAILURE;
2710 ::Error(
"xAOD::TEvent::connectBranch",
2711 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2712 "input branch \"%s\". Return code: %i" ),
2718 return StatusCode::FAILURE;
2748 ::Error(
"xAOD::TEvent::connectMetaBranch",
2749 XAOD_MESSAGE(
"Function called on un-initialised object" ) );
2750 return StatusCode::FAILURE;
2755 return StatusCode::SUCCESS;
2762 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2763 "Branch \"%s\" not available on input",
2766 return StatusCode::RECOVERABLE;
2770 if( !
br->GetEntries() ) {
2772 ::Warning(
"xAOD::TEvent::connectMetaBranch",
2773 "Branch \"%s\" doesn't hold any data",
2776 return StatusCode::RECOVERABLE;
2780 br->SetMakeClass( 0 );
2784 ::EDataType
dt = kOther_t;
2785 if(
br->GetExpectedType(
cl,
dt ) || ( !
cl ) ) {
2786 ::Error(
"xAOD::TEvent::connectMetaBranch",
2788 "branch %s" ),
key.c_str() );
2789 return StatusCode::FAILURE;
2793 void*
ptr =
cl->New();
2806 ::Error(
"xAOD::TEvent::connectMetaBranch",
2807 XAOD_MESSAGE(
"Couldn't connect variable of type \"%s\" to "
2808 "input branch \"%s\". Return code: %i" ),
2814 return StatusCode::FAILURE;
2818 if(
mgr->getEntry() < 0 ) {
2819 ::Error(
"xAOD::TEvent::connectMetaBranch",
2820 XAOD_MESSAGE(
"Couldn't read in metadata object with key "
2821 "\"%s\"" ),
key.c_str() );
2822 return StatusCode::FAILURE;
2844 return StatusCode::SUCCESS;
2862 ::Error(
"xAOD::TEvent::connectAux",
2864 return StatusCode::FAILURE;
2872 return StatusCode::SUCCESS;
2877 return StatusCode::SUCCESS;
2890 ::Fatal(
"xAOD::TEvent::connectAux",
2896 ::Fatal(
"xAOD::TEvent::connectAux",
2898 return StatusCode::FAILURE;
2902 static const TClass*
const holderClass =
2904 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
2906 return StatusCode::SUCCESS;
2913 if( ! storeHolder ) {
2914 ::Fatal(
"xAOD::TEvent::connectAux",
2925 ::Error(
"xAOD::TEvent::connectAux",
2927 "for: %s" ),
prefix.c_str() );
2928 ::Error(
"xAOD::TEvent::connectAux",
2929 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
2932 return StatusCode::FAILURE;
2936 return StatusCode::SUCCESS;
2957 return StatusCode::SUCCESS;
2961 ::Error(
"xAOD::TEvent::connectAux",
2962 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
2964 return StatusCode::FAILURE;
2981 return StatusCode::SUCCESS;
2986 ::Fatal(
"xAOD::TEvent::connectMetaAux",
2988 return StatusCode::FAILURE;
3002 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3008 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3010 return StatusCode::FAILURE;
3014 static const TClass*
const holderClass =
3016 if( ! omgr->
holder()->
getClass()->InheritsFrom( holderClass ) ) {
3018 return StatusCode::SUCCESS;
3025 if( ! storeHolder ) {
3026 ::Fatal(
"xAOD::TEvent::connectMetaAux",
3037 ::Error(
"xAOD::TEvent::connectMetaAux",
3038 XAOD_MESSAGE(
"Requested store types inconsistent" ) );
3039 ::Error(
"xAOD::TEvent::connectMetaAux",
3040 XAOD_MESSAGE(
"standalone = %s, getStoreType() = %i" ),
3043 return StatusCode::FAILURE;
3047 return StatusCode::SUCCESS;
3068 store->getEntry( 0 );
3071 return StatusCode::SUCCESS;
3075 ::Error(
"xAOD::TEvent::connectMetaAux",
3076 XAOD_MESSAGE(
"Unknown auxiliary access mode set (%i)" ),
3078 return StatusCode::FAILURE;
3092 ::TMethodCall setNameCall;
3096 setNameCall.InitWithPrototype(
mgr.holder()->getClass(),
3097 "setName",
"const char*" );
3098 if( setNameCall.IsValid() ) {
3103 const char* charParams =
params.Data();
3104 setNameCall.Execute(
mgr.holder()->get(), charParams );
3107 ::Warning(
"xAOD::TEvent::setUpDynamicStore",
3108 "Couldn't find setName(...) function for container %s "
3110 mgr.branch()->GetName(),
3111 mgr.holder()->getClass()->GetName() );
3116 static const TClass*
const holderClass =
3118 if( !
mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3120 return StatusCode::SUCCESS;
3127 if( ! storeHolder ) {
3128 ::Fatal(
"xAOD::TEvent::setUpDynamicStore",
3130 return StatusCode::FAILURE;
3154 store->getEntry( 0 );
3160 return StatusCode::SUCCESS;
3178 return StatusCode::SUCCESS;
3182 const std::string
key =
mgr.branch()->GetName();
3200 return StatusCode::SUCCESS;
3202 auxMgr = itr->second;
3203 auxKey =
key +
"Aux.";
3208 ::Int_t readBytes = auxMgr->
getEntry();
3212 const std::string dynAuxKey = auxKey +
"Dynamic";
3213 auto dynAuxMgr =
objects.find( dynAuxKey );
3215 if( ( dynAuxMgr !=
objects.end() ) &&
3217 ( auxMgr == &
mgr ) ) ) {
3222 dynAuxMgr->second->getEntry();
3236 auto dynAuxMgr =
objects.find( dynAuxKey );
3237 if( dynAuxMgr ==
objects.end() ) {
3238 ::Error(
"xAOD::TEvent::setAuxStore",
3240 return StatusCode::FAILURE;
3242 dynAuxMgr->second->getEntry();
3248 if( auxMgr == &
mgr ) {
3249 return StatusCode::SUCCESS;
3255 switch(
mgr.holder()->typeKind() ) {
3274 if(
vec && ( !
vec->trackIndices() ) ) {
3275 forceTrackIndices( *
vec );
3279 if( ( !
vec ) && ( ! aux ) ) {
3280 ::Fatal(
"xAOD::TEvent::setAuxStore",
3282 "SG::AuxVectorBase or SG::AuxElement" ),
3283 mgr.holder()->getClass()->GetName() );
3292 ::Fatal(
"xAOD::TEvent::setAuxStore",
3293 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3294 "right type" ), auxKey.c_str() );
3295 return StatusCode::FAILURE;
3311 ::Fatal(
"xAOD::TEvent::setAuxStore",
3312 XAOD_MESSAGE(
"Auxiliary manager for \"%s\" is not of the "
3313 "right type" ), auxKey.c_str() );
3314 return StatusCode::FAILURE;
3320 ::Fatal(
"xAOD::TEvent::setAuxStore",
3330 ::Fatal(
"xAOD::TEvent::setAuxStore",
3335 return StatusCode::SUCCESS;
3352 ::Int_t basketSize, ::Int_t splitLevel,
3362 return StatusCode::SUCCESS;
3366 if( !
mgr->holder()->getClass()->InheritsFrom(
"SG::IAuxStoreIO" ) ) {
3367 return StatusCode::SUCCESS;
3375 ::Fatal(
"xAOD::TEvent::putAux",
3376 XAOD_MESSAGE(
"There is a logic error in the code!" ) );
3385 sel.selectAux( item_itr->second );
3395 if( auxids.
empty() ) {
3396 return StatusCode::SUCCESS;
3400 const std::string dynNamePrefix =
3409 typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
3410 std::vector< AuxVarSort_t > varsort;
3411 varsort.reserve( auxids.
size() );
3413 varsort.emplace_back(
r.getName(
id ),
id );
3415 std::sort( varsort.begin(), varsort.end() );
3418 for(
const auto&
p : varsort ) {
3424 const std::string
brName = dynNamePrefix +
p.first;
3433 const std::type_info* brType = aux->
getIOType(
id );
3435 ::Error(
"xAOD::TEvent::putAux",
3438 return StatusCode::FAILURE;
3440 const std::string brTypeName =
3442 std::string brProperTypeName =
"<unknown>";
3448 if( strlen( brType->name() ) == 1 ) {
3451 brProperTypeName = brTypeName;
3456 ::Error(
"xAOD::TEvent::putAux",
3459 brName.c_str(), brTypeName.c_str() );
3460 return StatusCode::FAILURE;
3464 std::ostringstream leaflist;
3476 outTree.Branch(
brName.c_str(), hldr->
get(),
3477 leaflist.str().c_str(),
3479 if( ! auxmgr->
branch() ) {
3480 ::Error(
"xAOD::TEvent::putAux",
3483 brName.c_str(), brProperTypeName.c_str() );
3488 return StatusCode::FAILURE;
3495 TClass*
cl = TClass::GetClass( *brType, kTRUE, kTRUE );
3499 cl = TClass::GetClass( brTypeName.c_str() );
3502 ::Error(
"xAOD::TEvent::putAux",
3504 "variable \"%s\" of type \"%s\"" ),
3505 brName.c_str(), brTypeName.c_str() );
3506 return StatusCode::FAILURE;
3511 brProperTypeName =
cl->GetName();
3520 if (!
cl->CanSplit() && strncmp (
cl->GetName(),
"SG::PackedContainer<", 20) == 0)
3525 outTree.Branch(
brName.c_str(),
3527 hldr->
getPtr(), basketSize, splitLevel );
3528 if( ! auxmgr->
branch() ) {
3529 ::Error(
"xAOD::TEvent::putAux",
3532 brName.c_str(), brProperTypeName.c_str() );
3537 return StatusCode::FAILURE;
3545 if( outTree.GetEntries() ) {
3546 void*
ptr =
br->GetAddress();
3547 br->SetAddress( 0 );
3548 for( ::Long64_t
i = 0;
i < outTree.GetEntries(); ++
i ) {
3551 br->SetAddress(
ptr );
3560 mgr->branch()->GetName(),
3571 ::Fatal(
"xAOD::TEvent::putAux",
3572 XAOD_MESSAGE(
"There is an internal logic error in the "
3578 const_cast< void*
>(
static_cast< const void*
>( aux->
getIOData(
id ) ) );
3579 bmgr->second->setObject( nc_data );
3583 return StatusCode::SUCCESS;
3598 static const TClass*
const dvClass =
3600 static const TClass*
const aeClass =
3604 return (
mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3605 mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3618 static const TClass*
const storeClass =
3620 static const TClass*
const storeHolderClass =
3624 return (
mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3625 mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3642 static const TClass*
const dvClass =
3644 static const TClass*
const aeClass =
3648 if(
mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3650 }
else if(
mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3655 ::Error(
"xAOD::TEvent::isStandalone",
3657 "auxiliary store" ),
3658 mgr.holder()->getClass()->GetName() );
3673 const std::type_info& ti,
3692 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.
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 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.
@ 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)
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.
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 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.