Hi Klaus,
I cannot reproduce your problem. Please indicate which version of ROOT
you are using and which system.
>From the bits of information you give, I have build a small class Data8pi
like yours below and created a test program in the attachement.
Untar this file, then do:
.x pi8.C
This will generate a file pi8.root
You can generate the corresponding code with MakeClass with:
root > TFile f("pi8.root")
root > T.MakeClass("T")
You can test the code in T.C and T.h. It should work.
You can compare the files T.C and T.h with the ones I generated
from the small program (files TPI.C,h in the tar file)
Rene Brun
On Fri, 16 Nov 2001, K. Hauschild wrote:
> To save space I have removed the fUniqueId and fBits using
>
> Data8pi::Class()->IgnoreTObjectStreamer(); //Remove fUniqueId, fBits
>
> for example.
>
>
> This also has the unwanted side effect of removing the leaves
> fH and fK in of the Data class below.
>
> So, how can I save space by removing the unwanted fUniqueId fBits
> and keep the UShort_t data fH and fK ?
>
>
>
> I also noticed that fNGe, fNBGO and fNCsI (which
> are used for the size of the TClonesArrays) are redundant since
> the branches fGes, fBGO and fCsI contain this information so I
> remove these from the tree using the //! comment. This saved further
> space.
>
> ie
>
> tree.Show(13)
> ======> EVENT:13
> fUniqueID = 0
> fBits = 50331648
> fH = 846
> fK = 13
> fGes = 1
> fGes.fId = 14
> fGes.fChan = 1358
> fGes.fTac = 141
> fCsIs = 2
> fCsIs.fId = 10 36
> fCsIs.fChan = 747 73
> fCsIs.fTac = 2421 1920
>
>
> Could someone point me in the right direction to help me understand
> how I can selectively read the fGes, fCsIs and fBGOs information.....
>
> Many thanks,
>
> Karl
>
>
> Also below is a partial listing from tree->MakeClass() :
>
> //============================================================================
>
> class Data8pi : public TObject{
> private:
> UShort_t fH; // BGO ball sum energy
> UShort_t fK; // BGO ball multiplicity
> UShort_t fNGe; //! HPGe multiplicity : this info is stored in
> UShort_t fNBGO; //! BGO multiplicity : the TClonesArray below
> UShort_t fNCsI; //! CsI multiplicity : so not wirtten to file
>
> TClonesArray *fGes; // Ge Data (always non-zero)
> TClonesArray *fBGOs; // BGO Data
> TClonesArray *fCsIs; // CsI Data
>
> static TClonesArray *fgGes; // these are used for
> static TClonesArray *fgBGOs; // the initialisation
> static TClonesArray *fgCsIs; // of TClonesArray
>
> public:
> Data8pi();
> virtual ~Data8pi();
>
> void Clear(Option_t *option = "");
> static void Reset(Option_t *option = "");
>
> //setters
> void SetHK(UShort_t h, UShort_t k) { fH = h; fK = k; }
>
> void AddGe(UShort_t id, UShort_t chan, UShort_t tac);
> void AddBGO(UShort_t id, UShort_t chan, UShort_t tac);
> void AddCsI(UShort_t id, UShort_t chan, UShort_t tac);
>
> //getters
> TClonesArray *GetGes() const {return fGes;}
> TClonesArray *GetBGOs() const {return fBGOs;}
> TClonesArray *GetCsIs() const {return fCsIs;}
>
> ClassDef (Data8pi,1) //8pi Data class
> };
>
> class Ge8pi : public TObject {
>
> private:
> UShort_t fId; //Germanium Id
> UShort_t fChan; //Germanium chan (8pi => 0.25 keV/chan)
> UShort_t fTac; //Germanium TAC wrt RF
>
> public:
> Ge8pi() {;}
> Ge8pi(UShort_t id, UShort_t chan, UShort_t tac);
> virtual ~Ge8pi() {;}
>
> //setters and getters
> UShort_t GetId() const {return fId;}
> UShort_t GetChan() const {return fChan;}
> UShort_t GetTac() const {return fTac;}
>
> ClassDef (Ge8pi,1) //8pi Ge Data class
> };
>
> The BGO and CsI classes are the same as Data8pi.
>
> -----------------MakeClass------------------------------------------------
> const Int_t kMaxfGes = 4;
> const Int_t kMaxfBGOs = 1;
> const Int_t kMaxfCsIs = 5;
>
> class T {
> public :
> TTree *fChain; //pointer to the analyzed TTree or TChain
> Int_t fCurrent; //current Tree number in a TChain
> //Declaration of leaves types
> UInt_t fUniqueID;
> UInt_t fBits;
> UShort_t fH;
> UShort_t fK;
> Int_t fGes_;
> UShort_t fGes_fId[kMaxfGes];
> UShort_t fGes_fChan[kMaxfGes];
> UShort_t fGes_fTac[kMaxfGes];
> Int_t fBGOs_;
> UShort_t fBGOs_fId[kMaxfBGOs];
> UShort_t fBGOs_fChan[kMaxfBGOs];
> UShort_t fBGOs_fTac[kMaxfBGOs];
> Int_t fCsIs_;
> UShort_t fCsIs_fId[kMaxfCsIs];
> UShort_t fCsIs_fChan[kMaxfCsIs];
> UShort_t fCsIs_fTac[kMaxfCsIs];
>
> //List of branches
> TBranch *b_fUniqueID;
> TBranch *b_fBits;
> TBranch *b_fH;
> TBranch *b_fK;
> TBranch *b_fGes;
> TBranch *b_fGes_fId;
> TBranch *b_fGes_fChan;
> TBranch *b_fGes_fTac;
> TBranch *b_fBGOs;
> TBranch *b_fBGOs_fId;
> TBranch *b_fBGOs_fChan;
> TBranch *b_fBGOs_fTac;
> TBranch *b_fCsIs;
> TBranch *b_fCsIs_fId;
> TBranch *b_fCsIs_fChan;
> TBranch *b_fCsIs_fTac;
>
> T(TTree *tree=0);
> ~T();
> Int_t Cut(Int_t entry);
> Int_t GetEntry(Int_t entry);
> Int_t LoadTree(Int_t entry);
> void Init(TTree *tree);
> void Loop();
> Bool_t Notify();
> void Show(Int_t entry = -1);
> };
>
> #endif
>
>
> ==========================================================================
>
> CEA Saclay, DAPNIA/SPhN Phone : (33) 01 69 08 7553
> Bat 703 - l'Orme des Merisiers Fax : (33) 01 69 08 7584
> F-91191 Gif-sur-Yvette E-mail : khauschild@cea.fr
> France karl_hauschild@yahoo.co.uk
> WWW: http://www-dapnia.cea.fr/Sphn
>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET