Skip to content
Snippets Groups Projects
Commit 2156115d authored by scott snyder's avatar scott snyder Committed by scott snyder
Browse files

xAODRootAccess: Don't crash opening a schema-evolved file.

Don't crash opening a file that uses some kinds of automatic schema evolution.
If the type of a member changes from one class to another
(for example, from std::vector<double> to std::vector<float>),
then GetExpectedType will give us the on-disk class.
To get the class we use in memory, we need to use GetCurrentClass.
parent 81511495
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,9 @@
#include <TClass.h>
#include <TROOT.h>
#include <TVirtualCollectionProxy.h>
#include <TBranchElement.h>
#include <TStreamerInfo.h>
#include <TStreamerElement.h>
// EDM include(s):
#include "AthContainers/AuxTypeRegistry.h"
......@@ -1469,6 +1472,19 @@ namespace xAOD {
br->GetName() );
}
// Check for schema evolution:
// If a branch has automatic schema evolution from one class to another,
// then what we get from GetExpectedType will be the on-disk class.
// What we have in memory is given by GetCurrentClass.
if (expectedClass) {
if (TBranchElement* bre = dynamic_cast<TBranchElement*> (br)) {
TClass* newClass = bre->GetCurrentClass();
if (newClass && newClass != expectedClass) {
expectedClass = newClass;
}
}
}
// If this is a primitive variable, and we're still not sure whether this
// is a store for an object or a container, the answer is given...
if( ( ! expectedClass ) &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment