Hello,
I’m having an issue where the ROOT files I’m writing from a simple set of event model classes are much, much larger than I would expect. About 50K events ends up being around 13 gig!
The generated StreamerInfo looks reasonable e.g.
StreamerInfo for class: event::SimTrackerHit, version=1, checksum=0xc8ac5521
TObject BASE offset= 0 type=66 Basic ROOT object
int id_ offset= 16 type= 3
int layerID_ offset= 20 type= 3
float edep_ offset= 24 type= 5
float time_ offset= 28 type= 5
float px_ offset= 32 type= 5
float py_ offset= 36 type= 5
float pz_ offset= 40 type= 5
float x_ offset= 44 type= 5
float y_ offset= 48 type= 5
float z_ offset= 52 type= 5
float pathLength_ offset= 56 type= 5
TRef simParticle_ offset= 64 type=61
i= 0, TObject type= 66, offset= 0, len=1, method=0
i= 1, id_ type= 23, offset= 16, len=2, method=0 [optimized]
i= 2, edep_ type= 25, offset= 24, len=9, method=0 [optimized]
i= 3, simParticle_ type= 61, offset= 64, len=1, method=0
So it should only need about 65 bytes to store an object of the SimTrackerHit class.
The tree entry itself for the object also looks okay …
root [21] t->Show(0)
======> EVENT:0
Event = (event::SimEvent*)0x404e110
fUniqueID = 0
fBits = 50331648
eventNumber_ = 1000
run_ = 1
timestamp_ = 1473280918
weight_ = 1.23
recoilSimHits_ = 1
recoilSimHits_.fUniqueID = 0
recoilSimHits_.fBits = 50331648
recoilSimHits_.id_ = 22222222
recoilSimHits_.layerID_ = 0
recoilSimHits_.edep_ = 2.345000
recoilSimHits_.time_ = 42.000000
recoilSimHits_.px_ = 1.000000
recoilSimHits_.py_ = 2.000000
recoilSimHits_.pz_ = 3.000000
recoilSimHits_.x_ = 50.000000
recoilSimHits_.y_ = 40.000000
recoilSimHits_.z_ = 2000.000000
recoilSimHits_.pathLength_ = 0.000000
recoilSimHits_.simParticle_ = TRef
But the actual size taken by each data member of this single object within the event is enormous …
*............................................................................*
*Br 41 :recoilSimHits_ : Int_t recoilSimHits__ *
*Entries : 1 : Total Size= 12892 bytes File Size = 91 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 42 :recoilSimHits_.fUniqueID : UInt_t fUniqueID[recoilSimHits__] *
*Entries : 1 : Total Size= 983 bytes File Size = 113 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 43 :recoilSimHits_.fBits : UInt_t fBits[recoilSimHits__] *
*Entries : 1 : Total Size= 955 bytes File Size = 109 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 44 :recoilSimHits_.id_ : Int_t id_[recoilSimHits__] *
*Entries : 1 : Total Size= 941 bytes File Size = 107 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 45 :recoilSimHits_.layerID_ : Int_t layerID_[recoilSimHits__] *
*Entries : 1 : Total Size= 976 bytes File Size = 112 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 46 :recoilSimHits_.edep_ : Float_t edep_[recoilSimHits__] *
*Entries : 1 : Total Size= 955 bytes File Size = 109 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 47 :recoilSimHits_.time_ : Float_t time_[recoilSimHits__] *
*Entries : 1 : Total Size= 955 bytes File Size = 109 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 48 :recoilSimHits_.px_ : Float_t px_[recoilSimHits__] *
*Entries : 1 : Total Size= 941 bytes File Size = 107 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 49 :recoilSimHits_.py_ : Float_t py_[recoilSimHits__] *
*Entries : 1 : Total Size= 941 bytes File Size = 107 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 50 :recoilSimHits_.pz_ : Float_t pz_[recoilSimHits__] *
*Entries : 1 : Total Size= 941 bytes File Size = 107 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 51 :recoilSimHits_.x_ : Float_t x_[recoilSimHits__] *
*Entries : 1 : Total Size= 934 bytes File Size = 106 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 52 :recoilSimHits_.y_ : Float_t y_[recoilSimHits__] *
*Entries : 1 : Total Size= 934 bytes File Size = 106 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 53 :recoilSimHits_.z_ : Float_t z_[recoilSimHits__] *
*Entries : 1 : Total Size= 934 bytes File Size = 106 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 54 :recoilSimHits_.pathLength_ : Float_t pathLength_[recoilSimHits__] *
*Entries : 1 : Total Size= 997 bytes File Size = 115 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 55 :recoilSimHits_.simParticle_ : TRef simParticle_[recoilSimHits__] *
*Entries : 1 : Total Size= 1020 bytes File Size = 124 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
For instance ROOT claims to be taking 955 bytes to store a single float value!
In my single event test, I use the typical pattern for writing the event out using a tree …
rootFile = new TFile("event_model_test.root", "RECREATE");
tree = new TTree("Event", "event tree");
SimEvent* event = new SimEvent();
tree->Branch("Event", "event::SimEvent", &event, 32000, 3);
SimTrackerHit* trackerHit = (SimTrackerHit*) event->addObject(event::RECOIL_SIM_HITS);
// set values on trackerHit
tree->Fill();
rootFile->Write();
rootFile->Close();
I had suspected there was some issue in my code like perhaps objects not being cleared between events, but now I see that this is a problem even if I write an event only with one object in it!
Can anyone give me some hints as to how I would go about debugging this issue? Why would ROOT be taking up so much space to store primitive values like floats and ints?
Thanks.
–Jeremy