Hi,
I have quite a complicated problem, but since I’m getting lost in it myself, I’ll try to summarise:
I’m trying to extend the TSelector class by writing my own class inheriting from it, and then my analysis classes inherit from this extended class rather than TSelector. (I think this is a general question though, that’s why I didn’t write in the PROOF forum.) The problem is that my “extension” to TSelector is pretty complicated by now. I try to re-use an older analysis framework, in which this inheritance tree worked pretty well (The inheritance tree is attached to the post.), it just used TObject instead of TSelector previously. (The actual analysis classes inherit from SCycleBase in my code.)
In the code that I run locally, I instantiate my analysis classes like this:
[code]TClass* testClass = gROOT->GetClass( “FirstCycle”, true );
if( ! testClass || ! testClass->InheritsFrom( “SCycleBase” ) ) {
cout << “FirstCycle could not be loaded!” << endl;
return;
} else {
cout << “FirstCycle class loaded” << endl;
}
SCycleBase* cycle = reinterpret_cast< SCycleBase* >( testClass->New() );[/code]
With this I get a perfectly working instance of the FirstCycle class that I can access through its SCycleBase interface, including the interface provided by TSelector. I can even write:
SCycleBaseBase* cycle = reinterpret_cast< SCycleBaseBase* >( testClass->New() );
and that still lets me use the TSelector interface of the newly created object. If however I try to instantiate the object like:
TSelector* cycle = reinterpret_cast< TSelector* >( testClass->New() );
everything breaks… The cycle pointer is not valid in this case, and any usage of it results in a segmentation fault.
I tried playing with the order of the inheritance in the base classes, but to no avail so far. In my local code I can of course create a valid pointer to a TSelector object by creating a pointer to let’s say an SCycleBaseBase object first and then casting it to a TSelector object pointer. But the problem comes of course when I try to use my analysis class on PROOF. Since PROOF tries to instantiate my analysis class similarly to what I wrote, it always crashes.
Any ideas on the matter would be greatly appreciated. I know the inheritance tree could be simplified and that could solve the issue, but that would take a lot of work, and would disable a lot of nice features the code has currently.
Cheers,
Attila