58 for (iterator subsys = begin(); subsys != end(); ++subsys) {
66 for (iterator subsys = begin(); subsys != end(); ++subsys) {
68 subsys_parity->
FillDB(db, type);
74 for (iterator subsys = begin(); subsys != end(); ++subsys) {
82 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
113 if (this->size() == value.size()){
115 for(
size_t i=0;i<value.size();i++){
116 if (value.at(i)==NULL || this->at(i)==NULL){
123 if (
typeid(*ptr1)==
typeid(*ptr2)){
127 QwError <<
"QwSubsystemArrayParity::operator+ here where types don't match" <<
QwLog::endl;
128 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
129 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
154 if (this->size() == value.size()){
156 for(
size_t i=0;i<value.size();i++){
157 if (value.at(i)==NULL || this->at(i)==NULL){
164 if (
typeid(*ptr1)==
typeid(*ptr2)){
189 if (!value1.empty()&& !value2.empty()){
207 if (!value1.empty()&& !value2.empty()){
221 for (iterator subsys = begin(); subsys != end(); ++subsys) {
223 subsys_parity->
Scale(factor);
231 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
243 Bool_t status = kFALSE;
244 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
255 for (iterator subsys = begin(); subsys != end(); ++subsys) {
265 if (!value.empty()) {
266 if (this->size() == value.size()) {
270 for (
size_t i = 0; i < value.size(); i++) {
271 if (value.at(i)==NULL || this->at(i)==NULL) {
278 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
281 QwError <<
"QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" <<
QwLog::endl;
282 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
283 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
302 if (!value.empty()) {
303 if (this->size() == value.size()) {
305 for (
size_t i = 0; i < value.size(); i++) {
306 if (value.at(i)==NULL || this->at(i)==NULL) {
313 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
316 QwError <<
"QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" <<
QwLog::endl;
317 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
318 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
343 if (!value.empty()) {
344 if (this->size() == value.size()) {
346 for (
size_t i = 0; i < value.size(); i++) {
347 if (value.at(i)==NULL || this->at(i)==NULL) {
354 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
357 QwError <<
"QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" <<
QwLog::endl;
358 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
359 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
381 for (
size_t i = 0; i < this->size(); i++) {
386 if (this->at(i) == 0) {
387 QwError <<
"QwSubsystemArrayParity::Blind: "
388 <<
"parity subsystem null pointer!" <<
QwLog::endl;
393 subsys->
Blind(blinder);
400 if (this->size() != yield.size()) {
401 QwError <<
"QwSubsystemArrayParity::Blind: "
402 <<
"diff and yield array dimension mismatch!" <<
QwLog::endl;
407 for (
size_t i = 0; i < this->size(); i++) {
413 if (subsys_diff == 0 || subsys_yield == 0) {
414 QwError <<
"QwSubsystemArrayParity::Blind: "
415 <<
"diff or yield parity subsystem null pointer!" <<
QwLog::endl;
420 subsys_diff->
Blind(blinder, subsys_yield);
428 Bool_t localdebug=kFALSE;
430 if(localdebug) std::cout<<
"QwSubsystemArrayParity::Ratio \n";
432 if ( !denom.empty()){
434 if (this->size() == denom.size() ){
435 for(
size_t i=0;i<denom.size();i++){
436 if (denom.at(i)==NULL || this->at(i)==NULL){
438 if(localdebug) std::cout<<
"Either the value or the destination subsystem are null\n";
443 if (
typeid(*ptr1)==
typeid(*ptr2))
445 ptr1->
Ratio(numer.at(i).get(),denom.at(i).get());
449 <<
" type do not match : ratio computation aborted" <<
QwLog::endl;
461 if(localdebug) std::cout<<
"I am out of it \n";
476 for (iterator subsys = begin(); subsys != end(); ++subsys){
510 for (iterator subsys = begin(); subsys != end(); ++subsys){
519 Bool_t burpstatus = kFALSE;
520 if (!event.empty() && this->size() == event.size()){
521 for(
size_t i=0;i<
event.size();i++){
522 if (event.at(i)!=NULL && this->at(i)!=NULL){
525 if (
typeid(*ptr1)==
typeid(*ptr2)){
532 QwError <<
" QwSubsystemArrayParity::CheckForBurpFail types do not mach" <<
QwLog::endl;
533 QwError <<
" typeid(ptr1)=" <<
typeid(*ptr1).name()
534 <<
" but typeid(*(event.at(i).get()))=" <<
typeid(*ptr2).name()
549 for (const_iterator subsys = begin(); subsys != end(); ++subsys){
557 Bool_t localdebug=kFALSE;
558 if(localdebug) std::cout<<
"QwSubsystemArrayParity::UpdateErrorFlag \n";
559 if (!ev_error.empty()){
560 if (this->size() == ev_error.size()){
562 for(
size_t i=0;i<ev_error.size();i++){
563 if (ev_error.at(i)==NULL || this->at(i)==NULL){
570 if (
typeid(*ptr1)==
typeid(*ptr2)){
571 if(localdebug) std::cout<<
" here in QwSubsystemArrayParity::UpdateErrorFlag types mach \n";
577 QwError <<
" QwSubsystemArrayParity::UpdateErrorFlag types do not mach" <<
QwLog::endl;
578 QwError <<
" typeid(ptr1)=" <<
typeid(*ptr1).name()
579 <<
" but typeid(*(ev_error.at(i).get()))=" <<
typeid(*ptr2).name()
603 for (iterator subsys = begin(); subsys != end(); ++subsys){
612 std::vector< std::pair<UInt_t, UInt_t> >::iterator itber =
fBadEventRange.begin();
625 if (prefix.Contains(
"yield_") || prefix==
""){
628 tree->Branch(
"ErrorFlag", &(values.
back<Double_t>()),
"ErrorFlag/D");
659 std::unique_ptr<QwParameterFile> preamble =
nullptr;
664 double window_period = 0.0;
665 if (preamble->FileHasVariablePair(
"=",
"window_period",window_period)){
673 std::unique_ptr<QwParameterFile> section =
nullptr;
674 std::string section_name;
682 std::string subsys_type = section_name;
683 std::string subsys_name;
684 if (! section->FileHasVariablePair(
"=",
"name",subsys_name)) {
685 QwError <<
"No name defined in section for subsystem " << subsys_type <<
"." <<
QwLog::endl;
688 std::string mock_param_name;
689 if (! section->FileHasVariablePair(
"=",
"mock_param",mock_param_name)) {
690 QwError <<
"No mock data parameter defined for " << subsys_name <<
"." <<
QwLog::endl;
694 if (! subsys_parity){
695 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 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)
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.
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.
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.
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 AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)=0
Update the running sums for devices.
virtual void CalculateRunningAverage()=0
Calculate the average for all good events.
virtual Bool_t CheckForEndOfBurst() const
virtual void FillErrDB(QwParityDB *, TString)
virtual void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF)=0
remove one entry from the running sums for devices
virtual void Scale(Double_t factor)=0