Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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<int> buffer = getPMTStatusBits<int>();
47 
48  for (vector<int>::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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
debug
Definition: JMessage.hh:29
int main(int argc, char *argv[])
Definition: Main.cc:15
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit)
Function object to map PMT status bit to key.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Data structure for PMT geometry and calibration.
Utility class to parse command line options.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.