source: trunk/WuerzburgSoft/Thomas/mphys/MPhoton.cc@ 1350

Last change on this file since 1350 was 1349, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 5.2 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
19! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
20!
21! Copyright: MAGIC Software Development, 2000-2001
22!
23!
24\* ======================================================================== */
25
26//////////////////////////////////////////////////////////////////////////////
27// //
28// //
29//////////////////////////////////////////////////////////////////////////////
30#include "MPhoton.h"
31
32#include <iostream.h>
33
34#include <TF1.h>
35
36ClassImp(MPhoton);
37
38Double_t MPhoton::Planck(Double_t *x, Double_t *k=NULL)
39{
40 //
41 // Planck, per unit volume, per unit energy
42 //
43 // constants moved out of function, see below
44 //
45 Double_t E = x[0]; // [GeV]
46 Double_t z = k ? k[0] : 0;
47
48 Double_t T = 2.96*(z+1); // [K]
49 Double_t e = 1.602176462e-19; // [C]
50 Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K]
51
52 Double_t EkT = E/kB/T;
53
54 /*
55 //Double_t c = 299792458; // [m/s]
56 //Double_t h = 1e-9/e*6.62606876e-34; // [GeVs]
57 //Double_t hc = h*c; // [GeVm]
58
59 Double_t konst = 4.*TMath::Pi() * 2. / (hc*hc*hc);
60 return konst * E*E / (exp(EkT)-1.); // [1 / GeV / m^3 ]
61 */
62
63 return E*E / (exp(EkT)-1.); // [GeV^2]
64}
65
66Double_t MPhoton::Sigma_gg(Double_t *x, Double_t *k=NULL)
67{
68 Double_t s = x[0]; // omega: CM mass
69
70 Double_t E0 = 511e-6; // [GeV]
71 Double_t r0 = 2.81794092e-15; // [m] = e^2/4/pi/m/eps0/c^2
72
73 Double_t m = E0/s;
74
75 Double_t m2 = m*m;
76 Double_t beta = sqrt(1.-m2);
77 Double_t beta2 = 1.-m2;
78
79 Double_t p1 = r0*r0*TMath::Pi()/2;
80
81 // ----- Extreme Relativistic -----
82 // return p1*2 * m*m*m* (log(2./m)-1);
83 // --------------------------------
84
85 Double_t p2 = m2;
86 Double_t p3 = 3.-beta2*beta2;
87 Double_t p4 = log((1.+beta)/(1.-beta));
88 Double_t p5 = beta*2*(1.+m2);
89
90 Double_t sigma = p1*p2*(p3*p4-p5); // [m^2]
91
92 return sigma;
93}
94
95Double_t MPhoton::Int1(Double_t *x, Double_t *k=NULL)
96{
97 Double_t costheta = x[0];
98
99 Double_t Eg = k[0];
100 Double_t Ep = k[1];
101
102 Double_t E0 = 511e-6; // [GeV]
103
104 Double_t s = Eg*Ep/E0*(1.-costheta)*2;
105
106 if (s<E0) // Why is this necessary???
107 return 0;
108
109 Double_t sigma = Sigma_gg(&s); // [m^2]
110
111 return sigma/2 * (1.-costheta); // [m^2]
112}
113
114Double_t MPhoton::Int2(Double_t *x, Double_t *k)
115{
116 Double_t E0 = 511e-6; // [GeV]
117
118 Double_t Ep = x[0];
119 Double_t Eg = k[0];
120
121 Double_t z = k[1];
122
123 Double_t val[2] = { Eg, Ep };
124
125 Double_t from = -1.0;
126 Double_t to = 1.-E0*E0/2./Eg/Ep; // Originally Was: 1.
127
128 TF1 f("int1", Int1, from, to, 2);
129 Double_t int1 = f.Integral(from, to, val); // [m^2]
130 Double_t planck = Planck(&Ep, &z); // [GeV^2]
131
132 Double_t res = planck * int1;
133
134 res *= Eg/E0*1e-9; // FIXME!!!!!!!!!! WHICH FACTOR IS THIS????
135
136 return res; // [GeV^2 m^2]
137}
138
139// --------------------------------------------------------------------------
140//
141// Returns 0 in case IL becomes (numerically) infinite.
142//
143Double_t MPhoton::InteractionLength(Double_t *x, Double_t *k=NULL)
144{
145 Double_t E0 = 511e-6; // [GeV]
146 Double_t c = 299792458; // [m/s]
147 Double_t e = 1.602176462e-19; // [C]
148 Double_t h = 1e-9/e*6.62606876e-34; // [GeVs]
149 Double_t hc = h*c; // [GeVm]
150 Double_t pc = 1./3.258; // [pc/ly]
151 Double_t ly = 3600.*24.*365.*c; // [m/ly]
152
153 Double_t Eg = x[0];
154 Double_t z = k ? k[0] : 0;
155
156 Double_t val[2] = { Eg, z };
157
158 Double_t lolim = E0*E0/Eg;
159 Double_t inf = 4e-12; //E0*E0/Eg * sqrt(Eg);
160
161 TF1 f("int2", Int2, lolim, inf, 2);
162
163 Double_t int2 = f.Integral(lolim, inf, val); //[GeV^3 m^2]
164
165 if (int2==0)
166 {
167 //cout << "---> Int2==0 <---" << endl;
168 return 0;
169 }
170
171 /* Planck constants: konst */
172 Double_t konst = 4.*TMath::Pi() * 2. / (hc*hc*hc);
173 int2 *= konst; // [1 / m]
174
175 Double_t res = 1./ int2; // [m]
176 res *= pc/ly * 1e-3; // [kpc]
177
178 if (res > 1e50) return 1e50;
179 if (res < 0) return 1e35;
180
181 return res; //[kpc]
182}
183
184Double_t MPhoton::GetInteractionLength(Double_t energy, Double_t z)
185{
186 return InteractionLength(&energy, &z);
187}
188
189Double_t MPhoton::GetInteractionLength() const
190{
191 return InteractionLength((Double_t*)&fEnergy, (Double_t*)&fZ);
192}
193
Note: See TracBrowser for help on using the repository browser.