Hi All, I want to make my root Data files smaller : here is what I do, but I would like to know if the is a more space efficient way of storing the data. I have the following class to store/access data for a particular detector type. //Class for CsI Detectors class DetectorCsI : public TObject { private: UShort_t fId; //Detector Id UShort_t fPId; //Detector Particle Id UShort_t fChan; //Detector chan UShort_t fTac; //Detector TAC public: DetectorCsI() {;} DetectorCsI(UShort_t id, UShort_t pid, UShort_t chan, UShort_t tac); virtual ~DetectorCsI() {;} //setters and getters inline UShort_t GetId() {return fId; } inline UShort_t GetPId() {return fPId; } inline UShort_t GetChan() {return fChan;} inline UShort_t GetTac() {return fTac; } ClassDef (DetectorCsI,1) //CsI Detector class }; In an event there are a variable number of CsI detectors hit, so I use TClonesArrays, eg : OrsayData::OrsayData() { // Create a Data object for the Orsay experiment //class static variable are 0 for first time call if (fgGes == 0) fgGes = new TClonesArray("DetectorGe", N_GE); //Ge/BGO data array if (fgSaphir == 0) fgSaphir = new TClonesArray("Detector", N_SAPHIR); //array for Saphir if (fgCsIs == 0) fgCsIs = new TClonesArray("DetectorCsI",N_DIAMANT);//array for CsI fGes = fgGes; fSaphir = fgSaphir; fCsIs = fgCsIs; fSumBus1 = fSumBus2 = 0; fNGe = fNCsI = fNSaphir = 0; } (I have similar TClonesArrays for the Ge/BGO and Saphir data.) The event saved to a tree is given by : /////////////////////////////////////////////////////////////////////////////// // Class to store/extract processed data // class OrsayData : public TObject{ private: UChar_t fSumBus1; //Saphir Trigger UChar_t fSumBus2; //Ge/BGO Trigger int fNGe; //! HPGe multiplicity : this info is stored in int fNBGO; //! BGO multiplicity : the TClonesArray below int fNCsI; //! CsI multiplicity : so not wirtten to file int fNSaphir; //! Saphir multiplicity TClonesArray *fGes; // Ge Data TClonesArray *fSaphir; // Saphir Data TClonesArray *fCsIs; // CsI Data static TClonesArray *fgGes; // these are used for static TClonesArray *fgSaphir; // of TClonesArray static TClonesArray *fgCsIs; // of TClonesArray public: OrsayData(); virtual ~OrsayData(); void Clear(Option_t *option = ""); static void Reset(Option_t *option = ""); //setters void SetSumBus1(int SumBus1) {fSumBus1 = SumBus1;} void SetSumBus2(int SumBus2) {fSumBus2 = SumBus2;} void AddGe( UShort_t id, UShort_t chan, UShort_t tac, UShort_t bgo_chan, UShort_t bgo_tac); void AddSaphir( UShort_t id, UShort_t chan, UShort_t tac); void AddCsI( UShort_t id, UShort_t chan, UShort_t tac, UShort_t pid); //getters : processed data inline int GetSumBus1() { return fSumBus1; } inline int GetSumBus2() { return fSumBus2; } inline int GetNGe() { return fNGe; } inline int GetNBGO() { return fNBGO; } inline int GetNCsI() { return fNCsI; } inline int GetNSaphir() { return fNSaphir; } TClonesArray *GetGes() const {return fGes;} TClonesArray *GetSaphir() const {return fSaphir;} TClonesArray *GetCsIs() const {return fCsIs;} ClassDef (OrsayData,1) //Orsay Data class }; Using ->Print() on my TTree I have : *Br 10 :fCsIs : fCsIs_ * *Entries : 48523408 : Total Size= 388477911 bytes File Size = 113153367 * *Baskets : 4551 : Basket Size= 128000 bytes Compression= 3.43 * *............................................................................* *Br 11 :fCsIs.fId : fId[fCsIs_] * *Entries : 48523408 : Total Size= 205360612 bytes File Size = 17502009 * *Baskets : 3120 : Basket Size= 128000 bytes Compression= 11.73 * *............................................................................* *Br 12 :fCsIs.fPId : fPId[fCsIs_] * *Entries : 48523408 : Total Size= 205360396 bytes File Size = 20880526 * *Baskets : 3120 : Basket Size= 128000 bytes Compression= 9.84 * *............................................................................* *Br 13 :fCsIs.fChan : fChan[fCsIs_] * *Entries : 48523408 : Total Size= 205363516 bytes File Size = 21180885 * *Baskets : 3120 : Basket Size= 128000 bytes Compression= 9.70 * *............................................................................* *Br 14 :fCsIs.fTac : fTac[fCsIs_] * *Entries : 48523408 : Total Size= 205360396 bytes File Size = 20198629 * *Baskets : 3120 : Basket Size= 128000 bytes Compression= 10.17 * *............................................................................* So, in this case "fCsIs_" is a large overhead. I presume this is where the number of CsI elements hit is stored per event entry. From the numbers above it would seem this is 8 bytes per event entry. In my particular case this need only be 8 bits since I have less than 255 CsI detectors. Why is the overhead needed by ROOT so large ?. Is there any way to define the size of "fCsIs_" ? Or, am I barking up the wrong tree and there is a more space efficient way of handling this ? Many thanks, Karl ========================================================================== 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 : Sat Jan 04 2003 - 23:50:38 MET