Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPMTStatusBits.cc File Reference

Example program to test PMT status bits. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JPMT.hh"
#include "Jeep/JStreamToolkit.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

Example program to test PMT status bits.

Author
mdejong

Definition in file JPMTStatusBits.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file JPMTStatusBits.cc.

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 }
Utility class to parse command line options.
Definition: JParser.hh:1493
debug
Definition: JMessage.hh:29
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
Definition: JTransitTime.sh:36
#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:1954
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.