Diana Software
APhandle.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("AveragePulses");
7 
8  QAveragePulseHandle aphandle(1);
9  aphandle.SetDataset(6040);
10  dm.Get("AveragePulses",&aphandle,input);
11 
12  if(!aphandle.IsValid()) {
13  cout<<aphandle.GetError()<<endl;
14  return;
15  }
16 
17  const QAverageVector& av = aphandle.Get();
18  cout<<av<<endl;
19 
20  QError err = dm.Set(&aphandle,"DB");
21  cout<<err<<endl;
22 }
23 
24 void FillFromDB()
25 {
26  using namespace Diana;
27  gSystem->Load("libqroot");
28 
30  dm.SetOwner("AveragePulses");
31 
32  QAveragePulseHandle aphandle(1);
33  aphandle.SetDataset(6040);
34 
35  QError err = dm.Get("AveragePulses",&aphandle,"DB");
36  cout << err << endl;
37 
38  if(!aphandle.IsValid()) {
39  cout<<aphandle.GetError()<<endl;
40  return;
41  }
42 
43  const QAverageVector& av = aphandle.Get();
44  cout<<av<<endl;
45 }
void StoreOnDB(const char *input)
Definition: APhandle.C:1
void FillFromDB()
Definition: APhandle.C:24
err
Definition: CheckOF.C:114
QGlobalDataManager dm
global handle for average pulse
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...