Jpp  18.2.1-ARCA-DF-PATCH
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JCDFTable1D.cc File Reference

Program to plot CDF of Cherenkov light from muon using interpolation tables. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JPhysics/JCDFTable.hh"
#include "JPhysics/JPDFTypes.hh"
#include "JPhysics/JPDFToolkit.hh"
#include "JSirene/JCDFTable1D.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JPrint.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

Program to plot CDF of Cherenkov light from muon using interpolation tables.

Author
mdejong

Definition in file JCDFTable1D.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

< number of bins for average CDF integral of optical module

< safety factor for average CDF integral of optical module

Definition at line 30 of file JCDFTable1D.cc.

31 {
32  using namespace std;
33  using namespace JPP;
34 
35  string inputFile;
36  string outputFile;
37  int numberOfBins = 200; //!< number of bins for average CDF integral of optical module
38  double safetyFactor = 1.7; //!< safety factor for average CDF integral of optical module
39  int debug;
40 
41  try {
42 
43  JProperties properties;
44 
45  properties.insert(gmake_property(numberOfBins));
46  properties.insert(gmake_property(safetyFactor));
47 
48  JParser<> zap("Program to plot PDF of Cherenkov light from muon using interpolation tables.");
49 
50  zap['@'] = make_field(properties) = JPARSER::initialised();
51  zap['f'] = make_field(inputFile);
52  zap['o'] = make_field(outputFile) = "cdf.root";
53  zap['d'] = make_field(debug) = 0;
54 
55  zap(argc, argv);
56  }
57  catch(const exception &error) {
58  FATAL(error.what() << endl);
59  }
60 
61 
62  typedef JHermiteSplineFunction1D_t JFunction1D_t;
63  typedef JMAPLIST<JPolint1FunctionalMap,
64  JPolint1FunctionalGridMap,
65  JPolint1FunctionalGridMap>::maplist JMapList_t;
66  typedef JCDFTable<JFunction1D_t, JMapList_t> JCDF_t;
67 
68  typedef JCDFTable1D<JFunction1D_t::argument_type, JFunction1D_t::result_type> JCDF1D_t;
69 
70  JCDF_t function;
71 
72  try {
73 
74  NOTICE("loading input from file " << inputFile << "... " << flush);
75 
76  function.load(inputFile.c_str());
77 
78  NOTICE("OK" << endl);
79  }
80  catch(const JException& error) {
81  FATAL(error.what() << endl);
82  }
83 
84  JCDF1D_t integral(function, numberOfBins, safetyFactor);
85 
86 
87  TFile out(outputFile.c_str(), "recreate");
88 
89  TH1D h0("h0", NULL,
90  1000, function.intensity.getXmin(), function.intensity.getXmax());
91 
92  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
93 
94  const double R = h0.GetBinCenter(i);
95  const double y = integral.getNPE(R);
96 
97  h0.SetBinContent(i, y);
98  }
99 
100  out.Write();
101  out.Close();
102 }
Utility class to parse command line options.
Definition: JParser.hh:1514
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
double safetyFactor
safety factor for average CDF integral of optical module
Definition: JSirene.cc:70
Utility class to parse parameter values.
Definition: JProperties.hh:497
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
int numberOfBins
number of bins for average CDF integral of optical module
Definition: JSirene.cc:69
int debug
debug level