Example to write & read a Tree built with a complex class inheritance tree.
It demonstrates usage of inheritance and TClonesArrays This is simplified / stripped extract of an event structure which was used within the Marabou project.
To run this example, do:
#ifndef CLONESA_EVENT_SECOND_RUN
#define CLONESA_EVENT_SECOND_RUN yes
gROOT->ProcessLine(
"clonesA_Event(true)");
}
#else
{
if (
gROOT->GetVersionInt() < 30503 ) {
cout << "Works only with ROOT version >= 3.05/03" << endl;
return;
}
if (
gROOT->GetVersionDate() < 20030406 ) {
cout << "Works only with ROOT CVS version after 5. 4. 2003" << endl;
return;
}
TFile *
hfile =
new TFile(
"clonesA_Event.root",
"RECREATE",
"Test TClonesArray");
tree->Branch(
"top1",
"TUsrSevtData1",&
event1,8000,99);
tree->Branch(
"top2",
"TUsrSevtData2",&
event2,8000,99);
cout <<
"event " <<
ev << endl;
}
}
{
cout <<
"Pileup event1: " <<
event1->GetPileup() << endl;
cout <<
"Pileup event2: " <<
event2->GetPileup() << endl;
}
}
}
#endif
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TSystem * gSystem
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
A TTree represents a columnar dataset.
- Author
- The ROOT Team
Definition in file clonesA_Event.C.