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

Last change on this file since 1349 was 1349, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 4.3 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
35#include "TList.h"
36#include "MElectron.h"
37
38ClassImp(MPairProduction);
39
40Double_t AngleDistrib(Double_t *x, Double_t *k)
41{
42
43 const Double_t c = x[0]; // cos(alpha)
44 const Double_t b = k[0]; // sqrt(1-1/s)
45
46 const Double_t b2 = b*b;
47 const Double_t b4 = b2*b2;
48
49 const Double_t c2 = c*c;
50 const Double_t c4 = c2*c2;
51
52 const Double_t u = 1 - b4*c4 +2*b2*(1-b2)*(1-c2);
53 const Double_t d = 1-b2*c2;
54
55 return u/(d*d);
56}
57
58// --------------------------------------------------------------------------
59MPairProduction::MPairProduction()
60{
61 fAngle = new TF1("AngleDistrib", AngleDistrib, -1, 1, 1);
62}
63
64MPairProduction::~MPairProduction()
65{
66 delete fAngle;
67}
68
69#include <iostream.h>
70
71// --------------------------------------------------------------------------
72Bool_t MPairProduction::Process(MParticle *gamma, MParticle *phot, TList *list)
73{
74 //
75 // gamma: primary particle from source
76 // phot: infrared photon from background. (angle = interaction angle)
77 //
78 const Double_t E0 = 511e-6; // [GeV]
79
80 const Double_t theta = phot->GetAngle(); // [2pi]
81 const Double_t Ep = phot->GetEnergy(); // [GeV]
82 const Double_t Eg = gamma->GetEnergy(); // [GeV]
83
84 const Double_t ctheta = cos(theta);
85
86 const Double_t s = (Ep*Eg/(2*E0*E0))*(1-ctheta); //[1]
87 if (s<1)
88 return kFALSE;
89
90 const Double_t Epg = Ep/Eg; // 1+Epg ~ 1
91 const Double_t Egp = Eg/Ep; // 1+Egp ~ Egp
92
93 const Double_t phi = atan(sin(theta)/(Egp+ctheta));
94
95 const Double_t sphi = sin(phi);
96 const Double_t cphi = cos(phi);
97
98 const Double_t alpha = theta-phi;
99 const Double_t calpha = cos(alpha);
100 const Double_t salpha = sin(alpha);
101
102 const Double_t beta = (Eg*cphi+Ep*calpha)/(Ep+Eg);
103
104 //
105 // gamma1 = 1/gamma = sqrt(1-beta*beta)
106 //
107 const Double_t gamma1 = sqrt((sphi*phi+Epg*salpha*Epg*salpha+2*Epg*(1-cphi*calpha)));
108
109 const Double_t Beta = sqrt(1-1/s); //[1]
110
111 fAngle->SetParameter(0, Beta);
112
113 const Double_t psi = atan(gamma1*sphi/(cphi-beta));
114 const Double_t delta = acos(fAngle->GetRandom()) - psi;
115
116 const Double_t Bcosd = Beta*cos(delta);
117 const Double_t Bsind = Beta*sin(delta);
118
119 const Double_t E = sqrt(s)*E0/gamma1;
120 const Double_t dE = E*Bcosd;
121
122 MElectron *p[2];
123 p[0] = new MElectron(E+dE, gamma->GetZ());
124 p[1] = new MElectron(E-dE, gamma->GetZ());
125
126 const Double_t E1 = E0/(E+dE);
127 const Double_t E2 = E0/(E-dE);
128
129 const Double_t beta1 = sqrt(1.-E1*E1);
130 const Double_t beta2 = sqrt(1.-E2*E2);
131
132 p[0]->SetBeta(beta1);
133 p[1]->SetBeta(beta2);
134
135 const Double_t Bscp = Bsind*cphi;
136 const Double_t spg = sphi/gamma1;
137 const Double_t cpg = cphi/gamma1;
138
139 const Double_t tan1 = (spg*(Bcosd+1) + Bscp)/((cpg*(Bcosd+1) - Bscp));
140 const Double_t tan2 = (spg*(Bcosd-1) + Bscp)/((cpg*(Bcosd-1) - Bscp));
141
142 p[0]->SetAngle(atan(tan1));
143 p[1]->SetAngle(atan(tan2));
144
145 list->Add(p[0]);
146 list->Add(p[1]);
147
148 return kTRUE;
149}
150
Note: See TracBrowser for help on using the repository browser.