QwAnalysis
QwDBInterface Class Reference

#include <QwDBInterface.h>

Public Types

enum  EQwDBIDataTableType { kQwDBI_OtherTable, kQwDBI_BeamTable, kQwDBI_MDTable, kQwDBI_LumiTable }
 

Public Member Functions

 QwDBInterface ()
 
virtual ~QwDBInterface ()
 
void SetAnalysisID (UInt_t id)
 
void SetDetectorName (TString &in)
 
void SetDeviceID (UInt_t id)
 
void SetMonitorID (QwParityDB *db)
 
void SetMainDetectorID (QwParityDB *db)
 
void SetLumiDetectorID (QwParityDB *db)
 
EQwDBIDataTableType SetDetectorID (QwParityDB *db)
 
void SetMeasurementTypeID (const TString &in)
 
void SetMeasurementTypeID (const char *in)
 
void SetSubblock (UInt_t in)
 
void SetN (UInt_t in)
 
void SetValue (Double_t in)
 
void SetError (Double_t in)
 
TString GetDeviceName ()
 
void Reset ()
 
template<class T >
void AddThisEntryToList (std::vector< T > &list)
 
void PrintStatus (Bool_t print_flag)
 

Static Public Member Functions

static TString DetermineMeasurementTypeID (TString type, TString suffix="", Bool_t forcediffs=kFALSE)
 

Private Member Functions

template<class T >
TypedDBClone ()
 

Private Attributes

UInt_t fAnalysisId
 
UInt_t fDeviceId
 
UInt_t fSubblock
 
UInt_t fN
 
Double_t fValue
 
Double_t fError
 
Char_t fMeasurementTypeId [4]
 
TString fDeviceName
 

Static Private Attributes

static std::map< TString, TString > fPrefix
 

Detailed Description

Definition at line 38 of file QwDBInterface.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

QwDBInterface::QwDBInterface ( )
inline

Definition at line 65 of file QwDBInterface.h.

References fDeviceName, and fMeasurementTypeId.

66  : fAnalysisId(0),fDeviceId(0),fSubblock(0),fN(0),fValue(0.0),fError(0.0) {
67  std::strcpy(fMeasurementTypeId, "");fDeviceName ="";
68  }
UInt_t fSubblock
Definition: QwDBInterface.h:47
Char_t fMeasurementTypeId[4]
Definition: QwDBInterface.h:51
Double_t fValue
Definition: QwDBInterface.h:49
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46
Double_t fError
Definition: QwDBInterface.h:50
UInt_t fAnalysisId
Definition: QwDBInterface.h:45
virtual QwDBInterface::~QwDBInterface ( )
inlinevirtual

Definition at line 69 of file QwDBInterface.h.

69 { }

Member Function Documentation

template<class T >
void QwDBInterface::AddThisEntryToList ( std::vector< T > &  list)
inline

Definition at line 132 of file QwDBInterface.h.

References QwLog::endl(), fAnalysisId, fDeviceId, PrintStatus(), QwError, and Qw::T.

133 {
134  Bool_t okay = kTRUE;
135  if (fAnalysisId == 0) {
136  QwError << "QwDBInterface::AddDBEntryToList: Analysis ID invalid; entry dropped"
137  << QwLog::endl;
138  okay = kFALSE;
139  }
140  if (fDeviceId == 0) {
141  QwError << "QwDBInterface::AddDBEntryToList: Device ID invalid; entry dropped"
142  << QwLog::endl;
143  okay = kFALSE;
144  }
145  if (okay) {
146  T row = TypedDBClone<T>();
147  if (row.analysis_id == 0){
148  QwError << "QwDBInterface::AddDBEntryToList: Unknown list type; entry dropped"
149  << QwLog::endl;
150  okay = kFALSE;
151  } else {
152  list.push_back(row);
153  }
154  }
155  if (okay == kFALSE) {
156  PrintStatus(kTRUE);
157  };
158 }
void PrintStatus(Bool_t print_flag)
UInt_t fDeviceId
Definition: QwDBInterface.h:46
static const double T
Magnetic field: base unit is T.
Definition: QwUnits.h:111
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
UInt_t fAnalysisId
Definition: QwDBInterface.h:45

+ Here is the call graph for this function:

TString QwDBInterface::DetermineMeasurementTypeID ( TString  type,
TString  suffix = "",
Bool_t  forcediffs = kFALSE 
)
static

Definition at line 18 of file QwDBInterface.cc.

References QwLog::endl(), fPrefix, and QwDebug.

Referenced by QwRegression::FillDB(), QwMainCerenkovDetector::FillDB(), QwBeamLine::FillDB(), QwIntegratedRaster::FillDB(), and QwLumi::FillDB().

20 {
21  if (fPrefix.empty()){
22  fPrefix["yield"] = "y";
23  fPrefix["difference"] = "d";
24  fPrefix["asymmetry"] = "a";
25  fPrefix["asymmetry1"] = "a12";
26  fPrefix["asymmetry2"] = "aeo";
27  }
28  TString measurement_type("");
29  if (fPrefix.count(type)==1){
30  measurement_type = fPrefix[type];
31  if (measurement_type[0] == 'a' &&
32  (forcediffs
33  || (suffix == "p" || suffix == "a"
34  || suffix == "m")) ){
35  // Change the type to difference for position,
36  // angle, or slope asymmetry variables.
37  measurement_type[0] = 'd';
38  } else if (measurement_type[0] == 'y') {
39  measurement_type += suffix;
40  }
41  }
42  QwDebug << "\n"
43  << type << ", " << suffix
44  << " \'" << measurement_type.Data() << "\'" << QwLog::endl;
45  return measurement_type;
46 }
static std::map< TString, TString > fPrefix
Definition: QwDBInterface.h:43
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TString QwDBInterface::GetDeviceName ( )
inline

Definition at line 91 of file QwDBInterface.h.

References fDeviceName.

91 {return fDeviceName;};
TString fDeviceName
Definition: QwDBInterface.h:53
void QwDBInterface::PrintStatus ( Bool_t  print_flag)
inline

Definition at line 108 of file QwDBInterface.h.

References QwLog::endl(), fAnalysisId, fDeviceId, fDeviceName, fError, fMeasurementTypeId, fN, fSubblock, fValue, and QwMessage.

Referenced by AddThisEntryToList().

108  {
109  if(print_flag) {
110  QwMessage << std::setw(12)
111  << " AnalysisID " << fAnalysisId
112  << " Device :" << std::setw(30) << fDeviceName
113  << ":" << std::setw(4) << fDeviceId
114  << " Subblock " << fSubblock
115  << " n " << fN
116  << " Type " << fMeasurementTypeId
117  << " [ave, err] "
118  << " [" << std::setw(14) << fValue
119  << "," << std::setw(14) << fError
120  << "]"
121  << QwLog::endl;
122  }
123  }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
UInt_t fSubblock
Definition: QwDBInterface.h:47
Char_t fMeasurementTypeId[4]
Definition: QwDBInterface.h:51
Double_t fValue
Definition: QwDBInterface.h:49
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46
Double_t fError
Definition: QwDBInterface.h:50
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
UInt_t fAnalysisId
Definition: QwDBInterface.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwDBInterface::Reset ( )
inline

Definition at line 93 of file QwDBInterface.h.

References fAnalysisId, fDeviceId, fDeviceName, fError, fMeasurementTypeId, fN, fSubblock, and fValue.

Referenced by VQwHardwareChannel::AddEntriesToList().

93  {
94  fAnalysisId = 0;
95  fDeviceId = 0;
96  fSubblock = 0;
97  fN = 0;
98  fValue = 0.0;
99  fError = 0.0;
100  std::strcpy(fMeasurementTypeId,"");
101  fDeviceName = "";
102  };
UInt_t fSubblock
Definition: QwDBInterface.h:47
Char_t fMeasurementTypeId[4]
Definition: QwDBInterface.h:51
Double_t fValue
Definition: QwDBInterface.h:49
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46
Double_t fError
Definition: QwDBInterface.h:50
UInt_t fAnalysisId
Definition: QwDBInterface.h:45

+ Here is the caller graph for this function:

void QwDBInterface::SetAnalysisID ( UInt_t  id)
inline

Definition at line 71 of file QwDBInterface.h.

References fAnalysisId.

71 {fAnalysisId = id;};
UInt_t fAnalysisId
Definition: QwDBInterface.h:45
QwDBInterface::EQwDBIDataTableType QwDBInterface::SetDetectorID ( QwParityDB db)

Definition at line 64 of file QwDBInterface.cc.

References fDeviceId, fDeviceName, QwParityDB::GetLumiDetectorID(), QwParityDB::GetMainDetectorID(), QwParityDB::GetMonitorID(), kQwDBI_BeamTable, kQwDBI_LumiTable, kQwDBI_MDTable, and kQwDBI_OtherTable.

65 {
66  fDeviceId = db->GetMonitorID(fDeviceName.Data(),kFALSE);
67  if (fDeviceId!=0) return kQwDBI_BeamTable;
68  fDeviceId = db->GetMainDetectorID(fDeviceName.Data(),kFALSE);
69  if (fDeviceId!=0) return kQwDBI_MDTable;
70  fDeviceId = db->GetLumiDetectorID(fDeviceName.Data(),kFALSE);
71  if (fDeviceId!=0) return kQwDBI_LumiTable;
72  return kQwDBI_OtherTable;
73 }
UInt_t GetMonitorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:618
UInt_t GetMainDetectorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:661
UInt_t GetLumiDetectorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:790
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46

+ Here is the call graph for this function:

void QwDBInterface::SetDetectorName ( TString &  in)
inline

Definition at line 72 of file QwDBInterface.h.

References fDeviceName, and Qw::in.

Referenced by VQwHardwareChannel::AddEntriesToList().

72 {fDeviceName = in;};
static const double in
Definition: QwUnits.h:66
TString fDeviceName
Definition: QwDBInterface.h:53

+ Here is the caller graph for this function:

void QwDBInterface::SetDeviceID ( UInt_t  id)
inline

Definition at line 73 of file QwDBInterface.h.

References fDeviceId.

73 {fDeviceId = id;};
UInt_t fDeviceId
Definition: QwDBInterface.h:46
void QwDBInterface::SetError ( Double_t  in)
inline

Definition at line 89 of file QwDBInterface.h.

References fError, and Qw::in.

Referenced by VQwHardwareChannel::AddEntriesToList().

89 {fError = in;};
static const double in
Definition: QwUnits.h:66
Double_t fError
Definition: QwDBInterface.h:50

+ Here is the caller graph for this function:

void QwDBInterface::SetLumiDetectorID ( QwParityDB db)

Definition at line 59 of file QwDBInterface.cc.

References fDeviceId, fDeviceName, and QwParityDB::GetLumiDetectorID().

60 {
62 }
UInt_t GetLumiDetectorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:790
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46

+ Here is the call graph for this function:

void QwDBInterface::SetMainDetectorID ( QwParityDB db)

Definition at line 54 of file QwDBInterface.cc.

References fDeviceId, fDeviceName, and QwParityDB::GetMainDetectorID().

55 {
57 }
UInt_t GetMainDetectorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:661
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46

+ Here is the call graph for this function:

void QwDBInterface::SetMeasurementTypeID ( const TString &  in)
inline

Definition at line 78 of file QwDBInterface.h.

References fMeasurementTypeId.

78  {
79  std::strncpy(fMeasurementTypeId, in.Data(), 3);
80  fMeasurementTypeId[3] = '\0';
81  };
Char_t fMeasurementTypeId[4]
Definition: QwDBInterface.h:51
static const double in
Definition: QwUnits.h:66
void QwDBInterface::SetMeasurementTypeID ( const char *  in)
inline

Definition at line 82 of file QwDBInterface.h.

References fMeasurementTypeId.

82  {
83  std::strncpy(fMeasurementTypeId, in, 3);
84  fMeasurementTypeId[3] = '\0';
85  };
Char_t fMeasurementTypeId[4]
Definition: QwDBInterface.h:51
static const double in
Definition: QwUnits.h:66
void QwDBInterface::SetMonitorID ( QwParityDB db)

Definition at line 49 of file QwDBInterface.cc.

References fDeviceId, fDeviceName, and QwParityDB::GetMonitorID().

50 {
51  fDeviceId = db->GetMonitorID(fDeviceName.Data());
52 }
UInt_t GetMonitorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:618
TString fDeviceName
Definition: QwDBInterface.h:53
UInt_t fDeviceId
Definition: QwDBInterface.h:46

+ Here is the call graph for this function:

void QwDBInterface::SetN ( UInt_t  in)
inline

Definition at line 87 of file QwDBInterface.h.

References fN, and Qw::in.

Referenced by VQwHardwareChannel::AddEntriesToList().

87 {fN = in;};
static const double in
Definition: QwUnits.h:66

+ Here is the caller graph for this function:

void QwDBInterface::SetSubblock ( UInt_t  in)
inline

Definition at line 86 of file QwDBInterface.h.

References fSubblock, and Qw::in.

Referenced by VQwHardwareChannel::AddEntriesToList().

86 {fSubblock = in;};
UInt_t fSubblock
Definition: QwDBInterface.h:47
static const double in
Definition: QwUnits.h:66

+ Here is the caller graph for this function:

void QwDBInterface::SetValue ( Double_t  in)
inline

Definition at line 88 of file QwDBInterface.h.

References fValue, and Qw::in.

Referenced by VQwHardwareChannel::AddEntriesToList().

88 {fValue = in;};
static const double in
Definition: QwUnits.h:66
Double_t fValue
Definition: QwDBInterface.h:49

+ Here is the caller graph for this function:

template<class T >
T QwDBInterface::TypedDBClone ( )
private

Definition at line 76 of file QwDBInterface.cc.

References Qw::T.

77 {
78  T row(0);
79  return row;
80 }
static const double T
Magnetic field: base unit is T.
Definition: QwUnits.h:111

Field Documentation

UInt_t QwDBInterface::fAnalysisId
private

Definition at line 45 of file QwDBInterface.h.

Referenced by AddThisEntryToList(), PrintStatus(), Reset(), and SetAnalysisID().

UInt_t QwDBInterface::fDeviceId
private
TString QwDBInterface::fDeviceName
private
Double_t QwDBInterface::fError
private

Definition at line 50 of file QwDBInterface.h.

Referenced by PrintStatus(), Reset(), and SetError().

Char_t QwDBInterface::fMeasurementTypeId[4]
private

Definition at line 51 of file QwDBInterface.h.

Referenced by PrintStatus(), QwDBInterface(), Reset(), and SetMeasurementTypeID().

UInt_t QwDBInterface::fN
private

Definition at line 48 of file QwDBInterface.h.

Referenced by PrintStatus(), Reset(), and SetN().

std::map< TString, TString > QwDBInterface::fPrefix
staticprivate

Definition at line 43 of file QwDBInterface.h.

Referenced by DetermineMeasurementTypeID().

UInt_t QwDBInterface::fSubblock
private

Definition at line 47 of file QwDBInterface.h.

Referenced by PrintStatus(), Reset(), and SetSubblock().

Double_t QwDBInterface::fValue
private

Definition at line 49 of file QwDBInterface.h.

Referenced by PrintStatus(), Reset(), and SetValue().


The documentation for this class was generated from the following files: