Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JMatch.cc File Reference

Example program to plot match criterion. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JGeometry3D/JVertex3D.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JTrigger/JMatch3D.hh"
#include "JTrigger/JMatch3B.hh"
#include "JTrigger/JMatch1D.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

Example program to plot match criterion.

Author
mdejong

Definition in file JMatch.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 27 of file JMatch.cc.

28{
29 using namespace std;
30 using namespace JPP;
31
32 string outputFile;
33 JTriggerParameters parameters;
34 int debug;
35
36 try {
37
38 JParser<> zap("Example program to plot match criterion.");
39
40 zap['o'] = make_field(outputFile) = "match.root";
41 zap['@'] = make_field(parameters) = JPARSER::initialised();
42 zap['d'] = make_field(debug) = 0;
43
44 zap(argc, argv);
45 }
46 catch(const exception &error) {
47 FATAL(error.what() << endl);
48 }
49
50 typedef JVertex3D hit_type;
51
52 TFile out(outputFile.c_str(), "recreate");
53
54 TH1D h3dp("[3D]+", NULL, 5000, 0.0, 1000.0);
55 TH1D h3dm("[3D]-", NULL, 5000, 0.0, 1000.0);
56 TH1D h3bp("[3B]+", NULL, 5000, 0.0, 1000.0);
57 TH1D h3bm("[3B]-", NULL, 5000, 0.0, 1000.0);
58 TH1D h1dp("[1D]+", NULL, 5000, 0.0, 1000.0);
59 TH1D h1dm("[1D]-", NULL, 5000, 0.0, 1000.0);
60
61 const JMatch3D<hit_type> match3D;
62 const JMatch3B<hit_type> match3B(parameters.trigger3DMuon.roadWidth_m);
63 const JMatch1D<hit_type> match1D(parameters.trigger3DMuon.roadWidth_m);
64
65 const hit_type A(JVector3D(0.0, 0.0, 0.0), 0.0);
66
67 for (Int_t i = 1; i <= h3dp.GetXaxis()->GetNbins(); ++i) {
68
69 const Double_t x = h3dp.GetXaxis()->GetBinCenter(i);
70
71 double t3d = 0.0;
72 double t3b = 0.0;
73 double t1d = 0.0;
74
75 for (double t = 0.0; t <= x * INDEX_OF_REFRACTION_WATER * C_INVERSE; t += 0.1) {
76
77 const hit_type B(JVector3D(x, 0.0, 0.0), t);
78
79 if (match3D(A, B)) { t3d = t; }
80 if (match3B(A, B)) { t3b = t; }
81 if (match1D(A, B)) { t1d = t; }
82 }
83
84 h3dp.SetBinContent(i, +t3d);
85 h3dm.SetBinContent(i, -t3d);
86 h3bp.SetBinContent(i, +t3b);
87 h3bm.SetBinContent(i, -t3b);
88 h1dp.SetBinContent(i, +t1d);
89 h1dm.SetBinContent(i, -t1d);
90 }
91
92 out.Write();
93 out.Close();
94}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
3D match criterion for acoustic signals.
Definition JBillabong.cc:96
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
Utility class to parse command line options.
Definition JParser.hh:1698
1D match criterion.
Definition JMatch1D.hh:33
3D match criterion with road width.
Definition JMatch3B.hh:36
static const double INDEX_OF_REFRACTION_WATER
Average index of refraction of water corresponding to the group velocity.
static const double C_INVERSE
Inverse speed of light in vacuum [ns/m].
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Acoustic hit.
Definition JBillabong.cc:70
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68