14#include <TVirtualCollectionProxy.h>
32 namespace Experimental {
35 static std::map< SG::auxid_t, ::TClass* > s_dictCache =
36 std::map< SG::auxid_t, ::TClass* >();
39 : ::TObject(), m_stopOnError( kFALSE ), m_ignoredVariables(),
40 m_orpannedContainers() {
52 if( ! event.getEntries() ) {
53 return StatusCode::SUCCESS;
56 if( event.getEntry( 0 ) < 0 ) {
58 XAOD_MESSAGE(
"Couldn't load event 0 from the input" ) );
59 return StatusCode::FAILURE;
63 std::set< std::string > containerNames;
70 for( ; ef_itr != ef_end; ++ef_itr ) {
73 if( ef_itr->first.find(
"Aux." ) == ( ef_itr->first.size() - 4 ) ) {
76 if( ef_itr->second.parentName() !=
"" ) {
86 containerNames.insert( ef_itr->first );
90 const ::Long64_t
entries =
event.getEntries();
91 for( ::Long64_t entry = 0; entry <
entries; ++entry ) {
94 if( event.getEntry( entry ) < 0 ) {
96 XAOD_MESSAGE(
"Failed to load event %i from the input" ),
97 static_cast< int >( entry ) );
98 return StatusCode::FAILURE;
102 if( ! ( entry % 100 ) ) {
103 Info(
"check",
"Now validating entry %i / %i",
104 static_cast< int >( entry ),
static_cast< int >(
entries ) );
108 for(
const std::string& cname : containerNames ) {
113 event.retrieve(
vec, cname ) );
124 cname.c_str(),
static_cast< int >( entry ) );
131 return StatusCode::SUCCESS;
164 const std::string&
name ) {
176 Error(
"checkContainer",
181 return StatusCode::FAILURE;
183 return StatusCode::SUCCESS;
190 return StatusCode::SUCCESS;
195 const size_t size =
vec.size_v();
206 const void* vecPtr = ioStore->
getIOData( auxid );
208 Error(
"checkContainer",
210 name.c_str(), reg.getName( auxid ).c_str() );
211 return StatusCode::FAILURE;
216 auto itr = s_dictCache.find( auxid );
217 if( itr != s_dictCache.end() ) {
220 const std::type_info* typeId = reg.getVecType( auxid );
222 Error(
"checkContainer",
225 reg.getName( auxid ).c_str() );
226 return StatusCode::FAILURE;
228 cl = ::TClass::GetClass( *typeId );
229 s_dictCache[ auxid ] = cl;
232 Error(
"checkContainer",
233 XAOD_MESSAGE(
"Couldn't get dictionary for variable %s" ),
234 reg.getName( auxid ).c_str() );
235 return StatusCode::FAILURE;
239 ::TVirtualCollectionProxy* proxy = cl->GetCollectionProxy();
241 Error(
"checkContainer",
244 reg.getName( auxid ).c_str() );
245 return StatusCode::FAILURE;
249 proxy->PushProxy( (
void* ) vecPtr );
250 const size_t varSize =
static_cast< size_t >( proxy->Size() );
254 if( ( size != varSize ) &&
257 Error(
"checkContainer",
258 XAOD_MESSAGE(
"%s.size() (%i) != %sAux.%s.size() (%i)" ),
259 name.c_str(),
static_cast< int >( size ),
260 name.c_str(), reg.getName( auxid ).c_str(),
261 static_cast< int >( varSize ) );
262 return StatusCode::FAILURE;
267 return StatusCode::SUCCESS;
Handle mappings between names and auxid_t.
Manage index tracking and synchronization of auxiliary data.
std::vector< size_t > vec
Interface providing I/O for a generic auxiliary store.
Interface for const operations on an auxiliary store.
ClassImp(xAOD::Experimental::RFileChecker) namespace xAOD
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Handle mappings between names and auxid_t.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Manage index tracking and synchronization of auxiliary data.
Interface providing I/O for a generic auxiliary store.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
Interface for const operations on an auxiliary store.
A set of aux data identifiers.
Tool for running sanity checks on xAOD files.
void setStopOnError(::Bool_t value)
Set whether the validation should stop when an error is found.
const std::set< std::string > & ignoredVariables() const
Get the list of variables which are ignored in the test.
RFileChecker()
Default constructor.
std::set< std::string > m_ignoredVariables
List of variables to ignore in the test.
std::set< std::string > m_orpannedContainers
List of containers without an auxiliary store.
void addIgnoredVariable(const std::string &name)
Add a variable to be ignored in the test.
::Bool_t stopOnError() const
Check whether the validation will stop when an error is found.
StatusCode check(REvent &event)
Execute all sanity checks on a given file.
StatusCode checkContainer(const SG::AuxVectorBase &vec, const std::string &name)
Check the health of a container.
::Bool_t m_stopOnError
Stop the validation when an issue is found?
void setIgnoredVariables(const std::set< std::string > &value)
Set the list of variables to be ignored in the test.
size_t auxid_t
Identifier for a particular aux data item.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
EventFormat_v1 EventFormat
Definition of the current event format version.