[ROOT] Re: TTree question

From: Anton Fokin (anton.fokin@smartquant.com)
Date: Sun Jan 28 2001 - 10:52:47 MET


Hi Rene,

that's fine but I do not see what's wrong with UInt_t fDayNumber and TDate
class. The manual says

----
If a data member is a basic type, it becomes one basic branch of class
TBranch.
If a data member is an object of a class derived from TObject, the data
members of this object are also split into branches (one level only).
----

Is TTree mechanism trying to split static members?

/Anton


----- Original Message -----
From: Rene Brun <brun@pcbrun.cern.ch>
To: Anton Fokin <anton.fokin@smartquant.com>
Cc: roottalk <roottalk@pcroot.cern.ch>; Rene Brun <Rene.Brun@cern.ch>
Sent: Saturday, January 27, 2001 11:04 PM
Subject: Re: TTree question


> Hi Anton,
> In split mode a branch cannot contain basic type such as strings.
> See the list of limitations at:
>   http://root.cern.ch/root/HowtoWriteTree.html
>
> This limitation is about to be removed with the new TTree split
> mechanism that I am currently testing. Your class will be easily
> split by the new algorithm.
>
> Rene Brun
>
>
> On Sat, 27 Jan 2001, Anton Fokin wrote:
>
> > Hi,
> >
> > I am trying to improve I/O in my package and I have a number of
questions
> > about TTree performance.
> >
> > I store objects of THistoricalData class (see below) in a tree. One of
> > THistoricalData fields is of TDate class (see below). TDate holds number
of
> > days from day zero, fNDays, which is UInt_t. Before it was ULong_t and
it
> > cused warning in the split mode (see Eddy Offerman mail/Rene reply). Now
I
> > have changed it to UInt_t but I still get a warning:
> >
> > Loading data for COMPX (Nasdaq Combined Composite Index)
> > Warning in <TTree::Branch>: Cannot process member:fDate
> >
> > 1. Could you please explain this.
> >
> > 2. If I use non-split mode and set file compression level to 0, I see
that
> > the file is filled up with "THistoricalData" strings, I suppose for
every
> > entry in the tree. This makes 5 MB file out of ~800KB binary data I am
> > loading into the tree. Do you really write class label for every entry,
not
> > only for the branch???
> >
> > PS. in the split mode I get 12Mb !!!! file out of the same 800KB but
this I
> > would not blame before I clarify my question about warning message for
> > fNDays field.
> >
> > Regards,
> > Anton
> >
> > class THistoricalData : public TObject {
> > public:
> > enum EDataOption {
> >   kOK,
> >   kNotAvailable,
> >   kInterpolated
> > };
> > protected:
> >   TDate   fDate;       // Date
> >   Float_t fBid;        // Bid
> >   Float_t fAsk;        // Ask
> >   Float_t fHigh;       // High
> >   Float_t fLow;        // Low
> >   Float_t fClose;      // Close
> >   UInt_t  fVolume;     // Volume
> >    Int_t  fOption;     // Option
> > public:
> >           THistoricalData();
> >           THistoricalData(TDate Date, Float_t Bid, Float_t Ask, UInt_t
> > Volume, Int_t Option = kOK);
> >           THistoricalData(TDate Date, Float_t High, Float_t Low, Float_t
> > Close, UInt_t Volume, Int_t Option = kOK);
> >
> >     TDate GetDate()   { return fDate;   }
> >   Float_t GetBid()    { return fBid;    }
> >   Float_t GetAsk()    { return fAsk;    }
> >   Float_t GetHigh()   { return fHigh;   }
> >   Float_t GetLow()    { return fLow;    }
> >   Float_t GetClose()  { return fClose;  }
> >    UInt_t GetVolume() { return fVolume; }
> >     Int_t GetOption() { return fOption; }
> >
> >   Float_t GetPrice(Int_t Option = TFinObject::kTypicalPrice);
> >
> >      void Set(TDate Date, Float_t Bid, Float_t Ask, UInt_t Volume, Int_t
> > Option = kOK);
> >      void Set(TDate Date, Float_t High, Float_t Low, Float_t Close,
UInt_t
> > Volume, Int_t Option = kOK);
> >
> >      void SetDate(TDate Date)       { fDate   = Date;   }
> >      void SetBid(Float_t Bid)       { fBid    = Bid;    }
> >      void SetAsk(Float_t Ask)       { fAsk    = Ask;    }
> >      void SetHigh(Float_t High)     { fHigh   = High;   }
> >      void SetLow(Float_t Low)       { fLow    = Low;    }
> >      void SetClose(Float_t Close)   { fClose  = Close;  }
> >      void SetVolume(UInt_t Volume)  { fVolume = Volume; }
> >      void SetOption(Int_t Option)   { fOption = Option; }
> >
> >      void Print(const char* Option = "");
> >
> >   ClassDef(THistoricalData, 100) // Daily historical data
> > };
> >
> > #endif
> >
> >
> > class TDate : public TObject {
> >  public:
> >                           TDate();
> >                           TDate(TMonth Month, Int_t Day, Int_t Year);
> >                           TDate(Int_t DayOfYear, Int_t Year);
> >                           TDate(const TDate &Date);
> >                           TDate(UInt_t DayNumber);
> >                           TDate(const char* Date, const char* Pattern =
> > "yymmdd");
> >                           TDate(UInt_t Date, const char* Pattern);
> >                           TDate(const struct tm *Date);
> >
> >         TDate             AddMonths(Int_t MonthNumber);
> >         TDate             AddWeeks(Int_t WeekNumber);
> >         TDate             AddYears(Int_t YearNumber);
> >         TDate             BeginDST();
> >         static TDate      BeginDST(Int_t Year);
> >         Int_t             Day();
> >         UInt_t           DayNumber();
> >         TWeekDay          DayOfWeek();
> >         Int_t             DayOfYear();
> >         Int_t             DaysInMonth();
> >         static Int_t      DaysInMonth(TMonth Month, Int_t Year);
> >         Int_t             DaysInYear();
> >         static Int_t      DaysInYear(Int_t Year);
> >         TDate             EndDST();
> >         static TDate      EndDST(Int_t Year);
> >         Bool_t            IsDST();
> >         static Bool_t     IsDST(TDate &Date);
> >         Bool_t            IsLeapYear();
> >         static Bool_t     IsLeapYear(Int_t year);
> >         Bool_t            IsValid();
> >         static Bool_t     IsValid(TMonth Month, Int_t Day, Int_t Year);
> >         TMonth            Month();
> >
> >         Bool_t            operator!=(const TDate &Date) const;
> >         TDate             operator+(Int_t DayNumber) const;
> >         TDate             operator+(long DayNumber) const;
> >         TDate             operator++();
> >         TDate             operator++(int);
> >         TDate&            operator+=(Int_t DayNumber);
> >         TDate&            operator+=(long DayNumber);
> >         long              operator-(const TDate &Date) const;
> >         TDate             operator-(Int_t DayNumber) const;
> >         TDate             operator-(long DayNumber) const;
> >         TDate             operator--();
> >         TDate             operator--(int);
> >         TDate&            operator-=(Int_t DayNumber);
> >         TDate&            operator-=(long DayNumber);
> >         Bool_t            operator<(const TDate &Date) const;
> >         Bool_t            operator<=(const TDate &Date) const;
> >         TDate&            operator=(const TDate &Date);
> >         Bool_t            operator==(const TDate &Date) const;
> >         Bool_t            operator>(const TDate &Date) const;
> >         Bool_t            operator>=(const TDate &Date) const;
> >
> > //        TDate&            operator=(const UInt_t DayNumber);
> >         Bool_t            operator==(const UInt_t DayNumber) const;
> >         Bool_t            operator!=(const UInt_t DayNumber) const;
> >
> > //        static void       SetBeginDST(TMonth Month, TWeekDay WeekDay);
> > //        static void       SetEndDST(TMonth Month, TWeekDay WeekDay);
> >         static TDate      Today();
> >         Int_t             WeekOfMonth();
> >         Int_t             WeekOfYear();
> >         Int_t             WeeksInYear();
> >         static Int_t      WeeksInYear(Int_t Year);
> >         Int_t             Year();
> >
> >         UInt_t            Convert();
> >         TString           AsString();
> >         void              Print(const char* Option = "");
> >
> >         // Pope Gregor XIII's reform cancelled 10 days:
> >         // the day after Oct 4 1582 was Oct 15 1582
> >         static const Int_t    ReformYear;
> >         static const TMonth   ReformMonth;
> >         static const UInt_t  ReformDayNumber;
> >
> > protected:
> >         // Daylight Savings Time Month and Day of Week
> >         static TMonth   BeginDSTMonth;
> >         static TWeekDay BeginDSTDay;
> >         static TMonth   EndDSTMonth;
> >         static TWeekDay EndDSTDay;
> >
> > protected:
> >              TDate  Set(TMonth Month, Int_t Day, Int_t Year);
> >            UInt_t  MakeDayNumber(TDateEntry *DateEntry);
> >         TDateEntry* FromDayNumber(UInt_t DayNumber);
> >
> > private:
> >         UInt_t fDayNumber;
> >
> >
> >   ClassDef(TDate, 100) // Date manipulation
> > };
> >
> >
> >
>
>
>



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