14#include <TVirtualCollectionProxy.h>
33 static std::map< SG::auxid_t, ::TClass* > s_dictCache =
34 std::map< SG::auxid_t, ::TClass* >();
37 : ::TObject(), m_stopOnError( kFALSE ), m_ignoredVariables(),
38 m_orpannedContainers() {
48 if( ! event.getEntries() ) {
49 return StatusCode::SUCCESS;
53 if( event.getEntry( 0 ) < 0 ) {
55 XAOD_MESSAGE(
"Couldn't load event 0 from the input" ) );
56 return StatusCode::FAILURE;
60 std::set< std::string > containerNames;
64 for( ; ef_itr != ef_end; ++ef_itr ) {
67 if( ef_itr->first.find(
"Aux." ) == ( ef_itr->first.size() - 4 ) ) {
70 if( ef_itr->second.parentName() !=
"" ) {
80 containerNames.insert( ef_itr->first );
84 const ::Long64_t
entries =
event.getEntries();
85 for( ::Long64_t entry = 0; entry <
entries; ++entry ) {
88 if( event.getEntry( entry ) < 0 ) {
90 XAOD_MESSAGE(
"Failed to load event %i from the input" ),
91 static_cast< int >( entry ) );
92 return StatusCode::FAILURE;
96 if( ! ( entry % 100 ) ) {
97 Info(
"check",
"Now validating entry %i / %i",
98 static_cast< int >( entry ),
static_cast< int >(
entries ) );
102 for(
const std::string& cname : containerNames ) {
107 event.retrieve(
vec, cname ) );
118 cname.c_str(),
static_cast< int >( entry ) );
125 return StatusCode::SUCCESS;
158 const std::string&
name ) {
170 Error(
"checkContainer",
175 return StatusCode::FAILURE;
177 return StatusCode::SUCCESS;
184 return StatusCode::SUCCESS;
189 const size_t size =
vec.size_v();
200 const void* vecPtr = ioStore->
getIOData( auxid );
202 Error(
"checkContainer",
204 name.c_str(), reg.getName( auxid ).c_str() );
205 return StatusCode::FAILURE;
210 auto itr = s_dictCache.find( auxid );
211 if( itr != s_dictCache.end() ) {
214 const std::type_info* typeId = reg.getVecType( auxid );
216 Error(
"checkContainer",
219 reg.getName( auxid ).c_str() );
220 return StatusCode::FAILURE;
222 cl = ::TClass::GetClass( *typeId );
223 s_dictCache[ auxid ] = cl;
226 Error(
"checkContainer",
227 XAOD_MESSAGE(
"Couldn't get dictionary for variable %s" ),
228 reg.getName( auxid ).c_str() );
229 return StatusCode::FAILURE;
233 ::TVirtualCollectionProxy* proxy = cl->GetCollectionProxy();
235 Error(
"checkContainer",
238 reg.getName( auxid ).c_str() );
239 return StatusCode::FAILURE;
243 proxy->PushProxy( (
void* ) vecPtr );
244 const size_t varSize =
static_cast< size_t >( proxy->Size() );
248 if( ( size != varSize ) &&
251 Error(
"checkContainer",
252 XAOD_MESSAGE(
"%s.size() (%i) != %sAux.%s.size() (%i)" ),
253 name.c_str(),
static_cast< int >( size ),
254 name.c_str(), reg.getName( auxid ).c_str(),
255 static_cast< int >( varSize ) );
256 return StatusCode::FAILURE;
261 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.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
ClassImp(xAOD::TFileChecker) namespace xAOD
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.
const std::set< std::string > & ignoredVariables() const
Get the list of variables which are ignored in the test.
StatusCode checkContainer(const SG::AuxVectorBase &vec, const std::string &name)
Check the health of a container.
void addIgnoredVariable(const std::string &name)
Add a variable to be ignored in the test.
void setIgnoredVariables(const std::set< std::string > &value)
Set the list of variables to be ignored in the test.
::Bool_t stopOnError() const
Check whether the validation will stop when an error is found.
std::set< std::string > m_ignoredVariables
List of variables to ignore in the test.
::Bool_t m_stopOnError
Stop the validation when an issue is found?
TFileChecker()
Default constructor.
StatusCode check(TEvent &event)
Execute all sanity checks on a given file.
std::set< std::string > m_orpannedContainers
List of containers without an auxiliary store.
void setStopOnError(::Bool_t value)
Set whether the validation should stop when an error is found.
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.