Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecalib
dunecalib
Calib
getLinConstsProtoDUNE.cc
Go to the documentation of this file.
1
#include "
dunecalib/Calib/LinCalibProtoDUNE.h
"
2
3
#include "nuevdb/IFDatabase/Table.h"
4
#include <getopt.h>
5
#include <iostream>
6
7
int
gRun
= -1;
8
std::string
gDataType
=
"data"
;
9
std::string
gCSVFile
=
""
;
10
11
//------------------------------------------------------------
12
13
void
PrintUsage
()
14
{
15
std::cout <<
"Usage: getLinConstsProtoDUNE -r|--run [run number] -d|--datatype [data|mc] -f|--file [csv file] "
<<
std::endl
;
16
}
17
18
//------------------------------------------------------------
19
20
bool
ParseCLArgs
(
int
argc,
char
*
argv
[])
21
{
22
23
struct
option long_options[] = {
24
{
"help"
, 0, 0,
'h'
},
25
{
"run"
, 0, 0,
'r'
},
26
{
"datatype"
, 0, 0,
'd'
},
27
{
"file"
, 0, 0,
'f'
},
28
{0,0,0,0}
29
};
30
31
while
(1) {
32
int
optindx;
33
34
int
c
= getopt_long(argc,argv,
"hr:d:f:"
,long_options,&optindx);
35
36
if
(c==-1)
break
;
37
38
switch
(c) {
39
case
'r'
:
40
{
41
int
run
= atoi(optarg);
42
if
(run < 0) {
43
std::cout <<
"Invalid run number."
<<
std::endl
;
44
exit(0);
45
}
46
gRun
=
run
;
47
break
;
48
}
49
case
'd'
:
50
{
51
gDataType
= optarg;
52
break
;
53
}
54
case
'f'
:
55
{
56
gCSVFile
= optarg;
57
break
;
58
}
59
case
'h'
:
60
default
:
61
{
62
return
false
;
63
}
64
}
65
}
66
67
if
(
gRun
<0)
68
return
false
;
69
70
if
(
gDataType
!=
"mc"
&&
gDataType
!=
"data"
)
71
return
false
;
72
73
return
true
;
74
}
75
76
//------------------------------------------------------------
77
78
int
main
(
int
argc,
char
**
argv
)
79
{
80
if
(!
ParseCLArgs
(argc,argv)) {
81
PrintUsage
();
82
return
1;
83
}
84
85
calib::LinCalibProtoDUNE
* linCalib =
new
calib::LinCalibProtoDUNE
();
86
87
linCalib->
SetIsMC
((
gDataType
==
"mc"
));
88
linCalib->
SetUseCondb
(
true
);
89
if
(!
gCSVFile
.empty())
90
linCalib->
SetCSVFileName
(
gCSVFile
);
91
92
linCalib->
Update
(
gRun
);
93
94
calib::LinConsts_t
lc = linCalib->
GetLinConsts
(100);
95
std::cout <<
"Linearity constants correction for channel 100:"
96
<<
std::endl
;
97
std::cout <<
"\tGain = "
<< lc.
gain
98
<<
"\n\tOffset = "
<< lc.
offset
<<
std::endl
;
99
100
delete
linCalib;
101
102
return
0;
103
}
104
gRun
int gRun
Definition:
getLinConstsProtoDUNE.cc:7
gCSVFile
std::string gCSVFile
Definition:
getLinConstsProtoDUNE.cc:9
calib::LinConsts_t
Definition:
LinCalibProtoDUNE.h:31
string
std::string string
Definition:
nybbler.cc:12
calib::LinCalibProtoDUNE::SetUseCondb
void SetUseCondb(bool v)
Definition:
LinCalibProtoDUNE.h:58
PrintUsage
void PrintUsage()
Definition:
getLinConstsProtoDUNE.cc:13
calib::LinCalibProtoDUNE::Update
bool Update(uint64_t ts=0)
Definition:
LinCalibProtoDUNE.cxx:63
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
filelisting.run
int run
Definition:
filelisting.py:13
calib::LinCalibProtoDUNE::SetIsMC
void SetIsMC(bool v)
Definition:
LinCalibProtoDUNE.h:56
calib::LinConsts_t::offset
float offset
Definition:
LinCalibProtoDUNE.h:34
calib::LinConsts_t::gain
float gain
Definition:
LinCalibProtoDUNE.h:33
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:57
calib::LinCalibProtoDUNE
Definition:
LinCalibProtoDUNE.h:42
LinCalibProtoDUNE.h
gDataType
std::string gDataType
Definition:
getLinConstsProtoDUNE.cc:8
calib::LinCalibProtoDUNE::GetLinConsts
LinConsts_t GetLinConsts(int chanId)
Definition:
LinCalibProtoDUNE.cxx:78
calib::LinCalibProtoDUNE::SetCSVFileName
void SetCSVFileName(std::string f)
Definition:
LinCalibProtoDUNE.h:59
ParseCLArgs
bool ParseCLArgs(int argc, char *argv[])
Definition:
getLinConstsProtoDUNE.cc:20
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
main
int main(int argc, char **argv)
Definition:
getLinConstsProtoDUNE.cc:78
Generated by
1.8.11