70 JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
96 zap[
'p'] =
make_field(precision,
"precision for match with reference module") = 1.0e-5;
101 catch(
const exception &error) {
102 FATAL(error.what() << endl);
115 if (option == default_t) {
119 }
else if (option == modules_t) {
123 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
126 cout <<
' ' << noshowpos << setw(8) << right << module->getID();
127 cout <<
' ' << noshowpos << setw(3) << right << module->getString();
128 cout <<
' ' << noshowpos << setw(2) << right << module->getFloor();
129 cout <<
' ' <<
FIXED(7,2) << module->getX();
130 cout <<
' ' <<
FIXED(7,2) << module->getY();
131 cout <<
' ' <<
FIXED(7,2) << module->getZ();
132 cout <<
' ' <<
FIXED(8,2) << module->getT0();
134 if (module->getFloor() != 0) {
141 const double phi = (
JVector3Z_t.
getDot(q1.twist) >= 0.0 ? +1.0 : -1.0) * q1.twist.getAngle();
143 cout <<
' ' <<
FIXED(7,2) << phi;
149 const double phi = (
JVector3Z_t.
getDot(q1.twist) >= 0.0 ? +1.0 : -1.0) * q1.twist.getAngle();
151 cout <<
' ' <<
FIXED(7,2) << phi;
160 cout <<
' ' << (JModule::compare(buffer, *module, precision) ?
"==" :
"!=")
168 }
else if (option == pmts_t) {
170 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
171 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
173 cout <<
' ' << noshowpos << setw(8) << right << pmt->getID();
174 cout <<
' ' <<
FIXED(7,2) << pmt->getX();
175 cout <<
' ' <<
FIXED(7,2) << pmt->getY();
176 cout <<
' ' <<
FIXED(7,2) << pmt->getZ();
177 cout <<
' ' <<
FIXED(6,3) << pmt->getDX();
178 cout <<
' ' <<
FIXED(6,3) << pmt->getDY();
179 cout <<
' ' <<
FIXED(6,3) << pmt->getDZ();
180 cout <<
' ' <<
FIXED(8,2) << pmt->getT0();
181 cout <<
' ' << noshowpos << setw(8) << right << pmt->getStatus();
186 }
else if (option == geometry_t) {
191 }
else if (option == comment_t) {
195 }
else if (option == header_t ||
196 option == HEADER_t) {
198 if (option == header_t) {
200 cout <<
detector.getProperties() << endl;
204 cout <<
"validity = "
210 cout <<
"set_variable UTM_EAST " <<
FIXED(12,2) <<
detector.getUTMEast() <<
";" << endl;
211 cout <<
"set_variable UTM_NORTH " <<
FIXED(12,2) <<
detector.getUTMNorth() <<
";" << endl;
212 cout <<
"set_variable UTM_Z " <<
FIXED(12,2) <<
detector.getUTMZ() <<
";" << endl;
213 cout <<
"set_variable UTM_ZONE " <<
FIXED(12,2) <<
detector.getUTMZone() <<
";" << endl;
214 cout <<
"set_variable UTM_WGS " <<
FIXED(12,2) <<
detector.getWGS() <<
";" << endl;
217 }
else if (option == version_t ||
218 option == VERSION_t) {
220 if (option == version_t) {
222 cout <<
detector.getVersion() << endl;
226 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
229 }
else if (option == identifier_t ||
230 option == IDENTIFIER_t) {
232 if (option == identifier_t) {
234 cout <<
"Detector " <<
detector.getID() << endl;
238 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
241 }
else if (option == can_t ||
246 const double V = (cylinder.getZmax() - cylinder.getZmin()) *
PI * cylinder.getRadius() * cylinder.getRadius();
249 if (option == can_t) {
251 cout <<
"X = " <<
FIXED(7,1) << cylinder.getX() << endl;
252 cout <<
"Y = " <<
FIXED(7,1) << cylinder.getY() << endl;
253 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.getZmin() << endl;
254 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.getZmax() << endl;
255 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.getRadius() << endl;
256 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
257 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
258 cout <<
"Distance = " <<
FIXED(9,3) << D << endl;
262 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.getX() <<
";" << endl;
263 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.getY() <<
";" << endl;
264 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.getZmin() <<
";" << endl;
265 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.getZmax() <<
";" << endl;
266 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.getRadius() <<
";" << endl;
267 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
268 cout <<
"set_variable CAN_VOLUME_M3 " <<
SCIENTIFIC(12,3) << V <<
";" << endl;
269 cout <<
"set_variable CAN_DISTANCE_M " <<
FIXED(9,3) << D <<
";" << endl;
272 }
else if (option == center_t ||
273 option == CENTER_t) {
277 if (option == center_t) {
280 cout << showpos <<
FIXED(8,3) << center.getX() <<
' ';
281 cout << showpos <<
FIXED(8,3) << center.getY() <<
' ';
282 cout << showpos <<
FIXED(8,3) << center.getZ() << endl;
286 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.getX() <<
";" << endl;
287 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.getY() <<
";" << endl;
288 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.getZ() <<
";" << endl;
291 }
else if (option == summary_t ||
292 option == SUMMARY_t) {
307 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
308 strings.insert(module->getString());
309 modules.insert(module->getID());
312 if (option == summary_t) {
314 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
315 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
316 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
317 cout <<
"Number of PMTs = " << setw(4) << numberOfPMTs << endl;
318 cout <<
"First string = " << setw(4) <<
string.first << endl;
319 cout <<
"Last string = " << setw(4) <<
string.second << endl;
320 cout <<
"First floor = " << setw(4) << floor .first << endl;
321 cout <<
"Last floor = " << setw(4) << floor .second << endl;
325 cout <<
"set_variable NUMBER_OF_STRINGS " << setw(4) << numberOfStrings <<
";" << endl;
326 cout <<
"set_variable NUMBER_OF_FLOORS " << setw(4) << numberOfFloors <<
";" << endl;
327 cout <<
"set_variable NUMBER_OF_MODULES " << setw(4) << numberOfModules <<
";" << endl;
328 cout <<
"set_variable NUMBER_OF_PMTS " << setw(4) << numberOfPMTs <<
";" << endl;
329 cout <<
"set_variable FIRST_STRING " << setw(4) <<
string.first <<
";" << endl;
330 cout <<
"set_variable LAST_STRING " << setw(4) <<
string.second <<
";" << endl;
331 cout <<
"set_variable FIRST_FLOOR " << setw(4) << floor .first <<
";" << endl;
332 cout <<
"set_variable LAST_FLOOR " << setw(4) << floor .second <<
";" << endl;
333 cout <<
"set_array STRINGS ";
334 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));
336 cout <<
"set_array MODULES ";
337 copy(modules.begin(), modules.end(), ostream_iterator<int>(cout,
" "));
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
virtual const JModuleAddressMap & getDefaultModuleAddressMap() const =0
Get default module address map.
const JModuleAddressMap & get(const int id) const
Get module address map.
Data structure for a composite optical module.
void rotate(const JRotation3D &R)
Rotate module.
Data structure for unit quaternion in three dimensions.
const JQuaternion3D & getQuaternion() const
Get quaternion.
double getDot(const JVector3D &vector) const
Get dot product.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
JMODEL::JString getString(const JFit &fit)
Get model parameters of string.
int getNumberOfPMTs(const JModule &module)
Get number of PMTs.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
bool isORCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with that of ORCA.
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA.
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
JDetectorBuilder & getDetectorBuilder()
Get detector builder.
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
static const double PI
Mathematical constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const JModuleCounter getNumberOfModules
Function object to count unique modules.
double getMaximalTime(const double R_Hz)
Get maximal time for given rate.
Auxiliary data structure for floating point format specification.
Type definition of range.
Auxiliary interface for building detector.
const JModule & getModule(const int id=-1, const JLocation &location=JLocation()) const
Get module.
Auxiliary data structure for decomposition of quaternion in twist and swing quaternions.
Auxiliary class for date and time.
std::string toString() const
Get ASCII formatted date and time.
Auxiliary data structure for floating point format specification.