Newer
Older
/** \class THcRunParameters
\ingroup Base
\brief Get the run parameters from the parameter database
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
so that db_run.dat is not needed in hcana.
\author S. A. Wood 15-June-2017
*/
#include "THcRunParameters.h"
#include "THaAnalysisObject.h"
#include "TMath.h"
#include "THcParmList.h"
#include "THcGlobals.h"
#include <iostream>
/*#include "TDatime.h"
#include "TError.h"
#include "TMath.h"
#include "THaEvData.h"
#include <iostream>
*/
using namespace std;
//_____________________________________________________________________________
THcRunParameters::THcRunParameters() : THaRunParameters()
{
// Default constructor
}
//_____________________________________________________________________________
THcRunParameters::~THcRunParameters()
{
// Destructor
}
Int_t THcRunParameters::ReadDatabase( const TDatime& date )
{
// Query the run database for the beam and target parameters
// The date/time is ignored as it is assumed that run number
// parameter lookup has already occured.
// Return 0 if success, <0 if file error, >0 if not all required data found.
Double_t P, E, M = 0.511e-3, Q = -1.0, dE = 0.0;
DBRequest request[] = {
{ "gpbeam", &P },
{ "mbeam", &M, kDouble, 0, 1 },
{ "qbeam", &Q, kDouble, 0, 1 },
{ "dEbeam", &dE, kDouble, 0, 1 },
{ 0 }
};
gHcParms->LoadParmValues((DBRequest*)&request, "");
E = TMath::Sqrt(P*P+M*M);
Int_t iq = int(Q);
SetBeam( E, M, iq, dE );
return 0;
}
ClassImp(THcRunParameters)