Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JFluxMap.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
15#include "Jeep/JPrint.hh"
16#include "Jeep/JParser.hh"
17#include "Jeep/JMessage.hh"
18
19
20/**
21 * \file
22 * Example program for scanning event-weights of Monte Carlo files\n
23 * using specifiable flux functions.
24 *
25 * \author bjung
26 */
27int main(int argc, char **argv)
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}
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
int main(int argc, char **argv)
Definition JFluxMap.cc:27
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
#define WARNING(A)
Definition JMessage.hh:65
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.
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.
size_t setFlux(const JEvtCategoryHelper &category, const JFluxHelper &flux)
Set flux function for all MC-files corresponding to a given event category.
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