69 TFile f(
"tree108.root",
"RECREATE");
72 TTree t4(
"t4",
"A Tree with Events");
78 t4.Branch(
"event_split", &event,16000,99);
79 t4.Branch(
"event_not_split", &event,16000,0);
85 for (
Int_t ev = 0; ev < 100; ev++) {
87 gRandom->Rannor(sigmat, sigmas);
88 Int_t ntrack =
Int_t(600 + 600 * sigmat / 120.);
90 sprintf(etype,
"type%d", ev%5);
91 event->SetType(etype);
92 event->SetHeader(ev, 200, 960312, random);
93 event->SetNseg(
Int_t(10 * ntrack + 20 * sigmas));
95 event->SetFlag(
UInt_t(random + 0.5));
96 event->SetTemperature(random + 20.);
103 for (
UChar_t i0 = 0; i0 < 4; i0++) {
104 for(
UChar_t i1 = 0; i1 < 4; i1++) {
105 event->SetMatrix(i0, i1,
gRandom->Gaus(i0 * i1, 1));
110 for (
Int_t t = 0; t < ntrack; t++) event->AddTrack(random);
133 auto t4 =
f->Get<
TTree>(
"t4");
137 auto event =
new Event();
140 auto bntrack = t4->GetBranch(
"fNtrack");
141 auto branch = t4->GetBranch(
"event_split");
142 branch->SetAddress(&event);
149 bntrack->GetEntry(i);
152 if (event->GetNtrack() > 587)
156 nb += t4->GetEntry(i);
167 if (
gROOT->IsBatch())
186 gROOT->ProcessLine(
".L " + tutdir +
"/io/tree/Event.cxx+");
187 gROOT->ProcessLine(
"#define ACTUAL_RUN yes");
188 gROOT->ProcessLine(
"#include \"" __FILE__
"\"");
189 gROOT->ProcessLine(
"run()");
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
Using a TBrowser one can browse all ROOT objects.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
A TTree represents a columnar dataset.