Jpp
getAAnetFiles.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <map>
6 
7 #include "evt/Head.hh"
8 #include "JLang/JVectorize.hh"
9 #include "JAAnet/JHead.hh"
10 #include "JAAnet/JHeadToolkit.hh"
13 #include "JSupport/JSupport.hh"
14 #include "Jeep/JParser.hh"
15 #include "Jeep/JMessage.hh"
16 
17 namespace {
18 
19  using JAANET::JHead;
20 
21  struct JWeight_t :
22  public std::map<std::string, JHead>
23  {
24  /**
25  * Default constructor.
26  */
27  JWeight_t()
28  {
29  using namespace JPP;
30 
31  (*this)["MUPAGE"] = getMUPAGEHeader();
32  (*this)["GENHEN"] = getGenhenHeader();
33  (*this)["GENIE"] = getGenieHeader();
34  (*this)["SIRENE"] = getSireneHeader();
35  (*this)["KM3"] = getKM3Header();
36  (*this)["KM3SIM"] = getKM3SimHeader();
37  (*this)["CORSIKA_P"] = getCorsikaHeader( 0,14); // proton is single nucleon
38  (*this)["CORSIKA_HE"] = getCorsikaHeader( 4, 2);
39  (*this)["CORSIKA_C"] = getCorsikaHeader(12, 6);
40  (*this)["CORSIKA_0"] = getCorsikaHeader(16, 8);
41  (*this)["CORSIKA_FE"] = getCorsikaHeader(56,26);
42  (*this)["DAQ"] = getDAQHeader();
43  }
44  };
45 }
46 
47 
48 /**
49  * \file
50  * Auxiliary program to select Monte Carlo files according generator.
51  *
52  * \author mdejong
53  */
54 int main(int argc, char **argv)
55 {
56  using namespace std;
57  using namespace JPP;
58 
59  JWeight_t weight;
60 
61  JMultipleFileScanner_t inputFile;
62  string header;
63  bool option;
64  int debug;
65 
66  try {
67 
68  JParser<> zap("Auxiliary program to select Monte Carlo files according generator.");
69 
70  zap['f'] = make_field(inputFile);
71  zap['H'] = make_field(header) = get_keys(weight);
72  zap['O'] = make_field(option);
73  zap['d'] = make_field(debug) = 1;
74 
75  zap['H'] = JPARSER::not_initialised();
76 
77  zap(argc, argv);
78  }
79  catch(const exception &error) {
80  FATAL(error.what() << endl);
81  }
82 
83  DEBUG(weight[header]);
84 
85  cout << getAAnetFiles(inputFile, weight[header], option);
86 }
87 
JMessage.hh
JHead.hh
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
main
int main(int argc, char **argv)
Definition: getAAnetFiles.cc:54
JAANET::JHead
Monte Carlo run header.
Definition: JHead.hh:839
JHeadToolkit.hh
JSupport.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JMultipleFileScanner.hh
std::map
Definition: JSTDTypes.hh:16
JParser.hh
JVectorize.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
JMonteCarloFileSupportkit.hh
JLANG::get_keys
const std::vector< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
Definition: JVectorize.hh:141
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JPARSER::not_initialised
Empty structure for specification of parser element that is not initialised (i.e.
Definition: JParser.hh:69
JSUPPORT::getAAnetFiles
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, const JHead &header, const bool option=false)
Get list of files compatible with geven header.
Definition: JMonteCarloFileSupportkit.hh:441