JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwSubsystemArrayParity.h
Go to the documentation of this file.
1/**********************************************************\
2* File: QwSubsystemArrayParity.h *
3* *
4* Author: P. M. King *
5* Time-stamp: <2009-02-04 10:30> *
6\**********************************************************/
7
8/*!
9 * \file QwSubsystemArrayParity.h
10 * \brief Subsystem array container for parity analysis with asymmetry calculations
11 */
12
13#pragma once
14
15#include <vector>
16#include <TTree.h>
17
18#include "QwSubsystemArray.h"
19#include "VQwSubsystemParity.h"
20
21// Forward declarations
22class QwBlinder;
23class QwParityDB;
24class QwPromptSummary;
25
26/**
27 * \class QwSubsystemArrayParity
28 * \ingroup QwAnalysis
29 * \brief Subsystem array container specialized for parity analysis with asymmetry calculations
30 *
31 * Extends QwSubsystemArray to provide parity-specific operations such as
32 * asymmetry formation, helicity-based accumulation, blinding support, and
33 * database output for parity measurements. Manages collections of
34 * VQwSubsystemParity objects with coordinated event processing.
35 */
37
38 private:
39
40 /// Private default constructor
41 QwSubsystemArrayParity(); // not implement, will thrown linker error on use
42
43 public:
44
45 friend class VQwDataHandler;
46 friend class QwAlarmHandler;
47 friend class QwCombiner;
48 friend class QwCorrelator;
49 friend class LRBCorrector;
50 friend class QwExtractor;
51
52 /// Constructor with options
54 /// Copy constructor by reference
56 /// Default destructor
57 ~QwSubsystemArrayParity() override;
58
59 /// \brief Get the subsystem with the specified name
60 VQwSubsystemParity* GetSubsystemByName(const TString& name) override;
61 /// \brief Construct a branch and vector for this subsystem with a prefix
62 void ConstructBranchAndVector(TTree *tree, TString& prefix, QwRootTreeBranchVector &values);
63 /// \brief Fill the vector for this subsystem
64 void FillTreeVector(QwRootTreeBranchVector &values) const;
65 /// \brief Fill the histograms for this subsystem
66 void FillHistograms();
67
68 /// \brief Fill the database with MPS-based variables
69 /// Note that most subsystems don't need to do this.
70 void FillDB_MPS(QwParityDB *db, TString type);
71 /// \brief Fill the database
72 void FillDB(QwParityDB *db, TString type);
73 void FillErrDB(QwParityDB *db, TString type);
74
75 /// \brief Assignment operator
77 /// \brief Addition-assignment operator
79 /// \brief Subtraction-assignment operator
81 /// \brief Sum of two subsystem arrays
82 void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2);
83 /// \brief Difference of two subsystem arrays
84 void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2);
85 /// \brief Ratio of two subsystem arrays
86 void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom);
87 /// \brief Scale this subsystem array
88 void Scale(Double_t factor);
89
90
91 /// \brief Update the running sums for devices accumulated for the global error non-zero events/patterns
92 void AccumulateRunningSum(const QwSubsystemArrayParity& value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF);
93 /// \brief Update the running sums for devices check only the error flags at the channel level. Only used for stability checks
94 void AccumulateAllRunningSum(const QwSubsystemArrayParity& value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF);
95 /// \brief Remove the entry value from the running sums for devices
96 void DeaccumulateRunningSum(const QwSubsystemArrayParity& value, Int_t ErrorMask=0xFFFFFFF);
97
98 /// \brief Calculate the average for all good events
100
101 /// \brief Blind the asymmetry of this subsystem
102 void Blind(const QwBlinder* blinder);
103 /// \brief Unblind the asymmetry of this subsystem
104 void UnBlind(const QwBlinder* /*blinder*/)
105 { /* Not yet implemented */ };
106 /// \brief Blind the difference of this subsystem
107 void Blind(const QwBlinder* blinder, const QwSubsystemArrayParity& yield);
108 /// \brief Unblind the difference of this subsystem
109 void UnBlind(const QwBlinder* /*blinder*/, const QwSubsystemArrayParity& /*yield*/)
110 { /* Not yet implemented */ };
111
112
113 /// \brief Apply the single event cuts
114 Bool_t ApplySingleEventCuts();
115 /// \brief Update the data elements' error counters based on their
116 /// internal error flags.
118
120 Bool_t CheckBadEventRange();
121 /// \brief Report the number of events failed due to HW and event cut failures
122 void PrintErrorCounters() const;
123 /// \brief Return the error flag to the main routine
124 UInt_t GetEventcutErrorFlag() const {
125 return fErrorFlag;
126 };
127 const UInt_t* GetEventcutErrorFlagPointer() const {
128 return &fErrorFlag;
129 };
130
131 /// \brief Update the error flag internally from all the subsystems
132 void UpdateErrorFlag();
133
134 /// \brief update the error flag for each channel in the subsystem array with the corresponding value in the ev_error subsystem array
135 void UpdateErrorFlag(const QwSubsystemArrayParity& ev_error);
136
137 void UpdateErrorFlag(UInt_t errflag){fErrorFlag |= errflag;};
138
139 /// \brief Print value of all channels
140 void PrintValue() const;
141
142 void WritePromptSummary(QwPromptSummary *ps, TString type);
143
144 virtual Bool_t CheckForEndOfBurst() const;
145
146 public:
147 void LoadMockDataParameters(std::string mapfile);
148 protected:
149
150 /// Test whether this subsystem array can contain a particular subsystem
151 static Bool_t CanContain(VQwSubsystem* subsys) {
152 return (dynamic_cast<VQwSubsystemParity*>(subsys) != 0);
153 };
154
157
158}; // class QwSubsystemArrayParity
Array container for managing multiple subsystems.
Virtual base class for parity analysis subsystems.
Command-line and configuration file options processor.
Definition QwOptions.h:141
A helper class to manage a vector of branch entries for ROOT trees.
Definition QwRootFile.h:53
QwSubsystemArray()
Private default constructor.
Base class for subsystems implementing container-delegation pattern.
Data blinding utilities for parity violation analysis.
Definition QwBlinder.h:57
Subsystem array container specialized for parity analysis with asymmetry calculations.
QwSubsystemArrayParity()
Private default constructor.
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
QwSubsystemArrayParity & operator=(const QwSubsystemArrayParity &value)
Assignment operator.
void PrintValue() const
Print value of all channels.
~QwSubsystemArrayParity() override
Default destructor.
VQwSubsystemParity * GetSubsystemByName(const TString &name) override
Get the subsystem with the specified name.
void DeaccumulateRunningSum(const QwSubsystemArrayParity &value, Int_t ErrorMask=0xFFFFFFF)
Remove the entry value from the running sums for devices.
void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
Ratio of two subsystem arrays.
void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Sum of two subsystem arrays.
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
Construct a branch and vector for this subsystem with a prefix.
void WritePromptSummary(QwPromptSummary *ps, TString type)
void AccumulateAllRunningSum(const QwSubsystemArrayParity &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
Update the running sums for devices check only the error flags at the channel level....
void FillDB(QwParityDB *db, TString type)
Fill the database.
void FillHistograms()
Fill the histograms for this subsystem.
void Scale(Double_t factor)
Scale this subsystem array.
void LoadMockDataParameters(std::string mapfile)
UInt_t GetEventcutErrorFlag() const
Return the error flag to the main routine.
void Blind(const QwBlinder *blinder)
Blind the asymmetry of this subsystem.
virtual Bool_t CheckForEndOfBurst() const
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.
Bool_t CheckForBurpFail(QwSubsystemArrayParity &event)
static Bool_t CanContain(VQwSubsystem *subsys)
Test whether this subsystem array can contain a particular subsystem.
const UInt_t * GetEventcutErrorFlagPointer() const
void IncrementErrorCounters()
Update the data elements' error counters based on their internal error flags.
void UpdateErrorFlag(UInt_t errflag)
void UnBlind(const QwBlinder *, const QwSubsystemArrayParity &)
Unblind the difference of this subsystem.
void UnBlind(const QwBlinder *)
Unblind the asymmetry of this subsystem.
QwSubsystemArrayParity & operator-=(const QwSubsystemArrayParity &value)
Subtraction-assignment operator.
void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Difference of two subsystem arrays.
void AccumulateRunningSum(const QwSubsystemArrayParity &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
void FillErrDB(QwParityDB *db, TString type)
QwSubsystemArrayParity & operator+=(const QwSubsystemArrayParity &value)
Addition-assignment operator.
void FillTreeVector(QwRootTreeBranchVector &values) const
Fill the vector for this subsystem.
void CalculateRunningAverage()
Calculate the average for all good events.
void FillDB_MPS(QwParityDB *db, TString type)
Fill the database with MPS-based variables Note that most subsystems don't need to do this.
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
Abstract base class for subsystems participating in parity analysis.