Jpp
JPMTStatusBits.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
6 #include "JDetector/JPMT.hh"
7 
8 #include "Jeep/JStreamToolkit.hh"
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Example program to test PMT status bits.
17  * \author mdejong
18  */
19 int main(int argc, char **argv)
20 {
21  using namespace std;
22  using namespace JPP;
23 
24  int debug;
25 
26  try {
27 
28  JParser<> zap("Example program to test PMT status bits.");
29 
30  zap['d'] = make_field(debug) = 3;
31 
32  zap(argc, argv);
33  }
34  catch(const exception &error) {
35  FATAL(error.what() << endl);
36  }
37 
38 
39  if (debug >= debug_t) {
40  cout << "PMT status bits: ";
41  writeObject(cout, getPMTStatusBits<string>()) << endl;
42  }
43 
44  JPMT pmt;
45 
46  vector<JPMT::JPMTStatusBits_t> buffer = getPMTStatusBits<JPMT::JPMTStatusBits_t>();
47 
48  for (vector<JPMT::JPMTStatusBits_t>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
49 
50  ASSERT(pmt.has(*i) == false);
51 
52  DEBUG("Set PMT status " << putPMTStatusBit(*i) << endl);
53 
54  pmt.set(*i);
55 
56  ASSERT(pmt.has(*i) == true);
57  }
58 
59  return 0;
60 }
JMessage.hh
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
std::vector
Definition: JSTDTypes.hh:12
JDETECTOR::putPMTStatusBit
static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit)
Function object to map PMT status bit to key.
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
main
int main(int argc, char **argv)
Definition: JPMTStatusBits.cc:19
debug
int debug
debug level
Definition: JSirene.cc:59
JStreamToolkit.hh
JEEP::writeObject
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.
Definition: JStreamToolkit.hh:42
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JPMT.hh
JEEP::debug_t
debug
Definition: JMessage.hh:29