I have a class that has evolved from:
const int gkAliHLTDDLListSize = 30;
struct AliHLTEventDDL
{
AliHLTUInt32_t fCount;
AliHLTUInt32_t fList[gkAliHLTDDLListSize];
};
class AliHLTReadoutList : public TNamed
{
private:
AliHLTEventDDL fReadoutList;
ClassDef(AliHLTReadoutList, 2)
};
to the following:
const int gkAliHLTDDLListSize = 31;
struct AliHLTEventDDL
{
AliHLTUInt32_t fCount;
AliHLTUInt32_t fList[gkAliHLTDDLListSize];
};
class AliHLTReadoutList : public TNamed
{
private:
AliHLTEventDDL fReadoutList;
ClassDef(AliHLTReadoutList, 3)
};
I wrote a schema evolution rule to convert the old versions into new ones when reading the class:
#pragma read sourceClass="AliHLTReadoutList" version="[2]" targetClass="AliHLTReadoutList" \
source="AliHLTEventDDL fReadoutList" target="fReadoutList" \
code="{\
fReadoutList = onfile.fReadoutList;\
if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)\
{\
fReadoutList.fList[30] = fReadoutList.fList[29];\
fReadoutList.fList[29] = fReadoutList.fList[28];\
fReadoutList.fList[28] = 0x0;\
fReadoutList.fCount = gkAliHLTDDLListSize;\
}\
}"
Everything works fine when streaming a class from TFile, but when the object was written to a TTree the schema evolution rules are never invoked. Why could this be? What am I doing wrong?