Simple Event class example
execute as: .x tree0.C++
You have to copy it first to a directory where you have write access! Note that .x tree0.C cannot work with this example
After running this macro create an instance of Det and Event
now you can see the effect of the ClassDef() and ClassImp() macros. (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()/Imp() marcro can be listed with
.class
.class Event
.class Det
class Det {
public:
};
public:
};
void tree0() {
TTree *tree =
new TTree(
"tree",
"treelibrated tree");
Event *e = new Event;
for (
Int_t iev=0;iev<nevent;iev++) {
if (iev%1000==0) cout<<"Processing event "<<iev<<"..."<<endl;
gRandom->Rannor(ea,eb);
e->a.e=ea;
e->b.e=eb;
e->a.t=gRandom->Rndm();
e->b.t=e->a.t + gRandom->Gaus(0.,.1);
}
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");
cout<<endl;
cout<<"You can now examine the structure of your tree in the TreeViewer"<<endl;
cout<<endl;
}
- Author
- Heiko.nosp@m..Sch.nosp@m.eit@m.nosp@m.pi-h.nosp@m.d.mpg.nosp@m..de
Definition in file tree0.C.