Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Functions
JPlotK40.cc File Reference

Auxiliary plot fit function of JFitK40.cc. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JDetector/JModule.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JDetectorSupportkit.hh"
#include "JCalibrate/JCalibrateK40.hh"
#include "JCalibrate/JFitK40.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

Auxiliary plot fit function of JFitK40.cc.

Author
mdejong

Definition in file JPlotK40.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file JPlotK40.cc.

31 {
32  using namespace std;
33  using namespace JPP;
34 
36 
37  string outputFile;
38  int debug;
39 
40  try {
41 
42  JProperties properties;
43 
44  properties.insert(gmake_property(K40.R));
45  properties.insert(gmake_property(K40.p1));
46  properties.insert(gmake_property(K40.p2));
47  properties.insert(gmake_property(K40.p3));
48  properties.insert(gmake_property(K40.p4));
49 
50  JParser<> zap("Auxiliary plot fit function of JFitK40.cc.");
51 
52  zap['@'] = make_field(properties) = JPARSER::initialised();
53  zap['o'] = make_field(outputFile, "output file.") = "k40.root";
54  zap['d'] = make_field(debug, "debug.") = 1;
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
62 
63  const JModule module = getModule<JKM3NeT_t>(1001);
64 
65  const JModel model(module, K40);
66 
67  const int nx = model.getNumberOfPairs();
68  const double xmin = -0.5;
69  const double xmax = nx - 0.5;
70 
71 
72  TFile out(outputFile.c_str(), "recreate");
73 
74  TH1D h1("h1", NULL, nx, xmin, xmax);
75 
76  double R = 0.0;
77 
78  for (int ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
79 
80  const Double_t x = h1.GetXaxis()->GetBinCenter(ix);
81 
82  const pair_type pair = model.getPair((int) x);
83  const double rate = model.getValue(pair);
84 
85  R += rate;
86 
87  h1.SetBinContent(ix, rate);
88  }
89 
90  cout << "Total rate " << FIXED(7,3) << R << " [Hz]." << endl;
91 
92  out.Write();
93  out.Close();
94 }
string outputFile
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Data structure for a composite optical module.
Definition: JModule.hh:75
Utility class to parse parameter values.
Definition: JProperties.hh:501
Utility class to parse command line options.
Definition: JParser.hh:1698
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:448
Livetime of noise data.
Definition: JHead.hh:1062
Model for fit to acoustics data.
Fit parameters for two-fold coincidence rate due to K40.
Definition: JFitK40.hh:610
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68
Data structure for a pair of indices.