QwAnalysis
QwHelicityPattern.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwHelicityPattern.h *
3 * *
4 * Author: P. M. King *
5 * Time-stamp: <2007-05-08 15:40> *
6 \**********************************************************/
7 #ifndef __QwHelicityPattern__
8 #define __QwHelicityPattern__
9 
10 // System headers
11 #include <vector>
12 
13 // ROOT headers
14 #include <TTree.h>
15 
16 // Qweak headers
17 #include "QwSubsystemArrayParity.h"
18 #include "QwEPICSEvent.h"
19 #include "QwBlinder.h"
20 
21 // Forward declarations
22 class QwHelicity;
23 class QwRegression;
24 
25 ///
26 /// \ingroup QwAnalysis_ADC
27 ///
28 /// \ingroup QwAnalysis_BL
30  /******************************************************************
31  * Class: QwHelicityPattern
32  *
33  *
34  ******************************************************************/
35  private:
36  /// Private default constructor (not implemented, will throw linker error on use)
38  public:
39  /// Constructor with subsystem array
41  /// Virtual destructor
42  virtual ~QwHelicityPattern() { };
43 
44  /// \brief Define the configuration options
45  static void DefineOptions(QwOptions &options);
46  /// \brief Process the configuration options
47  void ProcessOptions(QwOptions &options);
48 
50  Bool_t HasDataLoaded() const { return fIsDataLoaded; };
51 
52  Bool_t IsCompletePattern() const;
53 
54  Bool_t IsEndOfBurst(){
55  // Is this the end of a burst?
56  return (fBurstLength > 0 && fCurrentPatternNumber % fBurstLength == 0);
57  }
58 
59  void CalculateAsymmetry();
60  void GetTargetChargeStat(Double_t & asym, Double_t & error, Double_t & width);//retrieves the target charge asymmetry,asymmetry error ,asymmetry width
61 
62  /// Enable/disable alternate asymmetry calculation
63  void EnableAlternateAsymmetry(const Bool_t flag = kTRUE) { fEnableAlternateAsym = flag; };
64  /// Disable alternate asymmetry calculation
66  /// Status of alternate asymmetry calculation flag
68 
69  /// Enable/disable burst sum calculation
70  void EnableBurstSum(const Bool_t flag = kTRUE) { fEnableBurstSum = flag; };
71  /// Disable burst sum calculation
72  void DisableBurstSum() { fEnableBurstSum = kFALSE; };
73  /// Status of burst sum calculation flag
74  Bool_t IsBurstSumEnabled() { return fEnableBurstSum; };
75 
76  /// Enable/disable running sum calculation
77  void EnableRunningSum(const Bool_t flag = kTRUE) { fEnableRunningSum = flag; };
78  /// Disable running sum calculation
79  void DisableRunningSum() { fEnableRunningSum = kFALSE; };
80  /// Status of running sum calculation flag
81  Bool_t IsRunningSumEnabled() { return fEnableRunningSum; };
82 
83  /// Enable/disable storing pattern differences
84  void EnableDifference(const Bool_t flag = kTRUE) { fEnableDifference = flag; };
85  /// Disable storing pattern differences
86  void DisableDifference() { fEnableDifference = kFALSE; };
87  /// Status of storing pattern differences flag
88  Bool_t IsDifferenceEnabled() { return fEnableDifference; };
89 
90  /// Update the blinder status with new external information
92  fBlinder.Update(db);
93  };
94  /// Update the blinder status with new external information
95  void UpdateBlinder(const QwSubsystemArrayParity& detectors) {
96  fBlinder.Update(detectors);
97  };
98  /// Update the blinder status with new external information
99  void UpdateBlinder(const QwEPICSEvent& epics) {
100  fBlinder.Update(epics);
101  };
102 
103  // wish these could be const references, but ConstructBranchAndVector messes with object
107 
108  void AccumulateBurstSum();
110  void AccumulateRunningSum();
111 
112  void CalculateBurstAverage();
115 
116  void PrintRunningBurstAverage() const;
117  void PrintRunningAverage() const;
118  void PrintBurstAverage() const;
119 
120  void ConstructHistograms(){ConstructHistograms((TDirectory*)NULL);};
121  void ConstructHistograms(TDirectory *folder);
122  void FillHistograms();
123 
124  void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values);
125  void ConstructBranch(TTree *tree, TString &prefix);
126  void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile &trim_tree);
127  void FillTreeVector(std::vector<Double_t> &values) const;
128  void FillDB(QwParityDB *db);
129  void FillErrDB(QwParityDB *db);
131 
132  Bool_t IsGoodAsymmetry(){ return fPatternIsGood;};
133  UInt_t GetEventcutErrorFlag() const{
135  };
136 
137  void ClearEventData();
138  void ClearBurstSum();
139  void ClearRunningSum();
140 
141  void Print() const;
142 
143  protected:
144  Bool_t fDEBUG;
145 
146  // QwHelicity* fHelicitySubsystem;
147 
148  std::vector<QwSubsystemArrayParity> fEvents;
149  std::vector<Bool_t> fEventLoaded;
150  std::vector<Int_t> fHelicity;// this is here up to when we code the Helicity decoding routine
151  std::vector<Int_t> fEventNumber;
155 
156  // Blinding strategy
158 
159  /// This indicates if the subsystem arrays are missing the helicity object.
160  /// It is updated once during initialization and once when processing the first event
162  /// This is true if any of the helicity objects of this pattern have indicated that
163  /// we should ignore the helicity. It is updated every event and reset by ClearEventData.
165 
166  // Yield and asymmetry of a single helicity pattern
169  // Alternate asymmetry calculations
173 
174  // Burst sum/difference of the yield and asymmetry
184 
185  // Running sum/average of the yield and asymmetry
193 
199 
203 
205 
206  // Flag to indicate that the pattern contains data
208  void SetDataLoaded(Bool_t flag) { fIsDataLoaded = flag; };
209 
210  friend class QwRegression;
211 
212 };
213 
214 
215 #endif
void EnableRunningSum(const Bool_t flag=kTRUE)
Enable/disable running sum calculation.
void UpdateBlinder(const QwSubsystemArrayParity &detectors)
Update the blinder status with new external information.
std::vector< Int_t > fEventNumber
QwSubsystemArrayParity fBurstDifference
void GetTargetChargeStat(Double_t &asym, Double_t &error, Double_t &width)
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fRunningAsymmetry
std::vector< Bool_t > fEventLoaded
Bool_t HasDataLoaded() const
void DisableBurstSum()
Disable burst sum calculation.
An options class.
Definition: QwOptions.h:133
QwSubsystemArrayParity fBurstAsymmetry
static void DefineOptions(QwOptions &options)
Define the configuration options.
void ConstructBranch(TTree *tree, TString &prefix)
QwHelicityPattern()
Private default constructor (not implemented, will throw linker error on use)
Class for blinding data, adapted from G0 blinder class.
Definition: QwBlinder.h:64
QwSubsystemArrayParity fNegativeHelicitySum
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
void DisableRunningSum()
Disable running sum calculation.
QwSubsystemArrayParity fYield
void WritePromptSummary(QwPromptSummary *ps)
void EnableAlternateAsymmetry(const Bool_t flag=kTRUE)
Enable/disable alternate asymmetry calculation.
virtual ~QwHelicityPattern()
Virtual destructor.
QwSubsystemArrayParity fAlternateDiff
void UpdateBlinder(QwParityDB *db)
Update the blinder status with new external information.
Bool_t IsBurstSumEnabled()
Status of burst sum calculation flag.
Bool_t IsCompletePattern() const
QwSubsystemArrayParity & GetBurstDifference()
QwSubsystemArrayParity fAsymmetry
void PrintBurstAverage() const
void EnableDifference(const Bool_t flag=kTRUE)
Enable/disable storing pattern differences.
QwSubsystemArrayParity fPositiveHelicitySum
QwSubsystemArrayParity fRunningBurstYield
QwSubsystemArrayParity fAsymmetry2
Virtual base class for the parity subsystems.
void PrintRunningAverage() const
QwSubsystemArrayParity & GetBurstYield()
void Update(QwParityDB *db)
Update the status with new external information.
Definition: QwBlinder.cc:138
void FillTreeVector(std::vector< Double_t > &values) const
void ProcessOptions(QwOptions &options)
Process the configuration options.
void DisableAlternateAsymmetry()
Disable alternate asymmetry calculation.
QwSubsystemArrayParity fRunningAsymmetry1
void SetDataLoaded(Bool_t flag)
QwSubsystemArrayParity fRunningAsymmetry2
UInt_t GetEventcutErrorFlag() const
Return the error flag to the main routine.
A class for blinding data, adapted from G0 blinder class.
Bool_t IsRunningSumEnabled()
Status of running sum calculation flag.
UInt_t GetEventcutErrorFlag() const
QwSubsystemArrayParity & GetBurstAsymmetry()
void LoadEventData(QwSubsystemArrayParity &event)
void UpdateBlinder(const QwEPICSEvent &epics)
Update the blinder status with new external information.
void FillErrDB(QwParityDB *db)
QwSubsystemArrayParity fAsymmetry1
Bool_t IsDifferenceEnabled()
Status of storing pattern differences flag.
void PrintRunningBurstAverage() const
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents
Bool_t IsAlternateAsymEnabled()
Status of alternate asymmetry calculation flag.
void EnableBurstSum(const Bool_t flag=kTRUE)
Enable/disable burst sum calculation.
void FillDB(QwParityDB *db)
QwSubsystemArrayParity fRunningDifference
void DisableDifference()
Disable storing pattern differences.
QwSubsystemArrayParity fRunningYield
QwSubsystemArrayParity fBurstYield
QwSubsystemArrayParity fRunningBurstAsymmetry