Re: [ROOT] Streamer options (fwd)

From: Peter H. L. Christiansen (pchristi@nbi.dk)
Date: Fri Mar 30 2001 - 09:05:53 EST

  • Next message: hagel@comp.tamu.edu: "Re: BB Calibration."

    Hi
    
    I just asked a question to the roottalk mailing list about the possibility
    of having a debug level in a class so you sometimes write out everything
    and sometimes less. I beleive that one of the things that have made it a
    little sour to analyse the tpc data is the difficulty in connecting data
    all the way. I think we should keep this in mind when we update BRAT
    before the next running period.
    So normally a local track would just be position, slope and covariance
    matrix, but if you want you can have the energy, hits etc.
    
    I have started writing some header files for new TPC classes (hits and
    tracks) where I would like to incorporate this. I will circulate them to
    the interested people. Those that I beleive are interested are :
    Jens Ivar, Kris, Flemming, Christian, Trine, Bjørn, Truls
    
    Cheers
       Peter
    
    ---------- Forwarded message ----------
    Date: Fri, 30 Mar 2001 13:30:15 +0000
    From: Rene Brun <Rene.Brun@cern.ch>
    To: Peter H. L. Christiansen <pchristi@nbi.dk>
    Cc: Roottalk <roottalk@pcroot.cern.ch>
    Subject: Re: [ROOT] Streamer options
    
    Hi Peter,
    
    With version 3.00/6 this is possible (see below), but not recommended.
    The data structure for the automatic Streamers is computed from
    the current status of the data member definition.
    The normal way (static way) to discard a data member from the I/O process
    is to add a "!" character as the first character in the comment field.
    Instead of this character, you can use the following dynamic way:
    Assuming a class MyClass and a data member fMaybe,do:
       const Int_t kObjIsPersistent = 4;
       MyClass::Class()->GetDataMember("fMaybe")->SetBit(kObjIsPersistent,0);
    Following this call, you can check that the member "fMaybe" is not in
    the StreamerInfo with:
       MyClass::Class()->GetStreamerInfo()->ls();
    
    or vice-versa, in case you had specified the "!" in the comment field,
    you can force this member to be persistent by:
      MyClass::Class()->GetDataMember("fMaybe")->SetBit(kObjIsPersistent,1);
    
    This technique will work if you want to set the option once for the duration
    of the job. It would also be possible to do/undo/do/.. in the same job.
    This will require a few more lines of code to delete the current StreamerInfo
    , set the bit and recompute the StreamerInfo.
    
    Rene Brun
    
    Peter H. L. Christiansen wrote:
    >
    > Hi ROOT users
    >
    > I have a class where I sometimes wants to write down some elements and
    > sometimes not. Is there a smart way of introducing a debug switch or do
    > you have to write the streamer yourself ?
    >
    > If I split the class in 2, like hit(always write) and hitdetails(inherits
    > from hit) (sometimes write) can I then do something smart ?
    >
    > Cheers
    >    Peter
    



    This archive was generated by hypermail 2b29 : Fri Mar 30 2001 - 09:07:00 EST