#include #include #include #include #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" /** * \file * * Example program to plot match criterion. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string outputFile; JTriggerParameters parameters; int debug; try { JParser<> zap("Example program to plot match criterion."); zap['o'] = make_field(outputFile) = "match.root"; zap['@'] = make_field(parameters) = JPARSER::initialised(); zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } typedef JVertex3D hit_type; TFile out(outputFile.c_str(), "recreate"); TH1D h3dp("[3D]+", NULL, 5000, 0.0, 1000.0); TH1D h3dm("[3D]-", NULL, 5000, 0.0, 1000.0); TH1D h3bp("[3B]+", NULL, 5000, 0.0, 1000.0); TH1D h3bm("[3B]-", NULL, 5000, 0.0, 1000.0); TH1D h1dp("[1D]+", NULL, 5000, 0.0, 1000.0); TH1D h1dm("[1D]-", NULL, 5000, 0.0, 1000.0); const JMatch3D match3D; const JMatch3B match3B(parameters.trigger3DMuon.roadWidth_m); const JMatch1D match1D(parameters.trigger3DMuon.roadWidth_m); const hit_type A(JVector3D(0.0, 0.0, 0.0), 0.0); for (Int_t i = 1; i <= h3dp.GetXaxis()->GetNbins(); ++i) { const Double_t x = h3dp.GetXaxis()->GetBinCenter(i); double t3d = 0.0; double t3b = 0.0; double t1d = 0.0; for (double t = 0.0; t <= x * INDEX_OF_REFRACTION_WATER * C_INVERSE; t += 0.1) { const hit_type B(JVector3D(x, 0.0, 0.0), t); if (match3D(A, B)) { t3d = t; } if (match3B(A, B)) { t3b = t; } if (match1D(A, B)) { t1d = t; } } h3dp.SetBinContent(i, +t3d); h3dm.SetBinContent(i, -t3d); h3bp.SetBinContent(i, +t3b); h3bm.SetBinContent(i, -t3b); h1dp.SetBinContent(i, +t1d); h1dm.SetBinContent(i, -t1d); } out.Write(); out.Close(); }