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

Example program to histogram time over threshold as a function of number of photo-electrons. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JDetector/JPMTAnalogueSignalProcessor.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 histogram time over threshold as a function of number of photo-electrons.

Author
mdejong

Definition in file JSlewing.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JSlewing.cc.

25 {
26  using namespace std;
27  using namespace JPP;
28 
29  string outputFile;
30  JPMTParameters parameters;
31  int debug;
32 
33  try {
34 
35  JProperties properties = parameters.getProperties();
36 
37  JParser<> zap("Example program to histogram time over threshold as a function of number of photo-electrons.");
38 
39  zap['o'] = make_field(outputFile) = "histogram.root";
40  zap['P'] = make_field(properties) = JPARSER::initialised();
41  zap['d'] = make_field(debug) = 0;
42 
43  zap(argc, argv);
44  }
45  catch(const exception &error) {
46  FATAL(error.what() << endl);
47  }
48 
49 
50  if (debug >= JEEP::debug_t) {
51  cout << "PMT parameters:" << endl;
52  cout << parameters.getProperties(JEquationParameters("=", "\n", "", "")) << endl;
53  }
54 
55  JPMTAnalogueSignalProcessor cpu(parameters);
56 
57  TFile out(outputFile.c_str(), "recreate");
58 
59  TH1D h0("h0", NULL, 500, 0.0, 100.0);
60 
61  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
62 
63  try {
64 
65  const double x = h0.GetBinCenter(i);
66  const double npe = cpu.getNPE(x);
67  const double y = cpu.getRiseTime(npe);
68 
69  h0.SetBinContent(i, y);
70  }
71  catch(const JValueOutOfRange& error) {}
72  }
73 
74  out.Write();
75  out.Close();
76 }
Utility class to parse command line options.
Definition: JParser.hh:1410
debug
Definition: JMessage.hh:27
Utility class to parse parameter values.
Definition: JProperties.hh:484
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:64
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
int debug
debug level
Definition: JSirene.cc:59
#define FATAL(A)
Definition: JMessage.hh:65