Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JEnergyCorrection.cc File Reference

Example program to histogram energy corrections. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JReconstruction/JEvtToolkit.hh"
#include "JReconstruction/JEnergyCorrection.hh"
#include "JROOT/JManager.hh"
#include "JTools/JRange.hh"
#include "Jeep/JeepToolkit.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 energy corrections.

Author
mdejong

Definition in file examples/JReconstruction/JEnergyCorrection.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 25 of file examples/JReconstruction/JEnergyCorrection.cc.

26{
27 using namespace std;
28 using namespace JPP;
29
30 typedef JRange<double> JRange_t;
31
32 string outputFile;
33 vector<string> energy_correction;
34 JRange_t X;
35 int debug;
36
37 try {
38
39 JParser<> zap("Example program to histogram energy corrections.");
40
41 zap['o'] = make_field(outputFile);
42 zap['E'] = make_field(energy_correction);
43 zap['x'] = make_field(X, "axis range in log(E/GeV)");
44 zap['d'] = make_field(debug) = 2;
45
46 zap(argc, argv);
47 }
48 catch(const exception& error) {
49 FATAL(error.what() << endl);
50 }
51
52
53 JManager<string, TH1D> zmap(new TH1D("h[%]", NULL, 1000, X.getLowerLimit(), X.getUpperLimit())); // [log(E)]
54
55 for (vector<string>::const_iterator f1 = energy_correction.begin(); f1 != energy_correction.end(); ++f1) {
56
57 const JEnergyCorrection fcn(*f1);
58
59 DEBUG(getFilename(*f1) << endl << fcn << endl);
60
61 for (int i = 1; i <= zmap->GetNbinsX(); ++i) {
62
63 const double x = zmap->GetBinCenter (i);
64 const double E = pow(10.0, x);
65 const double y = fcn(E) / E;
66
67 zmap[getFilename(*f1)]->SetBinContent(i, y);
68 }
69 }
70
71 zmap.Write(outputFile.c_str());
72}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
Auxiliary class for correction of energy determined by JEnergy.cc.
Range of values.
Definition JRange.hh:42
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).