Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getAAnetFiles.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <map>
6 
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 
Utility class to parse command line options.
Definition: JParser.hh:1493
ROOT TTree parameter settings.
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, const JHead &header, const bool option=false)
Get list of files compatible with geven header.
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
Match header for genie.
Definition: JHeadToolkit.hh:61
Match header for Corsika.
Match header for genhen.
Definition: JHeadToolkit.hh:42
Match header for km3.
Match header for DAQ.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
Match header for JSirene.cc.
Definition: JHeadToolkit.hh:99
int debug
debug level
Definition: JSirene.cc:61
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
General purpose messaging.
Monte Carlo run header.
Definition: JHead.hh:836
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition: JParser.hh:69
Auxiliary base class for list of file names.
Utility class to parse command line options.
Match header for MUPAGE.
Definition: JHeadToolkit.hh:24
Match header for km3.
std::vector< double > weight
Definition: JAlgorithm.hh:428
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
int main(int argc, char *argv[])
Definition: Main.cpp:15