24 const char*
const default_t =
"default";
26 const char*
const modules_t =
"modules";
27 const char*
const pmts_t =
"pmts";
28 const char*
const geometry_t =
"geometry";
30 const char*
const comment_t =
"comment";
31 const char*
const header_t =
"header";
32 const char*
const identifier_t =
"identifier";
33 const char*
const version_t =
"version";
34 const char*
const can_t =
"can";
35 const char*
const center_t =
"center";
36 const char*
const summary_t =
"summary";
38 const char*
const HEADER_t =
"HEADER";
39 const char*
const IDENTIFIER_t =
"IDENTIFIER";
40 const char*
const VERSION_t =
"VERSION";
41 const char*
const CAN_t =
"CAN";
42 const char*
const CENTER_t =
"CENTER";
43 const char*
const SUMMARY_t =
"SUMMARY";
53 int main(
int argc,
char **argv)
63 JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
93 catch(
const exception &error) {
94 FATAL(error.what() << endl);
109 if (option == default_t) {
113 }
else if (option == modules_t) {
115 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
118 cout <<
' ' << noshowpos << setw(8) << right << module->getID();
119 cout <<
' ' << noshowpos << setw(3) << right << module->getString();
120 cout <<
' ' << noshowpos << setw(2) << right << module->getFloor();
121 cout <<
' ' <<
FIXED(7,2) << module->getX();
122 cout <<
' ' <<
FIXED(7,2) << module->getY();
123 cout <<
' ' <<
FIXED(7,2) << module->getZ();
124 cout <<
' ' <<
FIXED(8,2) << module->getT0();
128 }
else if (option == pmts_t) {
130 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
131 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
134 cout <<
' ' << noshowpos << setw(8) << right << pmt->getID();
135 cout <<
' ' <<
FIXED(7,2) << pmt->getX();
136 cout <<
' ' <<
FIXED(7,2) << pmt->getY();
137 cout <<
' ' <<
FIXED(7,2) << pmt->getZ();
138 cout <<
' ' <<
FIXED(6,3) << pmt->getDX();
139 cout <<
' ' <<
FIXED(6,3) << pmt->getDY();
140 cout <<
' ' <<
FIXED(6,3) << pmt->getDZ();
141 cout <<
' ' <<
FIXED(8,2) << pmt->getT0();
142 cout <<
' ' << noshowpos << setw(8) << right << pmt->getStatus();
147 }
else if (option == geometry_t) {
152 }
else if (option == comment_t) {
156 }
else if (option == header_t ||
157 option == HEADER_t) {
159 if (option == header_t) {
161 cout <<
detector.getProperties() << endl;
165 cout <<
"set_variable UTM_EAST " <<
FIXED(12,2) <<
detector.getUTMEast() <<
";" << endl;
166 cout <<
"set_variable UTM_NORTH " <<
FIXED(12,2) <<
detector.getUTMNorth() <<
";" << endl;
167 cout <<
"set_variable UTM_Z " <<
FIXED(12,2) <<
detector.getUTMZ() <<
";" << endl;
168 cout <<
"set_variable UTM_ZONE " <<
FIXED(12,2) <<
detector.getUTMZone() <<
";" << endl;
169 cout <<
"set_variable UTM_WGS " <<
FIXED(12,2) <<
detector.getWGS() <<
";" << endl;
172 }
else if (option == version_t ||
173 option == VERSION_t) {
175 if (option == version_t) {
177 cout <<
detector.getVersion() << endl;
181 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
184 }
else if (option == identifier_t ||
185 option == IDENTIFIER_t) {
187 if (option == identifier_t) {
189 cout <<
"Detector " <<
detector.getID() << endl;
193 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
196 }
else if (option == can_t ||
201 const double V = (cylinder.getZmax() - cylinder.getZmin()) *
PI * cylinder.getRadius() * cylinder.getRadius();
203 if (option == can_t) {
205 cout <<
"X = " <<
FIXED(7,1) << cylinder.getX() << endl;
206 cout <<
"Y = " <<
FIXED(7,1) << cylinder.getY() << endl;
207 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.getZmin() << endl;
208 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.getZmax() << endl;
209 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.getRadius() << endl;
210 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
211 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
215 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.getX() <<
";" << endl;
216 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.getY() <<
";" << endl;
217 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.getZmin() <<
";" << endl;
218 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.getZmax() <<
";" << endl;
219 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.getRadius() <<
";" << endl;
220 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
221 cout <<
"set_variable CAN_VOLUME_M3" <<
SCIENTIFIC(12,3) << V <<
";" << endl;
224 }
else if (option == center_t ||
225 option == CENTER_t) {
229 if (option == center_t) {
232 cout << showpos <<
FIXED(8,3) << center.getX() <<
' ';
233 cout << showpos <<
FIXED(8,3) << center.getY() <<
' ';
234 cout << showpos <<
FIXED(8,3) << center.getZ() << endl;
238 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.getX() <<
";" << endl;
239 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.getY() <<
";" << endl;
240 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.getZ() <<
";" << endl;
243 }
else if (option == summary_t ||
244 option == SUMMARY_t) {
257 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
258 strings.insert(module->getString());
261 if (option == summary_t) {
263 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
264 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
265 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
266 cout <<
"First string = " << setw(4) <<
string.first << endl;
267 cout <<
"Last string = " << setw(4) <<
string.second << endl;
268 cout <<
"First floor = " << setw(4) << floor .first << endl;
269 cout <<
"Last floor = " << setw(4) << floor .second << endl;
273 cout <<
"set_variable NUMBER_OF_STRINGS " << setw(4) << numberOfStrings <<
";" << endl;
274 cout <<
"set_variable NUMBER_OF_FLOORS " << setw(4) << numberOfFloors <<
";" << endl;
275 cout <<
"set_variable NUMBER_OF_MODULES " << setw(4) << numberOfModules <<
";" << endl;
276 cout <<
"set_variable FIRST_STRING " << setw(4) <<
string.first <<
";" << endl;
277 cout <<
"set_variable LAST_STRING " << setw(4) <<
string.second <<
";" << endl;
278 cout <<
"set_variable FIRST_FLOOR " << setw(4) << floor .first <<
";" << endl;
279 cout <<
"set_variable LAST_FLOOR " << setw(4) << floor .second <<
";" << endl;
280 cout <<
"set_array STRINGS ";
281 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));
Utility class to parse command line options.
Auxiliary data structure for floating point format specification.
static const JModuleCounter getNumberOfModules
Function object to count unique modules.
Data structure for detector geometry and calibration.
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
static const double PI
Mathematical constants.
double getMaximalTime(const double R_Hz)
Get maximal time for given rate.
General purpose messaging.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary data structure for floating point format specification.
int main(int argc, char *argv[])