Jpp
 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 "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 23 of file JDrawK40.cc.

24 {
25  using namespace std;
26  using namespace JPP;
27 
28  JFitK40Parameters fitk40; // setting of internal fit parameters
29 
30  string outputFile;
31  int debug;
32 
33  try {
34 
35  JProperties properties;
36 
37  properties.insert(gmake_property(fitk40.Rate_Hz));
38  properties.insert(gmake_property(fitk40.p1));
39  properties.insert(gmake_property(fitk40.p2));
40  properties.insert(gmake_property(fitk40.p3));
41  properties.insert(gmake_property(fitk40.p4));
42 
43  JParser<> zap("Auxiliary program to draw K40 fit function.");
44 
45  zap['@'] = make_field(properties) = JPARSER::initialised();
46  zap['o'] = make_field(outputFile, "output file.");
47  zap['d'] = make_field(debug, "debug.") = 1;
48 
49  zap(argc, argv);
50  }
51  catch(const exception &error) {
52  FATAL(error.what() << endl);
53  }
54 
55 
56  const JModule module = JModule::getInstance();
57 
58  double ct = -1.0;
59 
60  for (JModule::const_iterator i = module.begin(); i != module.end(); ++i) {
61  for (JModule::const_iterator j = module.begin(); j != i; ++j) {
62 
63  if (getDot(i->getDirection(), j->getDirection()) > ct) {
64  ct = getDot(i->getDirection(), j->getDirection());
65  }
66  }
67  }
68 
69  cout << "Cosine minimal angle between PMT axes " << FIXED(5,3) << ct << endl;
70  cout << "Default rate [Hz] " << FIXED(6,3) << JFitK40Parameters().getValue(ct) << '/' << FIXED(6,3) << JFitK40Parameters().getValue(+1.0) << endl;
71  cout << "Modified rate [Hz] " << FIXED(6,3) << fitk40 .getValue(ct) << '/' << FIXED(6,3) << fitk40 .getValue(+1.0) << endl;
72 
73  TFile out(outputFile.c_str(), "recreate");
74 
75  TH1D h0("h0", NULL, 5000, -1.0, +1.0);
76 
77  for (Int_t i = 1; i <= h0.GetXaxis()->GetNbins(); ++i) {
78 
79  const Double_t x = h0.GetBinCenter(i);
80 
81  h0.SetBinContent(i, fitk40.getValue(x));
82  }
83 
84  out.Write();
85  out.Close();
86 }
Utility class to parse command line options.
Definition: JParser.hh:1493
#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:63
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
string outputFile
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
int j
Definition: JPolint.hh:634