Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JFluxMultiParticle.cc File Reference

Example program for scanning event-weights of Monte Carlo files
containing a given set of primaries. More...

#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JLang/JException.hh"
#include "JLang/JVectorize.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JAAnet/JEvtWeightToolkit.hh"
#include "JSupport/JLimit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JEvtWeightFileScannerSet.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "Jeep/JProperties.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
containing a given set of primaries.

The list of possible options for the flux includes:

   -@ zero         <type>
   -@ flat         <type>  <value>
   -@ powerlaw     <type>  <normalisation>  <spectral index>
   -@ atmospheric  <type>
Author
bjung

Definition in file JFluxMultiParticle.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file JFluxMultiParticle.cc.

56 {
57  using namespace std;
58  using namespace JPP;
59 
60  JMultipleFileScanner_t inputFiles;
61 
62  vector<int> zeroFluxes;
63  JFluxMap fluxMap;
64 
65  int debug;
66 
67  try {
68 
69  JParser<> zap;
70 
71  zap['f'] = make_field(inputFiles);
72  zap['@'] = make_field(fluxMap)
74  zap['d'] = make_field(debug)
75  = 1;
76 
77  zap(argc, argv);
78  }
79  catch(const exception& error) {
80  FATAL(error.what() << endl);
81  }
82 
83 
84  // Set event weighter
85 
86  JEvtWeightFileScannerSet<> scanners(inputFiles);
87 
88  if (scanners.setFlux(fluxMap) == 0) {
89  WARNING("No file found containing all given primaries; Flux function not set." << endl);
90  }
91 
92 
93  // Scan events
94 
95  for (JEvtWeightFileScannerSet<>::iterator scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
96 
97  if (scanner->simul.size() > 0) {
98  STATUS("Scanning " << scanner->simul[0].program << " files..." << endl);
99  }
100 
101  STATUS(LEFT(15) << "event" << RIGHT(15) << "weight" << endl);
102 
103  while (scanner->hasNext()) {
104 
105  const Evt* event = scanner->next();
106  const double weight = scanner->getWeight(*event);
107 
108  STATUS(LEFT (15) << scanner->getCounter() <<
109  SCIENTIFIC(15, 3) << weight << '\r'); DEBUG(endl);
110  }
111  }
112 
113  return 0;
114 }
Utility class to parse command line options.
Definition: JParser.hh:1711
#define WARNING(A)
Definition: JMessage.hh:65
#define STATUS(A)
Definition: JMessage.hh:63
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:84
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Auxiliary class for parsing multiparticle fluxes.
#define FATAL(A)
Definition: JMessage.hh:67
Auxiliary base class for list of file names.
std::vector< filescanner_type >::iterator iterator
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486
int debug
debug level
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62