1 | // $Id: BunchPropagator.cc 1807 2005-05-02 17:21:53Z moreggia $ |
---|
2 | // Author: Sylvain Moreggia 2004/09/29 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: BunchPropagator * |
---|
8 | * Package: RadiativeTransfer * |
---|
9 | * Coordinator: Sylvain Moreggia * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | //_____________________________________________________________________________ |
---|
14 | // |
---|
15 | // BunchPropagator |
---|
16 | // |
---|
17 | // <extensive class description> |
---|
18 | // |
---|
19 | // Config file parameters |
---|
20 | // ====================== |
---|
21 | // |
---|
22 | // <parameter name>: <parameter description> |
---|
23 | // -Valid options: <available options> |
---|
24 | // |
---|
25 | |
---|
26 | #include "BunchPropagator.hh" |
---|
27 | #include "Ground.hh" |
---|
28 | #include "EarthVector.hh" |
---|
29 | #include "Atmosphere.hh" |
---|
30 | |
---|
31 | ClassImp(BunchPropagator) |
---|
32 | |
---|
33 | //_____________________________________________________________________________ |
---|
34 | BunchPropagator::BunchPropagator() : EsafConfigurable(), EsafMsgSource(), fGround(0), fDetGeom(0) { |
---|
35 | // |
---|
36 | // Constructor |
---|
37 | // |
---|
38 | Msg(EsafMsg::Warning) << "Default ctor used -> OK if no clouds" << MsgDispatch; |
---|
39 | } |
---|
40 | |
---|
41 | //_____________________________________________________________________________ |
---|
42 | BunchPropagator::BunchPropagator(const Ground* g) : EsafConfigurable(), EsafMsgSource() { |
---|
43 | // |
---|
44 | // Constructor, copy the RadiativeTransfer ground description |
---|
45 | // |
---|
46 | CopyGround(g); |
---|
47 | fDetGeom = 0; |
---|
48 | } |
---|
49 | |
---|
50 | //_____________________________________________________________________________ |
---|
51 | BunchPropagator::~BunchPropagator() { |
---|
52 | // |
---|
53 | // Destructor |
---|
54 | // |
---|
55 | } |
---|
56 | |
---|
57 | //_____________________________________________________________________________ |
---|
58 | Medium BunchPropagator::GetNextImpact(const EarthVector& pos,const EarthVector& dir,EarthVector& res) const { |
---|
59 | // |
---|
60 | // Calculate the impact upon the next medium according to the given track |
---|
61 | // Return type of the next encountered medium |
---|
62 | // |
---|
63 | // - Cases with no impact are handled -> set impact to a boundary position, returning CLEARSKY as next medium |
---|
64 | // - If pos is underground, NONE medium is returned and impact set to (0,0,-HUGE) |
---|
65 | // |
---|
66 | // //TOFIX : impact on Aerosols should be done here when necessary |
---|
67 | // |
---|
68 | |
---|
69 | Medium rtn = GROUND; |
---|
70 | EarthVector gd_imp, cloud_imp; |
---|
71 | |
---|
72 | // get impact on ground |
---|
73 | gd_imp = fGround->GetImpact(pos,dir); |
---|
74 | res = gd_imp; |
---|
75 | // if pos is underground |
---|
76 | if(gd_imp.Z() == -HUGE) return NONE; |
---|
77 | |
---|
78 | // get impact on clouds, then make appropriate changes |
---|
79 | cloud_imp = Atmosphere::Get()->GetClouds()->GetCloudImpact(pos,dir); |
---|
80 | if((cloud_imp - pos).Mag() < (gd_imp - pos).Mag()) { |
---|
81 | res = cloud_imp; |
---|
82 | rtn = CLOUDY; |
---|
83 | } |
---|
84 | |
---|
85 | // if no impact, means clear sky conditions remain |
---|
86 | if(res.Z() == HUGE) { |
---|
87 | rtn = CLEARSKY; |
---|
88 | res = fEndFoV; //TOFIX : out of Fov must be more general |
---|
89 | } |
---|
90 | |
---|
91 | return rtn; |
---|
92 | } |
---|
93 | //_____________________________________________________________________________ |
---|
94 | Medium BunchPropagator::GetNextImpact(const BunchOfPhotons& b,EarthVector& res) const { |
---|
95 | return GetNextImpact(b.GetPos(),b.GetDir(),res); |
---|
96 | } |
---|
97 | |
---|
98 | //_____________________________________________________________________________ |
---|
99 | Medium BunchPropagator::GetFinalImpact(const EarthVector& pos,const EarthVector& dir,EarthVector& res) const { |
---|
100 | // |
---|
101 | // Calculate the final impact (i.e. ground or clear sky) |
---|
102 | // Return medium where this impact occurs |
---|
103 | // |
---|
104 | // - Cases with no impact are handled -> set impact to a boundary position, returning CLEARSKY as next medium |
---|
105 | // - If pos is underground, NONE medium is returned and impact set to (0,0,-HUGE) |
---|
106 | // |
---|
107 | |
---|
108 | Medium rtn = GROUND; |
---|
109 | res = fGround->GetImpact(pos,dir); |
---|
110 | |
---|
111 | // if pos is underground |
---|
112 | if(res.Z() == -HUGE) return NONE; |
---|
113 | |
---|
114 | // if no impact |
---|
115 | if(res.Z() == HUGE) { |
---|
116 | res = fEndFoV; //TOFIX : out of Fov must be more general |
---|
117 | rtn = CLEARSKY; |
---|
118 | } |
---|
119 | |
---|
120 | return rtn; |
---|
121 | } |
---|
122 | |
---|
123 | //_____________________________________________________________________________ |
---|
124 | Medium BunchPropagator::GetFinalImpact(const BunchOfPhotons& b,EarthVector& res) const { |
---|
125 | return GetFinalImpact(b.GetPos(),b.GetDir(),res); |
---|
126 | } |
---|
127 | |
---|