70int main(
int argc,
char **argv)
82 JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
109 zap[
'p'] =
make_field(precision,
"precision for match with reference module") = 1.0e-5;
114 catch(
const exception &error) {
115 FATAL(error.what() << endl);
128 if (option == default_t) {
132 }
else if (option == modules_t) {
136 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
139 cout <<
' ' << noshowpos << setw(8) << right << module->getID();
140 cout <<
' ' << noshowpos << setw(3) << right << module->getString();
141 cout <<
' ' << noshowpos << setw(2) << right << module->getFloor();
142 cout <<
' ' <<
FIXED(7,2) << module->getX();
143 cout <<
' ' <<
FIXED(7,2) << module->getY();
144 cout <<
' ' <<
FIXED(7,2) << module->getZ();
145 cout <<
' ' <<
FIXED(8,2) << module->getT0();
147 if (module->getFloor() != 0) {
154 const double phi = (JVector3Z_t.getDot(q1.
twist) >= 0.0 ? +1.0 : -1.0) * q1.
twist.
getAngle();
156 cout <<
' ' <<
FIXED(7,2) << phi;
162 const double phi = (JVector3Z_t.getDot(q1.
twist) >= 0.0 ? +1.0 : -1.0) * q1.
twist.
getAngle();
164 cout <<
' ' <<
FIXED(7,2) << phi;
169 const JRotation3D R = getRotation(buffer, *module);
173 cout <<
' ' << (JModule::compare(buffer, *module, precision) ?
"==" :
"!=")
181 }
else if (option == pmts_t) {
183 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
184 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
186 cout <<
' ' << noshowpos << setw(8) << right << pmt->getID();
187 cout <<
' ' <<
FIXED(7,2) << pmt->getX();
188 cout <<
' ' <<
FIXED(7,2) << pmt->getY();
189 cout <<
' ' <<
FIXED(7,2) << pmt->getZ();
190 cout <<
' ' <<
FIXED(6,3) << pmt->getDX();
191 cout <<
' ' <<
FIXED(6,3) << pmt->getDY();
192 cout <<
' ' <<
FIXED(6,3) << pmt->getDZ();
193 cout <<
' ' <<
FIXED(8,2) << pmt->getT0();
194 cout <<
' ' << noshowpos << setw(8) << right << pmt->getStatus();
199 }
else if (option == geometry_t ||
200 option == GEOMETRY_t) {
202 if (option == geometry_t) {
204 cout <<
"Maximal distance [m] = " <<
FIXED(6,1) << getMaximalDistance(
detector) << endl;
205 cout <<
"Minimal distance [m] = " <<
FIXED(6,1) << getMinimalDistance(
detector) << endl;
206 cout <<
"Maximal time [ns] = " <<
FIXED(6,1) << getMaximalTime (
detector) << endl;
210 cout <<
"set_variable MAXIMAL_DISTANCE_M " <<
FIXED(6,1) << getMaximalDistance(
detector) <<
";" << endl;
211 cout <<
"set_variable MINIMAL_DISTANCE_M " <<
FIXED(6,1) << getMinimalDistance(
detector) <<
";" << endl;
214 }
else if (option == comment_t) {
218 }
else if (option == header_t ||
219 option == HEADER_t) {
221 if (option == header_t) {
223 cout <<
detector.getProperties() << endl;
224 cout <<
"name = " << (isARCADetector(
detector) ?
"ARCA" :
227 cout <<
"validity = "
233 cout <<
"set_variable UTM_EAST " <<
FIXED(12,2) <<
detector.getUTMEast() <<
";" << endl;
234 cout <<
"set_variable UTM_NORTH " <<
FIXED(12,2) <<
detector.getUTMNorth() <<
";" << endl;
235 cout <<
"set_variable UTM_Z " <<
FIXED(12,2) <<
detector.getUTMZ() <<
";" << endl;
236 cout <<
"set_variable UTM_ZONE " <<
FIXED(12,2) <<
detector.getUTMZone() <<
";" << endl;
237 cout <<
"set_variable UTM_WGS " <<
FIXED(12,2) <<
detector.getWGS() <<
";" << endl;
240 }
else if (option == version_t ||
241 option == VERSION_t) {
243 if (option == version_t) {
245 cout <<
detector.getVersion() << endl;
249 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
252 }
else if (option == identifier_t ||
253 option == IDENTIFIER_t) {
255 if (option == identifier_t) {
257 cout <<
"Detector " <<
detector.getID() << endl;
261 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
264 }
else if (option == can_t ||
270 const double D = getMaximalDistance(
detector);
272 if (option == can_t) {
274 cout <<
"X = " <<
FIXED(7,1) << cylinder.
getX() << endl;
275 cout <<
"Y = " <<
FIXED(7,1) << cylinder.
getY() << endl;
276 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.
getZmin() << endl;
277 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.
getZmax() << endl;
278 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.
getRadius() << endl;
279 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
280 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
281 cout <<
"Distance = " <<
FIXED(9,3) << D << endl;
285 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.
getX() <<
";" << endl;
286 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.
getY() <<
";" << endl;
287 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.
getZmin() <<
";" << endl;
288 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.
getZmax() <<
";" << endl;
289 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.
getRadius() <<
";" << endl;
290 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
291 cout <<
"set_variable CAN_VOLUME_M3 " <<
SCIENTIFIC(12,3) << V <<
";" << endl;
292 cout <<
"set_variable CAN_DISTANCE_M " <<
FIXED(9,3) << D <<
";" << endl;
295 }
else if (option == center_t ||
296 option == CENTER_t) {
300 if (option == center_t) {
303 cout << showpos <<
FIXED(8,3) << center.
getX() <<
' ';
304 cout << showpos <<
FIXED(8,3) << center.
getY() <<
' ';
305 cout << showpos <<
FIXED(8,3) << center.
getZ() << endl;
309 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.
getX() <<
";" << endl;
310 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.
getY() <<
";" << endl;
311 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.
getZ() <<
";" << endl;
314 }
else if (option == summary_t ||
315 option == SUMMARY_t) {
317 const int numberOfStrings = getNumberOfStrings(
detector);
318 const int numberOfFloors = getNumberOfFloors (
detector);
319 const int numberOfModules = getNumberOfModules(
detector);
320 const int numberOfPMTs = getNumberOfPMTs (
detector);
324 const JRange_t string_t(make_array(
detector.begin(),
detector.end(), &JModule::getString));
325 const JRange_t floor_t (make_array(
detector.begin(),
detector.end(), &JModule::getFloor));
330 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
331 strings.insert(module->getString());
332 modules.insert(module->getID());
335 if (option == summary_t) {
337 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
338 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
339 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
340 cout <<
"Number of PMTs = " << setw(4) << numberOfPMTs << endl;
341 cout <<
"First string = " << setw(4) << string_t.first << endl;
342 cout <<
"Last string = " << setw(4) << string_t.second << endl;
343 cout <<
"First floor = " << setw(4) << floor_t .first << endl;
344 cout <<
"Last floor = " << setw(4) << floor_t .second << endl;
348 cout <<
"let \"NUMBER_OF_STRINGS = " << setw(5) << numberOfStrings <<
"\";" << endl;
349 cout <<
"let \"NUMBER_OF_FLOORS = " << setw(5) << numberOfFloors <<
"\";" << endl;
350 cout <<
"let \"NUMBER_OF_MODULES = " << setw(5) << numberOfModules <<
"\";" << endl;
351 cout <<
"let \"NUMBER_OF_PMTS = " << setw(5) << numberOfPMTs <<
"\";" << endl;
352 cout <<
"let \"FIRST_STRING = " << setw(5) << string_t.first <<
"\";" << endl;
353 cout <<
"let \"LAST_STRING = " << setw(5) << string_t.second <<
"\";" << endl;
354 cout <<
"let \"FIRST_FLOOR = " << setw(5) << floor_t .first <<
"\";" << endl;
355 cout <<
"let \"LAST_FLOOR = " << setw(5) << floor_t .second <<
"\";" << endl;
357 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));
358 cout <<
");" << endl;
360 copy(modules.begin(), modules.end(), ostream_iterator<int>(cout,
" "));
361 cout <<
");" << endl;
365 for (
const auto i : strings) {
366 cout <<
"typeset -A " << getString(i) <<
";" << endl;
369 cout << getString(i.getString()) <<
"[" << i.getFloor() <<
"]=" << i.getID() <<
";" << endl;