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";      
 
   35   const char* 
const geometry_t   =  
"geometry";     
 
   37   const char* 
const IDENTIFIER_t =  
"IDENTIFIER";   
 
   38   const char* 
const VERSION_t    =  
"VERSION";      
 
   39   const char* 
const CAN_t        =  
"CAN";          
 
   40   const char* 
const CENTER_t     =  
"CENTER";       
 
   41   const char* 
const SUMMARY_t    =  
"SUMMARY";      
 
   51 int main(
int argc, 
char **argv)
 
   61     JParser<> zap(
"Auxiliary program to print detector file in human friendly format.");
 
   84   catch(
const exception &error) {
 
   85     FATAL(error.what() << endl);
 
  100   if        (option == default_t) {
 
  104   } 
else if (option == header_t) {
 
  106     cout << 
detector.getProperties() << endl;
 
  108   } 
else if (option == modules_t) {
 
  110     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  114       for (JModule::const_iterator 
pmt = module->begin(); 
pmt != module->end(); ++
pmt) {
 
  118       t0 /= module->size();
 
  121       cout << 
' ' << noshowpos << setw(8) << right << module->
getID();
 
  122       cout << 
' ' << noshowpos << setw(3) << right << module->getString();
 
  123       cout << 
' ' << noshowpos << setw(2) << right << module->getFloor();
 
  124       cout << 
' ' << 
FIXED(7,2) << module->getX();
 
  125       cout << 
' ' << 
FIXED(7,2) << module->getY();
 
  126       cout << 
' ' << 
FIXED(7,2) << module->getZ();
 
  127       cout << 
' ' << 
FIXED(8,2) << t0;
 
  131   } 
else if (option == pmts_t) {
 
  133     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  134       for (JModule::const_iterator 
pmt = module->begin(); 
pmt != module->end(); ++
pmt) {
 
  137         cout << 
' ' << noshowpos << setw(8) << right << 
pmt->
getID();
 
  138         cout << 
' ' << 
FIXED(7,2) << 
pmt->getX();
 
  139         cout << 
' ' << 
FIXED(7,2) << 
pmt->getY();
 
  140         cout << 
' ' << 
FIXED(7,2) << 
pmt->getZ();
 
  141         cout << 
' ' << 
FIXED(6,3) << 
pmt->getDX();
 
  142         cout << 
' ' << 
FIXED(6,3) << 
pmt->getDY();
 
  143         cout << 
' ' << 
FIXED(6,3) << 
pmt->getDZ();
 
  144         cout << 
' ' << 
FIXED(8,2) << 
pmt->getT0();
 
  145         cout << 
' ' << noshowpos << setw(8) << right << 
pmt->getStatus();
 
  150   } 
else if (option == version_t || 
 
  151              option == VERSION_t) {
 
  153     if (option == version_t) {
 
  155       cout << 
detector.getVersion() << endl;
 
  159       cout << 
"set_variable DETECTOR_VERSION " << 
detector.getVersion() << 
";" << endl;
 
  162   } 
else if (option == identifier_t ||
 
  163              option == IDENTIFIER_t) {
 
  165     if (option == identifier_t) {
 
  167       cout << 
"Detector " << 
detector.getID() << endl;
 
  171       cout << 
"set_variable DETECTOR_ID      " << 
detector.getID() << 
";" << endl;
 
  174   } 
else if (option == can_t ||
 
  179     const double      V = (cylinder.getZmax() - cylinder.getZmin()) * 
PI * cylinder.getRadius() * cylinder.getRadius(); 
 
  181     if (option == can_t) {
 
  183       cout << 
"X      = " << 
FIXED(7,1)       << cylinder.getX()      << endl;
 
  184       cout << 
"Y      = " << 
FIXED(7,1)       << cylinder.getY()      << endl;
 
  185       cout << 
"Zmin   = " << 
FIXED(7,1)       << cylinder.getZmin()   << endl;
 
  186       cout << 
"Zmax   = " << 
FIXED(7,1)       << cylinder.getZmax()   << endl;
 
  187       cout << 
"Radius = " << 
FIXED(7,1)       << cylinder.getRadius() << endl;
 
  188       cout << 
"Depth  = " << 
FIXED(7,1)       << 
detector.getUTMZ()   << endl;
 
  189       cout << 
"Volume = " << 
SCIENTIFIC(12,3) << V                    << endl;
 
  193       cout << 
"set_variable CAN_X_M      " << 
FIXED(7,1)       << cylinder.getX()           << 
";" << endl;
 
  194       cout << 
"set_variable CAN_Y_M      " << 
FIXED(7,1)       << cylinder.getY()           << 
";" << endl;
 
  195       cout << 
"set_variable CAN_ZMIN_M   " << 
FIXED(7,1)       << cylinder.getZmin()        << 
";" << endl;
 
  196       cout << 
"set_variable CAN_ZMAX_M   " << 
FIXED(7,1)       << cylinder.getZmax()        << 
";" << endl;
 
  197       cout << 
"set_variable CAN_RADIUS_M " << 
FIXED(7,1)       << cylinder.getRadius()      << 
";" << endl;
 
  198       cout << 
"set_variable CAN_DEPTH_M  " << 
FIXED(7,1)       << 
detector.getUTMZ()        << 
";" << endl;
 
  199       cout << 
"set_variable CAN_VOLUME_M3" << 
SCIENTIFIC(12,3) << V                         << 
";" << endl;
 
  202   } 
else if (option == center_t || option == CENTER_t) {
 
  206     if (option == center_t) {
 
  209       cout << showpos << 
FIXED(8,3) << center.getX() << 
' ';
 
  210       cout << showpos << 
FIXED(8,3) << center.getY() << 
' ';
 
  211       cout << showpos << 
FIXED(8,3) << center.getZ() << endl;
 
  215       cout << 
"set_variable CENTER_X_M " << 
FIXED(7,1) << center.getX() << 
";" << endl;
 
  216       cout << 
"set_variable CENTER_Y_M " << 
FIXED(7,1) << center.getY() << 
";" << endl;
 
  217       cout << 
"set_variable CENTER_Z_M " << 
FIXED(7,1) << center.getZ() << 
";" << endl;
 
  220   } 
else if (option == summary_t ||
 
  221              option == SUMMARY_t) {
 
  229     const JRange_t string(
detector.begin(), 
detector.end(), &JModule::getString);
 
  230     const JRange_t floor (
detector.begin(), 
detector.end(), &JModule::getFloor);
 
  234     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  235       strings.insert(module->getString());
 
  238     if (option == summary_t) {
 
  240       cout << 
"Number of strings = " << setw(4) << numberOfStrings << endl;
 
  241       cout << 
"Number of floors  = " << setw(4) << numberOfFloors  << endl;
 
  242       cout << 
"Number of modules = " << setw(4) << numberOfModules << endl;
 
  243       cout << 
"First string      = " << setw(4) << 
string.first    << endl;
 
  244       cout << 
"Last  string      = " << setw(4) << 
string.second   << endl;
 
  245       cout << 
"First floor       = " << setw(4) << floor .first    << endl;
 
  246       cout << 
"Last  floor       = " << setw(4) << floor .second   << endl;
 
  250       cout << 
"set_variable NUMBER_OF_STRINGS " << setw(4) << numberOfStrings << 
";" << endl;
 
  251       cout << 
"set_variable NUMBER_OF_FLOORS  " << setw(4) << numberOfFloors  << 
";" << endl;
 
  252       cout << 
"set_variable NUMBER_OF_MODULES " << setw(4) << numberOfModules << 
";" << endl;
 
  253       cout << 
"set_variable FIRST_STRING      " << setw(4) << 
string.first    << 
";" << endl;
 
  254       cout << 
"set_variable LAST_STRING       " << setw(4) << 
string.second   << 
";" << endl;
 
  255       cout << 
"set_variable FIRST_FLOOR       " << setw(4) << floor .first    << 
";" << endl;
 
  256       cout << 
"set_variable LAST_FLOOR        " << setw(4) << floor .second   << 
";" << endl;
 
  257       cout << 
"set_array    STRINGS           ";
 
  258       copy(strings.begin(), strings.end(), ostream_iterator<int>(cout, 
" "));
 
  262   } 
else if (option == geometry_t) {
 
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. 
 
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
 
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 
 
int getID() const 
Get identifier. 
 
int getNumberOfFloors(const JDetector &detector)
Get number of floors. 
 
void load(const JString &file_name, JDetector &detector)
Load detector from input file. 
 
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. 
 
JRange< Double_t > JRange_t
 
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. 
 
Auxiliary data structure for floating point format specification. 
 
int main(int argc, char *argv[])