30 "enable burst sum calculation");
33 "enable running sum calculation");
36 "store pattern differences in tree");
39 "enable alternate asymmetries");
43 "print burst sum of subsystems");
46 "print running sum of subsystems");
49 (
"burstlength", po::value<int>()->default_value(240),
50 "number of patterns per burst");
70 QwWarning <<
"QwHelicityPattern::ProcessOptions: "
71 <<
"The 'enable-alternateasym' flag is disabled for pair analysis."
73 fEnableAlternateAsym = kFALSE;
82 fHelicityIsMissing(kFALSE),
83 fIgnoreHelicity(kFALSE),
86 fEnableAlternateAsym(kFALSE),
89 fEnableBurstSum(kFALSE),
90 fPrintBurstSum(kFALSE),
92 fBurstDifference(event),
93 fBurstAsymmetry(event),
94 fRunningBurstYield(event),
95 fRunningBurstDifference(event),
96 fRunningBurstAsymmetry(event),
97 fEnableRunningSum(kTRUE),
98 fPrintRunningSum(kFALSE),
100 fRunningDifference(event),
101 fRunningAsymmetry(event),
102 fRunningAsymmetry1(event),
103 fRunningAsymmetry2(event),
104 fEnableDifference(kFALSE),
106 fAlternateDiff(event),
107 fPositiveHelicitySum(event),
108 fNegativeHelicitySum(event),
109 fLastWindowNumber(0),
110 fLastPatternNumber(0),
114 std::vector<VQwSubsystem*> subsys_helicity =
event.GetSubsystemByType(
"QwHelicity");
115 if (subsys_helicity.size() > 0) {
125 if (subsys_helicity.size() > 1)
126 QwWarning <<
"Multiple helicity subsystems defined! "
132 QwError <<
"No helicity subsystem defined! "
133 <<
"Calculate asymmetries based on (+--+) quartets!"
163 "Standard exception from QwHelicityPattern : the pattern size has to be even; right now pattern_size=";
165 throw std::invalid_argument(loc.Data());
168 catch (std::exception&
e)
170 std::cerr << e.what() << std::endl;
184 Bool_t localdebug = kFALSE;
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;
196 std::vector<VQwSubsystem*> subsys_helicity =
event.GetSubsystemByType(
"QwHelicity");
199 if (subsys_helicity.size() > 0) {
201 helicity =
dynamic_cast<QwHelicity*
>(subsys_helicity.at(0));
210 QwError <<
"QwHelicityPattern::LoadEventData: The helicity subsystem does not have valid data!"
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;
224 localIgnoreHelicity = kTRUE;
229 localPatternNumber++;
230 localPhaseNumber = 0;
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++)
250 if(localPhaseNumber<0){
251 QwWarning <<
"QwHelicityPattern::LoadEventData: "
252 <<
"Reduced event phase number is less than zero; ignore this event."
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;
262 std::cout<<
"QwHelicityPattern::LoadEventData local i="
263 <<localPhaseNumber<<
"\n";
265 fEvents[localPhaseNumber] = event;
267 fHelicity[localPhaseNumber] = localHelicityActual;
286 Bool_t localdebug=kFALSE;
289 while(filled && i>-1)
292 std::cout<<
" i="<<i<<
" is loaded ?"
313 Bool_t localdebug=kFALSE;
315 if(localdebug) std::cout<<
"Entering QwHelicityPattern::CalculateAsymmetry \n";
320 Bool_t firstplushel=kTRUE;
321 Bool_t firstminushel=kTRUE;
332 localhel ^= ((i >> j)&0x1);
334 if (localhel == plushel) {
337 firstplushel = kFALSE;
341 }
else if (localhel == minushel) {
344 firstminushel = kFALSE;
354 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: here filling fPositiveHelicitySum \n";
356 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: with = \n";
358 firstplushel = kFALSE;
360 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: with += \n";
365 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: here filling fNegativeHelicitySum \n";
367 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: with = \n";
369 firstminushel = kFALSE;
371 if (localdebug) std::cout<<
"QwHelicityPattern::CalculateAsymmetry: with += \n";
376 QwDebug <<
"QwHelicityPattern::CalculateAsymmetry: "
377 <<
"Helicity should be "<<plushel<<
" or "<<minushel
379 <<
"; Asymmetry computation aborted!"<<
QwLog::endl;
388 if (checkhel == -9999) {
391 }
else if (checkhel!=0) {
394 QwError<<
" QwHelicityPattern::CalculateAsymmetry == \n"
395 <<
" you do not have the same number of positive and negative \n"
396 <<
" impossible to compute assymetry \n"
490 for(
size_t i=0; i<
fEvents.size(); i++)
711 TString prefix =
"yield_";
745 TString newprefix =
"yield_" + prefix;
747 newprefix =
"asym_" + prefix;
751 newprefix =
"diff_" + prefix;
755 newprefix =
"asym1_" + prefix;
757 newprefix =
"asym2_" + prefix;
764 TString newprefix =
"yield_" + prefix;
766 newprefix =
"asym_" + prefix;
770 newprefix =
"diff_" + prefix;
774 newprefix =
"asym1_" + prefix;
776 newprefix =
"asym2_" + prefix;
783 TString newprefix =
"yield_" + prefix;
785 newprefix =
"asym_" + prefix;
789 newprefix =
"diff_" + prefix;
793 newprefix =
"asym1_" + prefix;
795 newprefix =
"asym2_" + prefix;
#define QwMessage
Predefined log drain for regular messages.
void ProcessOptions(QwOptions &options)
Update the status with new external information.
void FillHistograms()
Fill the histograms for this subsystem.
void FillErrDB(QwParityDB *db, TString datatype)
std::vector< Int_t > fEventNumber
void PrintValue() const
Print value of all channels.
QwSubsystemArrayParity fBurstDifference
#define QwOut
Predefined log drain for explicit output.
Bool_t IsHelicityIgnored()
void ConstructHistograms()
Construct the histograms for this subsystem.
QwSubsystemArrayParity fDifference
#define default_bool_value(b)
void WritePromptSummary(QwPromptSummary *ps, TString type)
QwSubsystemArrayParity fRunningBurstDifference
QwSubsystemArrayParity fRunningAsymmetry
std::vector< Bool_t > fEventLoaded
void DisableBurstSum()
Disable burst sum calculation.
void CalculateBurstAverage()
QwSubsystemArrayParity fBurstAsymmetry
void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Sum of two subsystem arrays.
static void DefineOptions(QwOptions &options)
Define the configuration options.
void ConstructHistograms()
void ConstructBranch(TTree *tree, TString &prefix)
QwHelicityPattern()
Private default constructor (not implemented, will throw linker error on use)
QwSubsystemArrayParity fNegativeHelicitySum
void AccumulateRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
static void DefineOptions(QwOptions &options)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct a branch and vector for this subsystem with a prefix.
QwSubsystemArrayParity fYield
void WritePromptSummary(QwPromptSummary *ps)
Bool_t fEnableAlternateAsym
void CalculateRunningBurstAverage()
Bool_t HasDataLoaded() const
Long_t GetPatternNumber()
void CalculateRunningAverage()
Calculate the average for all good events.
QwSubsystemArrayParity fAlternateDiff
void CalculateAsymmetry()
Bool_t IsCompletePattern() const
QwSubsystemArrayParity fAsymmetry
void PrintBurstAverage() const
void AccumulateRunningSum()
Int_t GetMaxPatternPhase()
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
QwSubsystemArrayParity fPositiveHelicitySum
QwSubsystemArrayParity fRunningBurstYield
Int_t GetMinPatternPhase()
QwSubsystemArrayParity fAsymmetry2
void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Difference of two subsystem arrays.
Definition of the pure virtual base class of all data elements.
T GetValue(const std::string &key)
Get a templated value.
Virtual base class for the parity subsystems.
void FillErrDB(QwParityDB *db, TString type)
void Scale(Double_t factor)
Scale this subsystem array.
void PrintRunningAverage() const
#define QwDebug
Predefined log drain for debugging output.
A logfile class, based on an identical class in the Hermes analyzer.
void Blind(QwSubsystemArrayParity &diff)
Blind the asymmetry of an array of subsystems.
void AccumulateRunningBurstSum()
void FillTreeVector(std::vector< Double_t > &values) const
void ProcessOptions(QwOptions &options)
Process the configuration options.
void FillDB(QwParityDB *db, TString type)
Fill the database.
void FillDB(QwParityDB *db, TString datatype)
Write to the database.
void ConstructBranch(TTree *tree, TString &prefix)
Construct a branch for this subsystem with a prefix.
QwSubsystemArrayParity fRunningAsymmetry1
void SetDataLoaded(Bool_t flag)
Int_t fCurrentPatternNumber
QwSubsystemArrayParity fRunningAsymmetry2
A class for blinding data, adapted from G0 blinder class.
Bool_t fHelicityIsMissing
static std::ostream & endl(std::ostream &)
End of the line.
void AccumulateBurstSum()
void LoadEventData(QwSubsystemArrayParity &event)
void FillErrDB(QwParityDB *db)
QwSubsystemArrayParity fAsymmetry1
void PrintRunningBurstAverage() const
void IncrementErrorCounters()
Update the data elements' error counters based on their internal error flags.
#define QwWarning
Predefined log drain for warnings.
std::vector< Int_t > fHelicity
std::vector< QwSubsystemArrayParity > fEvents
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.
Long_t fLastPatternNumber
void FillDB(QwParityDB *db)
Int_t GetHelicityActual()
QwSubsystemArrayParity fRunningDifference
QwSubsystemArrayParity fRunningYield
void CalculateRunningAverage()
QwSubsystemArrayParity fBurstYield
#define QwError
Predefined log drain for errors.
QwSubsystemArrayParity fRunningBurstAsymmetry
TString GetSubsystemName() const
void FillTreeVector(std::vector< Double_t > &values) const
Fill the vector for this subsystem.
void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
Ratio of two subsystem arrays.