Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecalib
dunecalib
Calib
getXYZCalibProtoDUNE.cc
Go to the documentation of this file.
1
#include "
dunecalib/Calib/XYZCalibProtoDUNE.h
"
2
3
#include "nuevdb/IFDatabase/Table.h"
4
#include <getopt.h>
5
#include <iostream>
6
7
int
gRun
= -1;
8
std::string
gDataType
=
"mc"
;
9
std::string
gXCorrFile
=
""
;
10
std::string
gYZCorrFile
=
""
;
11
12
//------------------------------------------------------------
13
14
void
PrintUsage
()
15
{
16
std::cout <<
"Usage: getXYZCalibProtoDUNE -r|--run [run number] -d|--datatype [data|mc] -x|--xcorr [xcorr csv file] -y|--yzcorr [yzcorr csv file]"
<<
std::endl
;
17
}
18
19
//------------------------------------------------------------
20
21
bool
ParseCLArgs
(
int
argc,
char
*
argv
[])
22
{
23
24
struct
option long_options[] = {
25
{
"help"
, 0, 0,
'h'
},
26
{
"run"
, 0, 0,
'r'
},
27
{
"datatype"
, 0, 0,
'd'
},
28
{
"xcorr"
, 0, 0,
'x'
},
29
{
"yzcorr"
, 0, 0,
'y'
},
30
{0,0,0,0}
31
};
32
33
while
(1) {
34
int
optindx;
35
36
int
c
= getopt_long(argc,argv,
"r:d:x:y:"
,long_options,&optindx);
37
38
if
(c==-1)
break
;
39
40
switch
(c) {
41
case
'r'
:
42
{
43
int
run
= atoi(optarg);
44
if
(run < 0) {
45
std::cout <<
"Invalid run number."
<<
std::endl
;
46
exit(0);
47
}
48
gRun
=
run
;
49
break
;
50
}
51
case
'd'
:
52
{
53
gDataType
= optarg;
54
break
;
55
}
56
case
'x'
:
57
{
58
gXCorrFile
= optarg;
59
break
;
60
}
61
case
'y'
:
62
{
63
gYZCorrFile
= optarg;
64
break
;
65
}
66
default
:
67
break
;
68
}
69
}
70
71
if
(
gRun
<0)
72
return
false
;
73
74
if
(
gDataType
!=
"mc"
&&
gDataType
!=
"data"
)
75
return
false
;
76
77
return
true
;
78
}
79
80
//------------------------------------------------------------
81
82
int
main
(
int
argc,
char
**
argv
)
83
{
84
if
(!
ParseCLArgs
(argc,argv)) {
85
PrintUsage
();
86
return
1;
87
}
88
89
calib::XYZCalibProtoDUNE
* xyzCalib =
new
calib::XYZCalibProtoDUNE
();
90
91
xyzCalib->
SetIsMC
((
gDataType
==
"mc"
));
92
xyzCalib->
SetUseCondb
(
true
);
93
if
(!
gXCorrFile
.empty())
94
xyzCalib->
SetXCorrFileName
(
gXCorrFile
);
95
if
(!
gYZCorrFile
.empty())
96
xyzCalib->
SetYZCorrFileName
(
gYZCorrFile
);
97
98
xyzCalib->
Update
(
gRun
);
99
100
for
(
int
ip=0; ip<3; ++ip) {
101
std::cout <<
"Norm correction for plane "
<< ip <<
" = "
102
<< xyzCalib->
GetNormCorr
(ip) <<
std::endl
;
103
for
(
double
x
=-300.;
x
<=300.;
x
+=50.)
104
std::cout <<
"xCorr("
<<
x
<<
") = "
<< xyzCalib->
GetXCorr
(ip,
x
) <<
std::endl
;
105
106
for
(
double
y
=50.;
y
<=600.;
y
+= 100.)
107
for
(
double
z
=50.;
z
<=600.;
z
+= 100.)
108
std::cout <<
"yzCorr(0,"
<<
y
<<
","
<<
z
<<
") = "
109
<< xyzCalib->
GetYZCorr
(ip,0,
y
,
z
) <<
std::endl
;
110
}
111
112
delete
xyzCalib;
113
114
return
0;
115
}
116
calib::XYZCalibProtoDUNE::SetUseCondb
void SetUseCondb(bool v)
Definition:
XYZCalibProtoDUNE.h:84
calib::XYZCalibProtoDUNE::Update
bool Update(uint64_t ts=0)
Definition:
XYZCalibProtoDUNE.cxx:83
calib::XYZCalibProtoDUNE::SetIsMC
void SetIsMC(bool v)
Definition:
XYZCalibProtoDUNE.h:80
calib::XYZCalibProtoDUNE::GetNormCorr
virtual double GetNormCorr(int plane) override
Definition:
XYZCalibProtoDUNE.cxx:108
string
std::string string
Definition:
nybbler.cc:12
gXCorrFile
std::string gXCorrFile
Definition:
getXYZCalibProtoDUNE.cc:9
ParseCLArgs
bool ParseCLArgs(int argc, char *argv[])
Definition:
getXYZCalibProtoDUNE.cc:21
PrintUsage
void PrintUsage()
Definition:
getXYZCalibProtoDUNE.cc:14
calib::XYZCalibProtoDUNE::SetYZCorrFileName
void SetYZCorrFileName(std::string f)
Definition:
XYZCalibProtoDUNE.h:86
gRun
int gRun
Definition:
getXYZCalibProtoDUNE.cc:7
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
filelisting.run
int run
Definition:
filelisting.py:13
calib::XYZCalibProtoDUNE::GetYZCorr
virtual double GetYZCorr(int plane, int side, double y, double z) override
Definition:
XYZCalibProtoDUNE.cxx:140
makePolycone.z
z
Definition:
makePolycone.py:153
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:57
wirecell.validate.cmaps.y
y
Definition:
cmaps.py:73
gYZCorrFile
std::string gYZCorrFile
Definition:
getXYZCalibProtoDUNE.cc:10
calib::XYZCalibProtoDUNE::SetXCorrFileName
void SetXCorrFileName(std::string f)
Definition:
XYZCalibProtoDUNE.h:85
calib::XYZCalibProtoDUNE
Definition:
XYZCalibProtoDUNE.h:64
train.x
list x
Definition:
train.py:276
calib::XYZCalibProtoDUNE::GetXCorr
virtual double GetXCorr(int plane, double x) override
Definition:
XYZCalibProtoDUNE.cxx:121
main
int main(int argc, char **argv)
Definition:
getXYZCalibProtoDUNE.cc:82
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
XYZCalibProtoDUNE.h
gDataType
std::string gDataType
Definition:
getXYZCalibProtoDUNE.cc:8
Generated by
1.8.11