Jpp  19.1.0
the software that should make you happy
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  JLocation location;
32  JPosition3D pos;
33  int debug;
34 
35  try {
36 
37  JParser<> zap("Auxiliary program to generate detector files.");
38 
39  zap['o'] = make_field(outputFile, "detector file");
40  zap['D'] = make_field(detectorID, "detector identifier") = 1001;
41  zap['V'] = make_field(variant, "detector version") = getDetectorVersions<string>();
42  zap['M'] = make_field(moduleID, "list of module identifiers") = JPARSER::initialised();
43  zap['L'] = make_field(location, "location of module(s)") = JLocation(1, 1);
44  zap['P'] = make_field(pos, "position of module(s)") = JPosition3D(0.0, 0.0, 0.0);
45  zap['d'] = make_field(debug) = 0;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
53 
54  JDetector detector(detectorID, variant, JDetectorHeader());
55 
56  detector.comment.add(JMeta(argc,argv));
57 
58  for (const auto id : moduleID) {
59 
60  JModule module = getModule<JKM3NeT_t>(id);
61 
62  module.set(pos);
63  module.setLocation(location);
64 
65  detector.push_back(module);
66  }
67 
68  try {
70  }
71  catch(const JException& error) {
72  FATAL(error);
73  }
74 
75  return 0;
76 }
string outputFile
Detector support kit.
Data structure for detector geometry and calibration.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
ROOT I/O of application specific meta data.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Auxiliary methods for handling file names, type names and environment.
Data structure for detector header.
Detector data structure.
Definition: JDetector.hh:96
Logical location of module.
Definition: JLocation.hh:40
void setLocation(const JLocation &location)
Set location.
Definition: JLocation.hh:92
Data structure for a composite optical module.
Definition: JModule.hh:75
JModule & set(const JVector3D &pos)
Set position.
Definition: JModule.hh:407
Data structure for position in three dimensions.
Definition: JPosition3D.hh:38
General exception.
Definition: JException.hh:24
Utility class to parse command line options.
Definition: JParser.hh:1698
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
int main(int argc, char **argv)
Detector file.
Definition: JHead.hh:227
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72