83     int    scal  =  0xFFFFFFFF; 
 
   86   string  detectorFile_a;
 
   87   string  detectorFile_b;
 
   95     properties[
TCAL] = precision.tcal;
 
   96     properties[
PCAL] = precision.pcal;
 
   97     properties[
RCAL] = precision.rcal;
 
   98     properties[
ACAL] = precision.acal;
 
   99     properties[
CCAL] = precision.ccal;
 
  100     properties[
SCAL] = precision.scal;
 
  102     JParser<> zap(
"Auxiliary program to find differences between two detector files.");
 
  112   catch(
const exception &error) {
 
  113     FATAL(error.what() << endl);
 
  121     load(detectorFile_a, detector_a);
 
  128     load(detectorFile_b, detector_b);
 
  134   size_t numberOfPMTs = 0;
 
  136   bool is_equal = 
true;
 
  141   setFormat<JPosition3D>  (
JFormat_t(15, 9, std::ios::fixed | std::ios::showpos));
 
  145   if (detector_a.getID() != detector_b.getID()) {
 
  147     DEBUG(
"* Different detector identifiers "  
  148           << setw(5) << detector_a.getID() << 
" (A) and " << endl 
 
  149           << setw(5) << detector_b.getID() << 
" (B)."     << endl
 
  157   if (
getDistance(detector_a.getPosition(), detector_b.getPosition()) > precision.pcal) {
 
  159     DEBUG(
"  * different UTM position: " 
  160           << detector_a.getPosition() << 
" (A), "  
  161           << detector_b.getPosition() << 
" (B)" 
  162           << 
", B - A " << 
JPosition3D(detector_b.getPosition() - detector_a.getPosition()) << endl);
 
  168   for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
 
  169     if (module->size() > numberOfPMTs) {
 
  170        numberOfPMTs = module->size();
 
  176   for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
 
  178     if (!module_router_b.hasModule(module->getID())) {
 
  180       DEBUG(
"* Module " << setw(10) << module->getID() << 
" is in A " << 
getLabel(*module) << 
" but not in B" << endl);
 
  186   for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
 
  188     if (!module_router_a.hasModule(module->getID())) {
 
  190       DEBUG(
"* Module " << setw(10) << module->getID() << 
" is in B " << 
getLabel(*module) << 
" but not in A" << endl);
 
  200   DEBUG(
"Comparing module by module." << endl);
 
  202   for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
 
  204     if (!module_router_b.hasModule(module_a->getID())) {
 
  211     const JModule* module_b = &module_router_b.getModule(module_a->getID());
 
  213     DEBUG(
"  Module " << setw(10) << module_a->getID());
 
  217     if (module_a->getLocation() == module_b->
getLocation()) {
 
  224       DEBUG(
"  * different location: " 
  226             << 
getLabel(*module_b) << 
" (B)" << endl);
 
  233     if (fabs(module_a->getT0() - module_b->
getT0()) > precision.acal) {
 
  235       DEBUG(
"  * different T0: "  
  236             << module_a->getT0() << 
" (A), " 
  237             << module_b->
getT0() << 
" (B) " 
  238             << 
", B - A " << module_b->
getT0() - module_a->getT0() << endl);
 
  245     if (module_a->getQuaternion() != 
JQuaternion3D(0.0, 0.0, 0.0, 0.0) &&
 
  249       DEBUG(
"  * different quaternion calibration: "  
  250             << module_a->getQuaternion() << 
" (A), " 
  261       DEBUG(
"  * different position: " 
  262             << module_a->getPosition() << 
" (A), "  
  271     if (module_a->size() != module_b->size()) {
 
  273       DEBUG(
"  * different number of PMTs: " 
  274             << module_a->size() << 
" (A), "  
  275             << module_b->size() << 
" (B)" << endl);
 
  282     if (!module_a->empty() &&
 
  283         !module_b->empty()) { 
 
  285       const JQuantile q = getQuantile(*module_a, *module_b);
 
  287       if (fabs(q.
getMean()) > precision.tcal) {
 
  289         DEBUG(
"  * different average t0: " 
  299     if (module_a->getStatus(precision.scal) != module_b->
getStatus(precision.scal)) {
 
  301       DEBUG(
"  * different status module " << module_a->getID() << 
": " 
  302             << module_a->getStatus() << 
" (A), "  
  313     for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
 
  315       const JPMT& pmt_a = module_a->getPMT(pmt);
 
  320         DEBUG(
"  * different identifier PMT " << pmt << 
": " 
  321               << setw(8) << pmt_a.
getID() << 
" (A" << 
FILL(2,
'0') << pmt << 
"), " << 
FILL()
 
  322               << setw(8) << pmt_b.
getID() << 
" (B" << 
FILL(2,
'0') << pmt << 
")"   << 
FILL()
 
  323               << 
", B - A " << pmt_b.
getID() - pmt_a.
getID()  
 
  332     for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
 
  334       const JPMT& pmt_a = module_a->getPMT(pmt);
 
  337       if (fabs(pmt_a.
getT0() - pmt_b.
getT0()) > precision.tcal) {
 
  339         DEBUG(
"  * different T0 PMT " << pmt << 
": " 
  340               << pmt_a.
getT0() << 
" (A" << 
FILL(2,
'0') << pmt << 
"), " << 
FILL()
 
  341               << pmt_b.
getT0() << 
" (B" << 
FILL(2,
'0') << pmt << 
")"   << 
FILL()
 
  342               << 
", B - A " << pmt_b.
getT0() - pmt_a.
getT0()  
 
  351     for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
 
  353       const JPMT& pmt_a = module_a->getPMT(pmt);
 
  360         DEBUG(
"  * different PMT position: " 
  371     for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
 
  373       const JPMT& pmt_a = module_a->getPMT(pmt);
 
  380       if ((1.0 - dot) > precision.rcal) {
 
  382         DEBUG(
"  * different PMT direction: " 
  393     for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
 
  395       const JPMT& pmt_a = module_a->getPMT(pmt);
 
  400         DEBUG(
"  * different status PMT " << pmt << 
": " 
  417     for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
 
  418       string.insert(module->getString());
 
  419       floor .insert(module->getFloor ());
 
  422     for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
 
  423       string.insert(module->getString());
 
  424       floor .insert(module->getFloor ());
 
  430             string.size(), -0.5, 
string.size() - 0.5,
 
  431             floor .size(), -0.5, floor .size() - 0.5);
 
  441     TH2D* X2  = (TH2D*) M2.Clone(
"X2" );
 
  442     TH2D* Y2  = (TH2D*) M2.Clone(
"Y2" );
 
  443     TH2D* Z2  = (TH2D*) M2.Clone(
"Z2" );
 
  444     TH2D* T2  = (TH2D*) M2.Clone(
"T2" );
 
  445     TH2D* RMS = (TH2D*) M2.Clone(
"RMS");
 
  446     TH2D* R2  = (TH2D*) M2.Clone(
"R2" );
 
  447     TH2D* QA  = (TH2D*) M2.Clone(
"QA" );
 
  448     TH2D* QB  = (TH2D*) M2.Clone(
"QB" );
 
  449     TH2D* QC  = (TH2D*) M2.Clone(
"QC" );
 
  450     TH2D* QD  = (TH2D*) M2.Clone(
"QD" );
 
  451     TH2D* Q2  = (TH2D*) M2.Clone(
"Q2" );
 
  453     for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
 
  454       if (!module_router_b.hasModule(module->getID()) ) {
 
  455         M2.Fill(module->getString(), module->getFloor(), -1.0);
 
  459     for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
 
  460       if (!module_router_a.hasModule(module->getID()) ) {
 
  461         M2.Fill(module->getString(), module->getFloor(), +1.0);
 
  466     for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
 
  468       if (!module_router_b.hasModule(module_a->getID())) {
 
  472       const JModule* module_b = &module_router_b.getModule(module_a->getID());
 
  474       for (
size_t i = 0; i != numberOfPMTs; ++i) {
 
  476         if (module_a->getFloor() != 0) {
 
  477           H1[module_a->getID()]->SetBinContent(i + 1, module_a->getPMT(i).getT0() - module_b->
getPMT(i).
getT0());
 
  481       X2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), module_a->getX() - module_b->
getX() + numeric_limits<double>::min());
 
  482       Y2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), module_a->getY() - module_b->
getY() + numeric_limits<double>::min());
 
  483       Z2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), module_a->getZ() - module_b->
getZ() + numeric_limits<double>::min());
 
  485       if (module_a->getFloor() != 0 &&
 
  489         const JQuantile     q = getQuantile(*module_a, *module_b);
 
  493         const double phi = (
JVector3Z_t.
getDot(q1.twist) >= 0.0 ? +1.0 : -1.0) * q1.twist.getAngle();
 
  495         R2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), phi);
 
  496         QA ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), Q.
getA());
 
  497         QB ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), Q.
getB());
 
  498         QC ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), Q.
getC());
 
  499         QD ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), Q.
getD());
 
  500         Q2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), Q.
getAngle());
 
  501         T2 ->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), q.
getMean());
 
  502         RMS->Fill(getBin(
string, module_a->getString()), getBin(floor, module_a->getFloor()), q.
getSTDev());
 
  509     for (TH2D* h2 : { &M2, X2, Y2, Z2, T2, RMS, R2, QA, QB, QC, QD, Q2 }) {
 
Utility class to parse command line options. 
 
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions. 
 
static const std::string RCAL
(optical|base) module orientations 
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
double getB() const 
Get b value. 
 
int getFloor() const 
Get floor number. 
 
Data structure for a composite optical module. 
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance. 
 
clean eval JPrintDetector a $DETECTOR O IDENTIFIER for CALSET in tcal rcal pcal ccal acal scal
 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications. 
 
const JDirection3D & getDirection() const 
Get direction. 
 
Router for direct addressing of module data in detector data structure. 
 
Utility class to parse parameter values. 
 
static const std::string TCAL
PMT time offsets. 
 
static JRotation getRotation
Function object to get rotation matrix to go from first to second module. 
 
#define MAKE_CSTRING(A)
Make C-string. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration) 
 
double getDistance(const JVector3D &pos) const 
Get distance to point. 
 
double getDot(const JAngle3D &angle) const 
Get dot product. 
 
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects. 
 
const JQuaternion3D & getQuaternion() const 
Get quaternion. 
 
int getStatus() const 
Get status. 
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
 
#define ASSERT(A,...)
Assert macro. 
 
const JLocation & getLocation() const 
Get location. 
 
static const std::string SCAL
PMT status. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
int getID() const 
Get identifier. 
 
static const std::string PCAL
(optical|base) module positions 
 
Data structure for PMT geometry, calibration and status. 
 
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone) 
 
double getY() const 
Get y position. 
 
const JPosition3D & getPosition() const 
Get position. 
 
const JPMT & getPMT(const int index) const 
Get PMT. 
 
Auxiliary data structure for sequence of same character. 
 
double getD() const 
Get d value. 
 
Data structure for unit quaternion in three dimensions. 
 
double getAngle() const 
Get rotation angle. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector 
 
double getC() const 
Get c value. 
 
double getX() const 
Get x position. 
 
double getA() const 
Get a value. 
 
double getDot(const JVector3D &vector) const 
Get dot product. 
 
Data structure for position in three dimensions. 
 
Auxiliary data structure for decomposition of quaternion in twist and swing quaternions. 
 
double getZ() const 
Get z position. 
 
#define DEBUG(A)
Message macros. 
 
double getT0() const 
Get time offset.