Jpp  debug
the software that should make you happy
Functions
JFluxMap.cc File Reference

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

#include <iostream>
#include <iomanip>
#include <string>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JOscProb/JOscParameters.hh"
#include "JOscProb/JOscProbInterpolator.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JAAnet/JEvtCategoryMap.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JEvtWeightFileScannerSet.hh"
#include "Jeep/JPrint.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 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:2158
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:1714
@ LEFT
Definition: JTwosome.hh:18
@ RIGHT
Definition: JTwosome.hh:18
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
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:84
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 floating point format specification.
Definition: JManip.hh:488