1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: DiffusePhotonsOnPupil.cc 2835 2009-07-16 03:22:42Z biktem $ |
---|
3 | // A.Thea created Apr, 18 2004 |
---|
4 | |
---|
5 | #include "DiffusePhotonsOnPupil.hh" |
---|
6 | #include "OpticsFactory.hh" |
---|
7 | #include "EsafRandom.hh" |
---|
8 | #include "EsafSpectrum.hh" |
---|
9 | #include <TMath.h> |
---|
10 | |
---|
11 | ClassImp(DiffusePhotonsOnPupil) |
---|
12 | |
---|
13 | //______________________________________________________________________________ |
---|
14 | DiffusePhotonsOnPupil::DiffusePhotonsOnPupil() { |
---|
15 | // ctor |
---|
16 | |
---|
17 | fOptics = OpticsFactory::Get()->MakeOpticalSystem(); |
---|
18 | fThetaFOVMax = Conf()->GetNum("DiffusePhotonsOnPupil.fThetaFOVMax") |
---|
19 | *TMath::DegToRad(); |
---|
20 | |
---|
21 | // calculate the entrance disc size using the last element in fAngles |
---|
22 | fEntranceDiscRadius = fOptics->Radius()+fThetaFOVMax* |
---|
23 | (fOptics->FirstLensTop()-fOptics->FirstLensBottom()); |
---|
24 | |
---|
25 | fSpectrum = new EsafSpectrum(Conf()->GetStr("DiffusePhotonsOnPupil.fSpectrum").c_str()); |
---|
26 | |
---|
27 | string sThDist = Conf()->GetStr("DiffusePhotonsOnPupil.fThetaDistribution").c_str(); |
---|
28 | |
---|
29 | if (sThDist == "totaleff" ) { |
---|
30 | // this fuction is the inverse of the total optics efficacy as presented by |
---|
31 | // A.Thea at Munich EUSO General Meeting, Nov 2003 |
---|
32 | fThetaDist = new TF1("toteff","sin(x)/pol6",0,fThetaFOVMax); |
---|
33 | |
---|
34 | fThetaDist->SetParameter(0,2.99368e+06); |
---|
35 | fThetaDist->SetParError(0,10391.8); |
---|
36 | fThetaDist->SetParLimits(0,0,0); |
---|
37 | fThetaDist->SetParameter(1,532256); |
---|
38 | fThetaDist->SetParError(1,98140.9); |
---|
39 | fThetaDist->SetParLimits(1,0,0); |
---|
40 | fThetaDist->SetParameter(2,-2.21992e+06); |
---|
41 | fThetaDist->SetParError(2,333382); |
---|
42 | fThetaDist->SetParLimits(2,0,0); |
---|
43 | fThetaDist->SetParameter(3,-2.15698e+06); |
---|
44 | fThetaDist->SetParError(3,778156); |
---|
45 | fThetaDist->SetParLimits(3,0,0); |
---|
46 | fThetaDist->SetParameter(4,-1.26283e+08); |
---|
47 | fThetaDist->SetParError(4,1.72771e+06); |
---|
48 | fThetaDist->SetParLimits(4,0,0); |
---|
49 | fThetaDist->SetParameter(5,4.02746e+08); |
---|
50 | fThetaDist->SetParError(5,3.47659e+06); |
---|
51 | fThetaDist->SetParLimits(5,0,0); |
---|
52 | fThetaDist->SetParameter(6,-3.87307e+08); |
---|
53 | fThetaDist->SetParError(6,5.62178e+06); |
---|
54 | fThetaDist->SetParLimits(6,0,0); |
---|
55 | |
---|
56 | } else if ( sThDist == "uniform" ) { |
---|
57 | // uniform distribution in the FOV solid angle |
---|
58 | fThetaDist = new TF1("uniform","sin(x)",0, fThetaFOVMax); |
---|
59 | fThetaDist->SetParameter(0,0); |
---|
60 | fThetaDist->SetParError(0,0); |
---|
61 | fThetaDist->SetParLimits(0,0,0); |
---|
62 | fThetaDist->SetParameter(1,1); |
---|
63 | fThetaDist->SetParError(1,0); |
---|
64 | fThetaDist->SetParLimits(1,0,0); |
---|
65 | } else if ( sThDist == "costheta" ) { |
---|
66 | // this distribution keeps the incident flux constant |
---|
67 | fThetaDist = new TF1("costheta","sin(x)*cos(x)",0, fThetaFOVMax); |
---|
68 | } else |
---|
69 | Msg(EsafMsg::Panic) << "DiffusePhotonsOnPupil: " << |
---|
70 | sThDist << " unknown distribution" << MsgDispatch; |
---|
71 | |
---|
72 | |
---|
73 | } |
---|
74 | |
---|
75 | //______________________________________________________________________________ |
---|
76 | DiffusePhotonsOnPupil::~DiffusePhotonsOnPupil() { |
---|
77 | // dtor |
---|
78 | if (fSpectrum) delete fSpectrum; fSpectrum = 0; |
---|
79 | if (fThetaDist) delete fThetaDist; fThetaDist = 0; |
---|
80 | } |
---|
81 | |
---|
82 | //______________________________________________________________________________ |
---|
83 | Photon* DiffusePhotonsOnPupil::GetPhoton() { |
---|
84 | // get a new photon |
---|
85 | TRandom *rndm = EsafRandom::Get(); |
---|
86 | Double_t th = fThetaDist->GetRandom(0, fThetaFOVMax); |
---|
87 | Double_t ph = TwoPi()*rndm->Rndm(); |
---|
88 | |
---|
89 | Double_t rho = Sqrt(rndm->Rndm())*fEntranceDiscRadius; |
---|
90 | Double_t alpha = rndm->Rndm()*TwoPi(); |
---|
91 | |
---|
92 | Double_t s_pos[3]={0,0,0}; |
---|
93 | Double_t p_pos[3]={rho*Cos(alpha), rho*Sin(alpha), |
---|
94 | fOptics->FirstLensBottom()}; |
---|
95 | |
---|
96 | fParent.Build(1,s_pos, p_pos, th, ph, fSpectrum->GetLambda(), 0, Fluorescence); |
---|
97 | return &(fParent.GetPhoton()); |
---|
98 | } |
---|