61 string detectorFile_a;
62 string detectorFile_b;
69 JParser<> zap(
"Auxiliary program to find differences between two detector files.");
79 catch(
const exception &error) {
80 FATAL(error.what() << endl);
88 load(detectorFile_a, detector_a);
95 load(detectorFile_b, detector_b);
102 bool is_equal =
true;
110 if (detector_a.getID() != detector_b.getID()) {
112 DEBUG(
"* Different detector identifiers "
113 << setw(5) << detector_a.getID() <<
" (A) and " << endl
114 << setw(5) << detector_b.getID() <<
" (B)." << endl
123 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
125 if (!module_router_b.hasModule(module->getID())) {
127 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in A " <<
getLabel(*module) <<
" but not in B" << endl);
133 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
135 if (!module_router_a.hasModule(module->getID())) {
137 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in B " <<
getLabel(*module) <<
" but not in A" << endl);
147 DEBUG(
"Comparing module by module." << endl);
149 for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
151 if (!module_router_b.hasModule(module_a->getID())) {
158 const JModule* module_b = &module_router_b.getModule(module_a->getID());
160 DEBUG(
" Module " << setw(10) << module_a->getID());
164 if (module_a->getLocation() == module_b->
getLocation()) {
171 DEBUG(
" * different location: "
173 <<
getLabel(*module_b) <<
" (B)" << endl);
180 if (module_a->getPosition().getDistance(module_b->
getPosition()) > precision) {
182 DEBUG(
" * different position: "
183 << module_a->getPosition() <<
" (A), "
192 if (module_a->size() != module_b->size()) {
194 DEBUG(
" * different number of PMTs: "
195 << module_a->size() <<
" (A), "
196 << module_b->size() <<
" (B)" << endl);
203 const JQuantile q = compareT0(*module_a, *module_b);
205 if (fabs(q.
getMean()) > precision) {
207 DEBUG(
" * different average t0: "
218 for (
unsigned int pmt = 0;
pmt != module_a->size() &&
pmt != module_b->size(); ++
pmt) {
220 const JPMT& pmt_a = module_a->getPMT(
pmt);
223 if (fabs(pmt_a.
getT0() - pmt_b.
getT0()) > precision) {
225 DEBUG(
" * different T0 PMT " <<
pmt <<
": "
226 << pmt_a.
getT0() <<
" (A" <<
FILL(2,
'0') <<
pmt <<
"), "
228 <<
", B - A " << pmt_b.
getT0() - pmt_a.
getT0()
237 for (
unsigned int pmt = 0;
pmt != module_a->size() &&
pmt != module_b->size(); ++
pmt) {
239 const JPMT& pmt_a = module_a->getPMT(
pmt);
246 DEBUG(
" * different PMT position: "
257 for (
unsigned int pmt = 0;
pmt != module_a->size() &&
pmt != module_b->size(); ++
pmt) {
259 const JPMT& pmt_a = module_a->getPMT(
pmt);
264 DEBUG(
" * different status PMT " <<
pmt <<
": "
280 const JRange_t
string =
combine(
JRange_t(detector_a.begin(), detector_a.end(), &JModule::getString),
281 JRange_t(detector_b.begin(), detector_b.end(), &JModule::getString));
282 const JRange_t floor =
combine(
JRange_t(detector_a.begin(), detector_a.end(), &JModule::getFloor),
283 JRange_t(detector_b.begin(), detector_b.end(), &JModule::getFloor));
288 string.getLength() + 1,
289 string.getLowerLimit() - 0.5,
290 string.getUpperLimit() + 0.5,
291 floor.getLength() + 1,
292 floor.getLowerLimit() - 0.5,
293 floor.getUpperLimit() + 0.5);
295 TH2D* X2 = (TH2D*) M2.Clone(
"X2" );
296 TH2D* Y2 = (TH2D*) M2.Clone(
"Y2" );
297 TH2D* Z2 = (TH2D*) M2.Clone(
"Z2" );
298 TH2D* T2 = (TH2D*) M2.Clone(
"T2" );
299 TH2D* RM2 = (TH2D*) M2.Clone(
"RM2");
300 TH2D* R2 = (TH2D*) M2.Clone(
"R2" );
301 TH2D* QA = (TH2D*) M2.Clone(
"QA" );
302 TH2D* QB = (TH2D*) M2.Clone(
"QB" );
303 TH2D* QC = (TH2D*) M2.Clone(
"QC" );
304 TH2D* QD = (TH2D*) M2.Clone(
"QD" );
306 for( JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
307 if( !module_router_b.hasModule(module->getID()) ) {
308 M2.Fill(module->getString(), module->getFloor(), -1.0);
312 for( JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
313 if( !module_router_a.hasModule(module->getID()) ) {
314 M2.Fill(module->getString(), module->getFloor(), +1.0);
318 for( JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
320 if (!module_router_b.hasModule(module_a->getID())) {
324 const JModule* module_b = &module_router_b.getModule(module_a->getID());
328 for (
unsigned int pmt = 0;
pmt != module_a->size() &&
pmt != module_b->size(); ++
pmt) {
332 while (x > +
PI) { x -=
PI; }
333 while (x < -
PI) { x +=
PI; }
338 phi /= min(module_a->size(),
343 JQuantile q = compareT0(*module_a, *module_b);
345 X2 ->Fill(module_a->getString(), module_a->getFloor(), module_a->getX() - module_b->
getX());
346 Y2 ->Fill(module_a->getString(), module_a->getFloor(), module_a->getY() - module_b->
getY());
347 Z2 ->Fill(module_a->getString(), module_a->getFloor(), module_a->getZ() - module_b->
getZ());
348 T2 ->Fill(module_a->getString(), module_a->getFloor(), q.
getMean());
349 RM2->Fill(module_a->getString(), module_a->getFloor(), q.
getRMS());
350 R2 ->Fill(module_a->getString(), module_a->getFloor(), phi * 180.0/
PI);
351 QA ->Fill(module_a->getString(), module_a->getFloor(), Q.getA());
352 QB ->Fill(module_a->getString(), module_a->getFloor(), Q.getB());
353 QC ->Fill(module_a->getString(), module_a->getFloor(), Q.getC());
354 QD ->Fill(module_a->getString(), module_a->getFloor(), Q.getD());
Utility class to parse command line options.
const JStatus & getStatus() const
Get status.
Data structure for a composite optical module.
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.
double getPhi() const
Get phi angle.
double getDistance(const JVector3D &pos) const
Get distance to point.
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
#define ASSERT(A,...)
Assert macro.
const JLocation & getLocation() const
Get location.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
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.
const JPosition3D & getPosition() const
Get position.
const JPMT & getPMT(const int index) const
Get PMT.
Auxiliary data structure for sequence of same character.
Data structure for quaternion in three dimensions.
JRange< Double_t > JRange_t
double getX() const
Get x position.
Data structure for position in three dimensions.
double getZ() const
Get z position.
#define DEBUG(A)
Message macros.
double getT0() const
Get time offset.