45 static const int NUMBER_OF_POINTS = 20;
46 static const int NUMBER_OF_DEGREES = 1;
66int main(
int argc,
char **argv)
83 JParser<> zap(
"Auxiliary program to process AHRS data.");
85 zap[
'f'] =
make_field(inputFile,
"output of JConvertDB -q ahrs");
88 zap[
'c'] =
make_field(ahrsFile,
"output of JAHRSCalibration");
90 zap[
'S'] =
make_field(angle_deg,
"maximal angle w.r.t. fit") = 0.0;
91 zap[
'T'] =
make_field(T_s,
"time window for averaging") = 0.0;
92 zap[
'N'] =
make_field(npy,
"number of floors for missing data policy") = 1;
97 catch(
const exception &error) {
98 FATAL(error.what() << endl);
119 NOTICE(
"Magnetic declination " << getMagneticDeclination << endl);
120 NOTICE(
"Meridian angle [rad] " <<
FIXED(5,3) << meridian << endl);
131 struct element_type {
150 element_type(
const double t1,
167 static inline bool getOR(buffer_type::const_iterator __begin,
168 buffer_type::const_iterator __end)
170 for (buffer_type::const_iterator i = __begin; i != __end; ++i) {
186 static inline bool getAND(buffer_type::const_iterator __begin,
187 buffer_type::const_iterator __end)
189 for (buffer_type::const_iterator i = __begin; i != __end; ++i) {
214 for (JMultipleFileScanner_t::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
216 STATUS(
"processing file " << *file_name <<
"... " << flush);
224 const JAHRS* parameters = in.next();
225 const int id = parameters->
DOMID;
235 compass.
correct(getMagneticDeclination(parameters->
UNIXTIME * 1.0e-3), meridian);
239 data[id].push_back(element_type(parameters->
UNIXTIME * 1.0e-3, Q, 1,
false));
246 if (angle_deg > 0.0) {
248 for (map_type::iterator module = data.begin(); module != data.end(); ++module) {
250 if (!module->second.empty()) {
252 sort(module->second.begin(), module->second.end(),
make_comparator(&element_type::first));
254 buffer_type::iterator out =
module->second.begin();
255 buffer_type::const_iterator in =
module->second.begin();
256 buffer_type::const_iterator p =
module->second.begin();
257 buffer_type::const_iterator q =
module->second.begin();
259 for (
int i = 0; i != NUMBER_OF_POINTS && q !=
module->second.end(); ++i, ++q) {}
261 for (
int i = 0; i != NUMBER_OF_POINTS/2 && in != q; ++i, ++in) {
265 if (
getAngle(in->second, f1(in->first)) <= angle_deg) {
271 for (++p; q++ !=
module->second.end(); ++p, ++in) {
275 if (
getAngle(in->second, f1(in->first)) <= angle_deg) {
281 for ( ; in !=
module->second.end(); ++in) {
285 if (
getAngle(in->second, f1(in->first)) <= angle_deg) {
291 module->second.erase(out, module->second.end());
301 const JPolicy policy(router, buffer.begin(), buffer.end(), npy);
303 for (JPolicy::const_iterator module = policy.begin(); module != policy.end(); ++module) {
307 for (JPolicy::mapped_type::const_iterator in = module->second.begin(); in != module->second.end(); ++in) {
308 for (map_type::mapped_type::const_iterator i = data[*in].begin(); i != data[*in].end(); ++i) {
309 buffer.push_back(element_type(i->first, i->second, 1,
true));
317 sort(buffer.begin(), buffer.end(),
make_comparator(&element_type::first));
319 buffer_type::iterator out = buffer.begin();
320 buffer_type::const_iterator p = buffer.begin();
321 buffer_type::const_iterator q = buffer.begin();
323 for (p = buffer.begin(); p != buffer.end(); p = q) {
325 for (q = p; q != buffer.end() && q->first - p->first < T_s; ++q) {}
332 out->first =
getAverage(t1.begin(), t1.end());
333 out->second =
getAverage(q1.begin(), q1.end());
335 out->policy = element_type::getOR(p,q);
345 buffer.erase(out, buffer.end());
348 for (buffer_type::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
Meridian convergence angles for different sites.
Compass event data types.
ROOT TTree parameter settings.
ROOT TTree parameter settings.
Data structure for detector geometry and calibration.
Recording of objects on file according a format that follows from the file name extension.
General purpose class for hash map of unique elements.
General purpose messaging.
Direct access to module in detector data structure.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Policy for invalid modules.
I/O formatting auxiliaries.
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Data structure for compass in three dimensions.
void correct(const double declination, const double meridian)
Correct compass for magnetic declination and meridian convergence angle.
JQuaternion3D getQuaternion() const
Get quaternion.
int getFloor() const
Get floor number.
Router for direct addressing of module data in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
bool has(const int bit) const
Test PMT status.
Data structure for unit quaternion in three dimensions.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
static const int COMPASS_DISABLE
Enable (disable) use of compass if this status bit is 0 (1);.
JQuaternion3D getQuaternion(const JQuaternion &Q)
Get quaternion.
static JARCAMagneticDeclination getARCAMagneticDeclination
Function object for magnetic declination at ARCA site.
static JORCAMagneticDeclination getORCAMagneticDeclination
Function object for magnetic declination at ORCA site.
static const double ORCA_MERIDIAN_CONVERGENCE_ANGLE_RAD
ORCA meridian convergence angle [rad].
static const double ARCA_MERIDIAN_CONVERGENCE_ANGLE_RAD
ARCA meridian convergence angle [rad].
static JZEROMagneticDeclination getZEROMagneticDeclination
Function object for zero magnetic declination.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
bool isORCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with that of ORCA.
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA.
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
Long64_t counter_type
Type definition for counter.
bool is_valid(const json &js)
Check validity of JSon data.
std::map< int, range_type > map_type
int main(int argc, char **argv)
Auxiliary data structure for floating point format specification.
Auxiliary base class for interpolation of magnetic declination data obtained from website of NOAA.
Auxiliary class to define policy for invalid modules.
Auxiliary class to map module identifier to AHRS calibration.
Auxiliary data structure to check validity of AHRS data.
long long int UNIXTIME
[ms]
Auxiliary data structure for return type of make methods.
Template definition for function evaluation of Legendre polynome.
void set(T __begin, T __end)
Set Legendre polynome.
static counter_type max()
Get maximum counter value.
Auxiliary base class for list of file names.