#include <iostream>
#include "TH1F.h"
#include "TH2F.h"
#include "TCanvas.h"
#include "TVector3.h"
#include "TBox.h"
#include "TFile.h"
#include <math.h>
Go to the source code of this file.
void config_histo |
( |
TH1 * |
h, |
|
|
TString |
tx, |
|
|
TString |
ty, |
|
|
double |
offy = 1.65 |
|
) |
| |
Definition at line 35 of file trapmap_disc.C.
42 h->GetXaxis()->SetTitleOffset(1.3);
43 h->GetXaxis()->SetTitleColor(1);
44 h->GetXaxis()->SetTitleFont(42);
45 h->GetXaxis()->SetLabelSize(0.045);
46 h->GetXaxis()->SetTitleSize(0.045);
49 h->GetYaxis()->SetTitleOffset(offy);
50 h->GetYaxis()->SetTitleFont(42);
51 h->GetYaxis()->SetLabelSize(0.045);
52 h->GetYaxis()->SetTitleSize(0.045);
int trapmap_disc |
( |
double |
steps = 100 , |
|
|
double |
phst = 500 , |
|
|
double |
pmax = 6.0 , |
|
|
double |
H = 2 |
|
) |
| |
Definition at line 59 of file trapmap_disc.C.
References acos(), c1, config_histo(), cos(), count, f, fabs(), i, n, p, phi, Pi, pid(), sin(), sqrt(), tht(), TString, v1, v2, and Write().
61 double mass[5]={0.000511,0.10566,0.13957,0.493677,0.938272};
70 TCanvas *
c1=
new TCanvas(
"c1",
"c1",800,600);
75 double Pi=3.141592653589793;
79 double thtmin=0,thtmax=25;
81 double thtsteps=steps;
85 double pbin=(pmax-pmin)/psteps;
86 double thtbin=(thtmax-thtmin)/thtsteps;
88 TH1F *hftht2=
new TH1F(
"hftht2",
"part total refl no curvature",(
int)thtsteps+1,thtmin-0.5*thtbin,thtmax+0.5*thtbin);
89 hftht2->SetLineColor(2);
95 sprintf(tmp,
"hacc%d",i);
96 hacc[
i]=
new TH2F(tmp,title[i],(
int)psteps+1,pmin-0.5*pbin,pmax+0.5*pbin,(
int)thtsteps+1,thtmin-0.5*thtbin,thtmax+0.5*thtbin);
97 hacc[
i]->SetMaximum(1);
102 double tht_tref=asin(1./n);
103 cout <<tht_tref/3.1416*180<<endl;
111 for (pid=0;pid<5;pid++){
112 cout <<
"pid="<<pid<<endl;
113 for (ip=0;ip<=psteps;ip++)
115 double p=pmin+ip*pbin;
117 double cthetac=
sqrt(mass[pid]*mass[pid]+p*p)/(p*
n);
120 if (cthetac<=1) thetac=
acos(cthetac);
126 for (
double itht=thtmin;itht<=thtmax;itht+=thtbin)
131 double phistsize=Pi*2/phisteps;
136 for( phi=0;phi<2*
Pi;phi+=phistsize)
138 TVector3
v1(1,
sin(phi)*tan(thc),
cos(phi)*tan(thc));
144 double ang=
v1.Angle(
v2);
146 if (ang>Pi/2) ang=
fabs(ang-Pi);
148 if (ang>=tht_tref) ++
count;
150 hacc[
pid]->Fill(p,itht,count/phisteps);
157 for (pid=0;pid<5;pid++)
160 hacc[
pid]->Draw(opt);
164 TFile *
f=
new TFile(
"trapfrac_disc.root",
"recreate");
165 for (pid=0;pid<5;pid++)
friend F32vec4 acos(const F32vec4 &a)
friend F32vec4 cos(const F32vec4 &a)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
void config_histo(TH1 *h, TString tx, TString ty)
TString tht(TString pts, TString exts="px py pz")
friend F32vec4 fabs(const F32vec4 &a)