Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Functions
JPMTStatusBits.cc File Reference

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

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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JPMTStatusBits.cc.

21 {
22  using namespace std;
23  using namespace JPP;
24 
25  int debug;
26 
27  try {
28 
29  JParser<> zap("Example program to test PMT status bits.");
30 
31  zap['d'] = make_field(debug) = 3;
32 
33  zap(argc, argv);
34  }
35  catch(const exception &error) {
36  FATAL(error.what() << endl);
37  }
38 
39 
40  if (debug >= debug_t) {
41  cout << "PMT status bits: ";
42  writeObject(cout, getPMTStatusBits<string>()) << endl;
43  }
44 
45  JPMT pmt;
46 
47  vector<int> buffer = getPMTStatusBits<int>();
48 
49  for (vector<int>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
50 
51  ASSERT(pmt.has(*i) == false);
52 
53  DEBUG("Set PMT status " << putPMTStatusBit(*i) << endl);
54 
55  pmt.set(*i);
56 
57  ASSERT(pmt.has(*i) == true);
58  }
59 
60  return 0;
61 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Data structure for PMT geometry, calibration and status.
Definition: JPMT.hh:49
Utility class to parse command line options.
Definition: JParser.hh:1698
static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit)
Function object to map PMT status bit to key.
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.
@ debug_t
debug
Definition: JMessage.hh:29
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
void set(const int bit)
Set PMT status.
Definition: JStatus.hh:131
bool has(const int bit) const
Test PMT status.
Definition: JStatus.hh:120