source: trunk/WuerzburgSoft/Thomas/mphys/MPairProduction.cc@ 1360

Last change on this file since 1360 was 1358, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 5.8 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 "MPairProduction.h"
31
32#include <TF1.h>
33#include <TMath.h>
34#include <TRandom.h>
35
36#include "TList.h"
37#include "MElectron.h"
38
39ClassImp(MPairProduction);
40
41Double_t AngleDistrib(Double_t *x, Double_t *k)
42{
43
44 const Double_t c = x[0]; // cos(alpha)
45 const Double_t b = k[0]; // sqrt(1-1/s)
46
47 const Double_t b2 = b*b;
48 const Double_t b4 = b2*b2;
49
50 const Double_t c2 = c*c;
51 const Double_t c4 = c2*c2;
52
53 const Double_t u = 1 - b4*c4 +2*b2*(1-b2)*(1-c2);
54 const Double_t d = 1-b2*c2;
55
56 return u/(d*d);
57}
58
59// --------------------------------------------------------------------------
60MPairProduction::MPairProduction()
61{
62 fAngle = new TF1("AngleDistrib", AngleDistrib, -1, 1, 1);
63}
64
65MPairProduction::~MPairProduction()
66{
67 delete fAngle;
68}
69
70#include <iostream.h>
71
72// --------------------------------------------------------------------------
73Bool_t MPairProduction::Process(MParticle *gamma, const Double_t Ep, const Double_t theta, TList *list)
74{
75 //
76 // gamma: primary particle from source
77 // phot: infrared photon from background. (angle = interaction angle)
78 // Ep: Energy photon [GeV]
79 // theta: interaction angle [rad]
80 //
81
82
83 const Double_t E0 = 511e-6; // [GeV]
84 const Double_t Eg = gamma->GetEnergy(); // [GeV]
85
86 const Double_t ctheta = cos(theta);
87
88 const Double_t s = Ep*Eg*2*(1-ctheta); //[1]
89 const Double_t S = s/(E0*E0*4); //[1]
90 if (S<1)
91 return kFALSE;
92
93 const Double_t stheta = sin(theta);
94
95 const Double_t sqrbetah = s/((Eg+Ep)*(Eg+Ep)) + 1;
96 const Double_t sqrbetae = 1.-1./S;
97
98 const Double_t GammaH = (Eg+Ep)/sqrt(s);
99
100 Double_t psi = stheta/(GammaH*(ctheta-sqrt(sqrbetah)));
101
102 fAngle->SetParameter(0, sqrt(sqrbetae));
103
104 const Double_t alpha = psi-acos(fAngle->GetRandom());
105
106 Double_t salpha = sin(alpha);
107 Double_t calpha = cos(alpha);
108
109 const Double_t tphi = stheta/(Eg/Ep+ctheta); // tan(phi)
110
111 Double_t bb = sqrt(sqrbetah/sqrbetae);
112
113 Double_t s1 = calpha/GammaH;
114 Double_t s2 = tphi*s1 - salpha - bb;
115
116 Double_t tan1 = ((salpha+bb)*tphi+s1)/s2;
117 Double_t tan2 = ((salpha-bb)*tphi+s1)/s2;
118
119 const Double_t E = (Eg+Ep)/2;;
120 const Double_t f = sqrt(sqrbetah*sqrbetae)*salpha;
121
122 // cout << " {" << f << "," << E << "," << atan(tan1) << "," << atan(-tan2) << "} " << flush;
123
124 MElectron &p0 = *new MElectron(E*(1.-f), gamma->GetZ());
125 MElectron &p1 = *new MElectron(E*(1.+f), gamma->GetZ());
126 p0 = *gamma; // Set Position and direction
127 p1 = *gamma; // Set Position and direction
128
129 static TRandom rand(0);
130 Double_t rnd = rand.Uniform(TMath::Pi() * 2);
131 p0.SetNewDirection(atan(+tan1), rnd);
132 p1.SetNewDirection(atan(-tan2), rnd+TMath::Pi());
133
134 list->Add(&p0);
135 list->Add(&p1);
136
137 /*
138 const Double_t Epg = Ep/Eg; // 1+Epg ~ 1
139 const Double_t Egp = Eg/Ep; // 1+Egp ~ Egp
140
141 const Double_t phi = atan(sin(theta)/(Egp+ctheta));
142
143 const Double_t sphi = sin(phi);
144 const Double_t cphi = cos(phi);
145
146 const Double_t alpha = theta-phi;
147 const Double_t calpha = cos(alpha);
148 const Double_t salpha = sin(alpha);
149
150 const Double_t beta = (Eg*cphi+Ep*calpha)/(Ep+Eg);
151
152 //
153 // gamma1 = 1/gamma = sqrt(1-beta*beta)
154 //
155 const Double_t gamma1 = sqrt((sphi*phi+Epg*salpha*Epg*salpha+2*Epg*(1-cphi*calpha)));
156
157 const Double_t Beta = sqrt(1-1/s); //[1]
158
159 fAngle->SetParameter(0, Beta);
160
161 const Double_t psi = atan(gamma1*sphi/(cphi-beta));
162 const Double_t delta = acos(fAngle->GetRandom()) - psi;
163
164 const Double_t Bcosd = Beta*cos(delta);
165 const Double_t Bsind = Beta*sin(delta);
166
167 const Double_t E = sqrt(s)*E0/gamma1;
168 const Double_t dE = E*Bcosd;
169
170 const Double_t E1 = E0/(E+dE);
171 const Double_t E2 = E0/(E-dE);
172
173 const Double_t beta1 = sqrt(1.-E1*E1);
174 const Double_t beta2 = sqrt(1.-E2*E2);
175
176 const Double_t Bscp = Bsind*cphi;
177 const Double_t spg = sphi/gamma1;
178 const Double_t cpg = cphi/gamma1;
179
180 const Double_t tan1 = (spg*(Bcosd+1) + Bscp)/((cpg*(Bcosd+1) - Bscp));
181 const Double_t tan2 = (spg*(Bcosd-1) + Bscp)/((cpg*(Bcosd-1) - Bscp));
182
183 MElectron &p0 = *new MElectron(E+dE, gamma->GetZ());
184 MElectron &p1 = *new MElectron(E-dE, gamma->GetZ());
185 p0 = *gamma; // Set Position and direction
186 p1 = *gamma; // Set Position and direction
187
188 p0.SetBeta(beta1);
189 p1.SetBeta(beta2);
190
191 static TRandom rand(0);
192 Double_t rnd = rand.Uniform(TMath::Pi() * 2);
193 p0.SetNewDirection(atan(tan1), rnd);
194 p1.SetNewDirection(atan(tan2), rnd+TMath::Pi());
195
196 list->Add(&p0);
197 list->Add(&p1);
198 */
199 return kTRUE;
200}
201
Note: See TracBrowser for help on using the repository browser.