Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunetpc
dune
RunHistory
getDUNEPedestals.cc
Go to the documentation of this file.
1
#include "
dune/RunHistory/DetPedestalDUNE.h
"
2
3
#include <getopt.h>
4
#include <iostream>
5
#include <boost/tokenizer.hpp>
6
#include <boost/lexical_cast.hpp>
7
8
bool
gUseDB
=
false
;
9
bool
gPrintPedRun
=
false
;
10
int
gRun
= -1;
11
std::string
gDetName
=
""
;
12
std::string
gCfgFile
=
""
;
13
std::vector<uint64_t>
gChannelList
{};
14
15
//------------------------------------------------------------
16
17
void
PrintUsage
()
18
{
19
std::cout <<
"Usage: RunInfo [options] -r|--run [run number] -d|--detector [detector name, eg, dune35t]"
<<
std::endl
;
20
std::cout <<
"Options:"
<<
std::endl
;
21
std::cout <<
"-f (--file) [fhicl file] : use fhicl config file"
<<
std::endl
;
22
std::cout <<
"-D (--database) : get peds from database"
<<
std::endl
;
23
std::cout <<
"-P (--pedestalRun) : print pedestal run"
<<
std::endl
;
24
std::cout <<
"-C [chan1,chan2,...] : print only specific channels"
<<
std::endl
;
25
}
26
27
//------------------------------------------------------------
28
29
bool
ParseCLArgs
(
int
argc,
char
*
argv
[])
30
{
31
32
if
(argc < 2)
return
false
;
33
34
struct
option long_options[] = {
35
{
"help"
, 0, 0,
'h'
},
36
{
"run"
, 0, 0,
'r'
},
37
{
"detector"
, 0, 0,
'd'
},
38
{
"file"
, 0, 0,
'f'
},
39
{
"database"
, 0, 0,
'D'
},
40
{
"pedestalRun"
, 0, 0,
'P'
},
41
{0,0,0,0}
42
};
43
44
while
(1) {
45
int
optindx;
46
47
int
c
= getopt_long(argc,argv,
"r:d:f:C:DPh"
,long_options,&optindx);
48
49
if
(c==-1)
break
;
50
51
switch
(c) {
52
case
'r'
:
53
{
54
int
run
= atoi(optarg);
55
if
(run < 0) {
56
std::cout <<
"Invalid run number."
<<
std::endl
;
57
exit(0);
58
}
59
gRun
=
run
;
60
break
;
61
}
62
case
'd'
:
63
{
64
gDetName
= optarg;
65
break
;
66
}
67
case
'D'
:
68
{
69
gUseDB
=
true
;
70
break
;
71
}
72
case
'P'
:
73
{
74
gPrintPedRun
=
true
;
75
break
;
76
}
77
case
'f'
:
78
{
79
gCfgFile
= optarg;
80
break
;
81
}
82
case
'h'
:
83
{
84
PrintUsage
();
85
exit(0);
86
break
;
87
}
88
case
'C'
:
89
{
90
std::vector<std::string> cList;
91
std::string
channels
= optarg;
92
boost::tokenizer< boost::escaped_list_separator<char> > tok(channels);
93
cList.assign(tok.begin(),tok.end());
94
for
(
size_t
i=0; i<cList.size(); ++i) {
95
try
{
96
gChannelList
.push_back(boost::lexical_cast<uint64_t>(cList[i]));
97
}
98
catch
(
const
boost::bad_lexical_cast &) {
99
std::cout << cList[i] <<
" does not appear to be a channel id, skipping"
100
<<
std::endl
;
101
continue
;
102
}
103
}
104
break
;
105
}
106
default
:
107
break
;
108
}
109
}
110
111
return
true
;
112
}
113
114
//------------------------------------------------------------
115
116
int
main
(
int
argc,
char
**
argv
)
117
{
118
if
(!
ParseCLArgs
(argc,argv)) {
119
PrintUsage
();
120
return
1;
121
}
122
123
dune::DetPedestalDUNE
* ped =
new
dune::DetPedestalDUNE
(
gDetName
);
124
125
/*
126
if (gCfgFile != "")
127
ped->Configure(gCfgFile);
128
*/
129
130
if
(
gUseDB
) {
131
ped->
SetUseDB
(
gUseDB
);
132
ped->
Update
(
gRun
);
133
}
134
135
if
(
gPrintPedRun
) {
136
std::cout <<
"Pedestal run: "
<< ped->
VldTimeUsed
() <<
std::endl
;
137
}
138
139
if
(
gChannelList
.empty())
140
ped->
PrintAllValues
();
141
else
{
142
for
(
size_t
i=0; i<
gChannelList
.size(); ++i)
143
std::cout <<
"Channel: "
<<
gChannelList
[i]
144
<<
", Mean = "
<< ped->
PedMean
(
gChannelList
[i])
145
<<
", RMS = "
<< ped->
PedRms
(
gChannelList
[i])
146
<<
std::endl
;
147
}
148
149
delete
ped;
150
151
return
0;
152
}
153
dune::DetPedestalDUNE::PrintAllValues
void PrintAllValues()
Definition:
DetPedestalDUNE.cxx:325
dune::DetPedestalDUNE::SetUseDB
void SetUseDB(bool f)
Definition:
DetPedestalDUNE.h:39
ValidateOpDetSimulation.channels
dictionary channels
Definition:
ValidateOpDetSimulation.py:178
string
std::string string
Definition:
nybbler.cc:12
main
int main(int argc, char **argv)
Definition:
getDUNEPedestals.cc:116
PrintUsage
void PrintUsage()
Definition:
getDUNEPedestals.cc:17
dune::DetPedestalDUNE::VldTimeUsed
uint64_t VldTimeUsed() const
Definition:
DetPedestalDUNE.h:58
gDetName
std::string gDetName
Definition:
getDUNEPedestals.cc:11
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
dune::DetPedestalDUNE
Definition:
DetPedestalDUNE.h:23
dune::DetPedestalDUNE::PedMean
virtual float PedMean(raw::ChannelID_t ch) const
Retrieve pedestal information.
Definition:
DetPedestalDUNE.cxx:236
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:53
dune::DetPedestalDUNE::PedRms
virtual float PedRms(raw::ChannelID_t ch) const
Definition:
DetPedestalDUNE.cxx:281
gPrintPedRun
bool gPrintPedRun
Definition:
getDUNEPedestals.cc:9
DetPedestalDUNE.h
gCfgFile
std::string gCfgFile
Definition:
getDUNEPedestals.cc:12
gRun
int gRun
Definition:
getDUNEPedestals.cc:10
ParseCLArgs
bool ParseCLArgs(int argc, char *argv[])
Definition:
getDUNEPedestals.cc:29
dune::DetPedestalDUNE::Update
bool Update(uint64_t ts)
Definition:
DetPedestalDUNE.cxx:94
gChannelList
std::vector< uint64_t > gChannelList
Definition:
getDUNEPedestals.cc:13
gUseDB
bool gUseDB
Definition:
getDUNEPedestals.cc:8
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
run
unsigned int run
Definition:
NearlinePlotMaker.h:56
Generated by
1.8.11