1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: LightFactory.cc 2819 2009-03-13 11:48:16Z naumov $ |
---|
3 | // Marco Pallavicini created Mar, 13 2002 |
---|
4 | |
---|
5 | #include <string> |
---|
6 | #include "LightFactory.hh" |
---|
7 | #include "Config.hh" |
---|
8 | #include "StandardLightToEuso.hh" |
---|
9 | #include "FileUnisimLightToEuso.hh" |
---|
10 | #include "TestLightToEuso.hh" |
---|
11 | #include "PhPRootFileLightToEuso.hh" |
---|
12 | #include "SinglePhotonRootFileLightToEuso.hh" |
---|
13 | #include "BunchRadiativeTransfer.hh" |
---|
14 | #include "MCRadiativeTransfer.hh" |
---|
15 | #include "PureMCRadiativeTransfer.hh" |
---|
16 | #include "NoRadiativeTransfer.hh" |
---|
17 | #include "TestLightSource.hh" |
---|
18 | #include "FileShowerGenerator.hh" |
---|
19 | #include "ShowerLightSource.hh" |
---|
20 | #include "NoLightSource.hh" |
---|
21 | #include "NoEventGenerator.hh" |
---|
22 | #include "SlastShowerGenerator.hh" |
---|
23 | #include "UnisimFileShowerGenerator.hh" |
---|
24 | #include "CorsikaFileShowerGenerator.hh" |
---|
25 | #include "ConexFileShowerGenerator.hh" |
---|
26 | #ifdef ___USING_SLAST77___ |
---|
27 | #include "SlastLightToEuso.hh" |
---|
28 | #endif |
---|
29 | |
---|
30 | ClassImp(LightFactory) |
---|
31 | |
---|
32 | LightFactory* LightFactory::fMe = NULL; |
---|
33 | |
---|
34 | //______________________________________________________________________________ |
---|
35 | LightFactory::LightFactory() { |
---|
36 | // |
---|
37 | // ctor |
---|
38 | // |
---|
39 | } |
---|
40 | |
---|
41 | //______________________________________________________________________________ |
---|
42 | LightFactory::~LightFactory() { |
---|
43 | // |
---|
44 | // dtor |
---|
45 | // |
---|
46 | } |
---|
47 | |
---|
48 | //______________________________________________________________________________ |
---|
49 | LightFactory* LightFactory::Get(){ |
---|
50 | // |
---|
51 | // Instance |
---|
52 | // |
---|
53 | |
---|
54 | if (fMe == NULL) |
---|
55 | fMe = new LightFactory(); |
---|
56 | return fMe; |
---|
57 | } |
---|
58 | |
---|
59 | //______________________________________________________________________________ |
---|
60 | LightToEuso *LightFactory::GetLightToEuso() { |
---|
61 | // |
---|
62 | // Call ctor of appropriate LightToEuso object |
---|
63 | // |
---|
64 | |
---|
65 | ConfigFileParser *pConfig = Config::Get()->GetCF("General", "Euso"); |
---|
66 | string name = pConfig->GetStr ("Euso.fLightToEuso"); |
---|
67 | |
---|
68 | if (name == "standard") // normal simulation |
---|
69 | return new StandardLightToEuso(); |
---|
70 | |
---|
71 | else if (name == "unisim") // unisim file with photons on pupil |
---|
72 | return new FileUnisimLightToEuso(); |
---|
73 | |
---|
74 | else if (name == "test") // test photons on pupil with various shapes |
---|
75 | return new TestLightToEuso(); |
---|
76 | |
---|
77 | #ifdef ___USING_SLAST77___ |
---|
78 | else if (name == "slast") // slast f77 generation of photons on pupil |
---|
79 | return new SlastLightToEuso(); |
---|
80 | #endif |
---|
81 | |
---|
82 | else if (name == "phprootfile") // phproot file with photons on pupil |
---|
83 | return new PhPRootFileLightToEuso(); |
---|
84 | |
---|
85 | else if (name == "singlephrootfile") // singlephoton root file with singlephotons in atmosphere |
---|
86 | return new SinglePhotonRootFileLightToEuso(); |
---|
87 | |
---|
88 | else if (name == "none") // no photons at all; electronic test |
---|
89 | return NULL; |
---|
90 | |
---|
91 | else |
---|
92 | throw invalid_argument("invalid LightToEuso object: " + name); |
---|
93 | |
---|
94 | return NULL; |
---|
95 | |
---|
96 | } |
---|
97 | |
---|
98 | //______________________________________________________________________________ |
---|
99 | EventGenerator * LightFactory::GetGenerator( const string& name ) { |
---|
100 | // |
---|
101 | // Call ctor of appropriate EventGenerator object |
---|
102 | // |
---|
103 | |
---|
104 | if (name == "file") |
---|
105 | return new FileShowerGenerator(); |
---|
106 | |
---|
107 | else if (name == "noevent") |
---|
108 | return new NoEventGenerator(); |
---|
109 | |
---|
110 | else if (name == "slast++") |
---|
111 | return new SlastShowerGenerator(); |
---|
112 | |
---|
113 | else if (name == "Unisimfile") |
---|
114 | return new UnisimFileShowerGenerator(); |
---|
115 | |
---|
116 | else if (name == "Corsikafile") |
---|
117 | return new CorsikaFileShowerGenerator(); |
---|
118 | |
---|
119 | else if (name == "conex") |
---|
120 | return new ConexFileShowerGenerator(); |
---|
121 | |
---|
122 | else |
---|
123 | throw invalid_argument("invalid ShowerSource object: " + name); |
---|
124 | |
---|
125 | return NULL; |
---|
126 | } |
---|
127 | |
---|
128 | |
---|
129 | //______________________________________________________________________________ |
---|
130 | LightSource * LightFactory::GetLightSource( const string& name ) { |
---|
131 | // |
---|
132 | // Call ctor of appropriate LightSource object |
---|
133 | // |
---|
134 | |
---|
135 | if (name == "test") |
---|
136 | return new TestLightSource(); |
---|
137 | |
---|
138 | else if (name == "lighting") |
---|
139 | throw invalid_argument("LightingLS not yet implemented\n"); |
---|
140 | |
---|
141 | else if (name == "meteor") |
---|
142 | throw invalid_argument("MeteorLS not yet implemented\n"); |
---|
143 | |
---|
144 | else if (name == "lidar") |
---|
145 | throw invalid_argument("LidarLS not yet implemented\n"); |
---|
146 | |
---|
147 | else if (name == "file") |
---|
148 | throw invalid_argument("FileLS not yet implemented\n"); |
---|
149 | |
---|
150 | else if (name == "track") |
---|
151 | throw invalid_argument("TackLS not yet implemented\n"); |
---|
152 | |
---|
153 | else if (name == "shower") |
---|
154 | return new ShowerLightSource(); |
---|
155 | |
---|
156 | else if (name == "nolight") |
---|
157 | return new NoLightSource(); |
---|
158 | |
---|
159 | else |
---|
160 | throw invalid_argument("invalid LightSource object: " + name); |
---|
161 | |
---|
162 | return NULL; |
---|
163 | } |
---|
164 | |
---|
165 | //______________________________________________________________________________ |
---|
166 | RadiativeTransfer * LightFactory::GetRadiative( const string& name ) { |
---|
167 | // |
---|
168 | // Call ctor of appropriate RadiativeTransfer object |
---|
169 | // |
---|
170 | |
---|
171 | if (name == "bunch") |
---|
172 | return new BunchRadiativeTransfer(); |
---|
173 | |
---|
174 | else if (name == "MC") |
---|
175 | return new MCRadiativeTransfer(); |
---|
176 | |
---|
177 | else if (name == "PureMC") |
---|
178 | return new PureMCRadiativeTransfer(); |
---|
179 | |
---|
180 | else if (name == "notransfer") |
---|
181 | return new NoRadiativeTransfer(); |
---|
182 | |
---|
183 | else throw invalid_argument("invalid RadiativeTransfer object: " + name); |
---|
184 | |
---|
185 | return NULL; |
---|
186 | } |
---|