32 namespace Experimental {
35 static std::map< SG::auxid_t, ::TClass* > s_dictCache =
36 std::map< SG::auxid_t, ::TClass* >();
38 RFileChecker::RFileChecker()
39 : ::TObject(), m_stopOnError( kFALSE ), m_ignoredVariables(),
40 m_orpannedContainers() {
49 m_orpannedContainers.clear();
53 return StatusCode::SUCCESS;
58 XAOD_MESSAGE(
"Couldn't load event 0 from the input" ) );
59 return StatusCode::FAILURE;
63 std::set< std::string > containerNames;
65 EventFormat::const_iterator ef_itr =
ef->begin();
66 EventFormat::const_iterator ef_end =
ef->end();
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();
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 ) {
116 if( m_stopOnError ) {
118 checkContainer( *
vec, cname ) );
120 if( checkContainer( *
vec, cname ).isFailure() ) {
124 cname.c_str(),
static_cast< int >(
entry ) );
131 return StatusCode::SUCCESS;
134 void RFileChecker::setStopOnError( ::Bool_t
value ) {
136 m_stopOnError =
value;
140 ::Bool_t RFileChecker::stopOnError()
const {
142 return m_stopOnError;
145 void RFileChecker::addIgnoredVariable(
const std::string&
name ) {
147 m_ignoredVariables.insert(
name );
152 RFileChecker::setIgnoredVariables(
const std::set< std::string >&
value ) {
154 m_ignoredVariables =
value;
158 const std::set< std::string >& RFileChecker::ignoredVariables()
const {
160 return m_ignoredVariables;
164 const std::string&
name ) {
174 if( m_orpannedContainers.find(
name ) ==
175 m_orpannedContainers.end() ) {
176 Error(
"checkContainer",
180 m_orpannedContainers.insert(
name );
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",
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 ) &&
255 ( m_ignoredVariables.find( reg.
getName( auxid ) ) ==
256 m_ignoredVariables.end() ) ) {
257 Error(
"checkContainer",
258 XAOD_MESSAGE(
"%s.size() (%i) != %sAux.%s.size() (%i)" ),
259 name.c_str(),
static_cast< int >(
size ),
261 static_cast< int >( varSize ) );
262 return StatusCode::FAILURE;
267 return StatusCode::SUCCESS;