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;
168 cout <<
"set_variable UTM_EAST " <<
FIXED(12,2) <<
detector.getUTMEast() <<
";" << endl;
169 cout <<
"set_variable UTM_NORTH " <<
FIXED(12,2) <<
detector.getUTMNorth() <<
";" << endl;
170 cout <<
"set_variable UTM_Z " <<
FIXED(12,2) <<
detector.getUTMZ() <<
";" << endl;
171 cout <<
"set_variable UTM_ZONE " <<
FIXED(12,2) <<
detector.getUTMZone() <<
";" << endl;
172 cout <<
"set_variable UTM_WGS " <<
FIXED(12,2) <<
detector.getWGS() <<
";" << endl;
175 }
else if (option == version_t ||
176 option == VERSION_t) {
178 if (option == version_t) {
180 cout <<
detector.getVersion() << endl;
184 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
187 }
else if (option == identifier_t ||
188 option == IDENTIFIER_t) {
190 if (option == identifier_t) {
192 cout <<
"Detector " <<
detector.getID() << endl;
196 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
199 }
else if (option == can_t ||
204 const double V = (cylinder.getZmax() - cylinder.getZmin()) *
PI * cylinder.getRadius() * cylinder.getRadius();
206 if (option == can_t) {
208 cout <<
"X = " <<
FIXED(7,1) << cylinder.getX() << endl;
209 cout <<
"Y = " <<
FIXED(7,1) << cylinder.getY() << endl;
210 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.getZmin() << endl;
211 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.getZmax() << endl;
212 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.getRadius() << endl;
213 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
214 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
218 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.getX() <<
";" << endl;
219 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.getY() <<
";" << endl;
220 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.getZmin() <<
";" << endl;
221 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.getZmax() <<
";" << endl;
222 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.getRadius() <<
";" << endl;
223 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
224 cout <<
"set_variable CAN_VOLUME_M3" <<
SCIENTIFIC(12,3) << V <<
";" << endl;
227 }
else if (option == center_t ||
228 option == CENTER_t) {
232 if (option == center_t) {
235 cout << showpos <<
FIXED(8,3) << center.getX() <<
' ';
236 cout << showpos <<
FIXED(8,3) << center.getY() <<
' ';
237 cout << showpos <<
FIXED(8,3) << center.getZ() << endl;
241 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.getX() <<
";" << endl;
242 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.getY() <<
";" << endl;
243 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.getZ() <<
";" << endl;
246 }
else if (option == summary_t ||
247 option == SUMMARY_t) {
260 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
261 strings.insert(module->getString());
264 if (option == summary_t) {
266 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
267 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
268 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
269 cout <<
"First string = " << setw(4) <<
string.first << endl;
270 cout <<
"Last string = " << setw(4) <<
string.second << endl;
271 cout <<
"First floor = " << setw(4) << floor .first << endl;
272 cout <<
"Last floor = " << setw(4) << floor .second << endl;
276 cout <<
"set_variable NUMBER_OF_STRINGS " << setw(4) << numberOfStrings <<
";" << endl;
277 cout <<
"set_variable NUMBER_OF_FLOORS " << setw(4) << numberOfFloors <<
";" << endl;
278 cout <<
"set_variable NUMBER_OF_MODULES " << setw(4) << numberOfModules <<
";" << endl;
279 cout <<
"set_variable FIRST_STRING " << setw(4) <<
string.first <<
";" << endl;
280 cout <<
"set_variable LAST_STRING " << setw(4) <<
string.second <<
";" << endl;
281 cout <<
"set_variable FIRST_FLOOR " << setw(4) << floor .first <<
";" << endl;
282 cout <<
"set_variable LAST_FLOOR " << setw(4) << floor .second <<
";" << endl;
283 cout <<
"set_array STRINGS ";
284 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));
bool isORCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with that of ORCA.
Utility class to parse command line options.
int main(int argc, char *argv[])
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA.
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.