6 gSystem->Load(
"libTable");
10 TObject *nextObject = 0;
15 UInt_t totalEvent = 4;
16 UInt_t runNumber = 20010301;
20 for (i = 1;i<totalEvent;i++) {
21 outSet->
NextEventPut(ds,UInt_t(i),UInt_t(runNumber+j+10*run.Rndm()-5));
26 printf(
" ----------------------> TFile has been created <--------------------\n");
27 TFile *f =
new TFile(
"test.root");
30 Int_t size = readObj.TotalKeys();
31 printf(
" The total number of the objects: %d\n",size);
36 printf(
" -- > Loop over all objects, read them in to memory one by one < -- \n");
37 for( readObj = 0; int(readObj) < size; readObj.SkipObjects() ){
38 nextObject = *readObj;
39 printf(
" %d bytes of the object \"%s\" of class \"%s\" written with TKey \"%s\" has been read from file\n"
41 ,nextObject->GetName()
42 ,nextObject->IsA()->GetName()
43 ,(
const char *)readObj
49 printf(
" -- > Now loop over all objects in inverse order < -- \n");
50 for( readObj = size-1; (int)readObj >= 0; readObj.SkipObjects(-1))
52 nextObject = *readObj;
54 printf(
" Object \"%s\" of class \"%s\" written with TKey \"%s\" has been read from file\n"
55 ,nextObject->GetName()
56 , nextObject->IsA()->GetName()
57 ,(
const char *)readObj
61 printf(
"Error reading file by index\n");
66 printf(
" -- > Loop over the objects starting from the object with the key name \"event.02.01\" < -- \n");
67 for( readObj =
"event.02.01"; (
const char *)readObj != 0; readObj.SkipObjects()){
68 nextObject = *readObj;
69 printf(
" Object \"%s\" of class \"%s\" written with Tkey \"%s\" has been read from file\n"
70 , nextObject->GetName()
71 , nextObject->IsA()->GetName()
72 , (
const char *)readObj
77 printf(
" -- > Loop over the objects starting from the 86-th object < -- \n");
78 for( readObj = (
const char *)(readObj = 86); (
const char *)readObj != 0; readObj.SkipObjects()){
79 nextObject = *readObj;
80 printf(
" Object \"%s\" of class \"%s\" written with Tkey \"%s\" has been read from file\n"
81 , nextObject->GetName()
82 , nextObject->IsA()->GetName()
83 , (
const char *)readObj
virtual Int_t NextEventPut(TObject *obj, UInt_t eventNum, UInt_t runNumber, const char *name=0)
Create a special TKey name with obj provided and write it out.