Simple Event class example
execute as: .x tree103_tree.C++
You have to copy it first to a directory where you have write access! Note that .x tree103_tree.C cannot work with this example
Effect of ClassDef() macro
After running this macro create an instance of Det and Event
now you can see the effect of the ClassDef() macro. (for the Det class these commands are commented!) For instance 'e' now knows who it is:
cout<<
e.Class_Name()<<endl;
whereas d does not.
The methods that are added by the ClassDef() macro can be listed with
class Det {
public:
};
public:
};
void tree103_tree()
{
auto tree =
new TTree(
"tree",
"treelibrated tree");
tree->Branch(
"event", &
e);
for (
Int_t iev=0; iev<nevent; iev++) {
if (iev % 1000 == 0)
std::cout << "Processing event " << iev << "..." << std::endl;
tree->Fill();
}
tree->StartViewer();
tree->Draw("a.e");
tree->Draw("a.e", "3*(-.2<b.e && b.e<.2)", "same");
tree->Draw("b.e:a.e", "", "colz");
tree->Draw("b.t", "", "e");
tree->Draw("a.t", "", "same");
tree->Draw("b.t:a.t");
std::cout << std::endl;
std::cout << "You can now examine the structure of your tree in the TreeViewer" << std::endl;
std::cout << std::endl;
}
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
#define ClassDefOverride(name, id)
Mother of all ROOT objects.
A TTree represents a columnar dataset.
- Author
- Heiko.nosp@m..Sch.nosp@m.eit@m.nosp@m.pi-h.nosp@m.d.mpg.nosp@m..de
Definition in file tree103_tree.C.