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(
"tree105.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);
101 Float_t px, py, pz, p, charge = 0;
111 for (
Int_t i=0; i<10000; i++) {
125 gstep.vect[3] = px / p;
126 gstep.vect[4] = py / p;
127 gstep.vect[5] = pz / p;
128 gstep.vect[6] = p * charge;
130 gstep.gekin = gstep.getot - mass;
138 helixStep(gstep.step, gstep.vect, vout);
141 gstep.destep = gstep.step*
gRandom->Gaus(0.0002, 0.00001);
142 gstep.gekin -= gstep.destep;
143 gstep.getot = gstep.gekin + mass;
144 gstep.vect[6] = charge*
TMath::Sqrt(gstep.getot * gstep.getot - mass * mass);
145 gstep.vect[0] = vout[0];
146 gstep.vect[1] = vout[1];
147 gstep.vect[2] = vout[2];
148 gstep.vect[3] = vout[3];
149 gstep.vect[4] = vout[4];
150 gstep.vect[5] = vout[5];
154 if (gstep.gekin < 0.001)
173 auto t2 =
f->Get<
TTree>(
"t2");
175 TBranch *b_destep = t2->GetBranch(
"destep");
179 auto hdestep =
new TH1F(
"hdestep",
"destep in Mev", 100, 1
e-5, 3
e-5);
185 hdestep->Fill(destep);
191 auto c1 =
new TCanvas(
"c1",
"c1", 600, 800);
192 c1->SetFillColor(42);
195 hdestep->SetFillColor(45);
196 hdestep->Fit(
"gaus");
198 gPad->SetFillColor(37);
199 t2->SetMarkerColor(
kRed);
200 t2->Draw(
"vect[0]:vect[1]:vect[2]");
203 t2->ResetBranchAddresses();
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).
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 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)
A TTree represents a columnar dataset.
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.