Re: [ROOT] Root 3.00.06, schema evolution, and StreamerInfo

From: Heather Kelly (heather@lheapop.gsfc.nasa.gov)
Date: Fri Mar 23 2001 - 15:26:49 MET


Hi Rene,

Here are the results:

First Root Session with no files connected:

root [0]
gSystem->Load("I:/packages/RW_root3/TBEvent/v2/Win32Debug/TBEventshr.dll")
(int)0
root [1] Event::Class()->GetStreamerInfo()->ls()

StreamerInfo for class: Event, version=2
  BASE          TObject         offset=  0 type=66 Basic ROOT object
  UInt_t        m_run           offset= 12 type=13 Run number
  UInt_t        m_event         offset= 16 type=13 Event number
  TObjArray*    m_CAL           offset= 20 type=64 List of Calorimeter logs
  TObjArray*    m_ACD           offset= 24 type=64 List of ACD tiles
  TObjArray*    m_TKR           offset= 28 type=64 List of Tracker layers
  TObjArray*    m_MCPart        offset= 32 type=64 List of MC Particle objects
  L1T*          m_L1Trigger     offset= 36 type=64 Level 1 trigger object
  Tagger*       m_Tagger        offset= 40 type=64 Tagger object
   i= 0, TObject         type= 66, offset=  0, len=1, method=0
   i= 1, m_run           type= 13, offset= 12, len=1, method=0
   i= 2, m_event         type= 13, offset= 16, len=1, method=0
   i= 3, m_CAL           type= 64, offset= 20, len=1, method=26744439
   i= 4, m_ACD           type= 64, offset= 24, len=1, method=26743699
   i= 5, m_TKR           type= 64, offset= 28, len=1, method=26744074
   i= 6, m_MCPart        type= 64, offset= 32, len=1, method=26743814
   i= 7, m_L1Trigger     type= 64, offset= 36, len=1, method=26743589
   i= 8, m_Tagger        type= 64, offset= 40, len=1, method=26744489

****************************************************************************
********
Second Root session with the file connected:

root [0]
gSystem->Load("I:/packages/RW_root3/TBEvent/v2/Win32Debug/TBEventshr.dll")
(int)0
root [1] TFile f("myfile.root")
root [2] f.ShowStreamerInfo()

StreamerInfo for class: Event, version=2
  BASE          TObject         offset=  0 type=66 Basic ROOT object
  UInt_t        m_run           offset=  0 type=13 Run number
  UInt_t        m_event         offset=  0 type=13 Event number
  TObjArray*    m_CAL           offset=  0 type=64 List of Calorimeter logs
  TObjArray*    m_ACD           offset=  0 type=64 List of ACD tiles
  TObjArray*    m_TKR           offset=  0 type=64 List of Tracker layers
  TObjArray*    m_MCPart        offset=  0 type=64 List of MC Particle objects
  L1T*          m_L1Trigger     offset=  0 type=64 Level 1 trigger object
  Tagger*       m_Tagger        offset=  0 type=64 Tagger object

****************************************************************************
****

The only thing that strikes me is that the offsets are all zero in this case.

Does this give you any ideas?

Thank you,
Heather


At 07:41 AM 3/23/01 +0000, Rene Brun wrote:
>Hi Heather,
>
>Your understanding of the migration process is correct, including your
>implementation of Event::Streamer.
>I do not understand why you get the Warning message. This message is printed
>when your current class differs from the one used to write the file, but has
>still the same class version number. Could you do the following:
> - run a Root session with no files connected and with the following command:
>   root > Event::Class()->GetStreamerInfo()->ls()
> - run a new session. Connect your file
>   root > TFile f("myfile.root");
>   root > f.ShowStreamerInfo();
>
>Compare the result of StreamerInfo for the first session with the one in the
>second session. Let me know.
>
>Rene Brun
>
>
>Heather Kelly wrote:
>> 
>> Hi,
>> 
>> I am trying to use to Root 3.00.06, and am using Windows NT 4.
>> 
>> I have an Event class that I have used with both Root 2.22/10 and Root
>> 2.25/03.  I wanted to start using the schema evolution that is now
>> available.  To that end I followed the directions in the page
>> http://root.cern.ch/root/SchemaEvolution.html.
>> 
>> In this case, I moved the streamers to the implementation files,
>> incremented the version numbers of all classes, and modified the LinkDef.h
>> so that all classes were of the form:
>> #pragma link C++ class Event-;
>> 
>> Here is an example streamer, where we use the new method ReadBuffer if the
>> version number is > 1:
>> 
>> void Event::Streamer(TBuffer &R__b)
>> {
>>    // Stream an object of class Event.
>>    if (R__b.IsReading()) {
>>       UInt_t R__s, R__c;
>>       Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
>>       if (R__v > 1)
>>       {
>>           Event::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
>>           return;
>>       }
>>       /// Old Versions
>>       TObject::Streamer(R__b);
>>       R__b >> m_run;
>>       R__b >> m_event;
>>       R__b >> m_CAL;
>>       R__b >> m_ACD;
>>       R__b >> m_TKR;
>>       R__b >> m_MCPart;
>>       R__b >> m_L1Trigger;
>>       R__b >> m_Tagger;
>>    } else {
>>        Event::Class()->WriteBuffer(R__b, this);
>>    }
>> }
>> 
>> I can write a file (using Root 3.00.06) just fine, with no warnings...but
>> when I go to open the root file (again in Root 3.00.06)..I receive a number
>> of warning messages:
>> 
>> WARNING, class:Event StreamerInfo read from file:myfile.root
>>         has the same version:2 than the active class
>>         but a different checksum.
>>         You should update the version to ClassDef(Event,3).
>>         Do not try to write objects with the current class definition,
>>         the files will not be readable.
>> 
>> What am I doing incorrectly?
>> 
>> Thank you,
>> Heather
>> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET