Diana Software
StabPeakHandle.C
Go to the documentation of this file.
1 void StoreOnDB(const char* input, int chan, int dataset,int run) {
2  using namespace Diana;
3  gSystem->Load("libqroot");
4 
6  dm.SetOwner("SelectStabPeak");
7 
8  QStabPeakHandle sphandle;
9  sphandle.SetChannel(chan);
10  sphandle.SetDataset(dataset);
11  sphandle.SetRun(run);
12  sphandle.SetAmpLabel("COF@Amplitude");
13  sphandle.SetAmpVersion("0");
14 
15  dm.Get("SelectStabPeak",&sphandle,input);
16 
17  if(!sphandle.IsValid()) {
18  cout<<sphandle.GetError()<<endl;
19  return;
20  }
21 
22  const QStabPeak& sp = sphandle.Get();
23  cout<<sp<<endl;
24 
25  QError err = dm.Set(&sphandle,"DB");
26  cout<<err<<endl;
27 }
28 
29 void FillFromDB(int chan, int run, int dataset)
30 {
31  using namespace Diana;
32  gSystem->Load("libqroot");
33 
35  dm.SetOwner("SelectStabPeak");
36 
37  QStabPeakHandle sphandle;
38  sphandle.SetChannel(chan);
39  sphandle.SetDataset(dataset);
40  sphandle.SetRun(run);
41 
42  QError err = dm.Get("SelectStabPeak",&sphandle,"DB");
43  cout << err << endl;
44 
45  if(!sphandle.IsValid()) {
46  cout<<sphandle.GetError()<<endl;
47  return;
48  }
49 
50  const QStabPeak& sp = sphandle.Get();
51  cout<<sp<<endl;
52 }
53 
err
Definition: CheckOF.C:114
QGlobalDataManager dm
void StoreOnDB(const char *input, int chan, int dataset, int run)
Definition: StabPeakHandle.C:1
void FillFromDB(int chan, int run, int dataset)
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...