14 std::string bareOwner, extraLabel;
15 GetLabel().GetBareOwnerAndExtraLabel(bareOwner,extraLabel);
16 if (extraLabel==
"") extraLabel=
"None";
18 const int dataset = GetDataset();
19 const int run = GetRun();
22 std::string validity_kind;
28 validity_kind =
"'data_set'";
29 validity_start = dataset;
30 validity_end = dataset;
35 validity_kind =
"'run'";
41 err.SetDescription(__FILE__,__LINE__,
"Must provide run (SetRun()), or DataSet (SetDataSet()))");
45 std::vector<int> sruns;
46 std::vector<double> avgpulse;
51 std::stringstream squery;
52 squery<<
"select average_pulse from average_pulses where ap_algo = '"<<bareOwner
53 <<
"' and ap_version = '"<<GetVersion()
54 <<
"' and ap_extralabel = '"<<extraLabel
55 <<
"' and channel = "<< GetChannel()
56 <<
" and validity_kind = "<<validity_kind
57 <<
" and validity_start = "<<validity_start
58 <<
" and validity_end = "<<validity_end;
64 catch(
const QError& cerr) {
71 av.Resize(avgpulse.size());
72 for(
size_t i=0; i<avgpulse.size(); i++)
80 squery<<
"select source_runs from average_pulses where ap_algo = '"<<bareOwner
81 <<
"' and ap_version= '"<<GetVersion()
82 <<
"' and ap_extralabel= '"<<extraLabel
83 <<
"' and channel= "<< GetChannel()
84 <<
" and validity_kind= "<<validity_kind
85 <<
" and validity_start= "<<validity_start
86 <<
" and validity_end= "<<validity_end;
92 catch(
const QError& cerr) {
99 for(
size_t i=0; i<sruns.size(); i++)
107 squery<<
"select num_events from average_pulses where ap_algo = '"<<bareOwner
108 <<
"' and ap_version= '"<<GetVersion()
109 <<
"' and ap_extralabel= '"<<extraLabel
110 <<
"' and channel= "<< GetChannel()
111 <<
" and validity_kind= "<<validity_kind
112 <<
" and validity_start= "<<validity_start
113 <<
" and validity_end= "<<validity_end;
119 catch(
const QError& cerr) {
138 std::string bareOwner, extraLabel;
139 GetLabel().GetBareOwnerAndExtraLabel(bareOwner,extraLabel);
140 if (extraLabel==
"") extraLabel=
"None";
142 const int dataset = GetDataset();
143 const int run = GetRun();
145 std::string validity_kind;
152 validity_kind =
"'data_set'";
153 validity_start = dataset;
154 validity_end = dataset;
159 validity_kind =
"'run'";
160 validity_start = run;
165 err.SetDescription(__FILE__,__LINE__,
"Must provide run (SetRun()), or DataSet (SetDataSet()))");
170 std::stringstream list_run;
185 std::stringstream list_av ;
188 for(
size_t i=0; i<av.Size(); i++)
191 list_av<<av[i]<<
"}'";;
201 fields.push_back((std::string)
"ap_algo"); values.push_back(
"'"+bareOwner+
"'");
202 fields.push_back((std::string)
"ap_version"); values.push_back(
"'"+GetVersion()+
"'");
203 fields.push_back((std::string)
"ap_extralabel"); values.push_back(
"'"+extraLabel+
"'");
204 fields.push_back((std::string)
"channel"); values.push_back(GetChannel());
205 fields.push_back((std::string)
"validity_kind"); values.push_back(validity_kind);
206 fields.push_back((std::string)
"validity_start");values.push_back(validity_start);
207 fields.push_back((std::string)
"validity_end"); values.push_back(validity_end);
208 fields.push_back((std::string)
"source_runs"); values.push_back(list_run.str());
209 fields.push_back((std::string)
"average_pulse"); values.push_back(list_av.str());
210 fields.push_back((std::string)
"num_events"); values.push_back(av.
GetNumEvents());
214 db->
Insert(
"average_pulses",fields,values);
219 catch(
const QError& cerr) {
dm Get("DAQ",&rHandle,"DB")
std::vector< int > & GetSourceRuns()
Get the list of source runs.
int GetNumEvents() const
Get the number of events in the average.
void SetNumEvents(int nEvents)
Set the number of events in the average.
void Clear()
Clear the attributes.
std::vector< double > DoQueryVectorDouble(const std::string &query)
std::vector< int > DoQueryVectorInt(const std::string &query)
int DoQueryInt(const std::string &query)
int Insert(const std::string &tableName, const column &fields, const column &values)
error class with error type and description
std::vector< QVdt > QVdt_vector
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...