29const Int_t MAXMEC = 30;
66 enum Evect {kX, kY, kZ, kPX, kPY, kPZ, kPP};
67 vout[kPP] = vect[kPP];
68 Float_t h4 = field * 2.99792e-4;
77 Float_t f3 = step * tsint * vect[kPZ];
80 Float_t f6 = tet * cos1t * vect[kPZ];
81 vout[kX] = vect[kX] + (
f1*vect[kPX] - f2*vect[kPY]);
82 vout[kY] = vect[kY] + (
f1*vect[kPY] + f2*vect[kPX]);
83 vout[kZ] = vect[kZ] + (
f1*vect[kPZ] + f3);
84 vout[kPX] = vect[kPX] + (f4*vect[kPX] - f5*vect[kPY]);
85 vout[kPY] = vect[kPY] + (f4*vect[kPY] + f5*vect[kPX]);
86 vout[kPZ] = vect[kPZ] + (f4*vect[kPZ] + f6);
94 TFile f(
"tree106.root",
"recreate");
95 TTree t2(
"t2",
"a Tree with data from a fake Geant3");
96 auto gstep =
new Gctrak;
97 t2.Branch(
"track", &gstep, 8000, 1);
100 Float_t px, py, pz, p, charge=0;
104 gstep->lmec =
new Int_t[MAXMEC];
105 gstep->namec =
new Int_t[MAXMEC];
112 for (
Int_t i=0;i <10000; i++) {
126 gstep->vect[3] = px / p;
127 gstep->vect[4] = py / p;
128 gstep->vect[5] = pz / p;
129 gstep->vect[6] = p*charge;
131 gstep->gekin = gstep->getot - mass;
139 helixStep(gstep->step, gstep->vect, vout);
142 gstep->destep = gstep->step*
gRandom->Gaus(0.0002, 0.00001);
143 gstep->gekin -= gstep->destep;
144 gstep->getot = gstep->gekin + mass;
145 gstep->vect[6] = charge *
TMath::Sqrt(gstep->getot * gstep->getot - mass * mass);
146 gstep->vect[0] = vout[0];
147 gstep->vect[1] = vout[1];
148 gstep->vect[2] = vout[2];
149 gstep->vect[3] = vout[3];
150 gstep->vect[4] = vout[4];
151 gstep->vect[5] = vout[5];
153 for (
Int_t l=0;
l<gstep->nmec;
l++) {
155 gstep->namec[
l] =
l + 100;
157 if (gstep->gekin < 0.001)
177 auto t2 =
f->Get<
TTree>(
"t2");
178 Gctrak *gstep =
nullptr;
180 auto b_destep = t2->GetBranch(
"destep");
183 auto hdestep =
new TH1F(
"hdestep",
"destep in Mev", 100, 1
e-5, 3
e-5);
188 b_destep->GetEntry(i);
189 hdestep->Fill(gstep->destep);
195 auto c1 =
new TCanvas(
"c1",
"c1", 600, 800);
196 c1->SetFillColor(42);
199 hdestep->SetFillColor(45);
200 hdestep->Fit(
"gaus");
202 gPad->SetFillColor(37);
203 t2->SetMarkerColor(
kRed);
204 t2->Draw(
"vect[0]:vect[1]:vect[2]");
205 if (
gROOT->IsBatch())
209 gPad->GetViewer3D(
"ogl");
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
#define ClassDefOverride(name, id)
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
Mother of all ROOT objects.
A TTree represents a columnar dataset.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
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.