Hi Rene,
Actually...it seems I am one of those pathological cases.
I tried 3.03.04...my problems with TRef disappeared...
When I use 3.02.07 and follow the code in the debugger, the TRef Streamer
had this code:
if (R__b.IsReading()) {
TObject::Streamer(R__b);
R__b >> pidf;
fPID = TProcessID::ReadProcessID(pidf,gFile);
pidf was zero and gFile was null..resulting in a null fPID. The new
version seems to use
TFile *file = (TFile*)R__b.GetParent();
rather than relying on gFile
So all is well in the development version...
Thanks, (I think!)
Heather
At 09:26 AM 4/20/02 +0200, Rene Brun wrote:
>Hi Heather,
>
>Could you send me a running small example that I can use
>to test this problem? I cannot see what could be wrong with
>this simple case.
>In the development version 3.03, I fixed a few problems with TRef
>in some pathological cases. May be try it before sending me
>an example.
>
>Rene Brun
>
>On Fri, 19 Apr 2002, Heather Kelly wrote:
>
>> Hi,
>>
>> I am using ROOT 3.02.07 on Windows.
>>
>> I am trying to use TRef and I seem to be running into a problem. I have a
>> class like this, where I want to store a reference to another object:
>>
>> class McParticle : public TObject {
>>
>> const McParticle* getMother() const { return
>> (McParticle*)m_mother.GetObject(); };
>>
>> private:
>> // This stores a reference to another object of type McParticle
>> TRef m_mother;
>>
>> };
>>
>> When I create a new ROOT file, and open it in ROOT interactively, I am able
>> to retrieve the reference via the call to getMother(). However, if I
>> attempt to do the same thing with a compiled program that uses ROOT,
>> getMother() consistently returns null.
>>
>> Clearly there is something I do not understand.
>>
>> For example, suppose I have a TObjArray of McParticles, which I iterate
>> over, here is an example call to retrieve the reference - which fails in
>> compiled code:
>>
>> while (pRoot = (McParticle*)partIter.Next()) {
>> McParticle *momRoot = pRoot->getMother();
>>
>> In this particular case, all of the McParticles are stored to the same file
>> and in the same branch...
>>
>> Thanks,
>> Heather
>>
>
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET