Jpp  18.3.1
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 
9 
10 #include "Jeep/JParser.hh"
11 #include "Jeep/JMessage.hh"
12 
13 
14 /**
15  * \file
16  *
17  * Example program to print PMT logical addressing.
18  * \author mdejong
19  */
20 int main(int argc, char **argv)
21 {
22  using namespace std;
23 
24  int detectorID;
25  int moduleID;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Example program to print PMT logical addressing.");
31 
32  zap['D'] = make_field(detectorID);
33  zap['M'] = make_field(moduleID) = -1;
34  zap['d'] = make_field(debug) = 0;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42 
43  using namespace JPP;
44 
45  if (!hasDetectorAddressMap(detectorID)) {
46  FATAL("No detector address map for detector identifier " << detectorID << endl);
47  }
48 
49  const JDetectorAddressMap& demo = getDetectorAddressMap(detectorID);
50  const JModuleAddressMap& memo = demo.get(moduleID);
51 
52  for (JModuleAddressMap::const_iterator i = memo.begin(); i != memo.end(); ++i) {
53  cout << i->toString("TDC[%] = %%") << endl;
54  }
55 }
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 support kit.
#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