30{
34
38 string detectorFile;
39 double stdev;
40 bool overwriteDetector;
43
44 try {
45
46 JParser<> zap(
"Program to correct detector file for inconsistencies in configuration of data filter.");
47
48 zap[
'f'] =
make_field(inputFile,
"original raw data file and reprocessed raw data file");
51 zap[
'S'] =
make_field(stdev,
"number of standard deviations for comparison of counts per optical module.") = 10.0;
52 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a'.");
55
56 zap(argc, argv);
57 }
58 catch(const exception& error) {
59 FATAL(error.what() << endl);
60 }
61
62
63 if (inputFile.size() != 2) {
64 FATAL(
"Wrong number of input files " << inputFile.size() <<
" != " << 2 << endl);
65 }
66
68
69 try {
71 }
74 }
75
77
79
80 map_type zmap[2];
81
82 for (int i = 0; i != 2; ++i) {
83
84 STATUS(
"Processing " << inputFile[i] << endl);
85
87
88 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
89
91
93 zmap[i][hit->getModuleID()] += 1;
94 }
95 }
97 }
98
99 size_t ns = 0;
100
101 for (map_type::const_iterator
102 p = zmap[0].begin(),
103 q = zmap[1].begin(); (p != zmap[0].end() &&
104 q != zmap[1].end()); ) {
105
106 if (p->first < q->first) { ++p; }
107 else if (q->first < p->first) { ++q; }
108 else {
109
110 if (max ((double) p->second, (double) q->second) > stdev * sqrt(p->second + q->second) &&
111 fabs((double) p->second - (double) q->second) > stdev * sqrt(p->second + q->second)) {
112
113 ns += 1;
114
115 NOTICE(
"Module " << setw(8) << p->first <<
' ' << setw(6) << p->second <<
" <> " << setw(6) << q->second <<
' ' << (overwriteDetector ?
"-> set position to (0,0,0)" :
"") << endl);
116
117 if (overwriteDetector) {
119 }
120 }
121
122 ++p;
123 ++q;
124 }
125 }
126
127 if (overwriteDetector) {
128
129 NOTICE(
"Store calibration data on file " << detectorFile << endl);
130
132 }
133
135
136 return 0;
137}
#define DEBUG(A)
Message macros.
#define QAQC(A)
QA/QC output macro.
int qaqc
QA/QC file descriptor.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of module data in detector data structure.
Data structure for vector in three dimensions.
Utility class to parse command line options.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
JTriggerCounter_t next()
Increment trigger counter.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
std::map< int, range_type > map_type
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.