Jpp
Functions
JEnergyCorrection.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JFit/JEvtToolkit.hh"
#include "JFit/JEnergyCorrection.hh"
#include "JGizmo/JManager.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 JEnergyCorrection.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file JEnergyCorrection.cc.

24 {
25  using namespace std;
26 
27  string outputFile;
28  vector<string> energy_correction;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Example program to histogram energy corrections.");
34 
35  zap['o'] = make_field(outputFile);
36  zap['E'] = make_field(energy_correction);
37  zap['d'] = make_field(debug) = 2;
38 
39  zap(argc, argv);
40  }
41  catch(const exception& error) {
42  FATAL(error.what() << endl);
43  }
44 
45  using namespace JPP;
46 
47  JManager<string, TH1D> zmap(new TH1D("h[%]", NULL, 1000, +2.0, +7.0)); // [log(E)]
48 
49  for (vector<string>::const_iterator f1 = energy_correction.begin(); f1 != energy_correction.end(); ++f1) {
50 
51  const JEnergyCorrection fcn(*f1);
52 
53  DEBUG("Formula " << fcn << endl);
54 
55  for (int i = 1; i <= zmap[*f1]->GetNbinsX(); ++i) {
56 
57  const double x = zmap[*f1]->GetBinCenter (i);
58  const double E = pow(10.0, x);
59  const double y = fcn(E) / E;
60 
61  zmap[*f1]->SetBinContent(i, y);
62  }
63  }
64 
65  zmap.Write(outputFile.c_str());
66 }
JManager< string, TH1D >
std::vector
Definition: JSTDTypes.hh:12
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
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37