QwAnalysis
VQwHardwareChannel.cc
Go to the documentation of this file.
1 #include "VQwHardwareChannel.h"
2 
3 // Qweak database headers
4 #include "QwLog.h"
5 #include "QwDBInterface.h"
6 #include "QwParameterFile.h"
7 
9  fNumberOfDataWords(0),
10  fNumberOfSubElements(0), fDataToSave(kRaw)
11 {
12  fULimit = 0.0;
13  fLLimit = 0.0;
14  fErrorFlag = 0;
15  fErrorConfigFlag = 0;
16 }
17 
19  :VQwDataElement(value),
20  fNumberOfDataWords(value.fNumberOfDataWords),
21  fNumberOfSubElements(value.fNumberOfSubElements),
22  fDataToSave(value.fDataToSave),
23  fTreeArrayIndex(value.fTreeArrayIndex),
24  fTreeArrayNumEntries(value.fTreeArrayNumEntries),
25  fPedestal(value.fPedestal),
26  fCalibrationFactor(value.fCalibrationFactor),
27  kFoundPedestal(value.kFoundPedestal),
28  kFoundGain(value.kFoundGain),
29  bEVENTCUTMODE(value.bEVENTCUTMODE),
30  fULimit(value.fULimit),
31  fLLimit(value.fLLimit),
32  fStability(value.fStability)
33 {
34 }
35 
37  :VQwDataElement(value),
38  fNumberOfDataWords(value.fNumberOfDataWords),
39  fNumberOfSubElements(value.fNumberOfSubElements),
40  fDataToSave(datatosave),
41  fTreeArrayIndex(value.fTreeArrayIndex),
42  fTreeArrayNumEntries(value.fTreeArrayNumEntries),
43  fPedestal(value.fPedestal),
44  fCalibrationFactor(value.fCalibrationFactor),
45  kFoundPedestal(value.kFoundPedestal),
46  kFoundGain(value.kFoundGain),
47  bEVENTCUTMODE(value.bEVENTCUTMODE),
48  fULimit(value.fULimit),
49  fLLimit(value.fLLimit),
50  fStability(value.fStability)
51 {
52 }
53 
54 
55 void VQwHardwareChannel::SetSingleEventCuts(Double_t min, Double_t max)
56 {
57  fULimit=max;
58  fLLimit=min;
59 }
60 
61 void VQwHardwareChannel::SetSingleEventCuts(UInt_t errorflag,Double_t min, Double_t max, Double_t stability)
62 {
63  fErrorConfigFlag=errorflag;
64  fStability=stability;
65  SetSingleEventCuts(min,max);
66  QwMessage << "Set single event cuts for " << GetElementName() << ": "
67  << "Config-error-flag == 0x" << std::hex << errorflag << std::dec
68  << ", global? " << ((fErrorConfigFlag & kGlobalCut)==kGlobalCut) << ", stability? " << ((fErrorConfigFlag & kStabilityCut)==kStabilityCut)<<" cut "<<fStability << QwLog::endl;
69 }
70 
71 
72 void VQwHardwareChannel::AddEntriesToList(std::vector<QwDBInterface> &row_list)
73 {
74  QwDBInterface row;
75  TString name = GetElementName();
76  UInt_t entries = GetGoodEventCount();
77  // Loop over subelements and build the list.
78  for(UInt_t subelement=0;
79  subelement<GetNumberOfSubelements();
80  subelement++) {
81  row.Reset();
82  row.SetDetectorName(name);
83  row.SetSubblock(subelement);
84  row.SetN(entries);
85  row.SetValue(GetValue(subelement));
86  row.SetError(GetValueError(subelement));
87  row_list.push_back(row);
88  }
89 }
90 
91 void VQwHardwareChannel::ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& modulelist){
92  if (GetElementName()!=""){
93  TString devicename;
94  devicename=GetElementName();
95  devicename.ToLower();
96  if (modulelist.HasValue(devicename)){
97  ConstructBranch(tree,prefix);
98  }
99  }
100 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
Double_t fULimit
void SetError(Double_t in)
Definition: QwDBInterface.h:89
UInt_t GetGoodEventCount() const
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
void SetSingleEventCuts(Double_t min, Double_t max)
Set the upper and lower limits (fULimit and fLLimit) for this channel.
void SetN(UInt_t in)
Definition: QwDBInterface.h:87
void SetDetectorName(TString &in)
Definition: QwDBInterface.h:72
void SetSubblock(UInt_t in)
Definition: QwDBInterface.h:86
Bool_t HasValue(TString &vname)
The pure virtual base class of all data elements.
A logfile class, based on an identical class in the Hermes analyzer.
void AddEntriesToList(std::vector< QwDBInterface > &row_list)
size_t GetNumberOfSubelements()
Get the number of subelements in this data element.
UInt_t fErrorFlag
This the standard error code generated for the channel that contains the global/local/stability flags...
static const double min
Definition: QwUnits.h:76
UInt_t fErrorConfigFlag
contains the global/local/stability flags
void SetValue(Double_t in)
Definition: QwDBInterface.h:88
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
static const UInt_t kGlobalCut
Definition: QwTypes.h:176
virtual const TString & GetElementName() const
Get the name of this element.
Double_t GetValueError() const
Double_t fLLimit
Double_t GetValue() const
static const UInt_t kStabilityCut
Definition: QwTypes.h:178