Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JFluxMap.cc File Reference

Example program for scanning event-weights of Monte Carlo files
using specifiable flux functions. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program for scanning event-weights of Monte Carlo files
using specifiable flux functions.

Author
bjung

Definition in file JFluxMap.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 30 of file JFluxMap.cc.

31{
32 using namespace std;
33 using namespace JPP;
34
35 JMultipleFileScanner_t inputFiles;
36
37 string oscProbTable;
38 JOscParameters<double> oscParameters;
39
41
42 int debug;
43
44 try {
45
46 JParser<> zap;
47
48 zap['f'] = make_field(inputFiles);
49 zap['P'] = make_field(oscProbTable, "oscillation probability table file")
50 = "";
51 zap['@'] = make_field(oscParameters, "oscillation parameters")
53 zap['%'] = make_field(fluxMap)
55 zap['d'] = make_field(debug)
56 = 1;
57
58 zap(argc, argv);
59 }
60 catch(const exception& error) {
61 FATAL(error.what() << endl);
62 }
63
64
65 // Load oscillation probability table
66
67 if (!oscProbTable.empty()) {
68
69 JOscProbInterpolator<>& interpolator = static_cast<JOscProbInterpolator<>&>(fluxMap.oscProb.getOscProbInterface());
70
71 interpolator.set (oscParameters);
72 interpolator.load(oscProbTable.c_str());
73 }
74
75
76 // Create file scanners
77
78 JEvtWeightFileScannerSet<> scanners(inputFiles);
79
80 if (scanners.setFlux(fluxMap) == 0) {
81 WARNING("No flux functions set." << endl);
82 }
83
84
85 // Scan events
86
87 for (JEvtWeightFileScannerSet<>::iterator scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
88
89 if (scanner->simul.size() > 0) {
90 STATUS("Scanning " << scanner->simul[0].program << " files..." << endl);
91 }
92
93 STATUS(LEFT(15) << "event" << RIGHT(15) << "rate" << endl);
94
95 while (scanner->hasNext()) {
96
97 const Evt* event = scanner->next();
98 const double weight = scanner->getWeight(*event);
99
100 STATUS(LEFT (15) << scanner->getCounter() <<
101 SCIENTIFIC(15, 3) << weight << '\r'); DEBUG(endl);
102 }
103 }
104
105 return 0;
106}
#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:69
#define WARNING(A)
Definition JMessage.hh:65
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Template specialisation for a map between event categories and flux factors.
Data structure for single set of oscillation parameters.
Template definition of a multi-dimensional oscillation probability interpolation table.
void load(const char *const fileName)
Load oscillation probability table from file.
Utility class to parse command line options.
Definition JParser.hh:1698
@ LEFT
Definition JTwosome.hh:18
@ 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
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