Jpp  16.0.1
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"
9 #include "JSupport/JMeta.hh"
10 
11 #include "Jeep/JeepToolkit.hh"
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 /**
16  * \file
17  *
18  * Auxiliary program to generate detector file with set of modules.
19  *
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25  using namespace JPP;
26 
27  string outputFile;
28  int detectorID;
29  string variant;
30  set<int> moduleID;
31  JPosition3D pos;
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Auxiliary program to generate detector files.");
37 
38  zap['o'] = make_field(outputFile, "detector file");
39  zap['D'] = make_field(detectorID, "detector identifier") = 1001;
40  zap['V'] = make_field(variant, "detector version") = getDetectorVersions<string>();
41  zap['M'] = make_field(moduleID, "list of module identifiers") = JPARSER::initialised();
42  zap['P'] = make_field(pos, "position of module(s)") = JPosition3D(0.0, 0.0, 0.0);
43  zap['d'] = make_field(debug) = 0;
44 
45  zap(argc, argv);
46  }
47  catch(const exception &error) {
48  FATAL(error.what() << endl);
49  }
50 
51 
52  JDetector detector(detectorID, variant, JDetectorHeader());
53 
54  detector.comment.add(JMeta(argc,argv));
55 
56  for (const auto id : moduleID) {
57 
58  JModule module = getModule<JKM3NeT_t>(id);
59 
60  module.set(pos);
61 
62  detector.push_back(module);
63  }
64 
65  try {
66  store(outputFile, detector);
67  }
68  catch(const JException& error) {
69  FATAL(error);
70  }
71 
72  return 0;
73 }
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
Data structure for a composite optical module.
Definition: JModule.hh:68
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.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
JComment & add(const std::string &comment)
Add comment.
Definition: JComment.hh:100
do set_variable DETECTOR_TXT $WORKDIR detector
JModule & set(const JVector3D &pos)
Set position.
Definition: JModule.hh:408