40 JModule::const_iterator pmt_a = module_a.begin();
41 JModule::const_iterator pmt_b = module_b.begin();
43 for ( ; pmt_a != module_a.end() && pmt_b != module_b.end(); ++pmt_a, ++pmt_b) {
44 Q.
put(pmt_a->getT0() - pmt_b->getT0());
57 inline Double_t getBin(
const std::set<int>& buffer,
const int value)
71 int main(
int argc,
char **argv)
76 string detectorFile_a;
77 string detectorFile_b;
84 JParser<> zap(
"Auxiliary program to find differences between two detector files.");
94 catch(
const exception &error) {
95 FATAL(error.what() << endl);
103 load(detectorFile_a, detector_a);
110 load(detectorFile_b, detector_b);
116 size_t numberOfPMTs = 0;
118 bool is_equal =
true;
123 setFormat<JPosition3D> (
JFormat_t(15, 9, std::ios::fixed | std::ios::showpos));
127 if (detector_a.getID() != detector_b.getID()) {
129 DEBUG(
"* Different detector identifiers "
130 << setw(5) << detector_a.getID() <<
" (A) and " << endl
131 << setw(5) << detector_b.getID() <<
" (B)." << endl
137 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
138 if (module->size() > numberOfPMTs) {
139 numberOfPMTs = module->size();
145 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
147 if (!module_router_b.
hasModule(module->getID())) {
149 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in A " <<
getLabel(*module) <<
" but not in B" << endl);
155 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
157 if (!module_router_a.
hasModule(module->getID())) {
159 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in B " <<
getLabel(*module) <<
" but not in A" << endl);
169 DEBUG(
"Comparing module by module." << endl);
171 for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
182 DEBUG(
" Module " << setw(10) << module_a->
getID());
193 DEBUG(
" * different location: "
195 <<
getLabel(*module_b) <<
" (B)" << endl);
202 if (fabs(module_a->
getT0() - module_b->
getT0()) > precision) {
204 DEBUG(
" * different T0: "
205 << module_a->
getT0() <<
" (A), "
206 << module_b->
getT0() <<
" (B) "
207 <<
", B - A " << module_b->
getT0() - module_a->
getT0() << endl);
216 DEBUG(
" * different quaternion calibration: "
228 DEBUG(
" * different position: "
238 if (module_a->size() != module_b->size()) {
240 DEBUG(
" * different number of PMTs: "
241 << module_a->size() <<
" (A), "
242 << module_b->size() <<
" (B)" << endl);
249 if (!module_a->empty() &&
250 !module_b->empty()) {
252 const JQuantile q = getQuantile(*module_a, *module_b);
254 if (fabs(q.
getMean()) > precision) {
256 DEBUG(
" * different average t0: "
266 if (fabs(module_a->
getT0() - module_b->
getT0()) > precision) {
268 DEBUG(
" * different global t0: "
269 << module_a->
getT0() <<
" (A), "
270 << module_b->
getT0() <<
" (B)"
271 <<
", B - A " << module_b->
getT0() - module_a->
getT0()
281 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
286 if (fabs(pmt_a.
getT0() - pmt_b.
getT0()) > precision) {
288 DEBUG(
" * different T0 PMT " << pmt <<
": "
289 << pmt_a.
getT0() <<
" (A" <<
FILL(2,
'0') << pmt <<
"), " <<
FILL()
290 << pmt_b.
getT0() <<
" (B" <<
FILL(2,
'0') << pmt <<
")" <<
FILL()
291 <<
", B - A " << pmt_b.
getT0() - pmt_a.
getT0()
300 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
309 DEBUG(
" * different PMT position: "
320 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
327 DEBUG(
" * different status PMT " << pmt <<
": "
344 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
345 string.insert(module->getString());
346 floor .insert(module->getFloor ());
349 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
350 string.insert(module->getString());
351 floor .insert(module->getFloor ());
357 string.size(), -0.5,
string.size() - 0.5,
358 floor .size(), -0.5, floor .size() - 0.5);
368 TH2D* X2 = (TH2D*) M2.Clone(
"X2" );
369 TH2D* Y2 = (TH2D*) M2.Clone(
"Y2" );
370 TH2D* Z2 = (TH2D*) M2.Clone(
"Z2" );
371 TH2D* T2 = (TH2D*) M2.Clone(
"T2" );
372 TH2D* RMS = (TH2D*) M2.Clone(
"RMS");
373 TH2D* R2 = (TH2D*) M2.Clone(
"R2" );
374 TH2D* QA = (TH2D*) M2.Clone(
"QA" );
375 TH2D* QB = (TH2D*) M2.Clone(
"QB" );
376 TH2D* QC = (TH2D*) M2.Clone(
"QC" );
377 TH2D* QD = (TH2D*) M2.Clone(
"QD" );
378 TH2D* Q2 = (TH2D*) M2.Clone(
"Q2" );
380 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
381 if (!module_router_b.
hasModule(module->getID()) ) {
382 M2.Fill(module->getString(), module->getFloor(), -1.0);
386 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
387 if (!module_router_a.
hasModule(module->getID()) ) {
388 M2.Fill(module->getString(), module->getFloor(), +1.0);
393 for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
401 for (
size_t i = 0; i != numberOfPMTs; ++i) {
408 X2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getX() - module_b->
getX());
409 Y2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getY() - module_b->
getY());
410 Z2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getZ() - module_b->
getZ());
416 const JQuantile q = getQuantile(*module_a, *module_b);
422 R2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), phi);
436 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.
Q(UTCMax_s-UTCMin_s)-livetime_s
const JStatus & getStatus() const
Get status.
int main(int argc, char *argv[])
double getB() const
Get b value.
int getFloor() const
Get floor number.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
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.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
Router for direct addressing of module data in detector data structure.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
#define MAKE_CSTRING(A)
Make C-string.
Dynamic ROOT object management.
double getDistance(const JVector3D &pos) const
Get distance to point.
Data structure for detector geometry and calibration.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
const JQuaternion3D & getQuaternion() const
Get quaternion.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
#define ASSERT(A,...)
Assert macro.
I/O formatting auxiliaries.
JQuaternion3D twist
rotation around parallel axis
const JLocation & getLocation() const
Get location.
#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.
const JPosition3D & getPosition() const
Get position.
const JPMT & getPMT(const int index) const
Get PMT.
General purpose messaging.
Auxiliary data structure for sequence of same character.
double getD() const
Get d value.
Data structure for unit quaternion in three dimensions.
Direct access to module in detector data structure.
double getAngle() const
Get rotation angle.
int getString() const
Get string number.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
bool hasModule(const JObjectID &id) const
Has module.
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.
double getT0() const
Get time offset.