JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwDBInterface Class Reference

#include <QwDBInterface.h>

+ Collaboration diagram for QwDBInterface:

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 43 of file QwDBInterface.h.

Member Enumeration Documentation

◆ EQwDBIDataTableType

Enumerator
kQwDBI_OtherTable 
kQwDBI_BeamTable 
kQwDBI_MDTable 
kQwDBI_LumiTable 

Definition at line 45 of file QwDBInterface.h.

Constructor & Destructor Documentation

◆ QwDBInterface()

QwDBInterface::QwDBInterface ( )
inline

Definition at line 70 of file QwDBInterface.h.

71 : fAnalysisId(0),fDeviceId(0),fSubblock(0),fN(0),fValue(0.0),fError(0.0) {
72 std::strcpy(fMeasurementTypeId, "");fDeviceName ="";
73 }
Double_t fValue
Double_t fError
Char_t fMeasurementTypeId[4]
TString fDeviceName

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

◆ ~QwDBInterface()

virtual QwDBInterface::~QwDBInterface ( )
inlinevirtual

Definition at line 74 of file QwDBInterface.h.

74{ }

Member Function Documentation

◆ AddThisEntryToList()

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

Definition at line 137 of file QwDBInterface.h.

138{
139 Bool_t okay = kTRUE;
140 if (fAnalysisId == 0) {
141 QwError << "QwDBInterface::AddDBEntryToList: Analysis ID invalid; entry dropped"
142 << QwLog::endl;
143 okay = kFALSE;
144 }
145 if (fDeviceId == 0) {
146 QwError << "QwDBInterface::AddDBEntryToList: Device ID invalid; entry dropped"
147 << QwLog::endl;
148 okay = kFALSE;
149 }
150 if (okay) {
151 T row = TypedDBClone<T>();
152 // Note: analysis_id validation done above with fAnalysisId check
153 list.push_back(row);
154 }
155 if (okay == kFALSE) {
156 PrintStatus(kTRUE);
157 };
158}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
void PrintStatus(Bool_t print_flag)
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297

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

+ Here is the call graph for this function:

◆ DetermineMeasurementTypeID()

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

Definition at line 19 of file QwDBInterface.cc.

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

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

+ Here is the call graph for this function:

◆ GetDeviceName()

TString QwDBInterface::GetDeviceName ( )
inline

Definition at line 96 of file QwDBInterface.h.

96{return fDeviceName;};

References fDeviceName.

◆ PrintStatus()

void QwDBInterface::PrintStatus ( Bool_t print_flag)
inline

Definition at line 113 of file QwDBInterface.h.

113 {
114 if(print_flag) {
115 QwMessage << std::setw(12)
116 << " AnalysisID " << fAnalysisId
117 << " Device :" << std::setw(30) << fDeviceName
118 << ":" << std::setw(4) << fDeviceId
119 << " Subblock " << fSubblock
120 << " n " << fN
121 << " Type " << fMeasurementTypeId
122 << " [ave, err] "
123 << " [" << std::setw(14) << fValue
124 << "," << std::setw(14) << fError
125 << "]"
126 << QwLog::endl;
127 }
128 }
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49

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

Referenced by AddThisEntryToList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Reset()

void QwDBInterface::Reset ( )
inline

Definition at line 98 of file QwDBInterface.h.

98 {
99 fAnalysisId = 0;
100 fDeviceId = 0;
101 fSubblock = 0;
102 fN = 0;
103 fValue = 0.0;
104 fError = 0.0;
105 std::strcpy(fMeasurementTypeId,"");
106 fDeviceName = "";
107 };

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

◆ SetAnalysisID()

void QwDBInterface::SetAnalysisID ( UInt_t id)
inline

Definition at line 76 of file QwDBInterface.h.

76{fAnalysisId = id;};

References fAnalysisId.

◆ SetDetectorID()

EQwDBIDataTableType QwDBInterface::SetDetectorID ( QwParityDB * db)

◆ SetDetectorName()

void QwDBInterface::SetDetectorName ( TString & in)
inline

Definition at line 77 of file QwDBInterface.h.

77{fDeviceName = in;};

References fDeviceName.

◆ SetDeviceID()

void QwDBInterface::SetDeviceID ( UInt_t id)
inline

Definition at line 78 of file QwDBInterface.h.

78{fDeviceId = id;};

References fDeviceId.

◆ SetError()

void QwDBInterface::SetError ( Double_t in)
inline

Definition at line 94 of file QwDBInterface.h.

94{fError = in;};

References fError.

◆ SetLumiDetectorID()

void QwDBInterface::SetLumiDetectorID ( QwParityDB * db)

◆ SetMainDetectorID()

void QwDBInterface::SetMainDetectorID ( QwParityDB * db)

◆ SetMeasurementTypeID() [1/2]

void QwDBInterface::SetMeasurementTypeID ( const char * in)
inline

Definition at line 87 of file QwDBInterface.h.

87 {
88 std::strncpy(fMeasurementTypeId, in, 3);
89 fMeasurementTypeId[3] = '\0';
90 };

References fMeasurementTypeId.

◆ SetMeasurementTypeID() [2/2]

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

Definition at line 83 of file QwDBInterface.h.

83 {
84 std::strncpy(fMeasurementTypeId, in.Data(), 3);
85 fMeasurementTypeId[3] = '\0';
86 };

References fMeasurementTypeId.

◆ SetMonitorID()

void QwDBInterface::SetMonitorID ( QwParityDB * db)

◆ SetN()

void QwDBInterface::SetN ( UInt_t in)
inline

Definition at line 92 of file QwDBInterface.h.

92{fN = in;};

References fN.

◆ SetSubblock()

void QwDBInterface::SetSubblock ( UInt_t in)
inline

Definition at line 91 of file QwDBInterface.h.

91{fSubblock = in;};

References fSubblock.

◆ SetValue()

void QwDBInterface::SetValue ( Double_t in)
inline

Definition at line 93 of file QwDBInterface.h.

93{fValue = in;};

References fValue.

◆ TypedDBClone()

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

Definition at line 78 of file QwDBInterface.cc.

79{
80 T row(0);
81 return row;
82}

Referenced by AddThisEntryToList().

+ Here is the caller graph for this function:

Field Documentation

◆ fAnalysisId

UInt_t QwDBInterface::fAnalysisId
private

Definition at line 50 of file QwDBInterface.h.

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

◆ fDeviceId

UInt_t QwDBInterface::fDeviceId
private

Definition at line 51 of file QwDBInterface.h.

Referenced by AddThisEntryToList(), PrintStatus(), QwDBInterface(), Reset(), and SetDeviceID().

◆ fDeviceName

TString QwDBInterface::fDeviceName
private

Definition at line 58 of file QwDBInterface.h.

Referenced by GetDeviceName(), PrintStatus(), QwDBInterface(), Reset(), and SetDetectorName().

◆ fError

Double_t QwDBInterface::fError
private

Definition at line 55 of file QwDBInterface.h.

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

◆ fMeasurementTypeId

Char_t QwDBInterface::fMeasurementTypeId[4]
private

◆ fN

UInt_t QwDBInterface::fN
private

Definition at line 53 of file QwDBInterface.h.

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

◆ fPrefix

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

Definition at line 48 of file QwDBInterface.h.

Referenced by DetermineMeasurementTypeID().

◆ fSubblock

UInt_t QwDBInterface::fSubblock
private

Definition at line 52 of file QwDBInterface.h.

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

◆ fValue

Double_t QwDBInterface::fValue
private

Definition at line 54 of file QwDBInterface.h.

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


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