//TestPersist.h //Used to test how non-persistent data members are treated when reading //from TTrees #include "TObject.h" #define CUSTOM_STREAMER class TestPersist : public TObject { private: Int_t a;//this member is persistent Int_t b;//! this member is not persistent public: TestPersist(); virtual ~TestPersist(); void SetA(Int_t); Int_t GetA(); void SetB(Int_t); Int_t GetB(); Bool_t IsOK(); ClassDef(TestPersist,1)//Used to test how non-persistent data members are treated when reading }; //TestPersist.C //#include "TestPersist.h" ClassImp(TestPersist) TestPersist::TestPersist() { a=0; b=20; } TestPersist::~TestPersist() { } void TestPersist::SetA(Int_t i) { a=i; } void TestPersist::SetB(Int_t i) { b=i; } Int_t TestPersist::GetA() { return a; } Int_t TestPersist::GetB() { return b; } Bool_t TestPersist::IsOK() { return (a > b); } /////////////////////////////////////////////////////////////////////////// #ifdef CUSTOM_STREAMER // void TestPersist::Streamer(TBuffer &R__b) { // Stream an object of class TestPersist. UInt_t R__s, R__c; if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } TObject::Streamer(R__b); R__b >> a; R__b.CheckByteCount(R__s, R__c, TestPersist::IsA()); } else { R__c = R__b.WriteVersion(TestPersist::IsA(), kTRUE); TObject::Streamer(R__b); R__b << a; R__b.SetByteCount(R__c, kTRUE); } } // #endif //////////////////////////////////////////////////////////////////////////////