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

Auxiliary application to plot PMT parameters. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "km3net-dataformat/online/JDAQ.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JPMTParametersMap.hh"
#include "JDetector/JPMTParametersToolkit.hh"
#include "JGizmo/JManager.hh"
#include "Jeep/JPrint.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

Auxiliary application to plot PMT parameters.

Author
mdejong

Definition in file JPlotPMTParameters.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 27 of file JPlotPMTParameters.cc.

28 {
29  using namespace std;
30  using namespace JPP;
31  using namespace KM3NETDAQ;
32 
33  string detectorFile;
35  string outputFile;
36  int debug;
37 
38  try {
39 
40  JParser<> zap("Auxiliary application to plot PMT parameters.");
41 
42  zap['a'] = make_field(detectorFile, "detector file.");
43  zap['o'] = make_field(outputFile, "output file.") = "pmt_parameters.root";
44  zap['P'] = make_field(parameters, "PMT calibration data (or corresponding file name)");
45  zap['d'] = make_field(debug, "debug") = 0;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
54 
55  try {
56  load(detectorFile, detector);
57  }
58  catch(const JException& error) {
59  FATAL(error);
60  }
61 
62  if (detector.empty()) {
63  FATAL("Empty detector." << endl);
64  }
65 
66  JManager<string, TH1D> manager(new TH1D("%", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS - 0.5));
67 
68  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
69 
70  DEBUG("Module " << setw(10) << module->getID() << endl);
71 
72  for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
73 
74  const JProperties properties = parameters.getPMTParameters(JPMTIdentifier(module->getID(), pmt)).getProperties();
75 
76  for (JProperties::const_iterator p = properties.begin(); p != properties.end(); ++p) {
77 
78  try {
79  manager[MAKE_CSTRING(module->getID() << "." << p->first)]->Fill((Double_t) pmt, p->second.getValue<const double>());
80  }
81  catch(const exception& error) {}
82 
83  try {
84  manager[MAKE_CSTRING(module->getID() << "." << p->first)]->Fill((Double_t) pmt, p->second.getValue<const bool>() ? 1.0 : 0.0);
85  }
86  catch(const exception& error) {}
87  }
88 
89  const JPMTParameters buffer = parameters.getPMTParameters(JPMTIdentifier(module->getID(), pmt));
90 
91  manager[MAKE_CSTRING(module->getID() << "." << "EFFICIENCY")]->Fill((Double_t) pmt, getSurvivalProbability(buffer) * buffer.QE);
92  }
93  }
94 
95  manager.Write(outputFile.c_str());
96 }
Utility class to parse command line options.
Definition: JParser.hh:1493
General exception.
Definition: JException.hh:23
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition: JScale.hh:47
Detector data structure.
Definition: JDetector.hh:80
Utility class to parse parameter values.
Definition: JProperties.hh:496
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:708
string outputFile
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
Auxiliary class to manage set of compatible ROOT objects (e.g.
Definition: JManager.hh:42
Detector file.
Definition: JHead.hh:130
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
Auxiliary class for map of PMT parameters.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
double getSurvivalProbability(const JPMTParameters &parameters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
Data structure for PMT parameters.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62