38 JModule::const_iterator pmt_a = module_a.begin();
39 JModule::const_iterator pmt_b = module_b.begin();
41 for ( ; pmt_a != module_a.end() && pmt_b != module_b.end(); ++pmt_a , ++pmt_b) {
42 q.
put (pmt_a->getT0()-pmt_b->getT0());
56 int main(
int argc,
char **argv)
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) {
160 DEBUG(
" Module " << setw(10) << module_a->
getID());
171 DEBUG(
" * different location: "
173 <<
getLabel(*module_b) <<
" (B)" << endl);
182 DEBUG(
" * different position: "
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) {
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) {
246 DEBUG(
" * different PMT position: "
257 for (
unsigned int pmt = 0;
pmt != module_a->size() &&
pmt != module_b->size(); ++
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) {
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);
Utility class to parse command line options.
const JStatus & getStatus() const
Get status.
int getFloor() const
Get floor number.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
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.
Data structure for detector geometry and calibration.
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.
I/O formatting auxiliaries.
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.
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.
General purpose messaging.
Auxiliary data structure for sequence of same character.
Data structure for quaternion in three dimensions.
Direct access to module in detector data structure.
JRange< Double_t > JRange_t
int getString() const
Get string number.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
bool hasModule(const JObjectID &id) const
Has module.
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.
int main(int argc, char *argv[])