JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwSubsystemArrayParity.cc
Go to the documentation of this file.
1/**********************************************************\
2* File: QwSubsystemArrayParity.cc *
3* *
4* Author: *
5* Time-stamp: *
6\**********************************************************/
7
9
10// System headers
11#include <stdexcept>
12
13// Qweak headers
14#include "VQwSubsystemParity.h"
15#include "QwRootFile.h"
16
17//*****************************************************************//
18
19/// Default constructor
27
28//*****************************************************************//
29
30/// Copy constructor
38
39//*****************************************************************//
40
41/// Destructor
46
47//*****************************************************************//
48
53
54//*****************************************************************//
55
56void QwSubsystemArrayParity::FillDB_MPS(QwParityDB *db, TString type)
57{
58 for (iterator subsys = begin(); subsys != end(); ++subsys) {
59 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
60 subsys_parity->FillDB_MPS(db, type);
61 }
62}
63
64void QwSubsystemArrayParity::FillDB(QwParityDB *db, TString type)
65{
66 for (iterator subsys = begin(); subsys != end(); ++subsys) {
67 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
68 subsys_parity->FillDB(db, type);
69 }
70}
71
72void QwSubsystemArrayParity::FillErrDB(QwParityDB *db, TString type)
73{
74 for (iterator subsys = begin(); subsys != end(); ++subsys) {
75 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
76 subsys_parity->FillErrDB(db, type);
77 }
78}
79
81{
82 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
83 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
84 subsys_parity->WritePromptSummary(ps, type);
85 }
86}
87
88//*****************************************************************//
89
90/**
91 * Assignment operator
92 * @param source Subsystem array to assign to this array
93 * @return This subsystem array after assignment
94 */
101
102
103/**
104 * Addition-assignment operator
105 * @param value Subsystem array to add to this array
106 * @return This subsystem array after addition
107 */
109{
110 if (!value.empty()){
112 std::min(fCodaEventNumber, value.fCodaEventNumber);
113 if (this->size() == value.size()){
114 this->fErrorFlag|=value.fErrorFlag;
115 for(size_t i=0;i<value.size();i++){
116 if (value.at(i)==NULL || this->at(i)==NULL){
117 // Either the value or the destination subsystem
118 // are null
119 } else {
120 VQwSubsystemParity *ptr1 =
121 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
122 VQwSubsystem *ptr2 = value.at(i).get();
123 if (typeid(*ptr1)==typeid(*ptr2)){
124 *(ptr1) += ptr2;
125 //std::cout<<"QwSubsystemArrayParity::operator+ here where types match \n";
126 } else {
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()
130 << QwLog::endl;
131 // Subsystems don't match
132 }
133 }
134 }
135 } else {
136 // Array sizes don't match
137 }
138 } else {
139 // The vsource is empty
140 }
141 return *this;
142}
143
144/**
145 * Subtraction-assignment operator
146 * @param value Subsystem array to subtract from this array
147 * @return This array after subtraction
148 */
150{
151 if (!value.empty()){
153 std::min(fCodaEventNumber, value.fCodaEventNumber);
154 if (this->size() == value.size()){
155 this->fErrorFlag|=value.fErrorFlag;
156 for(size_t i=0;i<value.size();i++){
157 if (value.at(i)==NULL || this->at(i)==NULL){
158 // Either the value or the destination subsystem
159 // are null
160 } else {
161 VQwSubsystemParity *ptr1 =
162 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
163 VQwSubsystem *ptr2 = value.at(i).get();
164 if (typeid(*ptr1)==typeid(*ptr2)){
165 *(ptr1) -= ptr2;
166 } else {
167 // Subsystems don't match
168 }
169 }
170 }
171 } else {
172 // Array sizes don't match
173 }
174 } else {
175 // The vsource is empty
176 }
177 return *this;
178}
179
180/**
181 * Sum of two subsystem arrays
182 * @param value1 First subsystem array
183 * @param value2 Second subsystem array
184 */
186 const QwSubsystemArrayParity &value1,
187 const QwSubsystemArrayParity &value2)
188{
189 if (!value1.empty()&& !value2.empty()){
190 *(this) = value1;
191 *(this) += value2;
192 } else {
193 // The source is empty
194 }
195}
196
197/**
198 * Difference of two subsystem arrays
199 * @param value1 First subsystem array
200 * @param value2 Second subsystem array
201 */
203 const QwSubsystemArrayParity &value1,
204 const QwSubsystemArrayParity &value2)
205{
206
207 if (!value1.empty()&& !value2.empty()){
208 *(this) = value1;
209 *(this) -= value2;
210 } else {
211 // The source is empty
212 }
213}
214
215/**
216 * Scale this subsystem array
217 * @param factor Scale factor
218 */
219void QwSubsystemArrayParity::Scale(Double_t factor)
220{
221 for (iterator subsys = begin(); subsys != end(); ++subsys) {
222 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
223 subsys_parity->Scale(factor);
224 }
225}
226
227//*****************************************************************//
228
230{
231 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
232 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
233 subsys_parity->PrintValue();
234 }
235}
236
237
238
239//*****************************************************************//
240
242{
243 Bool_t status = kFALSE;
244 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
245 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
246 status |= subsys_parity->CheckForEndOfBurst();
247 }
248 return status;
249};
250
251//*****************************************************************//
252
254{
255 for (iterator subsys = begin(); subsys != end(); ++subsys) {
256 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
257 subsys_parity->CalculateRunningAverage();
258 }
259}
260
261
262
263void QwSubsystemArrayParity::AccumulateRunningSum(const QwSubsystemArrayParity& value, Int_t count, Int_t ErrorMask)
264{
265 if (!value.empty()) {
266 if (this->size() == value.size()) {
267 if (value.GetEventcutErrorFlag()==0){//do running sum only if error flag is zero. This way will prevent any Beam Trip(in ev mode 3) related events going into the running sum.
269 std::min(fCodaEventNumber, value.fCodaEventNumber);
270 for (size_t i = 0; i < value.size(); i++) {
271 if (value.at(i)==NULL || this->at(i)==NULL) {
272 // Either the value or the destination subsystem
273 // are null
274 } else {
275 VQwSubsystemParity *ptr1 =
276 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
277 VQwSubsystem *ptr2 = value.at(i).get();
278 if (typeid(*ptr1) == typeid(*ptr2)) {
279 ptr1->AccumulateRunningSum(ptr2, count, ErrorMask);
280 } else {
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()
284 << QwLog::endl;
285 // Subsystems don't match
286 }
287 }
288 }
289 }
290
291 } else {
292 // Array sizes don't match
293
294 }
295 } else {
296 // The value is empty
297 }
298}
299
300void QwSubsystemArrayParity::AccumulateAllRunningSum(const QwSubsystemArrayParity& value, Int_t count, Int_t ErrorMask)
301{
302 if (!value.empty()) {
303 if (this->size() == value.size()) {
304 //if (value.GetEventcutErrorFlag()==0){//do running sum only if error flag is zero. This way will prevent any Beam Trip(in ev mode 3) related events going into the running sum.
305 for (size_t i = 0; i < value.size(); i++) {
306 if (value.at(i)==NULL || this->at(i)==NULL) {
307 // Either the value or the destination subsystem
308 // are null
309 } else {
310 VQwSubsystemParity *ptr1 =
311 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
312 VQwSubsystem *ptr2 = value.at(i).get();
313 if (typeid(*ptr1) == typeid(*ptr2)) {
314 ptr1->AccumulateRunningSum(ptr2, count, ErrorMask);
315 } else {
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()
319 << QwLog::endl;
320 // Subsystems don't match
321 }
322 }
323 }
324 //}//else if ((value.fErrorFlag& 512)==512){
325 //QwMessage << " AccumulateRunningSum "<<(value.fErrorFlag & 0x2FF)<<" - "<<value.GetCodaEventNumber()<< QwLog::endl;
326 //}
327 } else {
328 // Array sizes don't match
329
330 }
331 } else {
332 // The value is empty
333 }
334}
335
336
338{
339 //Bool_t berror=kTRUE;//only needed for deaccumulation (stability check purposes)
340 //if (value.fErrorFlag>0){//check the error is global
341 //berror=((value.fErrorFlag & 0x2FF) == 0); //The operation value.fErrorFlag & 0x2FF clear everything else but the HW errors + event cut errors + blinder error
342 //}
343 if (!value.empty()) {
344 if (this->size() == value.size()) {
345 //if (value.GetEventcutErrorFlag()==0){//do derunningsum only if error flag is zero.
346 for (size_t i = 0; i < value.size(); i++) {
347 if (value.at(i)==NULL || this->at(i)==NULL) {
348 // Either the value or the destination subsystem
349 // are null
350 } else {
351 VQwSubsystemParity *ptr1 =
352 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
353 VQwSubsystem *ptr2 = value.at(i).get();
354 if (typeid(*ptr1) == typeid(*ptr2)) {
355 ptr1->DeaccumulateRunningSum(ptr2, ErrorMask);
356 } else {
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()
360 << QwLog::endl;
361 // Subsystems don't match
362 }
363 }
364 }
365 //}//else if ((value.fErrorFlag & 268435968)==268435968){
366 //QwMessage << " DeaccumulateRunningSum "<<(value.fErrorFlag & 0x2FF)<<" - "<<value.GetCodaEventNumber()<< QwLog::endl;
367 //}
368 } else {
369 // Array sizes don't match
370
371 }
372 } else {
373 // The value is empty
374 }
375}
376
377
379{
380 // Loop over subsystem array
381 for (size_t i = 0; i < this->size(); i++) {
382 // Cast into parity subsystems
383 VQwSubsystemParity* subsys = dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
384
385 // Check for null pointers
386 if (this->at(i) == 0) {
387 QwError << "QwSubsystemArrayParity::Blind: "
388 << "parity subsystem null pointer!" << QwLog::endl;
389 return;
390 }
391
392 // Apply blinding
393 subsys->Blind(blinder);
394 }
395}
396
398{
399 // Check for array size
400 if (this->size() != yield.size()) {
401 QwError << "QwSubsystemArrayParity::Blind: "
402 << "diff and yield array dimension mismatch!" << QwLog::endl;
403 return;
404 }
405
406 // Loop over subsystem array
407 for (size_t i = 0; i < this->size(); i++) {
408 // Cast into parity subsystems
409 VQwSubsystemParity* subsys_diff = dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
410 VQwSubsystemParity* subsys_yield = dynamic_cast<VQwSubsystemParity*>(yield.at(i).get());
411
412 // Check for null pointers
413 if (subsys_diff == 0 || subsys_yield == 0) {
414 QwError << "QwSubsystemArrayParity::Blind: "
415 << "diff or yield parity subsystem null pointer!" << QwLog::endl;
416 return;
417 }
418
419 // Apply blinding
420 subsys_diff->Blind(blinder, subsys_yield);
421 }
422}
423
425 const QwSubsystemArrayParity &numer,
426 const QwSubsystemArrayParity &denom)
427{
428 Bool_t localdebug=kFALSE;
429
430 if(localdebug) std::cout<<"QwSubsystemArrayParity::Ratio \n";
431 *this=numer;
432 if ( !denom.empty()){
433 this->fErrorFlag=(numer.fErrorFlag|denom.fErrorFlag);
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){
437 // Either the value or the destination subsystem are null
438 if(localdebug) std::cout<<"Either the value or the destination subsystem are null\n";
439 } else {
440 VQwSubsystemParity *ptr1 =
441 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
442 VQwSubsystem *ptr2 = denom.at(i).get();
443 if (typeid(*ptr1)==typeid(*ptr2))
444 {
445 ptr1->Ratio(numer.at(i).get(),denom.at(i).get());
446 } else {
447 // Subsystems don't match
448 QwError << "subsystem #" << i
449 << " type do not match : ratio computation aborted" << QwLog::endl;
450 }
451 }
452 }
453 } else {
454 QwError << "array size do not match : ratio computation aborted" << QwLog::endl;
455 // Array sizes don't match
456 }
457 } else {
458 QwError << "source empty : ratio computation aborted" << QwLog::endl;
459 // The source is empty
460 }
461 if(localdebug) std::cout<<"I am out of it \n";
462
463}
464
466 Int_t CountFalse;
467 Bool_t status;
468 UInt_t ErrorFlag;
469 fErrorFlag=0; // Testing if event number is within bad Event Range cut
470 if( CheckBadEventRange() )
472
473 VQwSubsystemParity *subsys_parity = nullptr;
474 CountFalse=0;
475 if (!empty()){
476 for (iterator subsys = begin(); subsys != end(); ++subsys){
477 subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
478 status=subsys_parity->ApplySingleEventCuts();
479 ErrorFlag = subsys_parity->GetEventcutErrorFlag();
480 if ((ErrorFlag & kEventCutMode3)==kEventCutMode3)//we only care about the event cut flag in event cut mode 3
481 fErrorFlag |= ErrorFlag;
482 if (!status)
483 {
484 if ((ErrorFlag&kGlobalCut)==kGlobalCut){
485 CountFalse++;
486 fErrorFlag |= ErrorFlag; //we need the error code for failed events in event mode 2 for beam trips and etc.
487 }
488 }
489
490
491 }
492 }
493 if (CountFalse > 0)
494 status = kFALSE;
495 else
496 status = kTRUE;
497
498 // Propagate all error codes to derived objects in the subsystems.
500
501 return status;
502}
503
504
505
507{
508 VQwSubsystemParity *subsys_parity = nullptr;
509 if (!empty()){
510 for (iterator subsys = begin(); subsys != end(); ++subsys){
511 subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
512 subsys_parity->IncrementErrorCounters();
513 }
514 }
515}
516
518{
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){
523 VQwSubsystemParity *ptr1 = dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
524 VQwSubsystem *ptr2 = event.at(i).get();
525 if (typeid(*ptr1)==typeid(*ptr2)){
526 //*(ptr1) = event.at(i).get();//when =operator is used
527 //pass the correct subsystem to update the errorflags at subsystem to devices to channel levels
528 //wError << "************* test " << typeid(*ptr1).name() << "*****************" << QwLog::endl;
529 burpstatus |= ptr1->CheckForBurpFail(ptr2);
530 } else {
531 // Subsystems don't match
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()
535 << QwLog::endl;
536 }
537 }
538 }
539 } else {
540 // The source is empty
541 }
542 return burpstatus;
543}
544
545
546void QwSubsystemArrayParity::PrintErrorCounters() const{// report number of events failed due to HW and event cut failure
547 const VQwSubsystemParity *subsys_parity = nullptr;
548 if (!empty()){
549 for (const_iterator subsys = begin(); subsys != end(); ++subsys){
550 subsys_parity=dynamic_cast<const VQwSubsystemParity*>((subsys)->get());
551 subsys_parity->PrintErrorCounters();
552 }
553 }
554}
555
557 Bool_t localdebug=kFALSE;//kTRUE;
558 if(localdebug) std::cout<<"QwSubsystemArrayParity::UpdateErrorFlag \n";
559 if (!ev_error.empty()){
560 if (this->size() == ev_error.size()){
561 this->fErrorFlag |= ev_error.fErrorFlag;
562 for(size_t i=0;i<ev_error.size();i++){
563 if (ev_error.at(i)==NULL || this->at(i)==NULL){
564 // Either the source or the destination subsystem
565 // are null
566 } else {
567 VQwSubsystemParity *ptr1 =
568 dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
569 VQwSubsystem *ptr2 = ev_error.at(i).get();
570 if (typeid(*ptr1)==typeid(*ptr2)){
571 if(localdebug) std::cout<<" here in QwSubsystemArrayParity::UpdateErrorFlag types mach \n";
572 //*(ptr1) = ev_error.at(i).get();//when =operator is used
573 //pass the correct subsystem to update the errorflags at subsystem to devices to channel levels
574 ptr1->UpdateErrorFlag(ev_error.at(i).get());
575 } else {
576 // Subsystems don't match
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()
580 << QwLog::endl;
581 }
582 }
583 }
584 } else {
585 // Array sizes don't match
586 }
587 } else {
588 // The source is empty
589 }
590};
591
592
594 //this routine will refresh the global error flag after stability cut check
595 //by default at the ApplySingleEventCuts routine fErrorFlag is updated properly and a const GetEventcutErrorFlag() routine
596 //returns the fErrorFlag value
597 fErrorFlag=0;
598 if( CheckBadEventRange() )
600
601 VQwSubsystemParity *subsys_parity = nullptr;
602 if (!empty()){
603 for (iterator subsys = begin(); subsys != end(); ++subsys){
604 subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
605 //Update the error flag of the parity subsystem
606 fErrorFlag|=subsys_parity->UpdateErrorFlag();
607 }
608 }
609}
610
612 std::vector< std::pair<UInt_t, UInt_t> >::iterator itber = fBadEventRange.begin(); // ber = bad event range
613 while(itber!=fBadEventRange.end()){
614 if( fCodaEventNumber >= (*itber).first
615 && fCodaEventNumber <= (*itber).second){
616 return kTRUE;
617 }
618 itber++;
619 }
620 return kFALSE;
621}
622
624 QwSubsystemArray::ConstructBranchAndVector(tree, prefix, values);
625 if (prefix.Contains("yield_") || prefix==""){
626 values.push_back("ErrorFlag", 'D');
627 fErrorFlagTreeIndex = values.size()-1;
628 tree->Branch("ErrorFlag", &(values.back<Double_t>()), "ErrorFlag/D");
629 } else {
631 }
632}
633
635{
637 if (fErrorFlagTreeIndex>=0 && fErrorFlagTreeIndex<static_cast<int>(values.size())){
638 values.SetValue(fErrorFlagTreeIndex, static_cast<double>(fErrorFlag));
639 }
640}
641
642
643//*****************************************************************//
649
650//*****************************************************************//
652{
653 // for (iterator subsys = begin(); subsys != end(); ++subsys) {
654 // VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(GetSubsystemByName(subsys_name)->LoadMockDataParameters(mock_param_name));
655 // subsys_parity->LoadMockDataParameters(mapfile);
656 // }
657 QwParameterFile detectors(mapfile);
658 // This is how this should work
659 std::unique_ptr<QwParameterFile> preamble = nullptr;
660 preamble = detectors.ReadSectionPreamble();
661 // Process preamble
662 QwVerbose << "Preamble:" << QwLog::endl;
663 QwVerbose << *preamble << QwLog::endl;
664 double window_period = 0.0;
665 if (preamble->FileHasVariablePair("=","window_period",window_period)){
666 fWindowPeriod = window_period * Qw::sec;
667 }else{
669 }
670
671 QwMessage << "fWindowPeriod = " << fWindowPeriod << QwLog::endl;
672
673 std::unique_ptr<QwParameterFile> section = nullptr;
674 std::string section_name;
675 while ((section = detectors.ReadNextSection(section_name))) {
676
677 // Debugging output of configuration section
678 QwVerbose << "[" << section_name << "]" << QwLog::endl;
679 QwVerbose << *section << QwLog::endl;
680
681 // Determine type and name of subsystem
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;
686 continue;
687 }
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;
691 continue;
692 }
693 VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(GetSubsystemByName(subsys_name));
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;
696 } else {
697 subsys_parity->LoadMockDataParameters(mock_param_name);
698 }
699 }
700}
#define QwVerbose
Predefined log drain for verbose messages.
Definition QwLog.h:54
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
ROOT file and tree management wrapper classes.
static const UInt_t kBadEventRangeError
Definition QwTypes.h:185
static const UInt_t kGlobalCut
Definition QwTypes.h:182
static const UInt_t kEventCutMode3
Definition QwTypes.h:174
Subsystem array container for parity analysis with asymmetry calculations.
Virtual base class for parity analysis subsystems.
static const double sec
Definition QwUnits.h:80
static const double ms
Time units: base unit is ms.
Definition QwUnits.h:77
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Command-line and configuration file options processor.
Definition QwOptions.h:141
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.
Definition QwRootFile.h:53
size_type size() const noexcept
Definition QwRootFile.h:81
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:195
void SetValue(size_type index, Double_t val)
Definition QwRootFile.h:108
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.
Definition QwBlinder.h:57
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.
void IncrementErrorCounters()
Update the data elements' error counters based on their internal error flags.
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