69int main(
int argc,
char **argv)
81 JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
107 zap[
'p'] =
make_field(precision,
"precision for match with reference module") = 1.0e-5;
112 catch(
const exception &error) {
113 FATAL(error.what() << endl);
126 if (option == default_t) {
130 }
else if (option == modules_t) {
134 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
137 cout <<
' ' << noshowpos << setw(8) << right << module->getID();
138 cout <<
' ' << noshowpos << setw(3) << right << module->getString();
139 cout <<
' ' << noshowpos << setw(2) << right << module->getFloor();
140 cout <<
' ' <<
FIXED(7,2) << module->getX();
141 cout <<
' ' <<
FIXED(7,2) << module->getY();
142 cout <<
' ' <<
FIXED(7,2) << module->getZ();
143 cout <<
' ' <<
FIXED(8,2) << module->getT0();
145 if (module->getFloor() != 0) {
152 const double phi = (JVector3Z_t.getDot(q1.
twist) >= 0.0 ? +1.0 : -1.0) * q1.
twist.
getAngle();
154 cout <<
' ' <<
FIXED(7,2) << phi;
160 const double phi = (JVector3Z_t.getDot(q1.
twist) >= 0.0 ? +1.0 : -1.0) * q1.
twist.
getAngle();
162 cout <<
' ' <<
FIXED(7,2) << phi;
167 const JRotation3D R = getRotation(buffer, *module);
171 cout <<
' ' << (JModule::compare(buffer, *module, precision) ?
"==" :
"!=")
179 }
else if (option == pmts_t) {
181 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
182 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
184 cout <<
' ' << noshowpos << setw(8) << right << pmt->getID();
185 cout <<
' ' <<
FIXED(7,2) << pmt->getX();
186 cout <<
' ' <<
FIXED(7,2) << pmt->getY();
187 cout <<
' ' <<
FIXED(7,2) << pmt->getZ();
188 cout <<
' ' <<
FIXED(6,3) << pmt->getDX();
189 cout <<
' ' <<
FIXED(6,3) << pmt->getDY();
190 cout <<
' ' <<
FIXED(6,3) << pmt->getDZ();
191 cout <<
' ' <<
FIXED(8,2) << pmt->getT0();
192 cout <<
' ' << noshowpos << setw(8) << right << pmt->getStatus();
197 }
else if (option == geometry_t) {
199 cout <<
"Maximal distance [m] = " <<
FIXED(6,1) << getMaximalDistance(
detector) << endl;
200 cout <<
"Maximal time [ns] = " <<
FIXED(6,1) << getMaximalTime (
detector) << endl;
202 }
else if (option == comment_t) {
206 }
else if (option == header_t ||
207 option == HEADER_t) {
209 if (option == header_t) {
211 cout <<
detector.getProperties() << endl;
212 cout <<
"name = " << (isARCADetector(
detector) ?
"ARCA" :
215 cout <<
"validity = "
221 cout <<
"set_variable UTM_EAST " <<
FIXED(12,2) <<
detector.getUTMEast() <<
";" << endl;
222 cout <<
"set_variable UTM_NORTH " <<
FIXED(12,2) <<
detector.getUTMNorth() <<
";" << endl;
223 cout <<
"set_variable UTM_Z " <<
FIXED(12,2) <<
detector.getUTMZ() <<
";" << endl;
224 cout <<
"set_variable UTM_ZONE " <<
FIXED(12,2) <<
detector.getUTMZone() <<
";" << endl;
225 cout <<
"set_variable UTM_WGS " <<
FIXED(12,2) <<
detector.getWGS() <<
";" << endl;
228 }
else if (option == version_t ||
229 option == VERSION_t) {
231 if (option == version_t) {
233 cout <<
detector.getVersion() << endl;
237 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
240 }
else if (option == identifier_t ||
241 option == IDENTIFIER_t) {
243 if (option == identifier_t) {
245 cout <<
"Detector " <<
detector.getID() << endl;
249 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
252 }
else if (option == can_t ||
258 const double D = getMaximalDistance(
detector);
260 if (option == can_t) {
262 cout <<
"X = " <<
FIXED(7,1) << cylinder.
getX() << endl;
263 cout <<
"Y = " <<
FIXED(7,1) << cylinder.
getY() << endl;
264 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.
getZmin() << endl;
265 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.
getZmax() << endl;
266 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.
getRadius() << endl;
267 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
268 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
269 cout <<
"Distance = " <<
FIXED(9,3) << D << endl;
273 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.
getX() <<
";" << endl;
274 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.
getY() <<
";" << endl;
275 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.
getZmin() <<
";" << endl;
276 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.
getZmax() <<
";" << endl;
277 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.
getRadius() <<
";" << endl;
278 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
279 cout <<
"set_variable CAN_VOLUME_M3 " <<
SCIENTIFIC(12,3) << V <<
";" << endl;
280 cout <<
"set_variable CAN_DISTANCE_M " <<
FIXED(9,3) << D <<
";" << endl;
283 }
else if (option == center_t ||
284 option == CENTER_t) {
288 if (option == center_t) {
291 cout << showpos <<
FIXED(8,3) << center.
getX() <<
' ';
292 cout << showpos <<
FIXED(8,3) << center.
getY() <<
' ';
293 cout << showpos <<
FIXED(8,3) << center.
getZ() << endl;
297 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.
getX() <<
";" << endl;
298 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.
getY() <<
";" << endl;
299 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.
getZ() <<
";" << endl;
302 }
else if (option == summary_t ||
303 option == SUMMARY_t) {
305 const int numberOfStrings = getNumberOfStrings(
detector);
306 const int numberOfFloors = getNumberOfFloors (
detector);
307 const int numberOfModules = getNumberOfModules(
detector);
308 const int numberOfPMTs = getNumberOfPMTs (
detector);
312 const JRange_t string_t(make_array(
detector.begin(),
detector.end(), &JModule::getString));
313 const JRange_t floor_t (make_array(
detector.begin(),
detector.end(), &JModule::getFloor));
318 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
319 strings.insert(module->getString());
320 modules.insert(module->getID());
323 if (option == summary_t) {
325 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
326 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
327 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
328 cout <<
"Number of PMTs = " << setw(4) << numberOfPMTs << endl;
329 cout <<
"First string = " << setw(4) << string_t.first << endl;
330 cout <<
"Last string = " << setw(4) << string_t.second << endl;
331 cout <<
"First floor = " << setw(4) << floor_t .first << endl;
332 cout <<
"Last floor = " << setw(4) << floor_t .second << endl;
336 cout <<
"let \"NUMBER_OF_STRINGS = " << setw(5) << numberOfStrings <<
"\";" << endl;
337 cout <<
"let \"NUMBER_OF_FLOORS = " << setw(5) << numberOfFloors <<
"\";" << endl;
338 cout <<
"let \"NUMBER_OF_MODULES = " << setw(5) << numberOfModules <<
"\";" << endl;
339 cout <<
"let \"NUMBER_OF_PMTS = " << setw(5) << numberOfPMTs <<
"\";" << endl;
340 cout <<
"let \"FIRST_STRING = " << setw(5) << string_t.first <<
"\";" << endl;
341 cout <<
"let \"LAST_STRING = " << setw(5) << string_t.second <<
"\";" << endl;
342 cout <<
"let \"FIRST_FLOOR = " << setw(5) << floor_t .first <<
"\";" << endl;
343 cout <<
"let \"LAST_FLOOR = " << setw(5) << floor_t .second <<
"\";" << endl;
345 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));
346 cout <<
");" << endl;
348 copy(modules.begin(), modules.end(), ostream_iterator<int>(cout,
" "));
349 cout <<
");" << endl;
353 for (
const auto i : strings) {
354 cout <<
"typeset -A " << getString(i) <<
";" << endl;
357 cout << getString(i.getString()) <<
"[" << i.getFloor() <<
"]=" << i.getID() <<
";" << endl;