Write and read a Vector3 class in a tree.
{
public:
fZ = z;
}
};
{
auto T =
new TTree(
"T",
"vector3 Tree");
T->Branch(
"v3", &
v, 32000, 1);
for (
Int_t i=0; i<10000; i++) {
v->SetXYZ(
r.Gaus(0, 1),
r.Landau(0, 1),
r.Gaus(100, 10));
T->Fill();
}
T->Write();
T->Print();
}
{
auto h1 =
new TH1F(
"x",
"x component of Vector3", 100, -3, 3);
T->GetEntry(i);
}
}
{
auto by = T->GetBranch(
"fY");
auto TH1F("y", "y component of Vector3", 100, -5, 20);
v->y());
}
h2->Draw();
}
{
auto c1 =
new TCanvas(
"c1",
"demo of Trees", 10, 10, 600, 800);
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
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.
1-D histogram with a float per channel (see TH1 documentation)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
This is the base class for the ROOT Random number generators.
A TTree represents a columnar dataset.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
- Author
- The ROOT Team
Definition in file tree122_vector3.C.