Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPMTParametersMap.cc File Reference

Example program to create PMT parameters map. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JPMTParametersMap.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

Example program to create PMT parameters map.

Author
mdejong

Definition in file JPMTParametersMap.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 20 of file JPMTParametersMap.cc.

21{
22 using namespace std;
23 using namespace JPP;
24
25 string detectorFile;
26 int debug;
27 JPMTParametersMap parameters;
28
29 try {
30
31 JParser<> zap("Example program to create PMT parameters map.");
32
33 zap['a'] = make_field(detectorFile) = "";
34 zap['P'] = make_field(parameters) = JPARSER::initialised();
35 zap['d'] = make_field(debug) = 0;
36
37 zap(argc, argv);
38 }
39 catch(const exception &error) {
40 FATAL(error.what() << endl);
41 }
42
43
44 if (detectorFile != "") {
45
47
48 try {
49 load(detectorFile, detector);
50 }
51 catch(const JException& error) {
52 FATAL(error);
53 }
54
55 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
56
57 for (unsigned int pmt = 0; pmt != module->size(); ++pmt) {
58
59 const JPMTIdentifier id(module->getID(), pmt);
60
61 parameters[id] = parameters.getDefaultPMTParameters();
62 }
63 }
64 }
65
66 cout << parameters;
67}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Detector data structure.
Definition JDetector.hh:96
Auxiliary class for map of PMT parameters.
const JPMTParameters & getDefaultPMTParameters() const
Get default PMT parameters.
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
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