28 const Int_t MAXMEC = 30;
52 Gctrak() {lmec=0; namec=0;}
62 enum Evect {kX,kY,kZ,kPX,kPY,kPZ,kPP};
63 vout[kPP] = vect[kPP];
77 vout[kX] = vect[kX] + (f1*vect[kPX] - f2*vect[kPY]);
78 vout[kY] = vect[kY] + (f1*vect[kPY] + f2*vect[kPX]);
79 vout[kZ] = vect[kZ] + (f1*vect[kPZ] +
f3);
80 vout[kPX] = vect[kPX] + (f4*vect[kPX] - f5*vect[kPY]);
81 vout[kPY] = vect[kPY] + (f4*vect[kPY] + f5*vect[kPX]);
82 vout[kPZ] = vect[kPZ] + (f4*vect[kPZ] +
f6);
91 TFile f(
"tree2.root",
"recreate");
92 TTree t2(
"t2",
"a Tree with data from a fake Geant3");
93 Gctrak *gstep =
new Gctrak;
94 t2.
Branch(
"track",&gstep,8000,1);
101 gstep->lmec =
new Int_t[MAXMEC];
102 gstep->namec =
new Int_t[MAXMEC];
109 for (
Int_t i=0;i<10000;i++) {
116 charge = 1;
if (
gRandom->
Rndm() < 0.5) charge = -1;
121 gstep->vect[3] = px/p;
122 gstep->vect[4] = py/p;
123 gstep->vect[5] = pz/p;
124 gstep->vect[6] = p*charge;
126 gstep->gekin = gstep->getot - mass;
134 helixStep(gstep->step, gstep->vect, vout);
137 gstep->destep = gstep->step*
gRandom->
Gaus(0.0002,0.00001);
138 gstep->gekin -= gstep->destep;
139 gstep->getot = gstep->gekin + mass;
140 gstep->vect[6] = charge*
TMath::Sqrt(gstep->getot*gstep->getot - mass*mass);
141 gstep->vect[0] = vout[0];
142 gstep->vect[1] = vout[1];
143 gstep->vect[2] = vout[2];
144 gstep->vect[3] = vout[3];
145 gstep->vect[4] = vout[4];
146 gstep->vect[5] = vout[5];
150 gstep->namec[
l] =
l+100;
152 if (gstep->gekin < 0.001) newParticle =
kTRUE;
176 TH1F *hdestep =
new TH1F(
"hdestep",
"destep in Mev",100,1e-5,3e-5);
182 hdestep->
Fill(gstep->destep);
193 hdestep->
Fit(
"gaus");
195 gPad->SetFillColor(37);
197 t2->
Draw(
"vect[0]:vect[1]:vect[2]");
198 if (
gROOT->IsBatch())
return;
201 gPad->GetViewer3D(
"x3d");
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
#define snext(osub1, osub2)
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
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 Int_t Fill()
Fill all branches.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
1-D histogram with a float per channel (see TH1 documentation)}
#define ClassDef(name, id)
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
virtual void SetMarkerColor(Color_t mcolor=1)
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void SetFillColor(Color_t fcolor)
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
R__EXTERN TRandom * gRandom
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
Mother of all ROOT objects.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
Double_t Sqrt(Double_t x)
A TTree is a list of TBranches.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.