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() {
tree->Branch(
"event",&
e);
for (
Int_t iev=0;iev<nevent;iev++) {
if (iev%1000==0) cout<<"Processing event "<<iev<<"..."<<endl;
}
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;
}
#define ClassDef(name, id)
R__EXTERN TRandom * gRandom
Mother of all ROOT objects.
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...
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
virtual Double_t Rndm()
Machine independent random number generator.
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 tree0.C.