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
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  JK40Parameters K40 = JK40Parameters::getInstance();
30 
31  string outputFile;
32  int debug;
33 
34  try {
35 
36  JProperties properties;
37 
38  properties.insert(gmake_property(K40.R));
39  properties.insert(gmake_property(K40.p1));
40  properties.insert(gmake_property(K40.p2));
41  properties.insert(gmake_property(K40.p3));
42  properties.insert(gmake_property(K40.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) << JK40Parameters::getInstance().getValue(ct) << '/' << FIXED(6,3) << JK40Parameters::getInstance().getValue(+1.0) << endl;
72  cout << "Modified rate [Hz] " << FIXED(6,3) << K40 .getValue(ct) << '/' << FIXED(6,3) << K40 .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, K40.getValue(x));
83  }
84 
85  out.Write();
86  out.Close();
87 }
Utility class to parse command line options.
Definition: JParser.hh:1514
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Definition: JAstronomy.hh:674
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
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
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:1989
#define FATAL(A)
Definition: JMessage.hh:67
int j
Definition: JPolint.hh:792
int debug
debug level