66#include "../test/Event.h"
71 TFile f(
"tree108.root",
"RECREATE");
74 TTree t4(
"t4",
"A Tree with Events");
80 t4.Branch(
"event_split", &event,16000,99);
81 t4.Branch(
"event_not_split", &event,16000,0);
87 for (
Int_t ev = 0; ev < 100; ev++) {
90 Int_t ntrack =
Int_t(600 + 600 * sigmat / 120.);
92 sprintf(etype,
"type%d", ev%5);
93 event->SetType(etype);
94 event->SetHeader(ev, 200, 960312, random);
95 event->SetNseg(
Int_t(10 * ntrack + 20 * sigmas));
97 event->SetFlag(
UInt_t(random + 0.5));
98 event->SetTemperature(random + 20.);
105 for (
UChar_t i0 = 0; i0 < 4; i0++) {
106 for(
UChar_t i1 = 0; i1 < 4; i1++) {
107 event->SetMatrix(i0, i1,
gRandom->
Gaus(i0 * i1, 1));
112 for (
Int_t t = 0; t < ntrack; t++) event->AddTrack(random);
135 auto t4 =
f->Get<
TTree>(
"t4");
139 auto event =
new Event();
142 auto bntrack = t4->GetBranch(
"fNtrack");
143 auto branch = t4->GetBranch(
"event_split");
144 branch->SetAddress(&event);
151 bntrack->GetEntry(i);
154 if (event->GetNtrack() > 587)
158 nb += t4->GetEntry(i);
169 if (
gROOT->IsBatch())
#define R__LOAD_LIBRARY(LIBRARY)
R__EXTERN TRandom * gRandom
Using a TBrowser one can browse all ROOT objects.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Double_t Rndm() override
Machine independent random number generator.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
A TTree represents a columnar dataset.