Jpp
18.0.0
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JDB
JTDC.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <fstream>
4
#include <vector>
5
6
#include "
JDB/JDB.hh
"
7
#include "
JDB/JSelector.hh
"
8
#include "
JDB/JSelectorSupportkit.hh
"
9
#include "
JDB/JDBToolkit.hh
"
10
#include "
JDB/JDetectorIntegration.hh
"
11
#include "
JDB/JPMTHV.hh
"
12
13
#include "
JDetector/JPMTIdentifier.hh
"
14
15
#include "
Jeep/JPrint.hh
"
16
#include "
Jeep/JParser.hh
"
17
#include "
Jeep/JMessage.hh
"
18
19
20
/**
21
* \file
22
* Auxiliary program to determine TDC constraints (input to JFitK40.cc) according HV settings from the database.
23
* \author mdejong
24
*/
25
int
main
(
const
int
argc,
const
char
*
const
argv[])
26
{
27
using namespace
std;
28
using namespace
JPP;
29
30
typedef
pair<int, int>
run_type;
31
32
JServer server;
33
string
usr;
34
string
pwd;
35
string
cookie;
36
string
detid;
37
run_type runs;
38
string
outputFile
;
39
bool
usePMTID;
// option for old data for which correction for PMT cable swaps does not apply
40
int
debug
;
41
42
try
{
43
44
JParser<>
zap(
"Auxiliary program to determine TDC constraints (input to JFitK40.cc) according HV settings from the database."
);
45
46
zap[
's'
] =
make_field
(server) =
getServernames
();
47
zap[
'u'
] =
make_field
(usr) =
""
;
48
zap[
'!'
] =
make_field
(pwd) =
""
;
49
zap[
'C'
] =
make_field
(cookie) =
""
;
50
zap[
'D'
] =
make_field
(detid,
"Detector identifier"
);
51
zap[
'r'
] =
make_field
(runs,
"Pair of data taking runs"
);
52
zap[
'o'
] =
make_field
(
outputFile
,
"TDC file"
) =
""
;
53
zap[
'U'
] =
make_field
(usePMTID);
54
zap[
'd'
] =
make_field
(
debug
) = 1;
55
56
zap(argc, argv);
57
}
58
catch
(
const
exception& error) {
59
FATAL
(error.what() << endl);
60
}
61
62
63
try
{
64
65
JDB::reset
(usr, pwd, cookie);
66
67
const
int
ID
= getDetector<int> (detid);
68
detid = getDetector<string>(detid);
69
70
typedef
vector<JDetectorIntegration>
detector_type;
71
72
detector_type
detector
;
73
74
{
75
ResultSet& rs =
getResultSet
(getTable<JDetectorIntegration>(), getSelector<JDetectorIntegration>(ID));
76
77
for
(JDetectorIntegration
parameters
; rs >>
parameters
; ) {
78
detector.push_back(parameters);
79
}
80
81
rs.Close();
82
}
83
84
const
JPMTHV pmt_hv[] = {
85
JPMTHV(ID, runs.first),
86
JPMTHV(ID, runs.second)
87
};
88
89
filebuf buffer;
90
91
if
(
outputFile
!=
""
) {
92
buffer.open(
outputFile
.c_str(), ios::out);
93
}
94
95
ostream os(buffer.is_open() ? &buffer : cout.rdbuf());
96
97
for
(detector_type::const_iterator
i
= detector.begin();
i
!= detector.end(); ++
i
) {
98
if
(
i
->PMTUPI.getPBS() ==
PBS::PMT
) {
99
if
(pmt_hv[0](
i
->PMTUPI).value == pmt_hv[1](
i
->PMTUPI).value) {
100
if
(usePMTID)
101
os << setw(10) <<
i
->DOMID <<
' '
<< setw(2) <<
i
->PMTID << endl;
102
else
103
os << setw(10) <<
i
->DOMID <<
' '
<< setw(2) <<
i
->CABLEPOS << endl;
104
}
105
}
106
}
107
108
buffer.close();
109
}
110
catch
(
const
exception& error) {
111
FATAL
(error.what() << endl);
112
}
113
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
i
then rm i
Definition:
JEvtReweightGSeaGenParameterScan.sh:337
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
std::pair
Definition:
JSTDTypes.hh:15
JDATABASE::PBS::PMT
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
std::vector
Definition:
JSTDTypes.hh:12
JDBToolkit.hh
JSelector.hh
JPrint.hh
I/O formatting auxiliaries.
ID
Definition:
raw_data_converter.cpp:43
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JDetectorIntegration.hh
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JPMTHV.hh
JTOOLS::reset
void reset(T &value)
Reset value.
Definition:
JToolsToolkit.hh:219
JParser.hh
Utility class to parse command line options.
JDATABASE::getResultSet
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition:
JDB.hh:436
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:106
JPMTIdentifier.hh
detector
do set_variable DETECTOR_TXT $WORKDIR detector
Definition:
detector-XY:fit1d.sh:38
JSelectorSupportkit.hh
JDB.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5