#include #include #include #define MAX_EVENTS 20000 void test() { gRandom->SetSeed(12345); UInt_t n; UChar_t cx, cy; UShort_t *a1 = new UShort_t[MAX_EVENTS]; UShort_t *a2 = new UShort_t[MAX_EVENTS]; UShort_t *a3 = new UShort_t[MAX_EVENTS]; UShort_t *a4 = new UShort_t[MAX_EVENTS]; UShort_t *a5 = new UShort_t[MAX_EVENTS]; TFile file( "test1.root", "recreate" ); TTree *tree = new TTree( "data", "comment" ); tree->Branch( "cx", &cx, "cx/b" ); tree->Branch( "cy", &cy, "cy/b" ); tree->Branch( "n", &n, "n/i" ); tree->Branch( "a1", a1, "a1[n]/s" ); tree->Branch( "a2", a2, "a2[n]/s" ); tree->Branch( "a3", a3, "a3[n]/s" ); tree->Branch( "a4", a4, "a4[n]/s" ); tree->Branch( "a5", a5, "a5[n]/s" ); int i, j; for( i=0; i<32; i++ ) { for( j=0; j<32; j++ ) { cx = i; cy = j; n = (UInt_t) gRandom->Uniform(MAX_EVENTS-1); for( UInt_t k=0; kGaus(1000, 100); a2[k] = (UShort_t) gRandom->Gaus(1000, 100); a3[k] = (UShort_t) gRandom->Gaus(1000, 100); a4[k] = (UShort_t) gRandom->Gaus(1000, 100); a5[k] = (UShort_t) gRandom->Gaus(1000, 100); } tree->Fill(); printf( "%02d:%02d\r", i, j ); } } tree->Write(); }