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

Auxiliary program to draw K40 fit function. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JDetector/JModule.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JROOT/JRootToolkit.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 program to draw K40 fit function.

Author
mdejong

Definition in file JDrawK40.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JDrawK40.cc.

25 {
26  using namespace std;
27  using namespace JPP;
28 
29  JFitK40Parameters fitk40; // setting of internal fit parameters
30 
31  string outputFile;
32  int debug;
33 
34  try {
35 
36  JProperties properties;
37 
38  properties.insert(gmake_property(fitk40.Rate_Hz));
39  properties.insert(gmake_property(fitk40.p1));
40  properties.insert(gmake_property(fitk40.p2));
41  properties.insert(gmake_property(fitk40.p3));
42  properties.insert(gmake_property(fitk40.p4));
43 
44  JParser<> zap("Auxiliary program to draw K40 fit function.");
45 
46  zap['@'] = make_field(properties) = JPARSER::initialised();
47  zap['o'] = make_field(outputFile, "output file.");
48  zap['d'] = make_field(debug, "debug.") = 1;
49 
50  zap(argc, argv);
51  }
52  catch(const exception &error) {
53  FATAL(error.what() << endl);
54  }
55 
56 
57  const JModule module = getModule<JKM3NeT_t>(1001);
58 
59  double ct = -1.0;
60 
61  for (JModule::const_iterator i = module.begin(); i != module.end(); ++i) {
62  for (JModule::const_iterator j = module.begin(); j != i; ++j) {
63 
64  if (getDot(i->getDirection(), j->getDirection()) > ct) {
65  ct = getDot(i->getDirection(), j->getDirection());
66  }
67  }
68  }
69 
70  cout << "Cosine minimal angle between PMT axes " << FIXED(5,3) << ct << endl;
71  cout << "Default rate [Hz] " << FIXED(6,3) << JFitK40Parameters().getValue(ct) << '/' << FIXED(6,3) << JFitK40Parameters().getValue(+1.0) << endl;
72  cout << "Modified rate [Hz] " << FIXED(6,3) << fitk40 .getValue(ct) << '/' << FIXED(6,3) << fitk40 .getValue(+1.0) << endl;
73 
74  TFile out(outputFile.c_str(), "recreate");
75 
76  TH1D h0("h0", NULL, 5000, -1.0, +1.0);
77 
78  for (Int_t i = 1; i <= h0.GetXaxis()->GetNbins(); ++i) {
79 
80  const Double_t x = h0.GetBinCenter(i);
81 
82  h0.SetBinContent(i, fitk40.getValue(x));
83  }
84 
85  out.Write();
86  out.Close();
87 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Data structure for a composite optical module.
Definition: JModule.hh:68
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Definition: JAstronomy.hh:409
Utility class to parse parameter values.
Definition: JProperties.hh:496
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
Double_t getValue(const Double_t ct) const
Get K40 coincidence rate as a function of cosine angle between PMT axes.
Definition: JFitK40.hh:263
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
int j
Definition: JPolint.hh:666
Fit parameters for two-fold coincidence rate due to K40.
Definition: JFitK40.hh:66