54     bool apply(
JModule& module)
 const 
   56       switch (data.size()) {
 
   59         return  apply(module, action, data[0]);                               
 
   62         return  apply(module, action, 
JVector3D(data[0], data[1], 0.0));      
 
   65         return  apply(module, action, 
JVector3D(data[0], data[1], data[2]));  
 
   80     friend inline std::istream& 
operator>>(std::istream& in, JModifier& modifier)
 
   84       if (in >> modifier.id >> modifier.action) {
 
   86         modifier.data.clear();
 
   88         for (
double x; in >> x; ) {
 
   89           modifier.data.push_back(x);
 
   92         if (!modifier.data.empty())
 
   93           in.clear(ios_base::eofbit);
 
   95           in.setstate(ios_base::badbit);
 
  109     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JModifier& modifier)
 
  113       out << modifier.action;
 
  137     static bool apply(
JModule& module, 
const std::string& action, 
const double value)
 
  139       if        (action == 
"set") {                          
 
  143       } 
else if (action == 
"add") {
 
  147       } 
else if (action == 
"sub") {
 
  151       } 
else if (action == 
"rot") {
 
  161       } 
else if (action == 
"mul") {
 
  169       } 
else if (action == 
"randadd") {                      
 
  171         module.
add(gRandom->Gaus(0.0, value));
 
  173       } 
else if (action == 
"randsub") {
 
  175         module.
sub(gRandom->Gaus(0.0, value));
 
  177       } 
else if (action == 
"randrot"){
 
  187       } 
else if (action == 
"randmul") {
 
  212     static bool apply(
JModule& module, 
const std::string& action, 
const JVector3D& pos)
 
  215                               gRandom->Gaus(0.0, pos.
getY()),
 
  216                               gRandom->Gaus(0.0, pos.
getZ()));
 
  220       else if (action == 
"add")
 
  222       else if (action == 
"sub")
 
  224       else if (action == 
"randset")                      
 
  226       else if (action == 
"randadd")
 
  228       else if (action == 
"randsub")
 
  258     bool apply(
JPMT& pmt)
 const 
  262         if        (action == 
"set") {
 
  266         } 
else if (action == 
"reset") {
 
  277       catch(
const std::exception&) {}
 
  290     friend inline std::istream& 
operator>>(std::istream& in, JPMTModifier& modifier)
 
  292       return in >> 
static_cast<JPMTIdentifier&
>(modifier) >> modifier.action >> modifier.value;
 
  303     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JPMTModifier& modifier)
 
  305       out << static_cast<const JPMTIdentifier&>(modifier);
 
  307       out << modifier.action;
 
  309       out << modifier.value;
 
  360 int main(
int argc, 
char **argv)
 
  375     JParser<> zap(
"Auxiliary program to modify detector.");
 
  387   catch(
const exception &error) {
 
  388     FATAL(error.what() << endl);
 
  413       istringstream is(*i);
 
  422     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  426         DEBUG(
"Modifier"                                                                              << 
' ' 
  427               << 
"(" << setw(3) << module->
getString() << 
"," << setw(2) << module->
getFloor() << 
")" << 
' ' 
  428               << setw(8) << module->
getID()                                                           << 
' ' 
  429               << 
"action" << 
' ' << i->action << endl);
 
  431         if (!i->apply(*module)) {
 
  432           ERROR(
"No valid action: " << *i << endl);
 
  441     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  445         DEBUG(
"Modifier"                                                                              << 
' ' 
  446               << 
"(" << setw(3) << module->
getString() << 
"," << setw(2) << module->
getFloor() << 
")" << 
' ' 
  447               << setw(8) << module->
getID()                                                           << 
' ' 
  448               << 
"action" << 
' ' << i->action << endl);
 
  450         if (!i->apply(*module)) {
 
  451           ERROR(
"No valid action: " << *i << endl);
 
  460     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  464         DEBUG(
"PMT modifier"                                                                      << 
' ' 
  465               << 
"(" << setw(8) << module->
getID() << 
"," << setw(2) << i->getPMTAddress() << 
")" << 
' ' 
  466               << 
"action" << 
' ' << i->action << 
' '  
  467               << 
"value"  << 
' ' << i->value  << endl);
 
  469         if (i->getPMTAddress() <  0                         ||
 
  471             !i->apply(module->
getPMT(i->getPMTAddress()))) {
 
  472           ERROR(
"No valid action: " << *i << endl);
 
void set(const JPMTStatusBits_t bit)
Set PMT status. 
 
Utility class to parse command line options. 
 
static const JGetPMTStatusBit getPMTStatusBit
Function object to map key to PMT status bit. 
 
std::istream & operator>>(std::istream &in, JHead &header)
Read header from input. 
 
Data structure for a composite optical module. 
 
Utility class to parse parameter values. 
 
int getNumberOfPMTs(const JModule &module)
Get number of PMTs. 
 
Empty structure for specification of parser element that is initialised (i.e. 
 
Data structure for detector geometry and calibration. 
 
JModule & sub(const JVector3D &pos)
Subtract position. 
 
int getFloor() const 
Get floor number. 
 
int getString() const 
Get string number. 
 
Data structure for vector in three dimensions. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
int getID() const 
Get identifier. 
 
Data structure for PMT geometry and calibration. 
 
double getY() const 
Get y position. 
 
void load(const JString &file_name, JDetector &detector)
Load detector from input file. 
 
void reset(const JPMTStatusBits_t bit)
Reset PMT status. 
 
const JPosition3D & getPosition() const 
Get position. 
 
const JPMT & getPMT(const int index) const 
Get PMT. 
 
void rotate(const JRotation3D &R)
Rotate module. 
 
General purpose messaging. 
 
Direct access to module in detector data structure. 
 
Utility class to parse command line options. 
 
static const char WILD_CARD
 
double getX() const 
Get x position. 
 
void store(const JString &file_name, const JDetector &detector)
Store detector to output file. 
 
JModule & set(const JVector3D &pos)
Set position. 
 
double getZ() const 
Get z position. 
 
JModule & add(const JVector3D &pos)
Add position. 
 
#define DEBUG(A)
Message macros. 
 
int main(int argc, char *argv[])