Jpp
JSlewing.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <cmath>
6 
7 #include "TROOT.h"
8 #include "TFile.h"
9 #include "TH1D.h"
10 
12 #include "JTrigger/JGetRiseTime.hh"
13 
14 #include "Jeep/JParser.hh"
15 #include "Jeep/JMessage.hh"
16 
17 
18 
19 /**
20  * \file
21  *
22  * Example program to histogram time over threshold as a function of number of photo-electrons.
23  * \author mdejong
24  */
25 int main(int argc, char **argv)
26 {
27  using namespace std;
28  using namespace JPP;
29 
30  string outputFile;
31  JPMTParameters parameters;
32  int debug;
33 
34  try {
35 
36  JProperties properties = parameters.getProperties();
37 
38  JParser<> zap("Example program to histogram time over threshold as a function of number of photo-electrons.");
39 
40  zap['o'] = make_field(outputFile) = "histogram.root";
41  zap['P'] = make_field(properties) = JPARSER::initialised();
42  zap['d'] = make_field(debug) = 0;
43 
44  zap(argc, argv);
45  }
46  catch(const exception &error) {
47  FATAL(error.what() << endl);
48  }
49 
50 
51  if (debug >= JEEP::debug_t) {
52  cout << "PMT parameters:" << endl;
53  cout << parameters.getProperties(JEquationParameters("=", "\n", "", "")) << endl;
54  }
55 
56  JPMTAnalogueSignalProcessor cpu(parameters);
57 
58  TFile out(outputFile.c_str(), "recreate");
59 
60  TH1D h0("[model]", NULL, 510, 0.0, 255.0);
61  TH1D h1("[parametrisation]", NULL, 510, 0.0, 255.0);
62 
63  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
64 
65  try {
66 
67  const double x = h0.GetBinCenter(i);
68  const double npe = cpu.getNPE(x);
69  const double y = cpu.getRiseTime(npe);
70 
71  h0.SetBinContent(i, y);
72  h1.SetBinContent(i, getRiseTime(x));
73  }
74  catch(const JValueOutOfRange& error) {}
75  }
76 
77  out.Write();
78  out.Close();
79 }
JPMTAnalogueSignalProcessor.hh
JMessage.hh
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
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
debug
int debug
debug level
Definition: JSirene.cc:59
main
int main(int argc, char **argv)
Definition: JSlewing.cc:25
JParser.hh
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition: JEquationParameters.hh:20
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JEEP::JProperties
Utility class to parse parameter values.
Definition: JProperties.hh:496
JTRIGGER::getRiseTime
static const JGetRiseTime getRiseTime
Function object for rise time evaluation.
Definition: JGetRiseTime.hh:313
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37
JEEP::debug_t
debug
Definition: JMessage.hh:29
JGetRiseTime.hh