Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
examples/JCalibrate/JPrintPMTThreshold.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <fstream>
5#include <algorithm>
6
9
10#include "Jeep/JParser.hh"
11#include "Jeep/JMessage.hh"
12
13
14/**
15 * \file
16 *
17 * Auxiliary program to print PMT thresholds.
18 * \author mdejong
19 */
20int main(int argc, char **argv)
21{
22 using namespace std;
23 using namespace JPP;
24
25 string inputFile;
26 int threshold;
27 int debug;
28
29 try {
30
31 JParser<> zap("Auxiliary program to print PMT thresholds.");
32
33 zap['f'] = make_field(inputFile, "PMT threshold file (json format)");
34 zap['T'] = make_field(threshold) = 0;
35 zap['d'] = make_field(debug) = 1;
36
37 zap(argc, argv);
38 }
39 catch(const exception &error) {
40 FATAL(error.what() << endl);
41 }
42
43
44 json js;
45
46 istream* in = open<istream>(inputFile.c_str());
47
48 *in >> js;
49
50 close(in);
51
52 try {
53
55
56 sort(calibration.begin(), calibration.end(), make_comparator(&JPMTThresholdCalibration_t::getUPI));
57
58 for (JPMTThresholdCalibration::const_iterator i = calibration.begin(); i != calibration.end(); ++i) {
59 if (i->threshold >= threshold) {
60 cout << "PMT " << left << setw(32) << static_cast<const JUPI_t&>(*i) << " -> " << right << setw(3) << i->threshold << endl;
61 }
62 }
63 }
64 catch(const exception& error) {
65 FATAL(error.what() << endl);
66 }
67}
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
nlohmann::json json
Utility class to parse command line options.
Definition JParser.hh:1698
int main(int argc, char **argv)
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Calibration.
Definition JHead.hh:330