55 for (
size_t i = 0; i < this->size(); ++i) {
56 if (this->at(i) !=
nullptr) {
59 QwError <<
"QwSubsystemArrayParity::BuildResolvedParitySelf "
60 <<
"failed to cast slot " << i <<
" to VQwSubsystemParity."
71 const Bool_t cache_valid =
75 if (cache_valid)
return;
80 if (this->size() != value.size())
return;
82 for (
size_t i = 0; i < value.size(); ++i) {
86 if (ptr1 ==
nullptr || ptr2 ==
nullptr)
continue;
88 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
92 QwError <<
" typeid(*ptr1)=" <<
typeid(*ptr1).name()
93 <<
" but typeid(*ptr2)=" <<
typeid(*ptr2).name()
110 for (iterator subsys = begin(); subsys != end(); ++subsys) {
118 for (iterator subsys = begin(); subsys != end(); ++subsys) {
120 subsys_parity->
FillDB(db, type);
126 for (iterator subsys = begin(); subsys != end(); ++subsys) {
134 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
165 if (this->size() == value.size()){
168 for(
size_t i=0;i<value.size();i++){
191 if (this->size() == value.size()){
194 for(
size_t i=0;i<value.size();i++){
216 if (!value1.empty()&& !value2.empty()){
234 if (!value1.empty()&& !value2.empty()){
248 for (iterator subsys = begin(); subsys != end(); ++subsys) {
250 subsys_parity->
Scale(factor);
258 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
270 Bool_t status = kFALSE;
271 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
282 for (iterator subsys = begin(); subsys != end(); ++subsys) {
292 if (!value.empty()) {
293 if (this->size() == value.size()) {
298 for (
size_t i = 0; i < value.size(); i++) {
315 if (!value.empty()) {
316 if (this->size() == value.size()) {
319 for (
size_t i = 0; i < value.size(); i++) {
342 if (!value.empty()) {
343 if (this->size() == value.size()) {
346 for (
size_t i = 0; i < value.size(); i++) {
366 for (
size_t i = 0; i < this->size(); i++) {
371 if (this->at(i) == 0) {
372 QwError <<
"QwSubsystemArrayParity::Blind: "
373 <<
"parity subsystem null pointer!" <<
QwLog::endl;
378 subsys->
Blind(blinder);
385 if (this->size() != yield.size()) {
386 QwError <<
"QwSubsystemArrayParity::Blind: "
387 <<
"diff and yield array dimension mismatch!" <<
QwLog::endl;
392 for (
size_t i = 0; i < this->size(); i++) {
398 if (subsys_diff == 0 || subsys_yield == 0) {
399 QwError <<
"QwSubsystemArrayParity::Blind: "
400 <<
"diff or yield parity subsystem null pointer!" <<
QwLog::endl;
405 subsys_diff->
Blind(blinder, subsys_yield);
413 Bool_t localdebug=kFALSE;
415 if(localdebug) std::cout<<
"QwSubsystemArrayParity::Ratio \n";
417 if ( !denom.empty()){
419 if (this->size() == denom.size() ){
420 for(
size_t i=0;i<denom.size();i++){
421 if (denom.at(i)==NULL || this->at(i)==NULL){
423 if(localdebug) std::cout<<
"Either the value or the destination subsystem are null\n";
428 if (
typeid(*ptr1)==
typeid(*ptr2))
430 ptr1->
Ratio(numer.at(i).get(),denom.at(i).get());
434 <<
" type do not match : ratio computation aborted" <<
QwLog::endl;
446 if(localdebug) std::cout<<
"I am out of it \n";
461 for (iterator subsys = begin(); subsys != end(); ++subsys){
495 for (iterator subsys = begin(); subsys != end(); ++subsys){
504 Bool_t burpstatus = kFALSE;
505 if (!event.empty() && this->size() == event.size()){
506 for(
size_t i=0;i<
event.size();i++){
507 if (event.at(i)!=NULL && this->at(i)!=NULL){
510 if (
typeid(*ptr1)==
typeid(*ptr2)){
517 QwError <<
" QwSubsystemArrayParity::CheckForBurpFail types do not mach" <<
QwLog::endl;
518 QwError <<
" typeid(ptr1)=" <<
typeid(*ptr1).name()
519 <<
" but typeid(*(event.at(i).get()))=" <<
typeid(*ptr2).name()
534 for (const_iterator subsys = begin(); subsys != end(); ++subsys){
542 Bool_t localdebug=kFALSE;
543 if(localdebug) std::cout<<
"QwSubsystemArrayParity::UpdateErrorFlag \n";
544 if (!ev_error.empty()){
545 if (this->size() == ev_error.size()){
547 for(
size_t i=0;i<ev_error.size();i++){
548 if (ev_error.at(i)==NULL || this->at(i)==NULL){
555 if (
typeid(*ptr1)==
typeid(*ptr2)){
556 if(localdebug) std::cout<<
" here in QwSubsystemArrayParity::UpdateErrorFlag types mach \n";
562 QwError <<
" QwSubsystemArrayParity::UpdateErrorFlag types do not mach" <<
QwLog::endl;
563 QwError <<
" typeid(ptr1)=" <<
typeid(*ptr1).name()
564 <<
" but typeid(*(ev_error.at(i).get()))=" <<
typeid(*ptr2).name()
588 for (iterator subsys = begin(); subsys != end(); ++subsys){
597 std::vector< std::pair<UInt_t, UInt_t> >::iterator itber =
fBadEventRange.begin();
610 if (prefix.Contains(
"yield_") || prefix==
""){
613 tree->Branch(
"ErrorFlag", &(values.
back<Double_t>()),
"ErrorFlag/D");
644 std::unique_ptr<QwParameterFile> preamble =
nullptr;
649 double window_period = 0.0;
650 if (preamble->FileHasVariablePair(
"=",
"window_period",window_period)){
658 std::unique_ptr<QwParameterFile> section =
nullptr;
659 std::string section_name;
667 std::string subsys_type = section_name;
668 std::string subsys_name;
669 if (! section->FileHasVariablePair(
"=",
"name",subsys_name)) {
670 QwError <<
"No name defined in section for subsystem " << subsys_type <<
"." <<
QwLog::endl;
673 std::string mock_param_name;
674 if (! section->FileHasVariablePair(
"=",
"mock_param",mock_param_name)) {
675 QwError <<
"No mock data parameter defined for " << subsys_name <<
"." <<
QwLog::endl;
679 if (! subsys_parity){
680 QwError <<
"Subsystem " << subsys_name <<
" listed in the mock-data-parameter map does not match any subsystems in the detetor map file." <<
QwLog::endl;
#define QwVerbose
Predefined log drain for verbose messages.
#define QwError
Predefined log drain for errors.
#define QwMessage
Predefined log drain for regular messages.
ROOT file and tree management wrapper classes.
static const UInt_t kBadEventRangeError
static const UInt_t kGlobalCut
static const UInt_t kEventCutMode3
Subsystem array container for parity analysis with asymmetry calculations.
Virtual base class for parity analysis subsystems.
static const double ms
Time units: base unit is ms.
static std::ostream & endl(std::ostream &)
End of the line.
Command-line and configuration file options processor.
Configuration file parser with flexible tokenization and search capabilities.
std::unique_ptr< QwParameterFile > ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
std::unique_ptr< QwParameterFile > ReadNextSection(std::string &secname, const bool keep_header=false)
A helper class to manage a vector of branch entries for ROOT trees.
size_type size() const noexcept
void push_back(const std::string &name, const char type='D')
void SetValue(size_type index, Double_t val)
QwSubsystemArray & operator=(const QwSubsystemArray &value)
Assignment operator.
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
QwSubsystemArray()
Private default constructor.
void ConstructBranchAndVector(TTree *tree, QwRootTreeBranchVector &values)
Construct the tree and vector for this subsystem.
std::vector< std::pair< UInt_t, UInt_t > > fBadEventRange
void FillTreeVector(QwRootTreeBranchVector &values) const
Fill the vector for this subsystem.
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
void FillHistograms()
Fill the histograms for this subsystem.
Base class for subsystems implementing container-delegation pattern.
Data blinding utilities for parity violation analysis.
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 BuildResolvedParitySelf() const
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 ResolveParityPairing(const QwSubsystemArrayParity &value, const char *context) const
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)
Bool_t CheckBadEventRange()
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.
const QwSubsystemArrayParity * fResolvedParityPeer
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.
std::vector< Bool_t > fResolvedParityCompatible
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.
std::vector< VQwSubsystem * > fResolvedParityPeerSlots
void IncrementErrorCounters()
Update the data elements' error counters based on their internal error flags.
Int_t fErrorFlagTreeIndex
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.
std::vector< VQwSubsystemParity * > fResolvedParitySelf
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
Abstract base class for subsystems participating in parity analysis.
virtual void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)=0
virtual Bool_t CheckForBurpFail(const VQwSubsystem *subsys)=0
Report the number of events failed due to HW and event cut failures.
virtual UInt_t GetEventcutErrorFlag()=0
Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
virtual void PrintValue() const
Print values of all channels.
virtual void FillDB_MPS(QwParityDB *, TString)
Fill the database with MPS-based variables Note that most subsystems don't need to do this.
virtual Bool_t ApplySingleEventCuts()=0
Apply the single event cuts.
virtual void FillDB(QwParityDB *, TString)
Fill the database.
virtual void Blind(const QwBlinder *)
Blind the asymmetry of this subsystem.
virtual void WritePromptSummary(QwPromptSummary *, TString)
virtual void IncrementErrorCounters()=0
Increment the error counters.
virtual void PrintErrorCounters() const =0
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
virtual void LoadMockDataParameters(TString)
virtual void CalculateRunningAverage()=0
Calculate the average for all good events.
virtual Bool_t CheckForEndOfBurst() const
virtual void FillErrDB(QwParityDB *, TString)
virtual void Scale(Double_t factor)=0