1 | // $Id: NoRadiativeTransfer.cc 2675 2006-04-23 18:00:34Z moreggia $ |
---|
2 | // Author: Sylvain Moreggia 2005/11/10 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: NoRadiativeTransfer * |
---|
8 | * Package: <packagename> * |
---|
9 | * Coordinator: <coordinator> * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | //_____________________________________________________________________________ |
---|
14 | // |
---|
15 | // NoRadiativeTransfer |
---|
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 "NoRadiativeTransfer.hh" |
---|
27 | #include "ListPhotonsInAtmosphere.hh" |
---|
28 | #include "EmptyPhotonsOnPupil.hh" |
---|
29 | #include "SinglePhoton.hh" |
---|
30 | #include "Config.hh" |
---|
31 | #include "EConst.hh" |
---|
32 | #include "BunchOfPhotons.hh" |
---|
33 | #include "Ground.hh" |
---|
34 | |
---|
35 | #include "EEvent.hh" |
---|
36 | #include "EAtmosphere.hh" |
---|
37 | #include "EAtmosphereBunchAdder.hh" |
---|
38 | #include "EAtmosphereSingleAdder.hh" |
---|
39 | |
---|
40 | ClassImp(NoRadiativeTransfer) |
---|
41 | |
---|
42 | using namespace TMath; |
---|
43 | using namespace sou; |
---|
44 | using namespace EConst; |
---|
45 | |
---|
46 | //_____________________________________________________________________________ |
---|
47 | NoRadiativeTransfer::NoRadiativeTransfer() : RadiativeTransfer(), fTotalList(0) { |
---|
48 | // |
---|
49 | // Constructor |
---|
50 | // |
---|
51 | |
---|
52 | fEmpty = new EmptyPhotonsOnPupil(); |
---|
53 | } |
---|
54 | |
---|
55 | //_____________________________________________________________________________ |
---|
56 | NoRadiativeTransfer::~NoRadiativeTransfer() { |
---|
57 | // |
---|
58 | // Destructor |
---|
59 | // |
---|
60 | SafeDelete(fEmpty); |
---|
61 | } |
---|
62 | |
---|
63 | //_______________________________________________________________________________________________________________________ |
---|
64 | PhotonsOnPupil* NoRadiativeTransfer::Get(PhotonsInAtmosphere* photons, const DetectorGeometry* dg) { |
---|
65 | // |
---|
66 | // Transport photons from source to Euso pupil |
---|
67 | // |
---|
68 | |
---|
69 | EEvent* ev = EEvent::GetCurrent(); |
---|
70 | if(ev->GetAtmosphere()) ev->GetAtmosphere()->SetMaxScatOrder(0); |
---|
71 | |
---|
72 | // if given list of photons is empty |
---|
73 | if(!photons) return NULL; |
---|
74 | |
---|
75 | if(photons->GetType() == "empty") return fEmpty; |
---|
76 | if(photons->GetType() != "list") Msg(EsafMsg::Panic) <<"Wrong PhotonsInAtmosphere format. ListPhotonsInAtmosphere expected."<< MsgDispatch; |
---|
77 | fTotalList = (ListPhotonsInAtmosphere*) photons; |
---|
78 | |
---|
79 | // number of bunches |
---|
80 | size_t NbBunch = fTotalList->GetListOfBunch().size(); |
---|
81 | Double_t NbTot = 0; |
---|
82 | Double_t nf = 0; |
---|
83 | Double_t nc = 0; |
---|
84 | for(size_t i=0; i<NbBunch; i++) { |
---|
85 | NbTot += (fTotalList->GetListOfBunch()[i])->GetWeight(); |
---|
86 | if(fTotalList->GetListOfBunch()[i]->GetType() == Fluo) nf += fTotalList->GetListOfBunch()[i]->GetWeight(); |
---|
87 | else nc += fTotalList->GetListOfBunch()[i]->GetWeight(); |
---|
88 | } |
---|
89 | #ifdef DEBUG |
---|
90 | Msg(EsafMsg::Debug) << "SIZE OF LIST OF BUNCHES = "<<NbBunch << MsgDispatch; |
---|
91 | Msg(EsafMsg::Debug) << "Nb fluo = " <<nf << MsgDispatch; |
---|
92 | Msg(EsafMsg::Debug) << "Nb ckov = " <<nc << MsgDispatch; |
---|
93 | #endif |
---|
94 | Msg(EsafMsg::Info) << "TOTAL number of photons ="<<NbTot << MsgDispatch; |
---|
95 | |
---|
96 | if ( NbBunch >=1 ) { |
---|
97 | EarthVector track = fTotalList->GetListOfBunch()[NbBunch - 1]->GetPos() |
---|
98 | - fTotalList->GetListOfBunch()[0]->GetPos(); |
---|
99 | #ifdef DEBUG |
---|
100 | Msg(EsafMsg::Debug) << "size of the photon track = "<<track.Mag()/km <<" km"<< MsgDispatch; |
---|
101 | #endif |
---|
102 | } |
---|
103 | |
---|
104 | |
---|
105 | // if some SinglePhotons created directly by LightSource module, they are saved into root |
---|
106 | if ( ev ) { |
---|
107 | const vector<SinglePhoton*>& list_single_2 = fTotalList->GetListOfSingle(); |
---|
108 | size_t nbnotsaved = fTotalList->GetNbNotSaved(); |
---|
109 | for (size_t i = list_single_2.size() - nbnotsaved; i<list_single_2.size(); i++ ) { |
---|
110 | EAtmosphereSingleAdder sa( list_single_2[i],true,false,0 ); |
---|
111 | ev->Fill(sa); |
---|
112 | fTotalList->OneSingleSaved(); |
---|
113 | } |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | // loop to store bunches into root files |
---|
118 | BunchOfPhotons* bunch = 0; |
---|
119 | while(true) { |
---|
120 | bunch = fTotalList->GetBunch(); |
---|
121 | if(!bunch) break; |
---|
122 | // saves bunch parameters at creation |
---|
123 | if ( ev ) { |
---|
124 | EAtmosphereBunchAdder ba( bunch, true ); |
---|
125 | ev->Fill(ba); |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | return fEmpty; |
---|
130 | } |
---|
131 | |
---|