29const Int_t MAXMEC = 30;
53 Gctrak() {lmec=
nullptr; namec=
nullptr;}
63 enum Evect {kX,kY,kZ,kPX,kPY,kPZ,kPP};
64 vout[kPP] = vect[kPP];
74 Float_t f3 = step*tsint*vect[kPZ];
77 Float_t f6 = tet*cos1t*vect[kPZ];
78 vout[kX] = vect[kX] + (
f1*vect[kPX] - f2*vect[kPY]);
79 vout[kY] = vect[kY] + (
f1*vect[kPY] + f2*vect[kPX]);
80 vout[kZ] = vect[kZ] + (
f1*vect[kPZ] + f3);
81 vout[kPX] = vect[kPX] + (f4*vect[kPX] - f5*vect[kPY]);
82 vout[kPY] = vect[kPY] + (f4*vect[kPY] + f5*vect[kPX]);
83 vout[kPZ] = vect[kPZ] + (f4*vect[kPZ] + f6);
92 TFile f(
"tree2.root",
"recreate");
93 TTree t2(
"t2",
"a Tree with data from a fake Geant3");
94 Gctrak *gstep =
new Gctrak;
95 t2.Branch(
"track",&gstep,8000,1);
102 gstep->lmec =
new Int_t[MAXMEC];
103 gstep->namec =
new Int_t[MAXMEC];
110 for (
Int_t i=0;i<10000;i++) {
117 charge = 1;
if (
gRandom->
Rndm() < 0.5) charge = -1;
122 gstep->vect[3] = px/
p;
123 gstep->vect[4] = py/
p;
124 gstep->vect[5] = pz/
p;
125 gstep->vect[6] =
p*charge;
127 gstep->gekin = gstep->getot - mass;
135 helixStep(gstep->step, gstep->vect, vout);
138 gstep->destep = gstep->step*
gRandom->
Gaus(0.0002,0.00001);
139 gstep->gekin -= gstep->destep;
140 gstep->getot = gstep->gekin + mass;
141 gstep->vect[6] = charge*
TMath::Sqrt(gstep->getot*gstep->getot - mass*mass);
142 gstep->vect[0] = vout[0];
143 gstep->vect[1] = vout[1];
144 gstep->vect[2] = vout[2];
145 gstep->vect[3] = vout[3];
146 gstep->vect[4] = vout[4];
147 gstep->vect[5] = vout[5];
151 gstep->namec[
l] =
l+100;
153 if (gstep->gekin < 0.001) newParticle =
kTRUE;
172 Gctrak *gstep =
nullptr;
177 TH1F *hdestep =
new TH1F(
"hdestep",
"destep in Mev",100,1
e-5,3
e-5);
183 hdestep->
Fill(gstep->destep);
190 c1->SetFillColor(42);
194 hdestep->
Fit(
"gaus");
196 gPad->SetFillColor(37);
198 t2->
Draw(
"vect[0]:vect[1]:vect[2]");
199 if (
gROOT->IsBatch())
return;
202 gPad->GetViewer3D(
"x3d");
#define ClassDefOverride(name, id)
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.
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.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
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 Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
virtual Long64_t GetEntries() const
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)