source: trunk/WuerzburgSoft/Thomas/mphys/MGenIRPhoton.cc@ 9492

Last change on this file since 9492 was 1352, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.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 "MGenIRPhoton.h"
31
32#include <TMath.h>
33#include <TF1.h>
34
35#include "MParList.h"
36#include "MPhoton.h"
37
38ClassImp(MGenIRPhoton);
39
40/*
41Double_t Planck(Double_t *x, Double_t *k)
42{
43 const Double_t E = x[0]; //[eV]
44
45 const Double_t T = 2.87; //[K]
46
47 const Double_t e = 1.602176462e-19; //[C]
48 const Double_t kB = 1.3806503e-23/e; //[eV/K]
49
50 const Double_t E3 = E*E*E;
51 const Double_t EkT = E/kB/T;
52
53 //const Double_t h = 1e-9/e*6.62606876e-34; //[GeVs]
54 //const Double_t h2 = h*h;
55 //const Double_t c = 299792458; //[m/s]
56 //const Double_t c3 = c*c*c;
57 //const Double_t konst = 4/c3/h2;
58
59 return E3/(exp(EkT)-1);
60}
61*/
62
63Double_t MGenIRPhoton::Planck(Double_t *x, Double_t *k=NULL)
64{
65 //
66 // Planck, per unit volume, per unit energy
67 //
68 // constants moved out of function
69 //
70 Double_t E = x[0]; // [GeV]
71 Double_t z = k ? k[0] : 0;
72
73 Double_t T = 2.96*(z+1); // [K]
74 Double_t e = 1.602176462e-19; // [C]
75 Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K]
76
77 Double_t EkT = E/kB/T;
78
79 /*
80 //Double_t c = 299792458; // [m/s]
81 //Double_t h = 1e-9/e*6.62606876e-34; // [GeVs]
82 //Double_t hc = h*c; // [GeVm]
83 Double_t konst = 4.*TMath::Pi() * 2. / (hc*hc*hc);
84 return konst * E*E / (exp(EkT)-1.); // [1 / GeV / m^3 ]
85 */
86
87 return E*E / (exp(EkT)-1.); // [GeV^2]
88}
89
90
91// --------------------------------------------------------------------------
92MGenIRPhoton::MGenIRPhoton()
93{
94 fSrc = new TF1("Planck", Planck, 0, .5e-2, 0);
95}
96
97MGenIRPhoton::~MGenIRPhoton()
98{
99 delete fSrc;
100}
101
102// --------------------------------------------------------------------------
103MParticle *MGenIRPhoton::GetRandom()
104{
105 const Double_t pi2 = TMath::Pi() * 2;
106
107 MPhoton *p = new MPhoton;
108 /*
109 MParticle *p = new MParticle(MParticle::kEGamma);
110 p->SetAngle(fRand.Uniform(pi2));
111 p->SetEnergy(fSrc->GetRandom()*1e-9);
112 */
113
114 return p;
115}
116
Note: See TracBrowser for help on using the repository browser.