QwAnalysis
QwPromptSummary.h
Go to the documentation of this file.
1 #ifndef __QwPromptSummary__
2 #define __QwPromptSummary__
3 /**
4  * \file QwPromptSummary.h
5  * \brief
6  * \author jhlee@jlab.org
7  * \date Friday, December 16 10:29:10 EST 2011
8  */
9 
10 #include <iostream>
11 
12 
13 #include "TObject.h"
14 #include "TClonesArray.h"
15 #include "TList.h"
16 #include "TString.h"
17 
18 #include "TROOT.h"
19 
20 /**
21  * \class QwPromptSummary
22  * \ingroup QwAnalysis
23  *
24  * \brief
25  *
26  */
27 
28 class PromptSummaryElement : public TObject
29 {
30  public:
32  PromptSummaryElement(TString name);
33  virtual ~PromptSummaryElement();
34  // friend std::ostream& operator<<(std::ostream& os, const PromptSummaryElement &ps_element);
35 
36  void FillData(Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit,
37  Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit);
38 
39  void SetName (const TString in) {fElementName=in;};
40  TString GetName () {return fElementName;};
41 
42 
43  // Yield : fHardwareBlockSumM2
44  // YieldError : fHardwareBlockSumError = sqrt(fHardwareBlockSumM2) / fGoodEventCount;
45 
46  void SetYield (const Double_t in) { fYield=in; };
47  void SetYieldError (const Double_t in) { fYieldError=in; };
48  void SetYieldWidth (const Double_t in) { fYieldWidth=in; };
49  void SetYieldUnit (const TString in) { fYieldUnit=in; };
50 
51  // Asymmetry :
52  void SetAsymmetry (const Double_t in) { fAsymDiff=in; };
53  void SetAsymmetryError (const Double_t in) { fAsymDiffError=in; };
54  void SetAsymmetryWidth (const Double_t in) { fAsymDiffWidth=in; };
55  void SetAsymmetryUnit (const TString in) { fAsymDiffUnit=in; };
56 
57 
58  // Difference :
59  void SetDifference (const Double_t in) { fAsymDiff=in; };
60  void SetDifferenceError (const Double_t in) { fAsymDiffError=in; };
61  void SetDifferenceWidth (const Double_t in) { fAsymDiffWidth=in; };
62  void SetDifferenceUnit (const TString in) { fAsymDiffUnit=in; };
63 
64 
65  // Yield
66  const Double_t GetYield () { return fYield; };
67  const Double_t GetYieldError () { return fYieldError; };
68  const Double_t GetYieldWidth () { return fYieldWidth; };
69  const TString GetYieldUnit () { return fYieldUnit; };
70 
71  // Asymmetry :
72  const Double_t GetAsymmetry () { return fAsymDiff; };
73  const Double_t GetAsymmetryError() { return fAsymDiffError; };
74  const Double_t GetAsymmetryWidth() { return fAsymDiffWidth; };
75  const TString GetAsymmetryUnit () { return fAsymDiffUnit; };
76 
77 
78  // Difference :
79  const Double_t GetDifference () { return fAsymDiff; };
80  const Double_t GetDifferenceError() { return fAsymDiffError; };
81  const Double_t GetDifferenceWidth() { return fAsymDiffWidth; };
82  const TString GetDifferenceUnit () { return fAsymDiffUnit; };
83 
84 
85  void Set(TString type, const Double_t a, const Double_t a_err, const Double_t a_width);
86 
87  // void SetAsymmetryWidthError (const Double_t in) { fAsymmetryWidthError=in; };
88  // void SetAsymmetryWidthUnit (const TString in) { fAsymmetryWidthUnit=in; };
89 
90 
91  TString GetCSVSummary();
92  TString GetTextSummary();
93  //
94 
95  // This is not sigma, but error defined in QwVQWK_Channel::CalculateRunningAverage() in QwVQWK_Channel.cc as follows
96  // fHardwareBlockSumError = sqrt(fHardwareBlockSumM2) / fGoodEventCount;
97  //
98  private:
99 
100  TString fElementName;
101 
102  Double_t fYield;
103  Double_t fYieldError;
104  Double_t fYieldWidth;
105  TString fYieldUnit;
106 
107  Double_t fAsymDiff;
108  Double_t fAsymDiffError;
109  Double_t fAsymDiffWidth;
110  TString fAsymDiffUnit;
111 
112  /* Double_t fAsymmetryWidth; */
113  /* Double_t fAsymmetryWidthError; */
114  /* TString fAsymmetryWidthUnit; */
115 
117 
118 };
119 
120 
121 class QwPromptSummary : public TObject
122 {
123 
124  public:
125  QwPromptSummary();
126  QwPromptSummary(Int_t run_number, Int_t runlet_number);
127  virtual ~QwPromptSummary();
128  // friend std::ostream& operator<<(std::ostream& os, const QwF1TDC &f1tdc);
129 
130 
131  Int_t fNElements;
132  TObjArray *fElementList;
133 
134  void SetRunNumber(const Int_t in) {fRunNumber = in;};
135  const Int_t GetRunNumber() {return fRunNumber;};
136 
137  void SetRunletNumber(const Int_t in) {fRunletNumber = in;};
138  const Int_t GetRunletNumber() {return fRunletNumber;};
139 
140 
142  PromptSummaryElement* GetElementByName(TString name);
143 
144  void FillDataInElement(TString name,
145  Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit,
146  Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit);
147 
148  void FillYieldToElement(TString name, Double_t yield, Double_t yield_error, Double_t yield_width, TString yield_unit);
149  void FillAsymDiffToElement(TString name, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit);
150  // void FillDifferenceToElement(Double_t asym_diff, Double_t asym_diff_err, TString asym_diff_unit);
151 
152  // void Print(const Option_t* options = 0) const;
153 
154  void FillDoubleDifference(TString type, TString name1, TString name2);
155 
156  Int_t GetSize() const {return fNElements;};
157  Int_t Size() const {return fNElements;};
158  Int_t HowManyElements() const {return fNElements;};
159 
160 
161  void PrintCSV();
162  void PrintTextSummary();
163 
164 private:
165 
166 
167 
168 
169  TString PrintTextSummaryHeader();
170  TString PrintTextSummaryTailer();
171  TString PrintCSVHeader();
172 
173  void SetupElementList();
174 
175  Int_t fRunNumber;
177 
178  Bool_t fLocalDebug;
179 
181 
182 };
183 
184 
185 #endif
Int_t Size() const
const Double_t GetDifferenceError()
void SetYieldWidth(const Double_t in)
const TString GetAsymmetryUnit()
void FillDoubleDifference(TString type, TString name1, TString name2)
const Double_t GetDifferenceWidth()
static const double in
Definition: QwUnits.h:66
void FillData(Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
virtual ~PromptSummaryElement()
void SetAsymmetryWidth(const Double_t in)
const Double_t GetYield()
const Int_t GetRunletNumber()
const Double_t GetYieldError()
void FillYieldToElement(TString name, Double_t yield, Double_t yield_error, Double_t yield_width, TString yield_unit)
virtual ~QwPromptSummary()
void FillAsymDiffToElement(TString name, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
const TString GetYieldUnit()
void AddElement(PromptSummaryElement *in)
const Double_t GetAsymmetryError()
void SetYield(const Double_t in)
ClassDef(QwPromptSummary, 0)
void FillDataInElement(TString name, Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
void SetDifferenceWidth(const Double_t in)
void SetRunletNumber(const Int_t in)
void SetAsymmetryError(const Double_t in)
void SetAsymmetry(const Double_t in)
void SetName(const TString in)
TObjArray * fElementList
Int_t HowManyElements() const
void SetDifferenceUnit(const TString in)
void Set(TString type, const Double_t a, const Double_t a_err, const Double_t a_width)
const TString GetDifferenceUnit()
const Double_t GetAsymmetry()
void SetYieldUnit(const TString in)
const Double_t GetAsymmetryWidth()
TString PrintTextSummaryHeader()
PromptSummaryElement * GetElementByName(TString name)
ClassDef(PromptSummaryElement, 0)
TString PrintCSVHeader()
TString PrintTextSummaryTailer()
void SetAsymmetryUnit(const TString in)
void SetDifferenceError(const Double_t in)
const Double_t GetDifference()
void SetYieldError(const Double_t in)
const Int_t GetRunNumber()
Int_t GetSize() const
void SetRunNumber(const Int_t in)
const Double_t GetYieldWidth()
void SetDifference(const Double_t in)