QwAnalysis
QwSubsystemArrayParity Class Reference

Virtual base class for the parity subsystems. More...

#include <QwSubsystemArrayParity.h>

+ Inheritance diagram for QwSubsystemArrayParity:
+ Collaboration diagram for QwSubsystemArrayParity:

Public Member Functions

 QwSubsystemArrayParity (QwOptions &options)
 Constructor with options. More...
 
 QwSubsystemArrayParity (const QwSubsystemArrayParity &source)
 Copy constructor by reference. More...
 
virtual ~QwSubsystemArrayParity ()
 Default destructor. More...
 
VQwSubsystemParityGetSubsystemByName (const TString &name)
 Get the subsystem with the specified name. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 Construct a branch and vector for this subsystem with a prefix. More...
 
void FillTreeVector (std::vector< Double_t > &values) const
 Fill the vector for this subsystem. More...
 
void FillHistograms ()
 Fill the histograms for this subsystem. More...
 
void FillDB_MPS (QwParityDB *db, TString type)
 Fill the database with MPS-based variables Note that most subsystems don't need to do this. More...
 
void FillDB (QwParityDB *db, TString type)
 Fill the database. More...
 
void FillErrDB (QwParityDB *db, TString type)
 
QwSubsystemArrayParityoperator= (const QwSubsystemArrayParity &value)
 Assignment operator. More...
 
QwSubsystemArrayParityoperator+= (const QwSubsystemArrayParity &value)
 Addition-assignment operator. More...
 
QwSubsystemArrayParityoperator-= (const QwSubsystemArrayParity &value)
 Subtraction-assignment operator. More...
 
void Sum (const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
 Sum of two subsystem arrays. More...
 
void Difference (const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
 Difference of two subsystem arrays. More...
 
void Ratio (const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
 Ratio of two subsystem arrays. More...
 
void Scale (Double_t factor)
 Scale this subsystem array. More...
 
void AccumulateRunningSum (const QwSubsystemArrayParity &value)
 Update the running sums for devices accumulated for the global error non-zero events/patterns. More...
 
void AccumulateAllRunningSum (const QwSubsystemArrayParity &value)
 Update the running sums for devices check only the error flags at the channel level. Only used for stability checks. More...
 
void DeaccumulateRunningSum (const QwSubsystemArrayParity &value)
 Remove the entry value from the running sums for devices. More...
 
void CalculateRunningAverage ()
 Calculate the average for all good events. More...
 
void Blind (const QwBlinder *blinder)
 Blind the asymmetry of this subsystem. More...
 
void UnBlind (const QwBlinder *blinder)
 Unblind the asymmetry of this subsystem. More...
 
void Blind (const QwBlinder *blinder, const QwSubsystemArrayParity &yield)
 Blind the difference of this subsystem. More...
 
void UnBlind (const QwBlinder *blinder, const QwSubsystemArrayParity &yield)
 Unblind the difference of this subsystem. More...
 
Bool_t ApplySingleEventCuts ()
 Apply the single event cuts. More...
 
void IncrementErrorCounters ()
 Update the data elements' error counters based on their internal error flags. More...
 
void PrintErrorCounters () const
 Report the number of events failed due to HW and event cut failures. More...
 
UInt_t GetEventcutErrorFlag () const
 Return the error flag to the main routine. More...
 
void UpdateErrorFlag ()
 Update the error flag internally from all the subsystems. More...
 
void UpdateErrorFlag (const QwSubsystemArrayParity &ev_error)
 update the error flag for each channel in the subsystem array with the corresponding value in the ev_error subsystem array More...
 
void PrintValue () const
 Print value of all channels. More...
 
void WritePromptSummary (QwPromptSummary *ps, TString type)
 
virtual Bool_t CheckForEndOfBurst () const
 
- Public Member Functions inherited from QwSubsystemArray
 QwSubsystemArray (QwOptions &options, CanContainFn myCanContain)
 Constructor with options. More...
 
 QwSubsystemArray (const QwSubsystemArray &source)
 Copy constructor by reference. More...
 
virtual ~QwSubsystemArray ()
 Virtual destructor. More...
 
void SetCodaRunNumber (UInt_t runnum)
 Set the internal record of the CODA run number. More...
 
void SetCodaSegmentNumber (UInt_t segnum)
 Set the internal record of the CODA segment number. More...
 
void SetCodaEventNumber (UInt_t evtnum)
 Set the internal record of the CODA event number. More...
 
void SetCodaEventType (UInt_t evttype)
 Set the internal record of the CODA event type. More...
 
UInt_t GetCodaRunNumber () const
 Get the internal record of the CODA run number. More...
 
UInt_t GetCodaSegmentNumber () const
 Get the internal record of the CODA segment number. More...
 
UInt_t GetCodaEventNumber () const
 Get the internal record of the CODA event number. More...
 
UInt_t GetCodaEventType () const
 Get the internal record of the CODA event type. More...
 
void SetCleanParameters (Double_t cleanparameter[3])
 Set the internal record of the CODA event number. More...
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask. More...
 
UInt_t GetEventTypeMask () const
 Get event type mask. More...
 
UInt_t UpdateEventTypeMask ()
 Update the event type mask from the subsystems. More...
 
void SetDataLoaded (const Bool_t flag)
 Set data loaded flag. More...
 
Bool_t HasDataLoaded () const
 Get data loaded flag. More...
 
void ProcessOptionsToplevel (QwOptions &options)
 Process configuration options for the subsystem array itself. More...
 
void ProcessOptionsSubsystems (QwOptions &options)
 Process configuration options for all subsystems in the array. More...
 
void ProcessOptions (QwOptions &options)
 Process configuration options (default behavior) More...
 
void push_back (VQwSubsystem *subsys)
 Add the subsystem to this array. More...
 
virtual std::vector
< VQwSubsystem * > 
GetSubsystemByType (const std::string &type)
 Get the list of subsystems of the specified type. More...
 
void ClearEventData ()
 
Int_t ProcessConfigurationBuffer (const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 Process the event buffer for configuration events. More...
 
Int_t ProcessEvBuffer (const UInt_t event_type, const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 Process the event buffer for events. More...
 
void RandomizeEventData (int helicity=0, double time=0.0)
 Randomize the data in this event. More...
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 Encode the data in this event. More...
 
void ProcessEvent ()
 Process the decoded data in this event. More...
 
void AtEndOfEventLoop ()
 Perform actions at the end of the event loop. More...
 
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays. More...
 
const VQwHardwareChannelReturnInternalValue (const TString &name) const
 Retrieve the variable name from subsystems in this subsystem array. More...
 
Bool_t ReturnInternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from subsystems in this subsystem array. More...
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwSubsystem *subsys, const VQwHardwareChannel *element)
 Publish the value name with description from a subsystem in this array. More...
 
void ListPublishedValues () const
 List the published values and description in this subsystem array. More...
 
void PrintParamFileList () const
 Print list of parameter files. More...
 
TList * GetParamFileNameList (TString name) const
 Get list of parameter files. More...
 
void PrintInfo () const
 Print some information about the subsystem. More...
 
void push_back (boost::shared_ptr< VQwSubsystem > subsys)
 
void ConstructHistograms ()
 Construct the histograms for this subsystem. More...
 
void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder. More...
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this subsystem in a folder with a prefix. More...
 
void FillHistograms ()
 Fill the histograms for this subsystem. More...
 
void ShareHistograms (const QwSubsystemArray &source)
 Share the histograms with another subsystem. More...
 
void ConstructBranchAndVector (TTree *tree, std::vector< Double_t > &values)
 Construct the tree and vector for this subsystem. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 Construct a branch and vector for this subsystem with a prefix. More...
 
void ConstructBranch (TTree *tree, TString &prefix)
 Construct a branch for this subsystem with a prefix. More...
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file)
 Construct a branch for this subsystem with a prefix after tree leave trimming. More...
 
void FillTreeVector (std::vector< Double_t > &values) const
 Fill the vector for this subsystem. More...
 
void ConstructTree ()
 Construct the tree for this subsystem. More...
 
void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder. More...
 
void ConstructTree (TDirectory *folder, TString &prefix)
 Construct the tree for this subsystem in a folder with a prefix. More...
 
void FillTree ()
 Fill the tree for this subsystem. More...
 
void DeleteTree ()
 Delete the tree for this subsystem. More...
 

Data Fields

const QwSubsystemArrayParitydummy_source
 
- Data Fields inherited from std::vector< T >
elements
 STL member. More...
 

Static Protected Member Functions

static Bool_t CanContain (VQwSubsystem *subsys)
 Test whether this subsystem array can contain a particular subsystem. More...
 
- Static Protected Member Functions inherited from QwSubsystemArray
static Bool_t CanContain (VQwSubsystem *subsys)
 Test whether this subsystem array can contain a particular subsystem. More...
 

Protected Attributes

UInt_t fErrorFlag
 
Int_t fErrorFlagTreeIndex
 
- Protected Attributes inherited from QwSubsystemArray
size_t fTreeArrayIndex
 
UInt_t fCodaRunNumber
 Index of this data element in root tree. More...
 
UInt_t fCodaSegmentNumber
 CODA segment number as provided by QwEventBuffer. More...
 
UInt_t fCodaEventNumber
 CODA event number as provided by QwEventBuffer. More...
 
UInt_t fCodaEventType
 CODA event type as provided by QwEventBuffer. More...
 
Double_t fCleanParameter [3]
 
UInt_t fEventTypeMask
 Mask of event types. More...
 
Bool_t fHasDataLoaded
 Has this array gotten data to be processed? More...
 
CanContainFn fnCanContain
 Function to determine which subsystems we can accept. More...
 

Private Member Functions

 QwSubsystemArrayParity ()
 Private default constructor. More...
 

Additional Inherited Members

- Public Types inherited from QwSubsystemArray
typedef Bool_t(* CanContainFn )(VQwSubsystem *)
 
- Static Public Member Functions inherited from QwSubsystemArray
static void DefineOptions (QwOptions &options)
 Define configuration options for global array. More...
 
- Protected Member Functions inherited from QwSubsystemArray
void LoadSubsystemsFromParameterFile (QwParameterFile &detectors)
 

Detailed Description

Virtual base class for the parity subsystems.

Virtual base class for the classes containing the event-based information from each parity subsystem. This will define the interfaces used in communicating with the CODA routines.

Definition at line 34 of file QwSubsystemArrayParity.h.

Constructor & Destructor Documentation

QwSubsystemArrayParity::QwSubsystemArrayParity ( )
private

Private default constructor.

QwSubsystemArrayParity::QwSubsystemArrayParity ( QwOptions options)
inline

Constructor with options.

Definition at line 44 of file QwSubsystemArrayParity.h.

QwSubsystemArray()
Private default constructor.
static Bool_t CanContain(VQwSubsystem *subsys)
Test whether this subsystem array can contain a particular subsystem.
QwSubsystemArrayParity::QwSubsystemArrayParity ( const QwSubsystemArrayParity source)

Copy constructor by reference.

Copy constructor.

Definition at line 19 of file QwSubsystemArrayParity.cc.

References dummy_source, fErrorFlag, and fErrorFlagTreeIndex.

20 : QwSubsystemArray(source)
21 {
22  // Store pointer to source
23  dummy_source = &source;
24 
25  // Copy error flags
26  fErrorFlag = source.fErrorFlag;
28 }
QwSubsystemArray()
Private default constructor.
const QwSubsystemArrayParity * dummy_source
QwSubsystemArrayParity::~QwSubsystemArrayParity ( )
virtual

Default destructor.

Destructor.

Definition at line 33 of file QwSubsystemArrayParity.cc.

34 {
35  // nothing
36 }

Member Function Documentation

void QwSubsystemArrayParity::AccumulateAllRunningSum ( const QwSubsystemArrayParity value)

Update the running sums for devices check only the error flags at the channel level. Only used for stability checks.

Definition at line 316 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::AccumulateRunningSum(), QwLog::endl(), and QwError.

Referenced by QwEventRing::push().

317 {
318  if (!value.empty()) {
319  if (this->size() == value.size()) {
320  //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.
321  for (size_t i = 0; i < value.size(); i++) {
322  if (value.at(i)==NULL || this->at(i)==NULL) {
323  // Either the value or the destination subsystem
324  // are null
325  } else {
326  VQwSubsystemParity *ptr1 =
327  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
328  if (typeid(*ptr1) == typeid(*(value.at(i).get()))) {
329  ptr1->AccumulateRunningSum(value.at(i).get());
330  } else {
331  QwError << "QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" << QwLog::endl;
332  QwError << " typeid(ptr1)=" << typeid(ptr1).name()
333  << " but typeid(value.at(i)))=" << typeid(value.at(i)).name()
334  << QwLog::endl;
335  // Subsystems don't match
336  }
337  }
338  }
339  //}//else if ((value.fErrorFlag& 512)==512){
340  //QwMessage << " AccumulateRunningSum "<<(value.fErrorFlag & 0x2FF)<<" - "<<value.GetCodaEventNumber()<< QwLog::endl;
341  //}
342  } else {
343  // Array sizes don't match
344 
345  }
346  } else {
347  // The value is empty
348  }
349 }
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
virtual void AccumulateRunningSum(VQwSubsystem *value)=0
Update the running sums for devices.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::AccumulateRunningSum ( const QwSubsystemArrayParity value)

Update the running sums for devices accumulated for the global error non-zero events/patterns.

Definition at line 282 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::AccumulateRunningSum(), QwLog::endl(), GetEventcutErrorFlag(), and QwError.

Referenced by QwHelicityPattern::AccumulateBurstSum(), QwHelicityPattern::AccumulateRunningBurstSum(), QwHelicityPattern::AccumulateRunningSum(), and main().

283 {
284  if (!value.empty()) {
285  if (this->size() == value.size()) {
286  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.
287  for (size_t i = 0; i < value.size(); i++) {
288  if (value.at(i)==NULL || this->at(i)==NULL) {
289  // Either the value or the destination subsystem
290  // are null
291  } else {
292  VQwSubsystemParity *ptr1 =
293  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
294  if (typeid(*ptr1) == typeid(*(value.at(i).get()))) {
295  ptr1->AccumulateRunningSum(value.at(i).get());
296  } else {
297  QwError << "QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" << QwLog::endl;
298  QwError << " typeid(ptr1)=" << typeid(ptr1).name()
299  << " but typeid(value.at(i)))=" << typeid(value.at(i)).name()
300  << QwLog::endl;
301  // Subsystems don't match
302  }
303  }
304  }
305  }
306 
307  } else {
308  // Array sizes don't match
309 
310  }
311  } else {
312  // The value is empty
313  }
314 }
Virtual base class for the parity subsystems.
UInt_t GetEventcutErrorFlag() const
Return the error flag to the main routine.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
virtual void AccumulateRunningSum(VQwSubsystem *value)=0
Update the running sums for devices.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwSubsystemArrayParity::ApplySingleEventCuts ( )

Apply the single event cuts.

Definition at line 478 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::ApplySingleEventCuts(), fErrorFlag, VQwSubsystemParity::GetEventcutErrorFlag(), kEventCutMode3, kGlobalCut, and UpdateErrorFlag().

Referenced by main().

478  {
479  Int_t CountFalse;
480  Bool_t status;
481  UInt_t ErrorFlag;
482  fErrorFlag=0;
483  VQwSubsystemParity *subsys_parity;
484  CountFalse=0;
485  if (!empty()){
486  for (iterator subsys = begin(); subsys != end(); ++subsys){
487  subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
488  status=subsys_parity->ApplySingleEventCuts();
489  ErrorFlag = subsys_parity->GetEventcutErrorFlag();
490  if ((ErrorFlag & kEventCutMode3)==kEventCutMode3)//we only care about the event cut flag in event cut mode 3
491  fErrorFlag |= ErrorFlag;
492  if (!status)
493  {
494  if ((ErrorFlag&kGlobalCut)==kGlobalCut){
495  CountFalse++;
496  fErrorFlag |= ErrorFlag; //we need the error code for failed events in event mode 2 for beam trips and etc.
497  }
498  }
499 
500 
501  }
502  }
503  if (CountFalse > 0)
504  status = kFALSE;
505  else
506  status = kTRUE;
507 
508  // Propagate all error codes to derived objects in the subsystems.
509  UpdateErrorFlag();
510 
511  return status;
512 }
Virtual base class for the parity subsystems.
virtual UInt_t GetEventcutErrorFlag()=0
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
virtual Bool_t ApplySingleEventCuts()=0
Apply the single event cuts.
static const UInt_t kEventCutMode3
Definition: QwTypes.h:173
static const UInt_t kGlobalCut
Definition: QwTypes.h:176
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Blind ( const QwBlinder blinder)

Blind the asymmetry of this subsystem.

Definition at line 392 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::Blind(), QwLog::endl(), and QwError.

Referenced by QwBlinder::Blind().

393 {
394  // Loop over subsystem array
395  for (size_t i = 0; i < this->size(); i++) {
396  // Cast into parity subsystems
397  VQwSubsystemParity* subsys = dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
398 
399  // Check for null pointers
400  if (this->at(i) == 0) {
401  QwError << "QwSubsystemArrayParity::Blind: "
402  << "parity subsystem null pointer!" << QwLog::endl;
403  return;
404  }
405 
406  // Apply blinding
407  subsys->Blind(blinder);
408  }
409 }
virtual void Blind(const QwBlinder *blinder)
Blind the asymmetry of this subsystem.
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Blind ( const QwBlinder blinder,
const QwSubsystemArrayParity yield 
)

Blind the difference of this subsystem.

Definition at line 411 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::Blind(), QwLog::endl(), and QwError.

412 {
413  // Check for array size
414  if (this->size() != yield.size()) {
415  QwError << "QwSubsystemArrayParity::Blind: "
416  << "diff and yield array dimension mismatch!" << QwLog::endl;
417  return;
418  }
419 
420  // Loop over subsystem array
421  for (size_t i = 0; i < this->size(); i++) {
422  // Cast into parity subsystems
423  VQwSubsystemParity* subsys_diff = dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
424  VQwSubsystemParity* subsys_yield = dynamic_cast<VQwSubsystemParity*>(yield.at(i).get());
425 
426  // Check for null pointers
427  if (subsys_diff == 0 || subsys_yield == 0) {
428  QwError << "QwSubsystemArrayParity::Blind: "
429  << "diff or yield parity subsystem null pointer!" << QwLog::endl;
430  return;
431  }
432 
433  // Apply blinding
434  subsys_diff->Blind(blinder, subsys_yield);
435  }
436 }
virtual void Blind(const QwBlinder *blinder)
Blind the asymmetry of this subsystem.
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwSubsystemArrayParity::CalculateRunningAverage ( )

Calculate the average for all good events.

Definition at line 272 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::CalculateRunningAverage().

Referenced by QwHelicityPattern::CalculateBurstAverage(), QwHelicityPattern::CalculateRunningAverage(), QwHelicityPattern::CalculateRunningBurstAverage(), main(), and QwEventRing::push().

273 {
274  for (iterator subsys = begin(); subsys != end(); ++subsys) {
275  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
276  subsys_parity->CalculateRunningAverage();
277  }
278 }
Virtual base class for the parity subsystems.
virtual void CalculateRunningAverage()=0
Calculate the average for all good events.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Bool_t QwSubsystemArrayParity::CanContain ( VQwSubsystem subsys)
inlinestaticprotected

Test whether this subsystem array can contain a particular subsystem.

Definition at line 135 of file QwSubsystemArrayParity.h.

135  {
136  return (dynamic_cast<VQwSubsystemParity*>(subsys) != 0);
137  };
Bool_t QwSubsystemArrayParity::CheckForEndOfBurst ( ) const
virtual

Definition at line 260 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::CheckForEndOfBurst().

Referenced by main().

261 {
262  Bool_t status = kFALSE;
263  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
264  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
265  status |= subsys_parity->CheckForEndOfBurst();
266  }
267  return status;
268 };
Virtual base class for the parity subsystems.
virtual Bool_t CheckForEndOfBurst() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  values 
)

Construct a branch and vector for this subsystem with a prefix.

Definition at line 590 of file QwSubsystemArrayParity.cc.

References QwSubsystemArray::ConstructBranchAndVector(), and fErrorFlagTreeIndex.

Referenced by QwHelicityPattern::ConstructBranchAndVector(), and main().

590  {
591  QwSubsystemArray::ConstructBranchAndVector(tree, prefix, values);
592  if (prefix=="yield_" || prefix==""){
593  values.push_back(0.0);
594  fErrorFlagTreeIndex = values.size()-1;
595  tree->Branch("ErrorFlag",&(values[fErrorFlagTreeIndex]),"ErrorFlag/D");
596  } else {
597  fErrorFlagTreeIndex = -1;
598  }
599 }
void ConstructBranchAndVector(TTree *tree, std::vector< Double_t > &values)
Construct the tree and vector for this subsystem.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::DeaccumulateRunningSum ( const QwSubsystemArrayParity value)

Remove the entry value from the running sums for devices.

Definition at line 352 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::DeaccumulateRunningSum(), QwLog::endl(), and QwError.

Referenced by QwEventRing::pop().

353 {
354  //Bool_t berror=kTRUE;//only needed for deaccumulation (stability check purposes)
355  //if (value.fErrorFlag>0){//check the error is global
356  //berror=((value.fErrorFlag & 0x2FF) == 0); //The operation value.fErrorFlag & 0x2FF clear everything else but the HW errors + event cut errors + blinder error
357  //}
358  if (!value.empty()) {
359  if (this->size() == value.size()) {
360  //if (value.GetEventcutErrorFlag()==0){//do derunningsum only if error flag is zero.
361  for (size_t i = 0; i < value.size(); i++) {
362  if (value.at(i)==NULL || this->at(i)==NULL) {
363  // Either the value or the destination subsystem
364  // are null
365  } else {
366  VQwSubsystemParity *ptr1 =
367  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
368  if (typeid(*ptr1) == typeid(*(value.at(i).get()))) {
369  ptr1->DeaccumulateRunningSum(value.at(i).get());
370  } else {
371  QwError << "QwSubsystemArrayParity::AccumulateRunningSum here where types don't match" << QwLog::endl;
372  QwError << " typeid(ptr1)=" << typeid(ptr1).name()
373  << " but typeid(value.at(i)))=" << typeid(value.at(i)).name()
374  << QwLog::endl;
375  // Subsystems don't match
376  }
377  }
378  }
379  //}//else if ((value.fErrorFlag & 268435968)==268435968){
380  //QwMessage << " DeaccumulateRunningSum "<<(value.fErrorFlag & 0x2FF)<<" - "<<value.GetCodaEventNumber()<< QwLog::endl;
381  //}
382  } else {
383  // Array sizes don't match
384 
385  }
386  } else {
387  // The value is empty
388  }
389 }
Virtual base class for the parity subsystems.
virtual void DeaccumulateRunningSum(VQwSubsystem *value)=0
remove one entry from the running sums for devices
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Difference ( const QwSubsystemArrayParity value1,
const QwSubsystemArrayParity value2 
)

Difference of two subsystem arrays.

Difference of two subsystem arrays

Parameters
value1First subsystem array
value2Second subsystem array

Definition at line 221 of file QwSubsystemArrayParity.cc.

Referenced by QwHelicityPattern::CalculateAsymmetry().

224 {
225 
226  if (!value1.empty()&& !value2.empty()){
227  *(this) = value1;
228  *(this) -= value2;
229  } else {
230  // The source is empty
231  }
232 }

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::FillDB ( QwParityDB db,
TString  type 
)

Fill the database.

Definition at line 55 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::FillDB().

Referenced by QwHelicityPattern::FillDB().

56 {
57  for (iterator subsys = begin(); subsys != end(); ++subsys) {
58  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
59  subsys_parity->FillDB(db, type);
60  }
61 }
virtual void FillDB(QwParityDB *db, TString type)
Fill the database.
Virtual base class for the parity subsystems.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::FillDB_MPS ( QwParityDB db,
TString  type 
)

Fill the database with MPS-based variables Note that most subsystems don't need to do this.

Definition at line 47 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::FillDB_MPS().

Referenced by main().

48 {
49  for (iterator subsys = begin(); subsys != end(); ++subsys) {
50  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
51  subsys_parity->FillDB_MPS(db, type);
52  }
53 }
Virtual base class for the parity subsystems.
virtual void FillDB_MPS(QwParityDB *db, TString type)
Fill the database with MPS-based variables Note that most subsystems don&#39;t need to do this...

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::FillErrDB ( QwParityDB db,
TString  type 
)

Definition at line 63 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::FillErrDB().

Referenced by QwHelicityPattern::FillErrDB().

64 {
65  // for (const_iterator subsys = dummy_source->begin(); subsys != dummy_source->end(); ++subsys) {
66  for (iterator subsys = begin(); subsys != end(); ++subsys) {
67  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
68  subsys_parity->FillErrDB(db, type);
69  }
70  return;
71 }
Virtual base class for the parity subsystems.
virtual void FillErrDB(QwParityDB *db, TString type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::FillHistograms ( )

Fill the histograms for this subsystem.

Definition at line 611 of file QwSubsystemArrayParity.cc.

References QwSubsystemArray::FillHistograms(), and GetEventcutErrorFlag().

Referenced by QwHelicityPattern::FillHistograms(), and main().

612 {
613  if (GetEventcutErrorFlag()==0)
615 }
void FillHistograms()
Fill the histograms for this subsystem.
UInt_t GetEventcutErrorFlag() const
Return the error flag to the main routine.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::FillTreeVector ( std::vector< Double_t > &  values) const

Fill the vector for this subsystem.

Definition at line 601 of file QwSubsystemArrayParity.cc.

References fErrorFlag, fErrorFlagTreeIndex, and QwSubsystemArray::FillTreeVector().

Referenced by QwHelicityPattern::FillTreeVector(), and main().

602 {
604  if (fErrorFlagTreeIndex>=0 && fErrorFlagTreeIndex<static_cast<int>(values.size())){
605  values.at(fErrorFlagTreeIndex) = fErrorFlag;
606  }
607 }
void FillTreeVector(std::vector< Double_t > &values) const
Fill the vector for this subsystem.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt_t QwSubsystemArrayParity::GetEventcutErrorFlag ( ) const
inline

Return the error flag to the main routine.

Definition at line 114 of file QwSubsystemArrayParity.h.

References fErrorFlag.

Referenced by AccumulateRunningSum(), FillHistograms(), QwHelicityPattern::GetEventcutErrorFlag(), and QwRegression::LinearRegression().

114  {
115  return fErrorFlag;
116  };

+ Here is the caller graph for this function:

VQwSubsystemParity * QwSubsystemArrayParity::GetSubsystemByName ( const TString &  name)
virtual

Get the subsystem with the specified name.

Reimplemented from QwSubsystemArray.

Definition at line 40 of file QwSubsystemArrayParity.cc.

References QwSubsystemArray::GetSubsystemByName().

Referenced by main().

41 {
42  return dynamic_cast<VQwSubsystemParity*>(QwSubsystemArray::GetSubsystemByName(name));
43 }
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
Virtual base class for the parity subsystems.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::IncrementErrorCounters ( )

Update the data elements' error counters based on their internal error flags.

Definition at line 516 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::IncrementErrorCounters().

Referenced by QwHelicityPattern::CalculateAsymmetry(), and main().

517 {
518  VQwSubsystemParity *subsys_parity;
519  if (!empty()){
520  for (iterator subsys = begin(); subsys != end(); ++subsys){
521  subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
522  subsys_parity->IncrementErrorCounters();
523  }
524  }
525 }
Virtual base class for the parity subsystems.
virtual void IncrementErrorCounters()=0
Increment the error counters.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QwSubsystemArrayParity & QwSubsystemArrayParity::operator+= ( const QwSubsystemArrayParity value)

Addition-assignment operator.

Addition-assignment operator

Parameters
valueSubsystem array to add to this array
Returns
This subsystem array after addition

Definition at line 130 of file QwSubsystemArrayParity.cc.

References QwLog::endl(), fErrorFlag, and QwError.

131 {
132  if (!value.empty()){
133 
134  if (this->size() == value.size()){
135  this->fErrorFlag|=value.fErrorFlag;
136  for(size_t i=0;i<value.size();i++){
137  if (value.at(i)==NULL || this->at(i)==NULL){
138  // Either the value or the destination subsystem
139  // are null
140  } else {
141  VQwSubsystemParity *ptr1 =
142  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
143  if (typeid(*ptr1)==typeid(*(value.at(i).get()))){
144  *(ptr1) += value.at(i).get();
145  //std::cout<<"QwSubsystemArrayParity::operator+ here where types match \n";
146  } else {
147  QwError << "QwSubsystemArrayParity::operator+ here where types don't match" << QwLog::endl;
148  QwError << " typeid(ptr1)=" << typeid(ptr1).name()
149  << " but typeid(value.at(i)))=" << typeid(value.at(i)).name()
150  << QwLog::endl;
151  // Subsystems don't match
152  }
153  }
154  }
155  } else {
156  // Array sizes don't match
157  }
158  } else {
159  // The vsource is empty
160  }
161  return *this;
162 }
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

QwSubsystemArrayParity & QwSubsystemArrayParity::operator-= ( const QwSubsystemArrayParity value)

Subtraction-assignment operator.

Subtraction-assignment operator

Parameters
valueSubsystem array to subtract from this array
Returns
This array after subtraction

Definition at line 169 of file QwSubsystemArrayParity.cc.

References fErrorFlag.

170 {
171  if (!value.empty()){
172 
173  if (this->size() == value.size()){
174  this->fErrorFlag|=value.fErrorFlag;
175  for(size_t i=0;i<value.size();i++){
176  if (value.at(i)==NULL || this->at(i)==NULL){
177  // Either the value or the destination subsystem
178  // are null
179  } else {
180  VQwSubsystemParity *ptr1 =
181  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
182  if (typeid(*ptr1)==typeid(*(value.at(i).get()))){
183  *(ptr1) -= value.at(i).get();
184  } else {
185  // Subsystems don't match
186  }
187  }
188  }
189  } else {
190  // Array sizes don't match
191  }
192  } else {
193  // The vsource is empty
194  }
195  return *this;
196 }
Virtual base class for the parity subsystems.
QwSubsystemArrayParity & QwSubsystemArrayParity::operator= ( const QwSubsystemArrayParity source)

Assignment operator.

Assignment operator

Parameters
sourceSubsystem array to assign to this array
Returns
This subsystem array after assignment

Definition at line 88 of file QwSubsystemArrayParity.cc.

References QwLog::endl(), QwSubsystemArray::fCodaEventNumber, fErrorFlag, and QwError.

89 {
90  Bool_t localdebug=kFALSE;
91  if(localdebug) std::cout<<"QwSubsystemArrayParity::operator= \n";
92  if (!source.empty()){
93  if (this->size() == source.size()){
94  this->fErrorFlag=source.fErrorFlag;
96  for(size_t i=0;i<source.size();i++){
97  if (source.at(i)==NULL || this->at(i)==NULL){
98  // Either the source or the destination subsystem
99  // are null
100  } else {
101  VQwSubsystemParity *ptr1 =
102  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
103  if (typeid(*ptr1)==typeid(*(source.at(i).get()))){
104  if(localdebug) std::cout<<" here in QwSubsystemArrayParity::operator= types mach \n";
105  *(ptr1) = source.at(i).get();
106  } else {
107  // Subsystems don't match
108  QwError << " QwSubsystemArrayParity::operator= types do not mach" << QwLog::endl;
109  QwError << " typeid(ptr1)=" << typeid(*ptr1).name()
110  << " but typeid(*(source.at(i).get()))=" << typeid(*(source.at(i).get())).name()
111  << QwLog::endl;
112  }
113  }
114  }
115  } else {
116  // Array sizes don't match
117  }
118  } else {
119  // The source is empty
120  }
121  return *this;
122 }
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwSubsystemArrayParity::PrintErrorCounters ( ) const

Report the number of events failed due to HW and event cut failures.

Definition at line 528 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::PrintErrorCounters().

Referenced by main().

528  {// report number of events failed due to HW and event cut faliure
529  const VQwSubsystemParity *subsys_parity;
530  if (!empty()){
531  for (const_iterator subsys = begin(); subsys != end(); ++subsys){
532  subsys_parity=dynamic_cast<const VQwSubsystemParity*>((subsys)->get());
533  subsys_parity->PrintErrorCounters();
534  }
535  }
536 }
Virtual base class for the parity subsystems.
virtual void PrintErrorCounters() const =0
Report the number of events failed due to HW and event cut failures.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::PrintValue ( ) const

Print value of all channels.

Definition at line 248 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::PrintValue().

Referenced by main(), QwHelicityPattern::PrintBurstAverage(), QwHelicityPattern::PrintRunningAverage(), and QwHelicityPattern::PrintRunningBurstAverage().

249 {
250  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
251  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
252  subsys_parity->PrintValue();
253  }
254 }
virtual void PrintValue() const
Print values of all channels.
Virtual base class for the parity subsystems.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Ratio ( const QwSubsystemArrayParity numer,
const QwSubsystemArrayParity denom 
)

Ratio of two subsystem arrays.

Definition at line 438 of file QwSubsystemArrayParity.cc.

References QwLog::endl(), fErrorFlag, QwError, and VQwSubsystemParity::Ratio().

Referenced by QwHelicityPattern::AccumulateRunningBurstSum(), and QwHelicityPattern::CalculateAsymmetry().

441 {
442  Bool_t localdebug=kFALSE;
443 
444  if(localdebug) std::cout<<"QwSubsystemArrayParity::Ratio \n";
445  *this=numer;
446  if ( !denom.empty()){
447  this->fErrorFlag=(numer.fErrorFlag|denom.fErrorFlag);
448  if (this->size() == denom.size() ){
449  for(size_t i=0;i<denom.size();i++){
450  if (denom.at(i)==NULL || this->at(i)==NULL){
451  // Either the value or the destination subsystem are null
452  if(localdebug) std::cout<<"Either the value or the destination subsystem are null\n";
453  } else {
454  VQwSubsystemParity *ptr1 =
455  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
456  if (typeid(*ptr1)==typeid(*(denom.at(i).get())))
457  {
458  ptr1->Ratio(numer.at(i).get(),denom.at(i).get());
459  } else {
460  // Subsystems don't match
461  QwError << "subsystem #" << i
462  << " type do not match : ratio computation aborted" << QwLog::endl;
463  }
464  }
465  }
466  } else {
467  QwError << "array size do not match : ratio computation aborted" << QwLog::endl;
468  // Array sizes don't match
469  }
470  } else {
471  QwError << "source empty : ratio computation aborted" << QwLog::endl;
472  // The source is empty
473  }
474  if(localdebug) std::cout<<"I am out of it \n";
475 
476 }
Virtual base class for the parity subsystems.
virtual void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)=0
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Scale ( Double_t  factor)

Scale this subsystem array.

Scale this subsystem array

Parameters
factorScale factor

Definition at line 238 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::Scale().

Referenced by QwHelicityPattern::CalculateAsymmetry().

239 {
240  for (iterator subsys = begin(); subsys != end(); ++subsys) {
241  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
242  subsys_parity->Scale(factor);
243  }
244 }
Virtual base class for the parity subsystems.
virtual void Scale(Double_t factor)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::Sum ( const QwSubsystemArrayParity value1,
const QwSubsystemArrayParity value2 
)

Sum of two subsystem arrays.

Sum of two subsystem arrays

Parameters
value1First subsystem array
value2Second subsystem array

Definition at line 203 of file QwSubsystemArrayParity.cc.

Referenced by QwHelicityPattern::CalculateAsymmetry().

206 {
207 
208  if (!value1.empty()&& !value2.empty()){
209  *(this) = value1;
210  *(this) += value2;
211  } else {
212  // The source is empty
213  }
214 }

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::UnBlind ( const QwBlinder blinder)
inline

Unblind the asymmetry of this subsystem.

Definition at line 96 of file QwSubsystemArrayParity.h.

Referenced by QwBlinder::UnBlind().

97  { /* Not yet implemented */ };

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::UnBlind ( const QwBlinder blinder,
const QwSubsystemArrayParity yield 
)
inline

Unblind the difference of this subsystem.

Definition at line 101 of file QwSubsystemArrayParity.h.

102  { /* Not yet implemented */ };
void QwSubsystemArrayParity::UpdateErrorFlag ( )

Update the error flag internally from all the subsystems.

Definition at line 574 of file QwSubsystemArrayParity.cc.

References fErrorFlag, and VQwSubsystemParity::UpdateErrorFlag().

Referenced by ApplySingleEventCuts(), QwHelicityPattern::CalculateAsymmetry(), and QwEventRing::push().

574  {
575  //this routine will refresh the global error flag after stability cut check
576  //by default at the ApplySingleEventCuts routine fErrorFlag is updated properly and a const GetEventcutErrorFlag() routine
577  //returns the fErrorFlag value
578  fErrorFlag=0;
579 
580  VQwSubsystemParity *subsys_parity;
581  if (!empty()){
582  for (iterator subsys = begin(); subsys != end(); ++subsys){
583  subsys_parity=dynamic_cast<VQwSubsystemParity*>((subsys)->get());
584  //Update the error flag of the parity subsystem
585  fErrorFlag|=subsys_parity->UpdateErrorFlag();
586  }
587  }
588 }
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
Virtual base class for the parity subsystems.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArrayParity::UpdateErrorFlag ( const QwSubsystemArrayParity ev_error)

update the error flag for each channel in the subsystem array with the corresponding value in the ev_error subsystem array

Definition at line 538 of file QwSubsystemArrayParity.cc.

References QwLog::endl(), fErrorFlag, QwError, and VQwSubsystemParity::UpdateErrorFlag().

538  {
539  Bool_t localdebug=kFALSE;//kTRUE;
540  if(localdebug) std::cout<<"QwSubsystemArrayParity::UpdateErrorFlag \n";
541  if (!ev_error.empty()){
542  if (this->size() == ev_error.size()){
543  this->fErrorFlag |= ev_error.fErrorFlag;
544  for(size_t i=0;i<ev_error.size();i++){
545  if (ev_error.at(i)==NULL || this->at(i)==NULL){
546  // Either the source or the destination subsystem
547  // are null
548  } else {
549  VQwSubsystemParity *ptr1 =
550  dynamic_cast<VQwSubsystemParity*>(this->at(i).get());
551  if (typeid(*ptr1)==typeid(*(ev_error.at(i).get()))){
552  if(localdebug) std::cout<<" here in QwSubsystemArrayParity::UpdateErrorFlag types mach \n";
553  //*(ptr1) = ev_error.at(i).get();//when =operator is used
554  //pass the correct subsystem to update the errorflags at subsystem to devices to channel levels
555  ptr1->UpdateErrorFlag(ev_error.at(i).get());
556  } else {
557  // Subsystems don't match
558  QwError << " QwSubsystemArrayParity::UpdateErrorFlag types do not mach" << QwLog::endl;
559  QwError << " typeid(ptr1)=" << typeid(*ptr1).name()
560  << " but typeid(*(ev_error.at(i).get()))=" << typeid(*(ev_error.at(i).get())).name()
561  << QwLog::endl;
562  }
563  }
564  }
565  } else {
566  // Array sizes don't match
567  }
568  } else {
569  // The source is empty
570  }
571 };
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
Virtual base class for the parity subsystems.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwSubsystemArrayParity::WritePromptSummary ( QwPromptSummary ps,
TString  type 
)

Definition at line 73 of file QwSubsystemArrayParity.cc.

References VQwSubsystemParity::WritePromptSummary().

Referenced by QwHelicityPattern::WritePromptSummary().

74 {
75  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
76  VQwSubsystemParity* subsys_parity = dynamic_cast<VQwSubsystemParity*>(subsys->get());
77  subsys_parity->WritePromptSummary(ps, type);
78  }
79 }
Virtual base class for the parity subsystems.
virtual void WritePromptSummary(QwPromptSummary *ps, TString type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const QwSubsystemArrayParity* QwSubsystemArrayParity::dummy_source

Definition at line 65 of file QwSubsystemArrayParity.h.

Referenced by QwSubsystemArrayParity().

UInt_t QwSubsystemArrayParity::fErrorFlag
protected
Int_t QwSubsystemArrayParity::fErrorFlagTreeIndex
protected

The documentation for this class was generated from the following files: