QwAnalysis
QwHelicityPattern Class Reference

#include <QwHelicityPattern.h>

+ Collaboration diagram for QwHelicityPattern:

Public Member Functions

 QwHelicityPattern (QwSubsystemArrayParity &event)
 Constructor with subsystem array. More...
 
virtual ~QwHelicityPattern ()
 Virtual destructor. More...
 
void ProcessOptions (QwOptions &options)
 Process the configuration options. More...
 
void LoadEventData (QwSubsystemArrayParity &event)
 
Bool_t HasDataLoaded () const
 
Bool_t IsCompletePattern () const
 
Bool_t IsEndOfBurst ()
 
void CalculateAsymmetry ()
 
void GetTargetChargeStat (Double_t &asym, Double_t &error, Double_t &width)
 
void EnableAlternateAsymmetry (const Bool_t flag=kTRUE)
 Enable/disable alternate asymmetry calculation. More...
 
void DisableAlternateAsymmetry ()
 Disable alternate asymmetry calculation. More...
 
Bool_t IsAlternateAsymEnabled ()
 Status of alternate asymmetry calculation flag. More...
 
void EnableBurstSum (const Bool_t flag=kTRUE)
 Enable/disable burst sum calculation. More...
 
void DisableBurstSum ()
 Disable burst sum calculation. More...
 
Bool_t IsBurstSumEnabled ()
 Status of burst sum calculation flag. More...
 
void EnableRunningSum (const Bool_t flag=kTRUE)
 Enable/disable running sum calculation. More...
 
void DisableRunningSum ()
 Disable running sum calculation. More...
 
Bool_t IsRunningSumEnabled ()
 Status of running sum calculation flag. More...
 
void EnableDifference (const Bool_t flag=kTRUE)
 Enable/disable storing pattern differences. More...
 
void DisableDifference ()
 Disable storing pattern differences. More...
 
Bool_t IsDifferenceEnabled ()
 Status of storing pattern differences flag. More...
 
void UpdateBlinder (QwParityDB *db)
 Update the blinder status with new external information. More...
 
void UpdateBlinder (const QwSubsystemArrayParity &detectors)
 Update the blinder status with new external information. More...
 
void UpdateBlinder (const QwEPICSEvent &epics)
 Update the blinder status with new external information. More...
 
QwSubsystemArrayParityGetBurstYield ()
 
QwSubsystemArrayParityGetBurstDifference ()
 
QwSubsystemArrayParityGetBurstAsymmetry ()
 
void AccumulateBurstSum ()
 
void AccumulateRunningBurstSum ()
 
void AccumulateRunningSum ()
 
void CalculateBurstAverage ()
 
void CalculateRunningBurstAverage ()
 
void CalculateRunningAverage ()
 
void PrintRunningBurstAverage () const
 
void PrintRunningAverage () const
 
void PrintBurstAverage () const
 
void ConstructHistograms ()
 
void ConstructHistograms (TDirectory *folder)
 
void FillHistograms ()
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 
void ConstructBranch (TTree *tree, TString &prefix)
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_tree)
 
void FillTreeVector (std::vector< Double_t > &values) const
 
void FillDB (QwParityDB *db)
 
void FillErrDB (QwParityDB *db)
 
void WritePromptSummary (QwPromptSummary *ps)
 
Bool_t IsGoodAsymmetry ()
 
UInt_t GetEventcutErrorFlag () const
 
void ClearEventData ()
 
void ClearBurstSum ()
 
void ClearRunningSum ()
 
void Print () const
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 Define the configuration options. More...
 

Protected Member Functions

void SetDataLoaded (Bool_t flag)
 

Protected Attributes

Bool_t fDEBUG
 
std::vector
< QwSubsystemArrayParity
fEvents
 
std::vector< Bool_t > fEventLoaded
 
std::vector< Int_t > fHelicity
 
std::vector< Int_t > fEventNumber
 
Int_t fCurrentPatternNumber
 
Int_t fPatternSize
 
Int_t fQuartetNumber
 
QwBlinder fBlinder
 
Bool_t fHelicityIsMissing
 
Bool_t fIgnoreHelicity
 
QwSubsystemArrayParity fYield
 
QwSubsystemArrayParity fAsymmetry
 
Bool_t fEnableAlternateAsym
 
QwSubsystemArrayParity fAsymmetry1
 
QwSubsystemArrayParity fAsymmetry2
 
Int_t fBurstLength
 
Bool_t fEnableBurstSum
 
Bool_t fPrintBurstSum
 
QwSubsystemArrayParity fBurstYield
 
QwSubsystemArrayParity fBurstDifference
 
QwSubsystemArrayParity fBurstAsymmetry
 
QwSubsystemArrayParity fRunningBurstYield
 
QwSubsystemArrayParity fRunningBurstDifference
 
QwSubsystemArrayParity fRunningBurstAsymmetry
 
Bool_t fEnableRunningSum
 
Bool_t fPrintRunningSum
 
QwSubsystemArrayParity fRunningYield
 
QwSubsystemArrayParity fRunningDifference
 
QwSubsystemArrayParity fRunningAsymmetry
 
QwSubsystemArrayParity fRunningAsymmetry1
 
QwSubsystemArrayParity fRunningAsymmetry2
 
Bool_t fEnableDifference
 
QwSubsystemArrayParity fDifference
 
QwSubsystemArrayParity fAlternateDiff
 
QwSubsystemArrayParity fPositiveHelicitySum
 
QwSubsystemArrayParity fNegativeHelicitySum
 
Long_t fLastWindowNumber
 
Long_t fLastPatternNumber
 
Int_t fLastPhaseNumber
 
Bool_t fPatternIsGood
 
Bool_t fIsDataLoaded
 

Private Member Functions

 QwHelicityPattern ()
 Private default constructor (not implemented, will throw linker error on use) More...
 

Friends

class QwRegression
 

Detailed Description

Definition at line 29 of file QwHelicityPattern.h.

Constructor & Destructor Documentation

QwHelicityPattern::QwHelicityPattern ( )
private

Private default constructor (not implemented, will throw linker error on use)

QwHelicityPattern::QwHelicityPattern ( QwSubsystemArrayParity event)

Constructor with subsystem array.

Definition at line 80 of file QwHelicityPattern.cc.

References ClearBurstSum(), ClearRunningSum(), Qw::e, QwLog::endl(), fCurrentPatternNumber, fEventLoaded, fEventNumber, fEvents, fHelicity, fHelicityIsMissing, fPatternSize, fQuartetNumber, QwHelicity::GetMaxPatternPhase(), VQwSubsystem::GetSubsystemName(), QwError, QwMessage, and QwWarning.

81  : fBlinder(),
82  fHelicityIsMissing(kFALSE),
83  fIgnoreHelicity(kFALSE),
84  fYield(event),
85  fAsymmetry(event),
86  fEnableAlternateAsym(kFALSE),
87  fAsymmetry1(event),
88  fAsymmetry2(event),
89  fEnableBurstSum(kFALSE),
90  fPrintBurstSum(kFALSE),
91  fBurstYield(event),
92  fBurstDifference(event),
93  fBurstAsymmetry(event),
94  fRunningBurstYield(event),
97  fEnableRunningSum(kTRUE),
98  fPrintRunningSum(kFALSE),
99  fRunningYield(event),
100  fRunningDifference(event),
101  fRunningAsymmetry(event),
102  fRunningAsymmetry1(event),
103  fRunningAsymmetry2(event),
104  fEnableDifference(kFALSE),
105  fDifference(event),
106  fAlternateDiff(event),
107  fPositiveHelicitySum(event),
108  fNegativeHelicitySum(event),
112 {
113  // Retrieve the helicity subsystem to query for
114  std::vector<VQwSubsystem*> subsys_helicity = event.GetSubsystemByType("QwHelicity");
115  if (subsys_helicity.size() > 0) {
116 
117  // Take the first helicity subsystem
118  // fHelicitySubsystem = dynamic_cast<QwHelicity*>(subsys_helicity.at(0));
119  QwHelicity* helicity = dynamic_cast<QwHelicity*>(subsys_helicity.at(0));
120 
121  // Get the maximum pattern phase (i.e. pattern size)
122  fPatternSize = helicity->GetMaxPatternPhase();
123 
124  // Warn if more than one helicity subsystem defined
125  if (subsys_helicity.size() > 1)
126  QwWarning << "Multiple helicity subsystems defined! "
127  << "Using " << helicity->GetSubsystemName() << "."
128  << QwLog::endl;
129 
130  } else {
131  // We are not using any helicity subsystem
132  QwError << "No helicity subsystem defined! "
133  << "Calculate asymmetries based on (+--+) quartets!"
134  << QwLog::endl;
135  fHelicityIsMissing = kTRUE;
136  fPatternSize = 4; // default to quartets
137  }
138  QwMessage << "QwHelicity::MaxPatternPhase = " << fPatternSize << QwLog::endl;
139 
140  try
141  {
142  if(fPatternSize%2 == 0)
143  {
144  fEvents.resize(fPatternSize,event);
145  fHelicity.resize(fPatternSize,-9999);
146  fEventNumber.resize(fPatternSize,-1);
147  fEventLoaded.resize(fPatternSize,kFALSE);
148 
149  // Initialize the pattern number
150  fQuartetNumber = 0;
152 
153  // Clear the burst sum
154  ClearBurstSum();
155 
156  // Clear the running sum
157  ClearRunningSum();
158 
159  }
160  else
161  {
162  TString loc=
163  "Standard exception from QwHelicityPattern : the pattern size has to be even; right now pattern_size=";
164  loc+=Form("%d",fPatternSize);
165  throw std::invalid_argument(loc.Data());
166  }
167  }
168  catch (std::exception& e)
169  {
170  std::cerr << e.what() << std::endl;
171  }
172 
173 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< Int_t > fEventNumber
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fRunningAsymmetry
std::vector< Bool_t > fEventLoaded
QwSubsystemArrayParity fBurstAsymmetry
QwSubsystemArrayParity fNegativeHelicitySum
QwSubsystemArrayParity fYield
static const double e
Definition: QwUnits.h:91
QwSubsystemArrayParity fAlternateDiff
QwSubsystemArrayParity fAsymmetry
Int_t GetMaxPatternPhase()
Definition: QwHelicity.h:100
QwSubsystemArrayParity fPositiveHelicitySum
QwSubsystemArrayParity fRunningBurstYield
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwSubsystemArrayParity fAsymmetry1
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield
QwSubsystemArrayParity fBurstYield
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
QwSubsystemArrayParity fRunningBurstAsymmetry
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

virtual QwHelicityPattern::~QwHelicityPattern ( )
inlinevirtual

Virtual destructor.

Definition at line 42 of file QwHelicityPattern.h.

42 { };

Member Function Documentation

void QwHelicityPattern::AccumulateBurstSum ( )

Accumulate the burst sum by adding this helicity pattern to the burst sums of yield and difference. There is no burst sum of asymmetry, because that can only be calculated with meaningful moments at the end of a burst.

Definition at line 562 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::AccumulateRunningSum(), fBurstDifference, fBurstYield, fDifference, fPatternIsGood, and fYield.

Referenced by CalculateAsymmetry().

563 {
564  if (fPatternIsGood){
567  // The difference is blinded, so the burst difference is also blinded.
568  }
569 }
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fDifference
void AccumulateRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fBurstYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::AccumulateRunningBurstSum ( )

Accumulate the running burst sum by adding the current burst sum to the running sums of burst yield, difference and asymmetry.

Definition at line 597 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::AccumulateRunningSum(), fBurstAsymmetry, fBurstDifference, fBurstYield, fEnableRunningSum, fRunningBurstAsymmetry, fRunningBurstDifference, fRunningBurstYield, and QwSubsystemArrayParity::Ratio().

Referenced by main().

598 {
599  // Accumulate the burst yield and difference
600  if (fEnableRunningSum) {
603  // The burst difference is blinded, so the running burst difference is also blinded.
604  }
605 
606  // Calculate asymmetry over this entire burst
608  // Accumulate this burst asymmetry
610 
611  // Be sure to clear the burst sums after this function!
612 }
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fBurstAsymmetry
void AccumulateRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
QwSubsystemArrayParity fRunningBurstYield
QwSubsystemArrayParity fBurstYield
QwSubsystemArrayParity fRunningBurstAsymmetry
void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
Ratio of two subsystem arrays.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::AccumulateRunningSum ( )

Accumulate the running sum by adding this helicity pattern to the running sums of yield, difference and asymmetry.

Definition at line 576 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::AccumulateRunningSum(), fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, fPatternIsGood, fRunningAsymmetry, fRunningAsymmetry1, fRunningAsymmetry2, fRunningDifference, fRunningYield, and fYield.

Referenced by CalculateAsymmetry().

577 {
578  if (fPatternIsGood){
580  if (fEnableDifference){
582  // The difference is blinded, so the running difference is also blinded.
583  }
585  if (fEnableAlternateAsym) {
588  }
589  }
590 }
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fRunningAsymmetry
void AccumulateRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
QwSubsystemArrayParity fAsymmetry1
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::CalculateAsymmetry ( )

Calculate asymmetries for the current pattern.

Definition at line 310 of file QwHelicityPattern.cc.

References AccumulateBurstSum(), AccumulateRunningSum(), QwBlinder::Blind(), QwSubsystemArray::ClearEventData(), ClearEventData(), QwSubsystemArrayParity::Difference(), QwLog::endl(), fAlternateDiff, fAsymmetry, fAsymmetry1, fAsymmetry2, fBlinder, fCurrentPatternNumber, fDifference, fEnableAlternateAsym, fEnableBurstSum, fEnableRunningSum, fEvents, fHelicity, fIgnoreHelicity, fNegativeHelicitySum, fPatternIsGood, fPatternSize, fPositiveHelicitySum, fQuartetNumber, fYield, QwSubsystemArrayParity::IncrementErrorCounters(), QwDebug, QwError, QwSubsystemArrayParity::Ratio(), QwSubsystemArrayParity::Scale(), QwSubsystemArrayParity::Sum(), and QwSubsystemArrayParity::UpdateErrorFlag().

Referenced by main().

311 {
312 
313  Bool_t localdebug=kFALSE;
314 
315  if(localdebug) std::cout<<"Entering QwHelicityPattern::CalculateAsymmetry \n";
316 
317  Int_t plushel = 1;
318  Int_t minushel = 0;
319  Int_t checkhel = 0;
320  Bool_t firstplushel=kTRUE;
321  Bool_t firstminushel=kTRUE;
322 
325 
326  if (fIgnoreHelicity){
327  // Don't check to see if we have equal numbers of even and odd helicity states in this pattern.
328  // Build an asymmetry with even-parity phases as "+" and odd-parity phases as "-"
329  for (size_t i = 0; i < (size_t) fPatternSize; i++) {
330  Int_t localhel = 1;
331  for (size_t j = 0; j < (size_t) fPatternSize/2; j++) {
332  localhel ^= ((i >> j)&0x1);
333  }
334  if (localhel == plushel) {
335  if (firstplushel) {
337  firstplushel = kFALSE;
338  } else {
339  fPositiveHelicitySum += fEvents.at(i);
340  }
341  } else if (localhel == minushel) {
342  if (firstminushel) {
344  firstminushel = kFALSE;
345  } else {
346  fNegativeHelicitySum += fEvents.at(i);
347  }
348  }
349  }
350  } else {
351  //
352  for (size_t i = 0; i < (size_t) fPatternSize; i++) {
353  if (fHelicity[i] == plushel) {
354  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: here filling fPositiveHelicitySum \n";
355  if (firstplushel) {
356  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: with = \n";
358  firstplushel = kFALSE;
359  } else {
360  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: with += \n";
361  fPositiveHelicitySum += fEvents.at(i);
362  }
363  checkhel += 1;
364  } else if (fHelicity[i] == minushel) {
365  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: here filling fNegativeHelicitySum \n";
366  if (firstminushel) {
367  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: with = \n";
369  firstminushel = kFALSE;
370  } else {
371  if (localdebug) std::cout<<"QwHelicityPattern::CalculateAsymmetry: with += \n";
372  fNegativeHelicitySum += fEvents.at(i);
373  }
374  checkhel -= 1;
375  } else {
376  QwDebug << "QwHelicityPattern::CalculateAsymmetry: "
377  << "Helicity should be "<<plushel<<" or "<<minushel
378  <<" but is "<< fHelicity[i]
379  << "; Asymmetry computation aborted!"<<QwLog::endl;
380  ClearEventData();
381  i = fPatternSize;
382  checkhel = -9999;
383  // This is an unknown helicity event.
384  }
385  }
386  }
387 
388  if (checkhel == -9999) {
389  //do nothing the asymmetry computation has been aborted earlier in this function
390  fPatternIsGood = kFALSE;
391  } else if (checkhel!=0) {
392  fPatternIsGood = kFALSE;
393  // there is a different number of plus and minus helicity window.
394  QwError<<" QwHelicityPattern::CalculateAsymmetry == \n"
395  <<" you do not have the same number of positive and negative \n"
396  <<" impossible to compute assymetry \n"
397  <<" dropping every thing -- pattern number ="<<fCurrentPatternNumber<<QwLog::endl;
398  } else {
399  // This is a good pattern.
400  // Calculate the asymmetry.
401  fPatternIsGood = kTRUE;
402  fQuartetNumber++;//Then increment the quartet number
403  //std::cout<<" quartet count ="<<fQuartetNumber<<"\n";
404 
409 
410 
411 
412  if (! fIgnoreHelicity){
413  // Only blind the difference if we're using the real helicity.
415  // Update the global error code in fDifference, and use it
416  // to update the errors in fYield, in case blinder errors
417  // can propagate to the global error.
420  }
423 
424  /*
425  With additional two asymmetry calculations
426  Don't blind them!
427 
428  quartet pattern + - - +
429  1 2 3 4
430  fAsymmetry = (1+4)-(2+3)/(1+2+3+4)
431  fAsymmetry1 = (1+2)-(3+4)/(1+2+3+4)
432  fAsymmetry2 = (1+3)-(2+4)/(1+2+3+4)
433  */
434  if (fEnableAlternateAsym) {
435  // fAsymmetry1: (first 1/2 pattern - second 1/2 pattern)/fYield
440  if (fPatternSize/2 > 1){
441  for (size_t i = 1; i < (size_t) fPatternSize/2 ; i++){
442  fPositiveHelicitySum += fEvents.at(i);
444  }
445  }
449  // Do not blind this helicity-uncorrelated difference.
451  // fAsymmetry2: (even events - odd events)/fYield
452  // Only build fAsymmetry2 if fPatternSize>2.
453  if (fPatternSize > 2) {
458  if (fPatternSize/2 > 1){
459  for (size_t i = 1; i < (size_t) fPatternSize/2 ; i++){
460  fPositiveHelicitySum += fEvents.at(2*i);
461  fNegativeHelicitySum += fEvents.at(2*i + 1);
462  }
463  }
467  // Do not blind this helicity-uncorrelated difference.
469  }
470  }
471 
472  // Accumulate the burst and running sums
475 
476  if (localdebug) QwDebug << " pattern number =" << fQuartetNumber << QwLog::endl;
477  }
478 
479  return;
480 }
QwSubsystemArrayParity fDifference
void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Sum of two subsystem arrays.
QwSubsystemArrayParity fNegativeHelicitySum
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAlternateDiff
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fPositiveHelicitySum
QwSubsystemArrayParity fAsymmetry2
void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Difference of two subsystem arrays.
void Scale(Double_t factor)
Scale this subsystem array.
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
void Blind(QwSubsystemArrayParity &diff)
Blind the asymmetry of an array of subsystems.
Definition: QwBlinder.h:174
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwSubsystemArrayParity fAsymmetry1
void IncrementErrorCounters()
Update the data elements&#39; error counters based on their internal error flags.
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
Ratio of two subsystem arrays.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::CalculateBurstAverage ( )

Calculate the average burst yield, difference and asymmetry.

Definition at line 618 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::CalculateRunningAverage(), fBurstAsymmetry, fBurstDifference, fBurstYield, fPrintBurstSum, and PrintBurstAverage().

Referenced by main().

619 {
623 
625 }
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fBurstAsymmetry
void CalculateRunningAverage()
Calculate the average for all good events.
void PrintBurstAverage() const
QwSubsystemArrayParity fBurstYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::CalculateRunningAverage ( )

Definition at line 641 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::CalculateRunningAverage(), fEnableAlternateAsym, fEnableDifference, fPrintRunningSum, fRunningAsymmetry, fRunningAsymmetry1, fRunningAsymmetry2, fRunningDifference, fRunningYield, and PrintRunningAverage().

Referenced by main().

642 {
644  if (fEnableDifference){
646  }
648  if (fEnableAlternateAsym) {
651  }
653 }
QwSubsystemArrayParity fRunningAsymmetry
void CalculateRunningAverage()
Calculate the average for all good events.
void PrintRunningAverage() const
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::CalculateRunningBurstAverage ( )

Calculate the average running burst yield, difference and asymmetry.

Definition at line 631 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::CalculateRunningAverage(), fPrintBurstSum, fRunningBurstAsymmetry, fRunningBurstDifference, fRunningBurstYield, and PrintRunningBurstAverage().

Referenced by main().

632 {
636 
638 }
QwSubsystemArrayParity fRunningBurstDifference
void CalculateRunningAverage()
Calculate the average for all good events.
QwSubsystemArrayParity fRunningBurstYield
void PrintRunningBurstAverage() const
QwSubsystemArrayParity fRunningBurstAsymmetry

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ClearBurstSum ( )

Clear the burst sums of yield and difference. No asymmetry burst sum is used.

Definition at line 546 of file QwHelicityPattern.cc.

References QwSubsystemArray::ClearEventData(), fBurstAsymmetry, fBurstDifference, fBurstYield, and fEnableBurstSum.

Referenced by main(), and QwHelicityPattern().

547 {
548  if (fEnableBurstSum) {
552  }
553 }
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fBurstAsymmetry
QwSubsystemArrayParity fBurstYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ClearEventData ( )

Clear event data and the vectors used for the calculation of. yields and asymmetries.

Definition at line 487 of file QwHelicityPattern.cc.

References QwBlinder::ClearEventData(), QwSubsystemArray::ClearEventData(), fAlternateDiff, fAsymmetry, fAsymmetry1, fAsymmetry2, fBlinder, fDifference, fEnableAlternateAsym, fEventLoaded, fEvents, fHelicity, fIgnoreHelicity, fNegativeHelicitySum, fPatternIsGood, fPositiveHelicitySum, fYield, and SetDataLoaded().

Referenced by CalculateAsymmetry(), LoadEventData(), and main().

488 {
489  fIgnoreHelicity = kFALSE;
490  for(size_t i=0; i<fEvents.size(); i++)
491  {
492  fEvents[i].ClearEventData();
493  fEventLoaded[i]=kFALSE;
494  fHelicity[i]=-999;
495  }
497 
498  // Primary yield and asymmetry
501  // Alternate asymmetries
505  }
506 
511 
512  fPatternIsGood = kFALSE;
513  SetDataLoaded(kFALSE);
514 }
QwSubsystemArrayParity fDifference
std::vector< Bool_t > fEventLoaded
QwSubsystemArrayParity fNegativeHelicitySum
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAlternateDiff
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fPositiveHelicitySum
QwSubsystemArrayParity fAsymmetry2
void ClearEventData()
Definition: QwBlinder.h:105
void SetDataLoaded(Bool_t flag)
QwSubsystemArrayParity fAsymmetry1
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ClearRunningSum ( )

Clear the running sums of yield, difference and asymmetry. Also clear the running burst sums if enabled.

Definition at line 521 of file QwHelicityPattern.cc.

References QwSubsystemArray::ClearEventData(), fEnableAlternateAsym, fEnableBurstSum, fEnableRunningSum, fRunningAsymmetry, fRunningAsymmetry1, fRunningAsymmetry2, fRunningBurstAsymmetry, fRunningBurstDifference, fRunningBurstYield, fRunningDifference, and fRunningYield.

Referenced by main(), and QwHelicityPattern().

522 {
523  if (fEnableRunningSum) {
527  // Running alternate asymmetries
528  if (fEnableAlternateAsym) {
531  }
532  // Running burst sums
533  if (fEnableBurstSum) {
537  }
538  }
539 }
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fRunningAsymmetry
QwSubsystemArrayParity fRunningBurstYield
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield
QwSubsystemArrayParity fRunningBurstAsymmetry

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ConstructBranch ( TTree *  tree,
TString &  prefix 
)

Definition at line 762 of file QwHelicityPattern.cc.

References QwSubsystemArray::ConstructBranch(), fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, and fYield.

763 {
764  TString newprefix = "yield_" + prefix;
765  fYield.ConstructBranch(tree, newprefix);
766  newprefix = "asym_" + prefix;
767  fAsymmetry.ConstructBranch(tree, newprefix);
768 
769  if (fEnableDifference) {
770  newprefix = "diff_" + prefix;
771  fDifference.ConstructBranch(tree, newprefix);
772  }
773  if (fEnableAlternateAsym) {
774  newprefix = "asym1_" + prefix;
775  fAsymmetry1.ConstructBranch(tree, newprefix);
776  newprefix = "asym2_" + prefix;
777  fAsymmetry2.ConstructBranch(tree, newprefix);
778  }
779 }
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
void ConstructBranch(TTree *tree, TString &prefix)
Construct a branch for this subsystem with a prefix.
QwSubsystemArrayParity fAsymmetry1

+ Here is the call graph for this function:

void QwHelicityPattern::ConstructBranch ( TTree *  tree,
TString &  prefix,
QwParameterFile trim_tree 
)

Definition at line 781 of file QwHelicityPattern.cc.

References QwSubsystemArray::ConstructBranch(), fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, and fYield.

782 {
783  TString newprefix = "yield_" + prefix;
784  fYield.ConstructBranch(tree, newprefix, trim_tree);
785  newprefix = "asym_" + prefix;
786  fAsymmetry.ConstructBranch(tree, newprefix, trim_tree);
787 
788  if (fEnableDifference) {
789  newprefix = "diff_" + prefix;
790  fDifference.ConstructBranch(tree, newprefix);
791  }
792  if (fEnableAlternateAsym) {
793  newprefix = "asym1_" + prefix;
794  fAsymmetry1.ConstructBranch(tree, newprefix, trim_tree);
795  newprefix = "asym2_" + prefix;
796  fAsymmetry2.ConstructBranch(tree, newprefix, trim_tree);
797  }
798 }
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
void ConstructBranch(TTree *tree, TString &prefix)
Construct a branch for this subsystem with a prefix.
QwSubsystemArrayParity fAsymmetry1

+ Here is the call graph for this function:

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

Definition at line 743 of file QwHelicityPattern.cc.

References QwSubsystemArrayParity::ConstructBranchAndVector(), fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, and fYield.

Referenced by main().

744 {
745  TString newprefix = "yield_" + prefix;
746  fYield.ConstructBranchAndVector(tree, newprefix, values);
747  newprefix = "asym_" + prefix;
748  fAsymmetry.ConstructBranchAndVector(tree, newprefix, values);
749 
750  if (fEnableDifference) {
751  newprefix = "diff_" + prefix;
752  fDifference.ConstructBranchAndVector(tree, newprefix, values);
753  }
754  if (fEnableAlternateAsym) {
755  newprefix = "asym1_" + prefix;
756  fAsymmetry1.ConstructBranchAndVector(tree, newprefix, values);
757  newprefix = "asym2_" + prefix;
758  fAsymmetry2.ConstructBranchAndVector(tree, newprefix, values);
759  }
760 }
QwSubsystemArrayParity fDifference
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct a branch and vector for this subsystem with a prefix.
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fAsymmetry1

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ConstructHistograms ( )
inline

Definition at line 120 of file QwHelicityPattern.h.

References ConstructHistograms().

Referenced by ConstructHistograms(), and main().

120 {ConstructHistograms((TDirectory*)NULL);};

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ConstructHistograms ( TDirectory *  folder)

Definition at line 709 of file QwHelicityPattern.cc.

References QwSubsystemArray::ConstructHistograms(), fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, and fYield.

710 {
711  TString prefix = "yield_";
712  fYield.ConstructHistograms(folder,prefix);
713  prefix = "asym_";
714  fAsymmetry.ConstructHistograms(folder,prefix);
715 
716  if (fEnableDifference) {
717  prefix = "diff_";
718  fDifference.ConstructHistograms(folder,prefix);
719  }
720  if (fEnableAlternateAsym) {
721  prefix = "asym1_";
722  fAsymmetry1.ConstructHistograms(folder,prefix);
723  prefix = "asym2_";
724  fAsymmetry2.ConstructHistograms(folder,prefix);
725  }
726 }
void ConstructHistograms()
Construct the histograms for this subsystem.
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fAsymmetry1

+ Here is the call graph for this function:

void QwHelicityPattern::DefineOptions ( QwOptions options)
static

Define the configuration options.

Defines configuration options using QwOptions functionality.

Parameters
optionsOptions object

Definition at line 26 of file QwHelicityPattern.cc.

References QwOptions::AddOptions(), default_bool_value, and QwBlinder::DefineOptions().

Referenced by DefineOptionsParity().

27 {
28  options.AddOptions("Helicity pattern")
29  ("enable-burstsum", po::value<bool>()->default_bool_value(false),
30  "enable burst sum calculation");
31  options.AddOptions("Helicity pattern")
32  ("enable-runningsum", po::value<bool>()->default_bool_value(true),
33  "enable running sum calculation");
34  options.AddOptions("Helicity pattern")
35  ("enable-differences", po::value<bool>()->default_bool_value(false),
36  "store pattern differences in tree");
37  options.AddOptions("Helicity pattern")
38  ("enable-alternateasym", po::value<bool>()->default_bool_value(false),
39  "enable alternate asymmetries");
40 
41  options.AddOptions("Helicity pattern")
42  ("print-burstsum", po::value<bool>()->default_bool_value(false),
43  "print burst sum of subsystems");
44  options.AddOptions("Helicity pattern")
45  ("print-runningsum", po::value<bool>()->default_bool_value(false),
46  "print running sum of subsystems");
47 
48  options.AddOptions("Helicity pattern")
49  ("burstlength", po::value<int>()->default_value(240),
50  "number of patterns per burst");
51 
52  QwBlinder::DefineOptions(options);
53 }
#define default_bool_value(b)
Definition: QwOptions.h:51
static void DefineOptions(QwOptions &options)
Definition: QwBlinder.cc:54
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition: QwOptions.h:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::DisableAlternateAsymmetry ( )
inline

Disable alternate asymmetry calculation.

Definition at line 65 of file QwHelicityPattern.h.

References fEnableAlternateAsym.

65 { fEnableAlternateAsym = kFALSE; };
void QwHelicityPattern::DisableBurstSum ( )
inline

Disable burst sum calculation.

Definition at line 72 of file QwHelicityPattern.h.

References fEnableBurstSum.

Referenced by ProcessOptions().

72 { fEnableBurstSum = kFALSE; };

+ Here is the caller graph for this function:

void QwHelicityPattern::DisableDifference ( )
inline

Disable storing pattern differences.

Definition at line 86 of file QwHelicityPattern.h.

References fEnableDifference.

86 { fEnableDifference = kFALSE; };
void QwHelicityPattern::DisableRunningSum ( )
inline

Disable running sum calculation.

Definition at line 79 of file QwHelicityPattern.h.

References fEnableRunningSum.

79 { fEnableRunningSum = kFALSE; };
void QwHelicityPattern::EnableAlternateAsymmetry ( const Bool_t  flag = kTRUE)
inline

Enable/disable alternate asymmetry calculation.

Definition at line 63 of file QwHelicityPattern.h.

References fEnableAlternateAsym.

63 { fEnableAlternateAsym = flag; };
void QwHelicityPattern::EnableBurstSum ( const Bool_t  flag = kTRUE)
inline

Enable/disable burst sum calculation.

Definition at line 70 of file QwHelicityPattern.h.

References fEnableBurstSum.

70 { fEnableBurstSum = flag; };
void QwHelicityPattern::EnableDifference ( const Bool_t  flag = kTRUE)
inline

Enable/disable storing pattern differences.

Definition at line 84 of file QwHelicityPattern.h.

References fEnableDifference.

84 { fEnableDifference = flag; };
void QwHelicityPattern::EnableRunningSum ( const Bool_t  flag = kTRUE)
inline

Enable/disable running sum calculation.

Definition at line 77 of file QwHelicityPattern.h.

References fEnableRunningSum.

77 { fEnableRunningSum = flag; };
void QwHelicityPattern::FillDB ( QwParityDB db)

Definition at line 816 of file QwHelicityPattern.cc.

References fBlinder, fEnableAlternateAsym, fEnableDifference, QwSubsystemArrayParity::FillDB(), QwBlinder::FillDB(), fRunningAsymmetry, fRunningAsymmetry1, fRunningAsymmetry2, fRunningDifference, and fRunningYield.

Referenced by main().

817 {
818  fBlinder.FillDB(db,"");
819 
820  fRunningYield.FillDB(db, "yield");
821  fRunningAsymmetry.FillDB(db, "asymmetry");
822  if (fEnableDifference) {
823  fRunningDifference.FillDB(db, "difference");
824  }
825  if (fEnableAlternateAsym) {
826  fRunningAsymmetry1.FillDB(db, "asymmetry1");
827  fRunningAsymmetry2.FillDB(db, "asymmetry2");
828  }
829 }
QwSubsystemArrayParity fRunningAsymmetry
void FillDB(QwParityDB *db, TString type)
Fill the database.
void FillDB(QwParityDB *db, TString datatype)
Write to the database.
Definition: QwBlinder.cc:937
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::FillErrDB ( QwParityDB db)

Definition at line 832 of file QwHelicityPattern.cc.

References fAsymmetry, fBlinder, QwSubsystemArrayParity::FillErrDB(), and QwBlinder::FillErrDB().

Referenced by main().

833 {
834  fBlinder.FillErrDB(db,"");
835  fAsymmetry.FillErrDB(db, "");
836  return;
837 };
void FillErrDB(QwParityDB *db, TString datatype)
Definition: QwBlinder.cc:1014
QwSubsystemArrayParity fAsymmetry
void FillErrDB(QwParityDB *db, TString type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::FillHistograms ( )

Definition at line 728 of file QwHelicityPattern.cc.

References fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, QwSubsystemArrayParity::FillHistograms(), fPatternIsGood, and fYield.

Referenced by main().

729 {
730  if (fPatternIsGood) {
733  if (fEnableDifference) {
735  }
739  }
740  }
741 }
void FillHistograms()
Fill the histograms for this subsystem.
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fAsymmetry1

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 800 of file QwHelicityPattern.cc.

References fAsymmetry, fAsymmetry1, fAsymmetry2, fDifference, fEnableAlternateAsym, fEnableDifference, QwSubsystemArrayParity::FillTreeVector(), fPatternIsGood, and fYield.

Referenced by main().

801 {
802  if (fPatternIsGood) {
803  fYield.FillTreeVector(values);
804  fAsymmetry.FillTreeVector(values);
805  if (fEnableDifference) {
806  fDifference.FillTreeVector(values);
807  }
808  if (fEnableAlternateAsym) {
809  fAsymmetry1.FillTreeVector(values);
810  fAsymmetry2.FillTreeVector(values);
811  }
812  }
813 }
QwSubsystemArrayParity fDifference
QwSubsystemArrayParity fYield
QwSubsystemArrayParity fAsymmetry
QwSubsystemArrayParity fAsymmetry2
QwSubsystemArrayParity fAsymmetry1
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:

QwSubsystemArrayParity& QwHelicityPattern::GetBurstAsymmetry ( )
inline

Definition at line 106 of file QwHelicityPattern.h.

References fBurstAsymmetry.

Referenced by main().

106 { return fBurstAsymmetry; };
QwSubsystemArrayParity fBurstAsymmetry

+ Here is the caller graph for this function:

QwSubsystemArrayParity& QwHelicityPattern::GetBurstDifference ( )
inline

Definition at line 105 of file QwHelicityPattern.h.

References fBurstDifference.

Referenced by main().

105 { return fBurstDifference; };
QwSubsystemArrayParity fBurstDifference

+ Here is the caller graph for this function:

QwSubsystemArrayParity& QwHelicityPattern::GetBurstYield ( )
inline

Definition at line 104 of file QwHelicityPattern.h.

References fBurstYield.

Referenced by main().

104 { return fBurstYield; };
QwSubsystemArrayParity fBurstYield

+ Here is the caller graph for this function:

UInt_t QwHelicityPattern::GetEventcutErrorFlag ( ) const
inline

Definition at line 133 of file QwHelicityPattern.h.

References fAsymmetry, and QwSubsystemArrayParity::GetEventcutErrorFlag().

Referenced by QwRegression::LinearRegression().

133  {
135  };
QwSubsystemArrayParity fAsymmetry
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 QwHelicityPattern::GetTargetChargeStat ( Double_t &  asym,
Double_t &  error,
Double_t &  width 
)
Bool_t QwHelicityPattern::HasDataLoaded ( ) const
inline

Definition at line 50 of file QwHelicityPattern.h.

References fIsDataLoaded.

50 { return fIsDataLoaded; };
Bool_t QwHelicityPattern::IsAlternateAsymEnabled ( )
inline

Status of alternate asymmetry calculation flag.

Definition at line 67 of file QwHelicityPattern.h.

References fEnableAlternateAsym.

67 { return fEnableAlternateAsym; };
Bool_t QwHelicityPattern::IsBurstSumEnabled ( )
inline

Status of burst sum calculation flag.

Definition at line 74 of file QwHelicityPattern.h.

References fEnableBurstSum.

Referenced by main().

74 { return fEnableBurstSum; };

+ Here is the caller graph for this function:

Bool_t QwHelicityPattern::IsCompletePattern ( ) const

Check to see if the pattern is complete.

Definition at line 284 of file QwHelicityPattern.cc.

References fEventLoaded, fEvents, and fPatternSize.

Referenced by main(), and Print().

285 {
286  Bool_t localdebug=kFALSE;
287  Bool_t filled=kTRUE;
288  Int_t i=fPatternSize-1;
289  while(filled && i>-1)
290  {
291  if (localdebug){
292  std::cout<<" i="<<i<<" is loaded ?"
293  <<fEventLoaded[fEvents.size()-i-1]<<"\n";
294  }
295  if(!fEventLoaded[i])
296  filled=kFALSE;
297  i--;
298  }
299 
300 
301 
302  return filled;
303 }
std::vector< Bool_t > fEventLoaded
std::vector< QwSubsystemArrayParity > fEvents

+ Here is the caller graph for this function:

Bool_t QwHelicityPattern::IsDifferenceEnabled ( )
inline

Status of storing pattern differences flag.

Definition at line 88 of file QwHelicityPattern.h.

References fEnableDifference.

88 { return fEnableDifference; };
Bool_t QwHelicityPattern::IsEndOfBurst ( )
inline

Definition at line 54 of file QwHelicityPattern.h.

References fBurstLength, and fCurrentPatternNumber.

Referenced by main().

54  {
55  // Is this the end of a burst?
56  return (fBurstLength > 0 && fCurrentPatternNumber % fBurstLength == 0);
57  }

+ Here is the caller graph for this function:

Bool_t QwHelicityPattern::IsGoodAsymmetry ( )
inline

Definition at line 132 of file QwHelicityPattern.h.

References fPatternIsGood.

Referenced by main().

132 { return fPatternIsGood;};

+ Here is the caller graph for this function:

Bool_t QwHelicityPattern::IsRunningSumEnabled ( )
inline

Status of running sum calculation flag.

Definition at line 81 of file QwHelicityPattern.h.

References fEnableRunningSum.

Referenced by main().

81 { return fEnableRunningSum; };

+ Here is the caller graph for this function:

void QwHelicityPattern::LoadEventData ( QwSubsystemArrayParity event)

Load event data corresponding to the current pattern from the subsystems.

Definition at line 181 of file QwHelicityPattern.cc.

References ClearEventData(), QwLog::endl(), fCurrentPatternNumber, fEventLoaded, fEventNumber, fEvents, fHelicity, fHelicityIsMissing, fIgnoreHelicity, fLastPatternNumber, fLastPhaseNumber, fLastWindowNumber, fPatternIsGood, fPatternSize, QwHelicity::GetEventNumber(), QwHelicity::GetHelicityActual(), QwHelicity::GetMinPatternPhase(), QwHelicity::GetPatternNumber(), QwHelicity::GetPhaseNumber(), VQwSubsystem::HasDataLoaded(), QwHelicity::IsHelicityIgnored(), Print(), QwError, QwWarning, and SetDataLoaded().

Referenced by main().

182 {
183 
184  Bool_t localdebug = kFALSE;
185  fPatternIsGood = kFALSE;
186 
187  Long_t localEventNumber = -1;
188  Long_t localPatternNumber = -1;
189  Int_t localPhaseNumber = -1;
190  Int_t localHelicityActual = -1;
191  Bool_t localIgnoreHelicity = kFALSE;
192 
193 
194  // Get the list of helicity subsystems
195  if (! fHelicityIsMissing){
196  std::vector<VQwSubsystem*> subsys_helicity = event.GetSubsystemByType("QwHelicity");
197  QwHelicity* helicity = 0;
198 
199  if (subsys_helicity.size() > 0) {
200  // Take the first helicity subsystem
201  helicity = dynamic_cast<QwHelicity*>(subsys_helicity.at(0));
202  if (helicity->HasDataLoaded()){
203  localIgnoreHelicity = helicity->IsHelicityIgnored();
204  // Get the event, pattern, phase number and helicity
205  localEventNumber = helicity->GetEventNumber();
206  localPatternNumber = helicity->GetPatternNumber();
207  localPhaseNumber = helicity->GetPhaseNumber() - helicity->GetMinPatternPhase(); // Use "reduced pattern phase", counts from 0.
208  localHelicityActual = helicity->GetHelicityActual();
209  } else {
210  QwError << "QwHelicityPattern::LoadEventData: The helicity subsystem does not have valid data!"
211  << QwLog::endl;
212  }
213  } else {
214  // We are not usng any helicity subsystem
215  static Bool_t user_has_been_warned = kFALSE;
216  if (! user_has_been_warned) {
217  QwError << "No helicity subsystem found! Dropping to \"Missing Helicity\" mode!" << QwLog::endl;
218  user_has_been_warned = kTRUE;
219  fHelicityIsMissing = kTRUE;
220  }
221  }
222  }
223  if (fHelicityIsMissing){
224  localIgnoreHelicity = kTRUE;
225  localPatternNumber = fLastPatternNumber;
226  localEventNumber = fLastWindowNumber + 1;
227  localPhaseNumber = fLastPhaseNumber + 1;
228  if(localPhaseNumber>=fPatternSize){
229  localPatternNumber++;
230  localPhaseNumber = 0; // Use "reduced pattern phase", counts from 0.
231  }
232  fLastWindowNumber = localEventNumber;
233  fLastPhaseNumber = localPhaseNumber;
234  fLastPatternNumber = localPatternNumber;
235  }
236  if(localdebug) {
237  std::cout<<"\n ###################################\n";
238  std::cout<<"QwHelicityPattern::LoadEventData :: ";
239  std::cout<<" event, pattern, phase # "<<localEventNumber<<" "<<localPatternNumber<<" "<<localPhaseNumber<<"\n";
240  std::cout<<" helicity ="<< localHelicityActual<<"\n";
241  for(size_t i=0; i<fEvents.size(); i++)
242  std::cout<<i<<":"<<fEventLoaded[i]<<" ";
243  std::cout<<"\n";
244  }
245  if(fCurrentPatternNumber!=localPatternNumber){
246  // new pattern
247  ClearEventData();
248  fCurrentPatternNumber=localPatternNumber;
249  }
250  if(localPhaseNumber<0){
251  QwWarning << "QwHelicityPattern::LoadEventData: "
252  << "Reduced event phase number is less than zero; ignore this event."
253  << QwLog::endl;
254  ClearEventData();
255  } else if(localPhaseNumber>=fPatternSize){
256  QwWarning<<" In QwHelicityPattern::LoadEventData trying upload an event with a phase larger than expected \n"
257  <<" phase ="<<localPhaseNumber+1<<" maximum expected phase="<<fPatternSize<<"\n"
258  <<" operation impossible, pattern reset to 0: no asymmetries will be computed "<<QwLog::endl;
259  ClearEventData();
260  } else {
261  if(localdebug){
262  std::cout<<"QwHelicityPattern::LoadEventData local i="
263  <<localPhaseNumber<<"\n";
264  }
265  fEvents[localPhaseNumber] = event;
266  fEventLoaded[localPhaseNumber] = kTRUE;
267  fHelicity[localPhaseNumber] = localHelicityActual;
268  fEventNumber[localPhaseNumber] = localEventNumber;
269  // Check to see if we should ignore the helicity; this is
270  // reset to false in ClearEventData.
271  fIgnoreHelicity |= localIgnoreHelicity;
272  SetDataLoaded(kTRUE);
273  }
274  if(localdebug){
275  Print();
276  }
277  return;
278 }
Int_t GetPhaseNumber()
Definition: QwHelicity.cc:1084
std::vector< Int_t > fEventNumber
Bool_t IsHelicityIgnored()
Definition: QwHelicity.h:140
std::vector< Bool_t > fEventLoaded
Bool_t HasDataLoaded() const
Definition: VQwSubsystem.h:94
Long_t GetPatternNumber()
Definition: QwHelicity.cc:1074
Long_t GetEventNumber()
Definition: QwHelicity.cc:1079
Int_t GetMinPatternPhase()
Definition: QwHelicity.h:103
void SetDataLoaded(Bool_t flag)
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents
Int_t GetHelicityActual()
Definition: QwHelicity.cc:1064
#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 QwHelicityPattern::Print ( ) const

Definition at line 851 of file QwHelicityPattern.cc.

References QwLog::endl(), fCurrentPatternNumber, fEventLoaded, fEventNumber, fHelicity, fPatternSize, IsCompletePattern(), and QwOut.

Referenced by LoadEventData().

852 {
853  QwOut << "Pattern number = " << fCurrentPatternNumber << QwLog::endl;
854  for (Int_t i = 0; i < fPatternSize; i++)
855  QwOut << "Event " << fEventNumber[i] << ": "
856  << fEventLoaded[i] << ", " << fHelicity[i] << QwLog::endl;
857  QwOut << "Is a complete pattern? (n/y:0/1) " << IsCompletePattern() << QwLog::endl;
858 }
std::vector< Int_t > fEventNumber
#define QwOut
Predefined log drain for explicit output.
Definition: QwLog.h:35
std::vector< Bool_t > fEventLoaded
Bool_t IsCompletePattern() const
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::vector< Int_t > fHelicity

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::PrintBurstAverage ( ) const

Definition at line 693 of file QwHelicityPattern.cc.

References QwLog::endl(), fBurstAsymmetry, fBurstDifference, fBurstYield, QwSubsystemArrayParity::PrintValue(), and QwMessage.

Referenced by CalculateBurstAverage().

694 {
695  QwMessage << " Burst average of asymmetry " << QwLog::endl;
696  QwMessage << " ==============================" << QwLog::endl;
698 
699  QwMessage << " Burst average of difference " << QwLog::endl;
700  QwMessage << " ==============================" << QwLog::endl;
702 
703  QwMessage << " Burst average of yields " << QwLog::endl;
704  QwMessage << " ==============================" << QwLog::endl;
706 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void PrintValue() const
Print value of all channels.
QwSubsystemArrayParity fBurstDifference
QwSubsystemArrayParity fBurstAsymmetry
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwSubsystemArrayParity fBurstYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::PrintRunningAverage ( ) const

Definition at line 672 of file QwHelicityPattern.cc.

References QwLog::endl(), fEnableAlternateAsym, fEnableDifference, fRunningAsymmetry, fRunningAsymmetry1, fRunningAsymmetry2, fRunningDifference, fRunningYield, QwSubsystemArrayParity::PrintValue(), and QwMessage.

Referenced by CalculateRunningAverage(), and main().

673 {
674  QwMessage << "QwHelicityPattern::PrintRunningAverage() const " << QwLog::endl;
675  // QwMessage << " Running average of yields " << QwLog::endl;
677  // QwMessage << " Running average of asymmetry " << QwLog::endl;
679  if (fEnableAlternateAsym) {
680  // QwMessage << " Running average of first half/second half asymmetry " << QwLog::endl;
682  // QwMessage << " Running average of even/odd asymmetry " << QwLog::endl;
684  }
685  if (fEnableDifference){
686  // QwMessage << " Running average of difference " << QwLog::endl;
688  }
689 
690 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void PrintValue() const
Print value of all channels.
QwSubsystemArrayParity fRunningAsymmetry
QwSubsystemArrayParity fRunningAsymmetry1
QwSubsystemArrayParity fRunningAsymmetry2
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::PrintRunningBurstAverage ( ) const

Definition at line 656 of file QwHelicityPattern.cc.

References QwLog::endl(), fRunningBurstAsymmetry, fRunningBurstDifference, fRunningBurstYield, QwSubsystemArrayParity::PrintValue(), and QwMessage.

Referenced by CalculateRunningBurstAverage(), and main().

657 {
658  QwMessage << " Running burst average of asymmetry" << QwLog::endl;
659  QwMessage << " ==============================" << QwLog::endl;
661 
662  QwMessage << " Running burst average of difference" << QwLog::endl;
663  QwMessage << " ==============================" << QwLog::endl;
665 
666  QwMessage << " Running burst average of yields" << QwLog::endl;
667  QwMessage << " ==============================" << QwLog::endl;
669 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void PrintValue() const
Print value of all channels.
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fRunningBurstYield
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwSubsystemArrayParity fRunningBurstAsymmetry

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::ProcessOptions ( QwOptions options)

Process the configuration options.

Definition at line 56 of file QwHelicityPattern.cc.

References DisableBurstSum(), QwLog::endl(), fBlinder, fBurstLength, fEnableAlternateAsym, fEnableBurstSum, fEnableDifference, fEnableRunningSum, fPatternSize, fPrintBurstSum, fPrintRunningSum, QwOptions::GetValue(), QwBlinder::ProcessOptions(), and QwWarning.

Referenced by main().

57 {
58  fEnableBurstSum = options.GetValue<bool>("enable-burstsum");
59  fEnableRunningSum = options.GetValue<bool>("enable-runningsum");
60  fPrintBurstSum = options.GetValue<bool>("print-burstsum");
61  fPrintRunningSum = options.GetValue<bool>("print-runningsum");
62 
63  fEnableDifference = options.GetValue<bool>("enable-differences");
64  fEnableAlternateAsym = options.GetValue<bool>("enable-alternateasym");
65 
66  fBurstLength = options.GetValue<int>("burstlength");
67  if (fBurstLength == 0) DisableBurstSum();
68 
69  if (fEnableAlternateAsym && fPatternSize <= 2){
70  QwWarning << "QwHelicityPattern::ProcessOptions: "
71  << "The 'enable-alternateasym' flag is disabled for pair analysis."
72  << QwLog::endl;
73  fEnableAlternateAsym = kFALSE;
74  }
75 
76  fBlinder.ProcessOptions(options);
77 }
void ProcessOptions(QwOptions &options)
Update the status with new external information.
Definition: QwBlinder.cc:112
void DisableBurstSum()
Disable burst sum calculation.
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::SetDataLoaded ( Bool_t  flag)
inlineprotected

Definition at line 208 of file QwHelicityPattern.h.

References fIsDataLoaded.

Referenced by ClearEventData(), and LoadEventData().

208 { fIsDataLoaded = flag; };

+ Here is the caller graph for this function:

void QwHelicityPattern::UpdateBlinder ( QwParityDB db)
inline

Update the blinder status with new external information.

Definition at line 91 of file QwHelicityPattern.h.

References fBlinder, and QwBlinder::Update().

Referenced by main().

91  {
92  fBlinder.Update(db);
93  };
void Update(QwParityDB *db)
Update the status with new external information.
Definition: QwBlinder.cc:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwHelicityPattern::UpdateBlinder ( const QwSubsystemArrayParity detectors)
inline

Update the blinder status with new external information.

Definition at line 95 of file QwHelicityPattern.h.

References fBlinder, and QwBlinder::Update().

95  {
96  fBlinder.Update(detectors);
97  };
void Update(QwParityDB *db)
Update the status with new external information.
Definition: QwBlinder.cc:138

+ Here is the call graph for this function:

void QwHelicityPattern::UpdateBlinder ( const QwEPICSEvent epics)
inline

Update the blinder status with new external information.

Definition at line 99 of file QwHelicityPattern.h.

References fBlinder, and QwBlinder::Update().

99  {
100  fBlinder.Update(epics);
101  };
void Update(QwParityDB *db)
Update the status with new external information.
Definition: QwBlinder.cc:138

+ Here is the call graph for this function:

void QwHelicityPattern::WritePromptSummary ( QwPromptSummary ps)

Definition at line 840 of file QwHelicityPattern.cc.

References fRunningAsymmetry, fRunningYield, and QwSubsystemArrayParity::WritePromptSummary().

Referenced by main().

841 {
842  fRunningYield.WritePromptSummary(ps, "yield");
843  fRunningAsymmetry.WritePromptSummary(ps, "asymmetry");
844 
845  return;
846 };
void WritePromptSummary(QwPromptSummary *ps, TString type)
QwSubsystemArrayParity fRunningAsymmetry
QwSubsystemArrayParity fRunningYield

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class QwRegression
friend

Definition at line 208 of file QwHelicityPattern.h.

Field Documentation

QwSubsystemArrayParity QwHelicityPattern::fAlternateDiff
protected

Definition at line 196 of file QwHelicityPattern.h.

Referenced by CalculateAsymmetry(), and ClearEventData().

QwBlinder QwHelicityPattern::fBlinder
protected
QwSubsystemArrayParity QwHelicityPattern::fBurstAsymmetry
protected
Int_t QwHelicityPattern::fBurstLength
protected

Definition at line 175 of file QwHelicityPattern.h.

Referenced by IsEndOfBurst(), and ProcessOptions().

Int_t QwHelicityPattern::fCurrentPatternNumber
protected
Bool_t QwHelicityPattern::fDEBUG
protected

Definition at line 144 of file QwHelicityPattern.h.

Bool_t QwHelicityPattern::fEnableBurstSum
protected
Bool_t QwHelicityPattern::fEnableRunningSum
protected
std::vector<Bool_t> QwHelicityPattern::fEventLoaded
protected
std::vector<Int_t> QwHelicityPattern::fEventNumber
protected

Definition at line 151 of file QwHelicityPattern.h.

Referenced by LoadEventData(), Print(), and QwHelicityPattern().

std::vector<QwSubsystemArrayParity> QwHelicityPattern::fEvents
protected
std::vector<Int_t> QwHelicityPattern::fHelicity
protected
Bool_t QwHelicityPattern::fHelicityIsMissing
protected

This indicates if the subsystem arrays are missing the helicity object. It is updated once during initialization and once when processing the first event

Definition at line 161 of file QwHelicityPattern.h.

Referenced by LoadEventData(), and QwHelicityPattern().

Bool_t QwHelicityPattern::fIgnoreHelicity
protected

This is true if any of the helicity objects of this pattern have indicated that we should ignore the helicity. It is updated every event and reset by ClearEventData.

Definition at line 164 of file QwHelicityPattern.h.

Referenced by CalculateAsymmetry(), ClearEventData(), and LoadEventData().

Bool_t QwHelicityPattern::fIsDataLoaded
protected

Definition at line 207 of file QwHelicityPattern.h.

Referenced by HasDataLoaded(), and SetDataLoaded().

Long_t QwHelicityPattern::fLastPatternNumber
protected

Definition at line 201 of file QwHelicityPattern.h.

Referenced by LoadEventData().

Int_t QwHelicityPattern::fLastPhaseNumber
protected

Definition at line 202 of file QwHelicityPattern.h.

Referenced by LoadEventData().

Long_t QwHelicityPattern::fLastWindowNumber
protected

Definition at line 200 of file QwHelicityPattern.h.

Referenced by LoadEventData().

QwSubsystemArrayParity QwHelicityPattern::fNegativeHelicitySum
protected

Definition at line 198 of file QwHelicityPattern.h.

Referenced by CalculateAsymmetry(), and ClearEventData().

Bool_t QwHelicityPattern::fPatternIsGood
protected
Int_t QwHelicityPattern::fPatternSize
protected
QwSubsystemArrayParity QwHelicityPattern::fPositiveHelicitySum
protected

Definition at line 197 of file QwHelicityPattern.h.

Referenced by CalculateAsymmetry(), and ClearEventData().

Bool_t QwHelicityPattern::fPrintBurstSum
protected
Bool_t QwHelicityPattern::fPrintRunningSum
protected

Definition at line 187 of file QwHelicityPattern.h.

Referenced by CalculateRunningAverage(), and ProcessOptions().

Int_t QwHelicityPattern::fQuartetNumber
protected

Definition at line 154 of file QwHelicityPattern.h.

Referenced by CalculateAsymmetry(), and QwHelicityPattern().

QwSubsystemArrayParity QwHelicityPattern::fRunningAsymmetry
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningAsymmetry1
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningAsymmetry2
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningBurstAsymmetry
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningBurstDifference
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningBurstYield
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningDifference
protected
QwSubsystemArrayParity QwHelicityPattern::fRunningYield
protected

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