46{
49
50 string inputFile;
52 int detectorID;
53 string variant;
55 double Zmin_m;
56 string option;
58
59
60
66
67 try {
68
69 JParser<> zap(
"Auxiliary program to generate detector files.");
70
72
73 zap[
'f'] =
make_field(inputFile,
"anchor positions") =
"";
75 zap[
'D'] =
make_field(detectorID,
"detector identifier");
76 zap[
'V'] =
make_field(variant,
"detector version") = getDetectorVersions<string>();
78 zap[
'z'] =
make_field(Zmin_m,
"distance from seabed [m]") = 100.;
79 zap[
'O'] =
make_field(option,
"detector type") = ARCA_t, ORCA_t, Antares_t;
81
82 zap(argc, argv);
83 }
84 catch(const exception &error) {
85 FATAL(error.what() << endl);
86 }
87
88
90
91 if (option == ARCA_t)
93 else if (option == ORCA_t)
95 else if (option == Antares_t)
96 ;
97 else
98 FATAL(
"Invalid option " << option << endl);
99
100
102
104 FATAL(
"No detector address map for detector identifier " <<
detector.getID() << endl);
105 }
106
108
110
111
112 deque<JAnchor> footprint;
113
114 if (inputFile != "") {
115
117
118 NOTICE(
"Reading file " << file_name <<
".. " << flush);
119
120 ifstream in(file_name.c_str());
121
122 if (in) {
123
125 footprint.push_back(anchor);
126 }
127
128 in.close();
129
131
132 } else {
133
134 FATAL(
"Error opening file " << inputFile);
135 }
136
137 } else {
138
139
140
141 footprint.push_back(
JAnchor( 1, 6, -7));
142 footprint.push_back(
JAnchor( 2, 188, 9));
143 footprint.push_back(
JAnchor( 3, 131, 153));
144 footprint.push_back(
JAnchor( 4, -85, 120));
145 footprint.push_back(
JAnchor( 5, -175, 39));
146 footprint.push_back(
JAnchor( 6, -64, -181));
147 footprint.push_back(
JAnchor( 7, 90, -178));
148 footprint.push_back(
JAnchor( 8, 368, 20));
149 footprint.push_back(
JAnchor( 9, 251, 159));
150 footprint.push_back(
JAnchor( 10, 264, -146));
151 footprint.push_back(
JAnchor( 11, 189, 293));
152 footprint.push_back(
JAnchor( 12, 12, 309));
153 footprint.push_back(
JAnchor( 13, -176, 338));
154 footprint.push_back(
JAnchor( 14, -266, 149));
155 footprint.push_back(
JAnchor( 15, -336, -1));
156 footprint.push_back(
JAnchor( 16, -248, -174));
157 footprint.push_back(
JAnchor( 17, -196, -348));
158 footprint.push_back(
JAnchor( 18, -18, -350));
159 footprint.push_back(
JAnchor( 19, 211, -339));
160 footprint.push_back(
JAnchor( 20, 541, -12));
161 footprint.push_back(
JAnchor( 21, 442, 183));
162 footprint.push_back(
JAnchor( 22, 422, -125));
163 footprint.push_back(
JAnchor( 23, 364, 287));
164 footprint.push_back(
JAnchor( 24, 342, -323));
165 footprint.push_back(
JAnchor( 25, 297, 499));
166 footprint.push_back(
JAnchor( 26, 51, 452));
167 footprint.push_back(
JAnchor( 27, -78, 488));
168 footprint.push_back(
JAnchor( 28, -281, 508));
169 footprint.push_back(
JAnchor( 29, -325, 304));
170 footprint.push_back(
JAnchor( 30, -455, 128));
171 footprint.push_back(
JAnchor( 31, -541, 15));
172 footprint.push_back(
JAnchor( 32, -429, -142));
173 footprint.push_back(
JAnchor( 33, -327, -316));
174 footprint.push_back(
JAnchor( 34, -255, -488));
175 footprint.push_back(
JAnchor( 35, -103, -508));
176 footprint.push_back(
JAnchor( 36, 74, -469));
177 footprint.push_back(
JAnchor( 37, 289, -452));
178 footprint.push_back(
JAnchor( 38, 715, 0));
179 footprint.push_back(
JAnchor( 39, 653, 154));
180 footprint.push_back(
JAnchor( 40, 614, -141));
181 footprint.push_back(
JAnchor( 41, 530, 269));
182 footprint.push_back(
JAnchor( 42, 512, -323));
183 footprint.push_back(
JAnchor( 43, 473, 472));
184 footprint.push_back(
JAnchor( 44, 458, -473));
185 footprint.push_back(
JAnchor( 45, 395, 632));
186 footprint.push_back(
JAnchor( 46, 205, 630));
187 footprint.push_back(
JAnchor( 47, 1, 667));
188 footprint.push_back(
JAnchor( 48, -160, 644));
189 footprint.push_back(
JAnchor( 49, -352, 639));
190 footprint.push_back(
JAnchor( 50, -413, 460));
191 footprint.push_back(
JAnchor( 51, -564, 286));
192 footprint.push_back(
JAnchor( 52, -636, 125));
193 footprint.push_back(
JAnchor( 53, -717, 23));
194 footprint.push_back(
JAnchor( 54, -605, -139));
195 footprint.push_back(
JAnchor( 55, -518, -279));
196 footprint.push_back(
JAnchor( 56, -482, -448));
197 footprint.push_back(
JAnchor( 57, -379, -595));
198 footprint.push_back(
JAnchor( 58, -211, -619));
199 footprint.push_back(
JAnchor( 59, 8, -652));
200 footprint.push_back(
JAnchor( 60, 214, -619));
201 footprint.push_back(
JAnchor( 61, 395, -617));
202 footprint.push_back(
JAnchor( 62, 886, -12));
203 footprint.push_back(
JAnchor( 63, 802, 155));
204 footprint.push_back(
JAnchor( 64, 844, -128));
205 footprint.push_back(
JAnchor( 65, 697, 285));
206 footprint.push_back(
JAnchor( 66, 731, -275));
207 footprint.push_back(
JAnchor( 67, 621, 450));
208 footprint.push_back(
JAnchor( 68, 600, -497));
209 footprint.push_back(
JAnchor( 69, 568, 593));
210 footprint.push_back(
JAnchor( 70, 517, -586));
211 footprint.push_back(
JAnchor( 71, 430, 776));
212 footprint.push_back(
JAnchor( 72, 240, 758));
213 footprint.push_back(
JAnchor( 73, 70, 783));
214 footprint.push_back(
JAnchor( 74, -75, 803));
215 footprint.push_back(
JAnchor( 75, -252, 809));
216 footprint.push_back(
JAnchor( 76, -478, 771));
217 footprint.push_back(
JAnchor( 77, -510, 590));
218 footprint.push_back(
JAnchor( 78, -643, 468));
219 footprint.push_back(
JAnchor( 79, -741, 284));
220 footprint.push_back(
JAnchor( 80, -845, 175));
221 footprint.push_back(
JAnchor( 81, -907, -6));
222 footprint.push_back(
JAnchor( 82, -792, -142));
223 footprint.push_back(
JAnchor( 83, -737, -340));
224 footprint.push_back(
JAnchor( 84, -639, -492));
225 footprint.push_back(
JAnchor( 85, -518, -596));
226 footprint.push_back(
JAnchor( 86, -455, -751));
227 footprint.push_back(
JAnchor( 87, -260, -814));
228 footprint.push_back(
JAnchor( 88, -103, -819));
229 footprint.push_back(
JAnchor( 89, 106, -764));
230 footprint.push_back(
JAnchor( 90, 274, -754));
231 footprint.push_back(
JAnchor( 91, 417, -762));
232 footprint.push_back(
JAnchor( 92, 1094, -4));
233 footprint.push_back(
JAnchor( 93, 1010, 120));
234 footprint.push_back(
JAnchor( 94, 992, -171));
235 footprint.push_back(
JAnchor( 95, 898, 324));
236 footprint.push_back(
JAnchor( 96, 901, -298));
237 footprint.push_back(
JAnchor( 97, 768, 471));
238 footprint.push_back(
JAnchor( 98, 818, -477));
239 footprint.push_back(
JAnchor( 99, 731, 632));
240 footprint.push_back(
JAnchor(100, 713, -633));
241 footprint.push_back(
JAnchor(101, 625, 772));
242 footprint.push_back(
JAnchor(102, 661, -759));
243 footprint.push_back(
JAnchor(103, 530, 949));
244 footprint.push_back(
JAnchor(104, 345, 960));
245 footprint.push_back(
JAnchor(105, 221, 931));
246 footprint.push_back(
JAnchor(106, -29, 962));
247 footprint.push_back(
JAnchor(107, -155, 967));
248 footprint.push_back(
JAnchor(108, -382, 917));
249 footprint.push_back(
JAnchor(109, -545, 965));
250 footprint.push_back(
JAnchor(110, -634, 779));
251 footprint.push_back(
JAnchor(111, -731, 600));
252 footprint.push_back(
JAnchor(112, -852, 471));
253 footprint.push_back(
JAnchor(113, -903, 322));
254 footprint.push_back(
JAnchor(114, -976, 166));
255 footprint.push_back(
JAnchor(115, -1100, 11));
256 footprint.push_back(
JAnchor(116, -1006, -131));
257 footprint.push_back(
JAnchor(117, -867, -332));
258 footprint.push_back(
JAnchor(118, -800, -504));
259 footprint.push_back(
JAnchor(119, -706, -593));
260 footprint.push_back(
JAnchor(120, -604, -800));
261 footprint.push_back(
JAnchor(121, -503, -933));
262 footprint.push_back(
JAnchor(122, -318, -927));
263 footprint.push_back(
JAnchor(123, -177, -926));
264 footprint.push_back(
JAnchor(124, -10, -894));
265 footprint.push_back(
JAnchor(125, 155, -919));
266 footprint.push_back(
JAnchor(126, 381, -967));
267 footprint.push_back(
JAnchor(127, 531, -900));
268 footprint.push_back(
JAnchor(128, 1091, 311));
269 footprint.push_back(
JAnchor(129, 1061, -285));
270 footprint.push_back(
JAnchor(130, 966, 481));
271 footprint.push_back(
JAnchor(131, 958, -457));
272 footprint.push_back(
JAnchor(132, 905, 658));
273 footprint.push_back(
JAnchor(133, 863, -630));
274 footprint.push_back(
JAnchor(134, 788, 742));
275 footprint.push_back(
JAnchor(135, 686, 911));
276 footprint.push_back(
JAnchor(136, 277, 1113));
277 footprint.push_back(
JAnchor(137, 92, 1094));
278 footprint.push_back(
JAnchor(138, -84, 1127));
279 footprint.push_back(
JAnchor(139, -302, 1062));
280 footprint.push_back(
JAnchor(140, -732, 892));
281 footprint.push_back(
JAnchor(141, -793, 761));
282 footprint.push_back(
JAnchor(142, -901, 661));
283 footprint.push_back(
JAnchor(143, -1012, 456));
284 footprint.push_back(
JAnchor(144, -1101, 280));
285 footprint.push_back(
JAnchor(145, -1077, -326));
286 footprint.push_back(
JAnchor(146, -973, -457));
287 footprint.push_back(
JAnchor(147, -883, -602));
288 footprint.push_back(
JAnchor(148, -822, -771));
289 footprint.push_back(
JAnchor(149, -689, -910));
290 footprint.push_back(
JAnchor(150, -457, -1066));
291 footprint.push_back(
JAnchor(151, -268, -1067));
292 footprint.push_back(
JAnchor(152, -58, -1080));
293 footprint.push_back(
JAnchor(153, 72, -1100));
294 footprint.push_back(
JAnchor(154, 280, -1081));
295
296
297
298 for (deque<JAnchor>::iterator i = footprint.begin(); i != footprint.end(); ++i) {
300 }
301
303 FATAL(
"Available footprint inconsistent with specified number of lines "
304 << parameters.
numberOfLines <<
" > " << footprint.size() << endl);
305 }
306
307
308
309 sort(footprint.begin(), footprint.end());
310
313 footprint.pop_front();
314 }
315 } else {
317 footprint.pop_back();
318 }
319 }
320
321
322
323 for (deque<JAnchor>::iterator i = footprint.begin(); i != footprint.end(); ++i) {
324 static_cast<JObjectID&
>(*i) = JObjectID(
distance(footprint.begin(),i) + 1);
325 }
326 }
327
328
329 for (deque<JAnchor>::iterator i = footprint.begin(); i != footprint.end(); ++i) {
330 DEBUG(i->getID() <<
' ' << i->getX() <<
' ' << i->getY() << endl);
331 }
332
333
334
335
337
338 for (deque<JAnchor>::const_iterator anchor = footprint.begin(); anchor != footprint.end(); ++anchor) {
339
340 {
342 anchor->getY(),
343 option == ARCA_t ? ARCA_TBARZ_M :
344 option == ORCA_t ? ORCA_TBARZ_M :
345 0.0);
346
347 const JLocation location(anchor->getID(), 0);
348
350
352
353 module.set(position);
354
355 module.compile();
356
358 }
359
360 for (
unsigned int floor = 1; floor <= parameters.
numberOfFloors; ++floor) {
361
363 anchor->getY(),
365
366 const JLocation location(anchor->getID(), floor);
367
369
371
372 if (option == ARCA_t || option == ORCA_t)
373 module = getModule<JKM3NeT_t> (id, location);
374 else if (option == Antares_t)
375 module = getModule<JAntares_t>(id, location);
376 else
377 FATAL(
"Invalid option " << option << endl);
378
379 module.add(position);
380
381 for (JModule::iterator pmt = module.begin(); pmt != module.end(); ++pmt, ++
PMT) {
383
384 }
385
387 }
388 }
389
390
391
392 try {
394 }
397 }
398
399 return 0;
400}
JDAQPMTIdentifier PMT
Command line options.
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Data structure for anchor position on sea bed.
Lookup table for PMT addresses in detector.
virtual int getModuleID(const JLocation &location) const
Get module identifier.
Auxiliary class for I/O of JDetectorParameters data structure.
Data structure for parameters for detector geometry.
JParameter< unsigned int > numberOfLines
JParameter< double > floorDistance_m
JParameter< int > detectorType
JParameter< unsigned int > numberOfFloors
JParameter< double > lineDistance_m
Logical location of module.
Data structure for a composite optical module.
Data structure for vector in three dimensions.
Utility class to parse command line options.
JDetectorHeader getARCADetectorHeader()
Get detector header for ARCA.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
JDetectorHeader getORCADetectorHeader()
Get detector header for ORCA.
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...