Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JAtmosphericNeutrinoFlux.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3#include <string>
4
7
10
11#include "JSupport/JSupport.hh"
14
18
19#include "Jeep/JPrint.hh"
20#include "Jeep/JParser.hh"
21#include "Jeep/JMessage.hh"
22
23
24/**
25 * \file
26 * Example program for printing the oscillated atmospheric neutrino fluxes for the events in a given neutrino MC-file.
27 *
28 * \author bjung
29 */
30int main(int argc, char **argv)
31{
32 using namespace std;
33 using namespace JPP;
34
35 JMultipleFileScanner_t inputFiles;
36 string oscProbTable;
37 JOscParameters<double> parameters;
38 int debug;
39
40 try {
41
42 JParser<> zap;
43
44 zap['f'] = make_field(inputFiles);
45 zap['P'] = make_field(oscProbTable, "oscillation probability table file");
46 zap['@'] = make_field(parameters, "oscillation parameters") = JPARSER::initialised();
47 zap['d'] = make_field(debug) = 1;
48
49 zap(argc, argv);
50 }
51 catch(const exception& error) {
52 FATAL(error.what() << endl);
53 }
54
55
56 // Create atmospheric neutrino flux function
57
58 const JOscProbHelper oscProb = JOscProbInterpolator<>(oscProbTable.c_str(), parameters);
59 const JAtmosphericNeutrinoFlux flux(oscProb);
60
61 // Scan events
62
63 JEvtWeightFileScannerSet<> scanners(inputFiles);
64
65 for (JEvtWeightFileScannerSet<>::iterator scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
66
67 scanner->setFlux(flux); //!< Set flux for this file scanner
68
69 if (scanner->simul.size() > 0) {
70 STATUS("Scanning " << scanner->simul[0].program << " files..." << endl);
71 }
72
73 STATUS(LEFT (10) << "event ID" << ' ' <<
74 RIGHT(15) << "E [GeV]" << ' ' <<
75 RIGHT(15) << "costh" << ' ' <<
76 RIGHT(40) << "flux [GeV^-1 * m^-2 * sr^-1 * s^-1]" << ' ' <<
77 RIGHT(20) << "rate [Hz]" << endl);
78
79 while (scanner->hasNext()) {
80
81 const Evt* event = scanner->next();
82 const Trk& neutrino = get_neutrino(*event);
83
84 const double E = neutrino.E;
85 const double costh = -neutrino.dir.z / neutrino.dir.len();
86 const double F = flux.getFlux(*event);
87 const double weight = scanner->getWeight(*event);
88
89 STATUS(LEFT (10) << scanner->getCounter() << ' ' <<
90 FIXED (15, 3) << E << ' ' <<
91 FIXED (15, 3) << costh << ' ' <<
92 SCIENTIFIC(40, 3) << F << ' ' <<
93 SCIENTIFIC(20, 3) << weight << '\r'); DEBUG(endl);
94 }
95 }
96
97 return 0;
98}
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
I/O formatting auxiliaries.
ROOT TTree parameter settings of various packages.
Data structure for single set of oscillation parameters.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
Definition JParser.hh:1698
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
@ RIGHT
Definition JTwosome.hh:18
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Implementation of atmospheric neutrino flux using official KM3NeT atmospheric flux function.
Neutrino flux.
Definition JHead.hh:906
Helper class for oscillation probability calculators.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
std::vector< filescanner_type >::iterator iterator
Auxiliary base class for list of file names.
Auxiliary data structure for alignment of data.
Definition JManip.hh:266
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
Vec dir
track direction
Definition Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition Trk.hh:20
double len() const
Get length.
Definition Vec.hh:145
double z
Definition Vec.hh:14