Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
getPMT.cc File Reference

Auxiliary program to print PMT data for a given PMT channel or identifier. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JPMTChannel.hh"
#include "JDetector/JPMTIdentifier.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print PMT data for a given PMT channel or identifier.

Author
mdejong

Definition in file getPMT.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 20 of file getPMT.cc.

21{
22 using namespace std;
23 using namespace JPP;
24
25 string detectorFile;
26 JPMTChannel channel;
27 JObjectID id;
28 int debug;
29
30 try {
31
32 JParser<> zap("Auxiliary program to print PMT data for a given PMT channel.");
33
34 zap['a'] = make_field(detectorFile);
35 zap['P'] = make_field(channel, "PMT channel: <string> <floor> <TDC>") = JPMTChannel();
36 zap['p'] = make_field(id, "PMT identifier") = JObjectID();
37 zap['d'] = make_field(debug) = 1;
38
39 zap(argc, argv);
40 }
41 catch(const exception &error) {
42 FATAL(error.what() << endl);
43 }
44
45
47
48 try {
49 load(detectorFile, detector);
50 }
51 catch(const JException& error) {
52 FATAL(error);
53 }
54
55 if (channel != JPMTChannel()) {
56
57 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
58
59 if (module->getLocation() == channel.getLocation()) {
60
61 cout << module->getPMT(channel.getTDC()) << endl;
62
63 break;
64 }
65 }
66
67 } else if (id != JObjectID()) {
68
69 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
70 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
71 if (pmt->getID() == id.getID()) {
72
73 cout << *pmt << endl;
74
75 break;
76 }
77 }
78 }
79
80 } else {
81
82 while (cin >> channel && channel != JPMTChannel()) {
83
84 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
85
86 if (module->getLocation() == channel.getLocation()) {
87
88 cout << module->getPMT(channel.getTDC()) << endl;
89
90 break;
91 }
92 }
93 }
94 }
95}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Detector data structure.
Definition JDetector.hh:96
const JLocation & getLocation() const
Get location.
Definition JLocation.hh:70
Auxiliary class to uniquely identify PMT readout channel.
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Detector file.
Definition JHead.hh:227