Diana Software
NPShandle.C
Go to the documentation of this file.
1 void StoreOnDB(const char* input) {
2  using namespace Diana;
3  gSystem->Load("libqroot");
4 
6  dm.SetOwner("NoiseAvgPowerSpectrum");
7 
8  QAverageNoiseHandle anhandle(1);
9  anhandle.SetDataset(6040);
10  dm.Get("NoiseAvgPowerSpectrum",&anhandle,input);
11 
12  if(!anhandle.IsValid()) {
13  cout<<anhandle.GetError()<<endl;
14  return;
15  }
16 
17  const QAverageVector& av = anhandle.Get();
18  cout<<av<<endl;
19 
20  QError err = dm.Set(&anhandle,"DB");
21  cout<<err<<endl;
22 }
23 
24 void FillFromDB()
25 {
26  using namespace Diana;
27  gSystem->Load("libqroot");
28 
30  dm.SetOwner("NoiseAvgPowerSpectrum");
31 
32  QAverageNoiseHandle anhandle(1);
33  anhandle.SetDataset(6040);
34 
35  dm.Get("NoiseAvgPowerSpectrum",&anhandle,"DB");
36 
37  if(!anhandle.IsValid()) {
38  cout<<anhandle.GetError()<<endl;
39  return;
40  }
41 
42  const QAverageVector& av = anhandle.Get();
43  cout<<av<<endl;
44 }
err
Definition: CheckOF.C:114
QGlobalDataManager dm
void StoreOnDB(const char *input)
Definition: NPShandle.C:1
void FillFromDB()
Definition: NPShandle.C:24
global handle for average noise power spectra
average vector object
error class with error type and description
Definition: QError.hh:115
Object to manage I/O (DB, file, or memory) of diana global quantities.
void SetOwner(const std::string &owner)
set the module that is accessing this object
QError Set(GlobalHandle< Q > *gh, const std::string &outSource, bool printError=true) const
Set a QObject using a GlobalHandle.
QError Get(const std::string &owner, GlobalHandle< Q > *gh, const std::string &inSource, bool printError=true) const
Get an object using a global handle.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...