Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JCalibrate
createPMTMap.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JDetector/JDetector.hh
"
6
#include "
JDetector/JDetectorToolkit.hh
"
7
#include "
JDetector/JModuleRouter.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
#include "
Jeep/JMessage.hh
"
11
#include "
JTrigger/JTriggerToolkit.hh
"
12
13
14
/**
15
* \file
16
*
17
* Auxiliary program to create map for reference PMTs.
18
*
19
* the option
20
* <pre>
21
* -T "s"
22
* </pre>
23
* or
24
* <pre>
25
* -T{"s1","s2"}
26
* </pre>
27
* has to be used with a vector of strings. This vector contains either the
28
* list of reference PMT identities or the keyword <tt>odd</tt>.
29
* If the keyword <tt>odd</tt> is used, all the PMTs with an odd identity are
30
* listed in the output file. The parity is calculated as following:
31
* <pre>
32
* (floor id - 1)*31 + PMT id
33
* </pre>
34
* \author acreusot
35
*/
36
37
int
main
(
int
argc,
char
**argv)
38
{
39
using namespace
std;
40
using namespace
JPP;
41
//using namespace KM3NETDAQ;
42
43
string
detectorFile;
44
string
outputFile
;
45
vector<string>
mapType;
46
int
debug
;
47
48
try
{
49
JParser<>
zap(
"Auxiliary program to create PMT map files."
);
50
zap[
'a'
] =
make_field
(detectorFile);
51
zap[
'o'
] =
make_field
(
outputFile
);
52
zap[
'T'
] =
make_field
(mapType);
53
zap[
'd'
] =
make_field
(
debug
) = 1;
54
zap(argc, argv);
55
}
56
57
catch
(
const
exception &error) {
58
FATAL
(error.what() << endl);
59
}
60
61
fstream outstr(
outputFile
.c_str(), ofstream::out);
62
JDetector
detector
;
63
try
{
64
load
(detectorFile,
detector
);
65
}
66
catch
(
const
JException
& error) {
67
FATAL
(error);
68
}
69
for
(JDetector::const_iterator module =
detector
.begin(); module !=
detector
.end(); ++module) {
70
const
int
floorId = module->getFloor();
71
const
int
domId = module->getID();
72
for
(
unsigned
int
t = 0; t < mapType.size(); ++t) {
73
if
(mapType[t] ==
"odd"
) {
74
for
(
unsigned
int
pmt = 0; pmt <
NUMBER_OF_PMTS
; ++pmt) {
75
const
int
id
= (floorId - 1)*NUMBER_OF_PMTS + pmt;
76
if
(
id
% 2 != 0) {
77
outstr << domId <<
' '
<< pmt << endl;
78
}
79
}
80
}
else
{
81
outstr << domId <<
' '
<< mapType[t] << endl;
82
}
83
}
84
}
85
outstr.close();
86
87
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
JLANG::JException
General exception.
Definition:
JException.hh:23
JDETECTOR::JDetector
Detector data structure.
Definition:
JDetector.hh:80
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JDetector.hh
Data structure for detector geometry and calibration.
std::vector
Definition:
JSTDTypes.hh:12
JAANET::detector
Detector file.
Definition:
JHead.hh:196
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JTriggerToolkit.hh
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JModuleRouter.hh
Direct access to module in detector data structure.
JDETECTOR::load
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Definition:
JDetectorToolkit.hh:440
JParser.hh
Utility class to parse command line options.
JDetectorToolkit.hh
detector
do set_variable DETECTOR_TXT $WORKDIR detector
Definition:
detector-XY:fit1d.sh:37
KM3NETDAQ::NUMBER_OF_PMTS
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition:
JDAQ.hh:26
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5