Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
software/JDetector/JModule.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <set>
4 
5 #include "JDetector/JDetector.hh"
8 #include "JSupport/JMeta.hh"
9 
10 #include "Jeep/JeepToolkit.hh"
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 /**
15  * \file
16  *
17  * Auxiliary program to generate detector file with set of modules.
18  *
19  * \author mdejong
20  */
21 int main(int argc, char **argv)
22 {
23  using namespace std;
24  using namespace JPP;
25 
26  string outputFile;
27  int detectorID;
28  string variant;
29  set<int> moduleID;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Auxiliary program to generate detector files.");
35 
36  zap['o'] = make_field(outputFile, "detector file");
37  zap['D'] = make_field(detectorID, "detector identifier") = 1001;
38  zap['V'] = make_field(variant, "detector version") = getDetectorVersions<string>();
39  zap['M'] = make_field(moduleID, "list of module identifiers") = JPARSER::initialised();
40  zap['d'] = make_field(debug) = 0;
41 
42  zap(argc, argv);
43  }
44  catch(const exception &error) {
45  FATAL(error.what() << endl);
46  }
47 
48 
49  JDetector detector(detectorID, variant, JDetectorHeader());
50 
51  detector.comment.add(JMeta(argc,argv));
52 
53  for (const auto id : moduleID) {
54  detector.push_back(getModule<JKM3NeT_t>(id));
55  }
56 
57  try {
58  store(outputFile, detector);
59  }
60  catch(const JException& error) {
61  FATAL(error);
62  }
63 
64  return 0;
65 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
int main(int argc, char *argv[])
Definition: Main.cc:15
Detector data structure.
Definition: JDetector.hh:89
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
string outputFile
Data structure for detector geometry and calibration.
Data structure for detector header.
Detector support kit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
Auxiliary methods for handling file names, type names and environment.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
ROOT I/O of application specific meta data.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
JComment & add(const std::string &comment)
Add comment.
Definition: JComment.hh:100
do set_variable DETECTOR_TXT $WORKDIR detector