Jpp 19.3.0-rc.1
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...

#include <iostream>
#include <iomanip>
#include <string>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.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 27 of file JFluxMap.cc.

28{
29 using namespace std;
30 using namespace JPP;
31
32 JMultipleFileScanner_t inputFiles;
33
34 JFluxMap fluxMap;
35
36 int debug;
37
38 try {
39
40 JParser<> zap;
41
42 zap['f'] = make_field(inputFiles);
43 zap['@'] = make_field(fluxMap)
45 zap['d'] = make_field(debug)
46 = 1;
47
48 zap(argc, argv);
49 }
50 catch(const exception& error) {
51 FATAL(error.what() << endl);
52 }
53
54
55 // Create file scanners
56
57 JEvtWeightFileScannerSet<> scanners(inputFiles);
58
59 if (scanners.setFlux(fluxMap) == 0) {
60 WARNING("No flux functions set." << endl);
61 }
62
63
64 // Scan events
65
66 for (JEvtWeightFileScannerSet<>::iterator scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
67
68 if (scanner->simul.size() > 0) {
69 STATUS("Scanning " << scanner->simul[0].program << " files..." << endl);
70 }
71
72 STATUS(LEFT(15) << "event" << RIGHT(15) << "rate" << endl);
73
74 while (scanner->hasNext()) {
75
76 const Evt* event = scanner->next();
77 const double weight = scanner->getWeight(*event);
78
79 STATUS(LEFT (15) << scanner->getCounter() <<
80 SCIENTIFIC(15, 3) << weight << '\r'); DEBUG(endl);
81 }
82 }
83
84 return 0;
85}
#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
#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.
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