FairRoot/PandaRoot
Functions
trapmap_barrel.C File Reference
#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.

Functions

void config_histo (TH1 *h, TString tx, TString ty, double offy=1.65)
 
int trapmap_barrel (double steps=100, double phst=500, double pmax=6.0, double H=2, double rd=0.48)
 

Function Documentation

void config_histo ( TH1 *  h,
TString  tx,
TString  ty,
double  offy = 1.65 
)

Definition at line 36 of file trapmap_barrel.C.

37 {
38  h->SetLineWidth(1);
39  h->SetLineColor(1);
40  h->SetFillColor(3);
41  //h->Sumw2();
42 
43  h->GetXaxis()->SetTitleOffset(1.3);
44  h->GetXaxis()->SetTitleColor(1);
45  h->GetXaxis()->SetTitleFont(42);
46  h->GetXaxis()->SetLabelSize(0.045);
47  h->GetXaxis()->SetTitleSize(0.045);
48  //h->GetXaxis()->SetNdivisions(510);
49 
50  h->GetYaxis()->SetTitleOffset(offy);
51  h->GetYaxis()->SetTitleFont(42);
52  h->GetYaxis()->SetLabelSize(0.045);
53  h->GetYaxis()->SetTitleSize(0.045);
54 
55  h->SetXTitle(tx);
56  h->SetYTitle(ty);
57 
58 }
int trapmap_barrel ( double  steps = 100,
double  phst = 500,
double  pmax = 6.0,
double  H = 2,
double  rd = 0.48 
)

Definition at line 60 of file trapmap_barrel.C.

References acos(), alpha, c1, config_histo(), cos(), count, f, fabs(), i, n, p, phi, Pi, pid(), pt(), r, sin(), sqrt(), tht(), TString, v1, v2, and Write().

61 {
62  double mass[5]={0.000511,0.10566,0.13957,0.493677,0.938272};
63 
64  TString title[5];
65  title[0]="Electrons";
66  title[1]="Muons";
67  title[2]="Pions";
68  title[3]="Kaons";
69  title[4]="Protons";
70 
71  TCanvas *c1=new TCanvas("c1","c1",800,600);
72  c1->Divide(3,2);
73 
74 
75  int i=0;
76 
77  double Pi=3.141592653589793;
78 
79  //double d0=0.017;
80  double n=1.472;
81 
82  double thtmin=15,thtmax=150;
83  double pmin=0;
84  double thtsteps=steps;
85  double phisteps=phst;
86  double psteps=steps;
87 
88  double pbin=(pmax-pmin)/psteps;
89  double thtbin=(thtmax-thtmin)/thtsteps;
90 
91  TH1F *hftht2=new TH1F("hftht2","part total refl no curvature",(int)thtsteps+1,thtmin-0.5*thtbin,thtmax+0.5*thtbin);
92  hftht2->SetLineColor(2);
93 
94  TH2F *hacc[5];
95  for (i=0;i<5;i++)
96  {
97  char tmp[20];
98  sprintf(tmp,"hacc%d",i);
99  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);
100  hacc[i]->SetMaximum(1);
101  config_histo(hacc[i],"p[GeV/c^{2}]","#theta [deg]");
102  }
103 
104  double tht_tref=asin(1./n);
105  cout <<tht_tref/3.1416*180<<endl;
106 
107 
108  double phi=0;
109 
110  int pid=0;
111  int ip=0;
112 
113  for (pid=0;pid<5;pid++){
114  cout <<"pid="<<pid<<endl;
115  for (ip=0;ip<=psteps;ip++)
116  {
117  double p=pmin+ip*pbin;
118  double thetac=0;
119  double cthetac=sqrt(mass[pid]*mass[pid]+p*p)/(p*n);
120 
121  if (cthetac<=1) thetac=acos(cthetac);
122 
123  double tht;//=theta/180.*3.1416;
124  double thc=thetac;// /180.*3.1416;
125 
126  if (thc>0)
127  for (double itht=thtmin;itht<=thtmax;itht+=thtbin)
128  {
129  tht=itht/180.*Pi;
130 
131 
132  double phistsize=Pi*2/phisteps;
133 
134  double count=0;
135 
136  double pt = p*sin(tht);
137  double r = pt/(0.3*H);
138  if (2*r<rd) continue;
139  double alpha = asin(rd/(2*r));
140 
141  for( phi=0;phi<2*Pi;phi+=phistsize)
142  {
143  TVector3 v1(1,sin(phi)*tan(thc),cos(phi)*tan(thc));
144 
145  v1.RotateY(tht);
146  v1.RotateX(-alpha);
147 
148  TVector3 v2(0,0,1);
149  TVector3 v3(0,1,0);
150 
151  double ang=v1.Angle(v2);
152  double ang2=v1.Angle(v3);
153 
154  if (ang>Pi/2) ang=fabs(ang-Pi);
155  if (ang2>Pi/2) ang2=fabs(ang2-Pi);
156 
157  if (ang>=tht_tref && ang2>=tht_tref) ++count;
158  }
159 
160  hacc[pid]->Fill(p,itht,count/phisteps);
161  }
162  }
163  }
164 
165  TString opt("surf1");
166 
167  for (pid=0;pid<5;pid++)
168  {
169  c1->cd(pid+1);
170  hacc[pid]->Draw(opt);
171  }
172  c1->cd();
173 
174  TFile *f=new TFile("trapfrac_barrel.root","recreate");
175  for (pid=0;pid<5;pid++)
176  hacc[pid]->Write();
177  f->Close();
178  return 0;
179 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
Double_t p
Definition: anasim.C:58
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
int n
int pid()
TString pt(TString pts, TString exts="px py pz")
Definition: invexp.C:133
vTop Write()
void config_histo(TH1 *h, TString tx, TString ty)
TString tht(TString pts, TString exts="px py pz")
Definition: invexp.C:168
TFile * f
Definition: bump_analys.C:12
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
c1
Definition: plot_dirc.C:35
TVector3 v1
Definition: bump_analys.C:40
TVector3 v2
Definition: bump_analys.C:40
int count
double alpha
Definition: f_Init.h:9
Double_t Pi