Jpp 19.3.0-rc.5
the software that should make you happy
Loading...
Searching...
No Matches
JMatch.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5#include <vector>
6
7#include "TROOT.h"
8#include "TFile.h"
9#include "TH1D.h"
10
13#include "JTrigger/JMatch3D.hh"
14#include "JTrigger/JMatch3B.hh"
15#include "JTrigger/JMatch1D.hh"
16#include "JTrigger/JMatch3G.hh"
17
18#include "Jeep/JParser.hh"
19#include "Jeep/JMessage.hh"
20
21
22/**
23 * \file
24 *
25 * Example program to plot match criterion.
26 * \author mdejong
27 */
28int main(int argc, char **argv)
29{
30 using namespace std;
31 using namespace JPP;
32
33 string outputFile;
34 JTriggerParameters parameters;
35 int debug;
36
37 try {
38
39 JParser<> zap("Example program to plot match criterion.");
40
41 zap['o'] = make_field(outputFile) = "match.root";
42 zap['@'] = make_field(parameters) = JPARSER::initialised();
43 zap['d'] = make_field(debug) = 0;
44
45 zap(argc, argv);
46 }
47 catch(const exception &error) {
48 FATAL(error.what() << endl);
49 }
50
51 typedef JVertex3D hit_type;
52
53 TFile out(outputFile.c_str(), "recreate");
54
55 TH1D h3dp("[3D]+", NULL, 5000, 0.0, 1000.0);
56 TH1D h3dm("[3D]-", NULL, 5000, 0.0, 1000.0);
57 TH1D h3bp("[3B]+", NULL, 5000, 0.0, 1000.0);
58 TH1D h3bm("[3B]-", NULL, 5000, 0.0, 1000.0);
59 TH1D h1dp("[1D]+", NULL, 5000, 0.0, 1000.0);
60 TH1D h1dm("[1D]-", NULL, 5000, 0.0, 1000.0);
61 TH1D h3gp("[3G]+", NULL, 5000, 0.0, 1000.0);
62 TH1D h3gm("[3G]-", NULL, 5000, 0.0, 1000.0);
63
64 const JMatch3D<hit_type> match3D;
65 const JMatch3B<hit_type> match3B(parameters.trigger3DMuon.roadWidth_m);
66 const JMatch1D<hit_type> match1D(parameters.trigger3DMuon.roadWidth_m);
67 const JMatch3G<hit_type> match3G(parameters.trigger3DShower.DMax_m);
68
69 const hit_type A(JVector3D(0.0, 0.0, 0.0), 0.0);
70
71 for (Int_t i = 1; i <= h3dp.GetXaxis()->GetNbins(); ++i) {
72
73 const Double_t x = h3dp.GetXaxis()->GetBinCenter(i);
74
75 double t3d = 0.0;
76 double t3b = 0.0;
77 double t1d = 0.0;
78 double t3g = 0.0;
79
80 for (double t = 0.0; t <= x * INDEX_OF_REFRACTION_WATER * C_INVERSE; t += 0.1) {
81
82 const hit_type B(JVector3D(x, 0.0, 0.0), t);
83
84 if (match3D(A, B)) { t3d = t; }
85 if (match3B(A, B)) { t3b = t; }
86 if (match1D(A, B)) { t1d = t; }
87 if (match3G(A, B)) { t3g = t; }
88 }
89
90 h3dp.SetBinContent(i, +t3d);
91 h3dm.SetBinContent(i, -t3d);
92 h3bp.SetBinContent(i, +t3b);
93 h3bm.SetBinContent(i, -t3b);
94 h1dp.SetBinContent(i, +t1d);
95 h1dm.SetBinContent(i, -t1d);
96 h3gp.SetBinContent(i, +t3g);
97 h3gm.SetBinContent(i, -t3g);
98 }
99
100 out.Write();
101 out.Close();
102}
string outputFile
Match operator for Cherenkov light from muon with given direction.
Match operator for Cherenkov light from muon in any direction.
Match operator for Cherenkov light from muon in any direction.
Match operator for Cherenkov light from shower in any direction.
int main(int argc, char **argv)
Definition JMatch.cc:28
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#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
3G match criterion.
Definition JMatch3G.hh:31
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