Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JModuleAddressMap.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
8 
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Example program to print PMT logical addressing.
17  * \author mdejong
18  */
19 int main(int argc, char **argv)
20 {
21  using namespace std;
22 
23  int detectorID;
24  int moduleID;
25  int debug;
26 
27  try {
28 
29  JParser<> zap("Example program to print PMT logical addressing.");
30 
31  zap['D'] = make_field(detectorID);
32  zap['M'] = make_field(moduleID) = -1;
33  zap['d'] = make_field(debug) = 0;
34 
35  zap(argc, argv);
36  }
37  catch(const exception &error) {
38  FATAL(error.what() << endl);
39  }
40 
41 
42  using namespace JPP;
43 
44  if (!hasDetectorAddressMap(detectorID)) {
45  FATAL("No detector address map for detector identifier " << detectorID << endl);
46  }
47 
48  const JDetectorAddressMap& demo = getDetectorAddressMap(detectorID);
49  const JModuleAddressMap& memo = demo.get(moduleID);
50 
51  for (JModuleAddressMap::const_iterator i = memo.begin(); i != memo.end(); ++i) {
52  cout << i->toString("TDC[%] = %%") << endl;
53  }
54 }
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
Detector specific mapping between logical positions and readout channels of PMTs in optical modules...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
KM3NeT DAQ constants, bit handling, etc.
int debug
debug level