Hall C ROOT/C++ Analyzer (hcana)
THcRunParameters.cxx
Go to the documentation of this file.
1 
10 #include "THcRunParameters.h"
11 #include "THaAnalysisObject.h"
12 #include "TMath.h"
13 #include "THcParmList.h"
14 #include "THcGlobals.h"
15 #include <iostream>
16 /*#include "TDatime.h"
17 #include "TError.h"
18 #include "TMath.h"
19 #include "THaEvData.h"
20 #include <iostream>
21 */
22 
23 using namespace std;
24 
25 //_____________________________________________________________________________
26 THcRunParameters::THcRunParameters() : THaRunParameters()
27 {
28  // Default constructor
29 }
30 
31 //_____________________________________________________________________________
33 {
34  // Destructor
35 }
37 {
38  // Query the run database for the beam and target parameters
39  // The date/time is ignored as it is assumed that run number
40  // parameter lookup has already occured.
41 
42  // Return 0 if success, <0 if file error, >0 if not all required data found.
43  Double_t P, E, M = 0.511e-3, Q = -1.0, dE = 0.0;
44 
45  DBRequest request[] = {
46  { "gpbeam", &P },
47  { "mbeam", &M, kDouble, 0, 1 },
48  { "qbeam", &Q, kDouble, 0, 1 },
49  { "dEbeam", &dE, kDouble, 0, 1 },
50  { 0 }
51  };
52 
53  gHcParms->LoadParmValues((DBRequest*)&request, "");
54 
55  E = TMath::Sqrt(P*P+M*M);
56  Int_t iq = int(Q);
57  SetBeam( E, M, iq, dE );
58 
59  return 0;
60  }
virtual ~THcRunParameters()
int Int_t
STL namespace.
Get the run parameters from the parameter database so that db_run.dat is not needed in hcana...
constexpr Double_t E()
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
double Double_t
virtual Int_t ReadDatabase(const TDatime &date)
ClassImp(THcDCLookupTTDConv) THcDCLookupTTDConv
int * iq
R__EXTERN class THcParmList * gHcParms
Definition: THcGlobals.h:11
Double_t Sqrt(Double_t x)