Jpp  19.1.0-rc.1
the software that should make you happy
Functions
software/JDetector/JModule.cc File Reference

Auxiliary program to generate detector file with set of modules. More...

#include <string>
#include <iostream>
#include <set>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JDetectorSupportkit.hh"
#include "JGeometry3D/JPosition3D.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JeepToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to generate detector file with set of modules.

Author
mdejong

Definition in file software/JDetector/JModule.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file software/JDetector/JModule.cc.

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
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Data structure for detector header.
Detector data structure.
Definition: JDetector.hh:96
Logical location of module.
Definition: JLocation.hh:39
void setLocation(const JLocation &location)
Set location.
Definition: JLocation.hh:91
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:1714
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
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:84
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72