Jpp  17.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPythia.cc File Reference

Auxiliary program histogram plot EM-equivalent energy for hadrons. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JSirene/JPythia.hh"
#include "JROOT/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

Auxiliary program histogram plot EM-equivalent energy for hadrons.

Author
mdejong

Definition in file JPythia.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file JPythia.cc.

23 {
24  using namespace std;
25  using namespace JPP;
26 
27  string outputFile;
28  double epsilon;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Auxiliary program histogram plot EM-equivalent energy for hadrons."\
34  "\nNote that the results have a small offset to effectively be visualised.");
35 
36  zap['o'] = make_field(outputFile) = "pythia.root";
37  zap['e'] = make_field(epsilon) = 0.004;
38  zap['d'] = make_field(debug) = 2;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
47 
48  JManager<int, TH1D> zmap(new TH1D("E[%]", NULL, 500, -0.8, 9.0));
49 
50  const int buffer[] = {
53  //TRACK_TYPE_NEUTRAL_ANTIPION,
58  -1 };
59 
60  map<int, double> Y; // offsets for graphics
61 
62  for (const int *type = buffer; *type != -1; ++type) {
63  Y[*type] = epsilon * (type - buffer);
64  }
65 
66  for (int i = 1; i <= zmap->GetNbinsX(); ++i) {
67 
68  const double x = zmap->GetBinCenter(i);
69  const double E = pow(10.0, x);
70 
71  for (const int *type = buffer; *type != -1; ++type) {
72  zmap[*type]->SetBinContent(i, pythia(*type, E)/E + Y[*type]);
73  }
74  }
75 
76  zmap.Write(outputFile.c_str());
77 }
Utility class to parse command line options.
Definition: JParser.hh:1500
then usage E
Definition: JMuonPostfit.sh:35
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
static const JPythia pythia
Function object for relative light yield as a function of GEANT particle code.
Definition: JPythia.hh:96
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:98
int debug
debug level
Definition: JSirene.cc:67
#define FATAL(A)
Definition: JMessage.hh:67
const double epsilon
Definition: JQuadrature.cc:21