39   static const int         WILDCARD    =  -1;
 
   41   static const std::string reset_t     = 
"reset";             
 
   42   static const std::string set_t       = 
"set";               
 
   43   static const std::string add_t       = 
"add";               
 
   44   static const std::string sub_t       = 
"sub";               
 
   45   static const std::string rot_t       = 
"rot";               
 
   46   static const std::string mul_t       = 
"mul";               
 
   47   static const std::string tilt_t      = 
"tilt";              
 
   49   static const std::string assign_t    = 
"assign";            
 
   50   static const std::string string_t    = 
"string";            
 
   52   static const std::string rand_t      = 
"rand";              
 
   53   static const std::string randset_t   =  rand_t + set_t;     
 
   54   static const std::string randadd_t   =  rand_t + add_t;     
 
   55   static const std::string randsub_t   =  rand_t + sub_t;     
 
   56   static const std::string randrot_t   =  rand_t + rot_t;     
 
   57   static const std::string randmul_t   =  rand_t + mul_t;     
 
   58   static const std::string randtilt_t  =  rand_t + tilt_t;    
 
   60   static const std::string RESET_t     = 
"RESET";             
 
   61   static const std::string SET_t       = 
"SET";               
 
   62   static const std::string ADD_t       = 
"ADD";               
 
   63   static const std::string SUB_t       = 
"SUB";               
 
   64   static const std::string ROT_t       = 
"ROT";               
 
   74   inline bool apply(
JModule& module, 
const std::string& action)
 
   76     if        (action == reset_t) {
 
   80       for (JModule::iterator pmt = module.begin(); pmt != module.end(); ++pmt) {
 
   85     } 
else if (action == RESET_t) {
 
   90     } 
else if (action == SET_t) {
 
  116   inline bool apply(
JModule& module, 
const std::string& action, 
const double value)
 
  118     if        (action == set_t) {                          
 
  122     } 
else if (action == add_t) {
 
  126     } 
else if (action == sub_t) {
 
  130     } 
else if (action == rot_t) {
 
  140     } 
else if (action == mul_t) {
 
  148     } 
else if (action == SET_t) {
 
  152     } 
else if (action == ADD_t) {
 
  156     } 
else if (action == SUB_t) {
 
  160     } 
else if (action == ROT_t) {
 
  164     } 
else if (action == randadd_t) {                      
 
  166       module.
add(gRandom->Gaus(0.0, value));
 
  168     } 
else if (action == randsub_t) {
 
  170       module.
sub(gRandom->Gaus(0.0, value));
 
  172     } 
else if (action == randrot_t){
 
  182     } 
else if (action == randmul_t) {
 
  193     } 
else if (action == assign_t) {                       
 
  195       module.
setID((
int) value);
 
  197     } 
else if (action == string_t) {
 
  219   inline bool apply(
JModule& module, 
const std::string& action, 
const double first, 
const double second)
 
  221     if        (action == tilt_t) {                         
 
  223       const double Tx = 
first;
 
  224       const double Ty = second;
 
  225       const double Tz = sqrt(1.0 - Tx*Tx - Ty*Ty);
 
  227       const double x  = Tx * module.
getZ()  +  module.
getX();
 
  228       const double y  = Ty * module.
getZ()  +  module.
getY();
 
  229       const double z  = Tz * module.
getZ();
 
  250   inline bool apply(
JModule& module, 
const std::string& action, 
const JVector3D& pos)
 
  253                             gRandom->Gaus(0.0, pos.
getY()),
 
  254                             gRandom->Gaus(0.0, pos.
getZ()));
 
  258     else if (action == add_t)
 
  260     else if (action == sub_t)
 
  262     else if (action == randset_t)                      
 
  264     else if (action == randadd_t)
 
  266     else if (action == randsub_t)
 
  287     else if (action == ADD_t)
 
  289     else if (action == SUB_t)
 
  306   inline bool apply(
JPMT& pmt, 
const std::string& action, 
const std::string& value)
 
  312       else if (action == reset_t)
 
  319     catch(
const std::exception&) {
 
  343       return (action != 
"" && !data.empty());
 
  353     bool apply(
JModule& module)
 const 
  355       switch (data.size()) {
 
  358         return  ::apply(module, action);
 
  361         return  ::apply(module, action, data[0]);
 
  364         return  ::apply(module, action, data[0], data[1]);
 
  367         return  ::apply(module, action, 
JVector3D(data[0], data[1], data[2]));
 
  370         return  ::apply(module, action, 
JQuaternion3D(data[0], data[1], data[2], data[3]));
 
  385     friend inline std::istream& 
operator>>(std::istream& 
in, JModifier& modifier)
 
  387       if (in >> modifier.action) {
 
  389         modifier.data.clear();
 
  391         for (
double x; in >> x; ) {
 
  392           modifier.data.push_back(x);
 
  395         in.clear(std::ios_base::eofbit);
 
  409     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JModifier& modifier)
 
  411       out << modifier.action;
 
  436   inline const JModifier& getModifier(
const int id, 
const JModifier& modifier)
 
  442     const string::size_type pos = modifier.action.find(rand_t);
 
  444     if (pos != string::npos) {
 
  446       JModifier& 
result = buffer[id][modifier.action][modifier.data.size()];
 
  448       if (!result.is_valid()) {      
 
  450         result.action = modifier.action.substr(pos + rand_t.length());
 
  452         for (
size_t i = 0; i != modifier.data.size(); ++i) {
 
  453           result.data.push_back(gRandom->Gaus(0.0, modifier.data[i]));
 
  469   struct JPMTModifier {
 
  483     bool apply(
JPMT& pmt)
 const 
  485       return ::apply(pmt, action, value);
 
  496     friend inline std::istream& 
operator>>(std::istream& in, JPMTModifier& modifier)
 
  498       return in >> modifier.action >> modifier.value;
 
  509     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JPMTModifier& modifier)
 
  511       out << modifier.action;
 
  513       out << modifier.value;
 
  535     static const char SEPARATOR = 
'-';
 
  552     friend inline std::istream& 
operator>>(std::istream& in, JRange_t& 
range)
 
  554       if (in >> range.first) {
 
  556         range.second = range.first;
 
  558         if (in.peek() == (int) JRange_t::SEPARATOR) {
 
  581     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JRange_t& range)
 
  583       return out << range.first << JRange_t::SEPARATOR << range.second;
 
  595   inline void print(std::ostream& out, 
const JModule& module, 
const JModifier& modifier)
 
  600     out << 
"Modifier"                                                                                           << 
' ' 
  602         << setw(10) << module.
getID()                                                                           << 
' ' 
  603         << 
"action" << 
' ' << modifier.action << 
JEEPZ() << modifier.data << endl;
 
  614   inline void print(std::ostream& out, 
const JPMTIdentifier& pmt, 
const JPMTModifier& modifier)
 
  619     out << 
"PMT modifier"                                                                 << 
' ' 
  620         << 
"(" << setw(10) << pmt.
getID() << 
"," << setw(2) << pmt.
getPMTAddress() << 
")" << 
' ' 
  621         << 
"action" << 
' ' << modifier.action << 
' '  
  622         << 
"value"  << 
' ' << modifier.value  << endl;
 
  722 int main(
int argc, 
char **argv)
 
  747     JParser<> zap(
"Auxiliary program to modify detector.");
 
  765   catch(
const exception &error) {
 
  766     FATAL(error.what() << endl);
 
  782   if ((keep.empty() ? 0 : 1  +
 
  783        rm  .empty() ? 0 : 1  +
 
  784        id  .empty() ? 0 : 1) > 1) {
 
  785     FATAL(
"Use either option -k, -r or -m." << endl);
 
  791   if (
detector.setToLatestVersion()) {
 
  792     NOTICE(
"Set detector version to " << 
detector.getVersion() << endl);
 
  806       istringstream 
is(*i);
 
  817   for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ) {
 
  819     bool __rm__ = !keep.empty() && rm.empty();
 
  834       __rm__ = find(
id.begin(), 
id.end(), module->
getID()) == 
id.end();
 
  837     const auto range = del.equal_range(module->
getString());
 
  839     for (
auto i = range.first; i != range.second; ++i) {
 
  840       if (i->second == module->
getFloor()) {
 
  854     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  856       if (module->
getID() == i->first || i->first == WILDCARD ){
 
  859           print(cout, *module, i->second);
 
  862         if (!i->second.apply(*module)) {
 
  863           ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
  872     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  874       if (module->
getString() == i->first || i->first == WILDCARD) {
 
  876         const JModifier modifier = getModifier(module->
getString(), i->second);
 
  879           print(cout, *module, i->second);
 
  882         if (!modifier.apply(*module)) {
 
  883           ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
  892     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  896         if (module->
getString() == i->first || i->first == WILDCARD) {
 
  898           const JModifier modifier = getModifier(module->
getString(), i->second);
 
  901             print(cout, *module, i->second);
 
  904           if (!modifier.apply(*module)) {
 
  905             ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
  915     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  917       if (module->
getID() == i->first.getModuleID() || i->first.getModuleID() == WILDCARD) {
 
  920           print(cout, i->first, i->second);
 
  923         if        (i->first.getPMTAddress() == WILDCARD) {
 
  926             if (!i->second.apply(module->
getPMT(pmt))) {
 
  927               ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
  931         } 
else if (i->first.getPMTAddress() <  0                         ||
 
  933                    !i->second.apply(module->
getPMT(i->first.getPMTAddress()))) {
 
  934           ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
  944       FATAL(
"Invalid detector identifier " << 
detector.getID() << endl);
 
  949     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  958           print(cout, 
id, i->second);
 
  961         if (!i->second.apply(module->
getPMT(
id.getPMTAddress()))) {
 
  962           ERROR(
"No valid action: " << i->first << 
' ' << i->second << endl);
 
void set(const int bit)
Set PMT status. 
 
Utility class to parse command line options. 
 
static const JGetPMTStatusBit getPMTStatusBit
Function object to map key to PMT status bit. 
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
int main(int argc, char *argv[])
 
int getFloor() const 
Get floor number. 
 
Data structure for a composite optical module. 
 
static const double HYDROPHONE_DELAYTIME_US
Hydrophone delay time [us]. 
 
JQuaternion3D getConjugate() const 
Get conjugate of this quaternion. 
 
void setLocation(const JLocation &location)
Set location. 
 
bool hasDetectorAddressMap(const int id)
Check if detector address map is available. 
 
Utility class to parse parameter values. 
 
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average. 
 
int getNumberOfPMTs(const JModule &module)
Get number of PMTs. 
 
void subT0(const double t0)
Subtract time offset. 
 
Auxiliary class for controlling PMT status. 
 
Lookup table for PMT addresses in detector. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Data structure for time calibration. 
 
void reset(const int bit)
Reset PMT status. 
 
Data structure for detector geometry and calibration. 
 
const JModuleAddressMap & get(const int id) const 
Get module address map. 
 
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
 
const JQuaternion3D & getQuaternion() const 
Get quaternion. 
 
JModule & sub(const JVector3D &pos)
Subtract position. 
 
Lookup table for PMT addresses in optical module. 
 
I/O formatting auxiliaries. 
 
static const double PIEZO_DELAYTIME_US
Piezo delay time [us]. 
 
Data structure for vector in three dimensions. 
 
void setQuaternion(const JQuaternion3D &quaternion)
Set quaternion. 
 
Logical location of module. 
 
#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 getID() const 
Get identifier. 
 
This class represents a rotation around the z-axis. 
 
bool is_valid(const json &js)
Check validity of JSon data. 
 
Data structure for PMT geometry and calibration. 
 
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file. 
 
JPosition3D getPosition(const Vec &pos)
Get position. 
 
int getPMTAddress() const 
Get PMT identifier (= TDC). 
 
double getY() const 
Get y position. 
 
Auxiliary data structure for streaming of STL containers. 
 
const JPosition3D & getPosition() const 
Get position. 
 
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map. 
 
static const JModule & getInstance()
Get reference to unique instance of this class object. 
 
const JPMT & getPMT(const int index) const 
Get PMT. 
 
void rotate(const JRotation3D &R)
Rotate module. 
 
General purpose messaging. 
 
Auxiliary data structure for sequence of same character. 
 
Data structure for unit quaternion in three dimensions. 
 
Direct access to module in detector data structure. 
 
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
 
int getString() const 
Get string number. 
 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input. 
 
const JPMTAddressTranslator & getAddressTranslator(const int tdc) const 
Get PMT address translator. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
void setT0(const double t0)
Set time offset. 
 
Auxiliary class to define a range between two values. 
 
Utility class to parse command line options. 
 
Wrapper class around string. 
 
void setCalibration(const JCalibration &cal)
Set calibration. 
 
void setID(const int id)
Set identifier. 
 
double getX() const 
Get x position. 
 
Base class for data structures with artithmetic capabilities. 
 
void addT0(const double t0)
Add time offset. 
 
Data structure for position in three dimensions. 
 
Data structure for PMT physical address. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
JModule & set(const JVector3D &pos)
Set position. 
 
double getZ() const 
Get z position. 
 
JModule & add(const JVector3D &pos)
Add position. 
 
double getT0() const 
Get time offset.