31const Int_t MAXMEC = 30;
60 enum Evect {kX,kY,kZ,kPX,kPY,kPZ,kPP};
61 vout[kPP] = vect[kPP];
71 Float_t f3 = step*tsint*vect[kPZ];
74 Float_t f6 = tet*cos1t*vect[kPZ];
75 vout[kX] = vect[kX] + (
f1*vect[kPX] - f2*vect[kPY]);
76 vout[kY] = vect[kY] + (
f1*vect[kPY] + f2*vect[kPX]);
77 vout[kZ] = vect[kZ] + (
f1*vect[kPZ] + f3);
78 vout[kPX] = vect[kPX] + (f4*vect[kPX] - f5*vect[kPY]);
79 vout[kPY] = vect[kPY] + (f4*vect[kPY] + f5*vect[kPX]);
80 vout[kPZ] = vect[kPZ] + (f4*vect[kPZ] + f6);
89 TFile f(
"tree2.root",
"recreate");
90 TTree t2(
"t2",
"a Tree with data from a fake Geant3");
92 t2.Branch(
"vect",gstep.vect,
"vect[7]/F");
93 t2.Branch(
"getot",&gstep.getot);
94 t2.Branch(
"gekin",&gstep.gekin);
95 t2.Branch(
"nmec",&gstep.nmec);
96 t2.Branch(
"lmec",gstep.lmec,
"lmec[nmec]/I");
97 t2.Branch(
"destep",&gstep.destep);
98 t2.Branch(
"pid",&gstep.pid);
111 for (
Int_t i=0;i<10000;i++) {
118 charge = 1;
if (
gRandom->
Rndm() < 0.5) charge = -1;
123 gstep.vect[3] = px/
p;
124 gstep.vect[4] = py/
p;
125 gstep.vect[5] = pz/
p;
126 gstep.vect[6] =
p*charge;
128 gstep.gekin = gstep.getot - mass;
136 helixStep(gstep.step, gstep.vect, vout);
139 gstep.destep = gstep.step*
gRandom->
Gaus(0.0002,0.00001);
140 gstep.gekin -= gstep.destep;
141 gstep.getot = gstep.gekin + mass;
142 gstep.vect[6] = charge*
TMath::Sqrt(gstep.getot*gstep.getot - mass*mass);
143 gstep.vect[0] = vout[0];
144 gstep.vect[1] = vout[1];
145 gstep.vect[2] = vout[2];
146 gstep.vect[3] = vout[3];
147 gstep.vect[4] = vout[4];
148 gstep.vect[5] = vout[5];
150 for (
Int_t l=0;
l<gstep.nmec;
l++) gstep.lmec[
l] =
l;
151 if (gstep.gekin < 0.001) newParticle =
kTRUE;
175 TH1F *hdestep =
new TH1F(
"hdestep",
"destep in Mev",100,1
e-5,3
e-5);
181 hdestep->
Fill(destep);
188 c1->SetFillColor(42);
192 hdestep->
Fit(
"gaus");
194 gPad->SetFillColor(37);
196 t2->
Draw(
"vect[0]:vect[1]:vect[2]");
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TRandom * gRandom
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
A TTree is a list of TBranches.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
virtual void SetAddress(void *add)
Set address of this branch.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
1-D histogram with a float per channel (see TH1 documentation)}
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.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
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...
Double_t Rndm() override
Machine independent random number generator.
A TTree represents a columnar dataset.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual Long64_t GetEntries() const
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
#define snext(osub1, osub2)