24 const char*
const default_t =
"default";
26 const char*
const header_t =
"header";
27 const char*
const modules_t =
"modules";
28 const char*
const pmts_t =
"pmts";
30 const char*
const identifier_t =
"identifier";
31 const char*
const version_t =
"version";
32 const char*
const can_t =
"can";
33 const char*
const center_t =
"center";
34 const char*
const summary_t =
"summary";
36 const char*
const IDENTIFIER_t =
"IDENTIFIER";
37 const char*
const VERSION_t =
"VERSION";
38 const char*
const CAN_t =
"CAN";
39 const char*
const CENTER_t =
"CENTER";
40 const char*
const SUMMARY_t =
"SUMMARY";
50 int main(
int argc,
char **argv)
60 JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
82 catch(
const exception &error) {
83 FATAL(error.what() << endl);
98 if (option == default_t) {
102 }
else if (option == header_t) {
104 cout <<
detector.getProperties() << endl;
106 }
else if (option == modules_t) {
108 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
112 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
116 t0 /= module->size();
119 cout <<
' ' << noshowpos << setw(8) << right << module->getID();
120 cout <<
' ' << noshowpos << setw(3) << right << module->getString();
121 cout <<
' ' << noshowpos << setw(2) << right << module->getFloor();
122 cout <<
' ' <<
FIXED(7,2) << module->getX();
123 cout <<
' ' <<
FIXED(7,2) << module->getY();
124 cout <<
' ' <<
FIXED(7,2) << module->getZ();
125 cout <<
' ' <<
FIXED(8,2) << t0;
129 }
else if (option == pmts_t) {
131 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
132 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
135 cout <<
' ' << noshowpos << setw(8) << right << pmt->getID();
136 cout <<
' ' <<
FIXED(7,2) << pmt->getX();
137 cout <<
' ' <<
FIXED(7,2) << pmt->getY();
138 cout <<
' ' <<
FIXED(7,2) << pmt->getZ();
139 cout <<
' ' <<
FIXED(6,3) << pmt->getDX();
140 cout <<
' ' <<
FIXED(6,3) << pmt->getDY();
141 cout <<
' ' <<
FIXED(6,3) << pmt->getDZ();
142 cout <<
' ' <<
FIXED(8,2) << pmt->getT0();
143 cout <<
' ' << noshowpos << setw(8) << right << pmt->getStatus();
148 }
else if (option == version_t ||
149 option == VERSION_t) {
151 if (option == version_t) {
153 cout <<
detector.getVersion() << endl;
157 cout <<
"set_variable DETECTOR_VERSION " <<
detector.getVersion() <<
";" << endl;
160 }
else if (option == identifier_t ||
161 option == IDENTIFIER_t) {
163 if (option == identifier_t) {
165 cout <<
"Detector " <<
detector.getID() << endl;
169 cout <<
"set_variable DETECTOR_ID " <<
detector.getID() <<
";" << endl;
172 }
else if (option == can_t ||
177 const double V = (cylinder.getZmax() - cylinder.getZmin()) *
PI * cylinder.getRadius() * cylinder.getRadius();
179 if (option == can_t) {
181 cout <<
"X = " <<
FIXED(7,1) << cylinder.getX() << endl;
182 cout <<
"Y = " <<
FIXED(7,1) << cylinder.getY() << endl;
183 cout <<
"Zmin = " <<
FIXED(7,1) << cylinder.getZmin() << endl;
184 cout <<
"Zmax = " <<
FIXED(7,1) << cylinder.getZmax() << endl;
185 cout <<
"Radius = " <<
FIXED(7,1) << cylinder.getRadius() << endl;
186 cout <<
"Depth = " <<
FIXED(7,1) <<
detector.getUTMZ() << endl;
187 cout <<
"Volume = " <<
SCIENTIFIC(12,3) << V << endl;
191 cout <<
"set_variable CAN_X_M " <<
FIXED(7,1) << cylinder.getX() <<
";" << endl;
192 cout <<
"set_variable CAN_Y_M " <<
FIXED(7,1) << cylinder.getY() <<
";" << endl;
193 cout <<
"set_variable CAN_ZMIN_M " <<
FIXED(7,1) << cylinder.getZmin() <<
";" << endl;
194 cout <<
"set_variable CAN_ZMAX_M " <<
FIXED(7,1) << cylinder.getZmax() <<
";" << endl;
195 cout <<
"set_variable CAN_RADIUS_M " <<
FIXED(7,1) << cylinder.getRadius() <<
";" << endl;
196 cout <<
"set_variable CAN_DEPTH_M " <<
FIXED(7,1) <<
detector.getUTMZ() <<
";" << endl;
197 cout <<
"set_variable CAN_VOLUME_M3" <<
SCIENTIFIC(12,3) << V <<
";" << endl;
200 }
else if (option == center_t || option == CENTER_t) {
204 if (option == center_t) {
207 cout << showpos <<
FIXED(8,3) << center.getX() <<
' ';
208 cout << showpos <<
FIXED(8,3) << center.getY() <<
' ';
209 cout << showpos <<
FIXED(8,3) << center.getZ() << endl;
213 cout <<
"set_variable CENTER_X_M " <<
FIXED(7,1) << center.getX() <<
";" << endl;
214 cout <<
"set_variable CENTER_Y_M " <<
FIXED(7,1) << center.getY() <<
";" << endl;
215 cout <<
"set_variable CENTER_Z_M " <<
FIXED(7,1) << center.getZ() <<
";" << endl;
218 }
else if (option == summary_t ||
219 option == SUMMARY_t) {
227 const JRange_t string(
detector.begin(),
detector.end(), &JModule::getString);
228 const JRange_t floor (
detector.begin(),
detector.end(), &JModule::getFloor);
232 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
233 strings.insert(module->getString());
236 if (option == summary_t) {
238 cout <<
"Number of strings = " << setw(4) << numberOfStrings << endl;
239 cout <<
"Number of floors = " << setw(4) << numberOfFloors << endl;
240 cout <<
"Number of modules = " << setw(4) << numberOfModules << endl;
241 cout <<
"First string = " << setw(4) <<
string.first << endl;
242 cout <<
"Last string = " << setw(4) <<
string.second << endl;
243 cout <<
"First floor = " << setw(4) << floor .first << endl;
244 cout <<
"Last floor = " << setw(4) << floor .second << endl;
248 cout <<
"set_variable NUMBER_OF_STRINGS " << setw(4) << numberOfStrings <<
";" << endl;
249 cout <<
"set_variable NUMBER_OF_FLOORS " << setw(4) << numberOfFloors <<
";" << endl;
250 cout <<
"set_variable NUMBER_OF_MODULES " << setw(4) << numberOfModules <<
";" << endl;
251 cout <<
"set_variable FIRST_STRING " << setw(4) <<
string.first <<
";" << endl;
252 cout <<
"set_variable LAST_STRING " << setw(4) <<
string.second <<
";" << endl;
253 cout <<
"set_variable FIRST_FLOOR " << setw(4) << floor .first <<
";" << endl;
254 cout <<
"set_variable LAST_FLOOR " << setw(4) << floor .second <<
";" << endl;
255 cout <<
"set_array STRINGS ";
256 copy(strings.begin(), strings.end(), ostream_iterator<int>(cout,
" "));