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> avgnoise;
51 std::stringstream squery;
52 squery<<
"select noise_power_spectrum from noise_power_spectra where nps_algo = '"<<bareOwner
53 <<
"' and nps_version= '"<<GetVersion()
54 <<
"' and nps_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 for(
size_t i=0; i<avgnoise.size(); i++)
73 av.Append(avgnoise[i]);
79 squery<<
"select source_runs from noise_power_spectra where nps_algo = '"<<bareOwner
80 <<
"' and nps_version= '"<<GetVersion()
81 <<
"' and nps_extralabel= '"<<extraLabel
82 <<
"' and channel= "<< GetChannel()
83 <<
" and validity_kind= "<<validity_kind
84 <<
" and validity_start= "<<validity_start
85 <<
" and validity_end= "<<validity_end;
91 catch(
const QError& cerr) {
98 for(
size_t i=0; i<sruns.size(); i++)
106 squery<<
"select num_events from noise_power_spectra where nps_algo = '"<<bareOwner
107 <<
"' and nps_version= '"<<GetVersion()
108 <<
"' and nps_extralabel= '"<<extraLabel
109 <<
"' and channel= "<< GetChannel()
110 <<
" and validity_kind= "<<validity_kind
111 <<
" and validity_start= "<<validity_start
112 <<
" and validity_end= "<<validity_end;
118 catch(
const QError& cerr) {
136 std::string bareOwner, extraLabel;
137 GetLabel().GetBareOwnerAndExtraLabel(bareOwner,extraLabel);
138 if (extraLabel==
"") extraLabel=
"None";
140 const int dataset = GetDataset();
141 const int run = GetRun();
143 std::string validity_kind;
150 validity_kind =
"'data_set'";
151 validity_start = dataset;
152 validity_end = dataset;
157 validity_kind =
"'run'";
158 validity_start = run;
163 err.SetDescription(__FILE__,__LINE__,
"Must provide run (SetRun()), or DataSet (SetDataSet()))");
171 std::stringstream list_run;
186 std::stringstream list_av ;
189 for(
size_t i=0; i<av.Size(); i++)
192 list_av<<av[i]<<
"}'";;
203 std::stringstream squery;
204 fields.push_back((std::string)
"nps_algo"); values.push_back(
"'"+bareOwner+
"'");
205 fields.push_back((std::string)
"nps_version"); values.push_back(
"'"+GetVersion()+
"'");
206 fields.push_back((std::string)
"nps_extralabel"); values.push_back(
"'"+extraLabel+
"'");
207 fields.push_back((std::string)
"channel"); values.push_back(GetChannel());
208 fields.push_back((std::string)
"validity_kind"); values.push_back(validity_kind);
209 fields.push_back((std::string)
"validity_start"); values.push_back(validity_start);
210 fields.push_back((std::string)
"validity_end"); values.push_back(validity_end);
211 fields.push_back((std::string)
"source_runs"); values.push_back(list_run.str());
212 fields.push_back((std::string)
"noise_power_spectrum"); values.push_back(list_av.str());
213 fields.push_back((std::string)
"num_events"); values.push_back(av.
GetNumEvents());
217 db->
Insert(
"noise_power_spectra",fields,values);
220 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...