JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwHelicity Class Reference

Subsystem for helicity state management and pattern recognition. More...

#include <QwHelicity.h>

+ Inheritance diagram for QwHelicity:
+ Collaboration diagram for QwHelicity:

Public Member Functions

 QwHelicity (const TString &name)
 Constructor with name.
 
 QwHelicity (const QwHelicity &source)
 Copy constructor.
 
virtual ~QwHelicity () override
 Virtual destructor.
 
void ProcessOptions (QwOptions &options) override
 Process the command line options.
 
Int_t LoadChannelMap (TString mapfile) override
 Mandatory map file definition.
 
Int_t LoadInputParameters (TString pedestalfile) override
 Mandatory parameter file definition.
 
Int_t LoadEventCuts (TString filename) override
 Optional event cut file.
 
Bool_t ApplySingleEventCuts () override
 Apply the single event cuts.
 
Bool_t CheckForBurpFail (const VQwSubsystem *ev_error) override
 Report the number of events failed due to HW and event cut failures.
 
Int_t ProcessConfigurationBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 
Int_t ProcessEvBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
 
Int_t ProcessEvBuffer (UInt_t ev_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 
void ProcessEventUserbitMode ()
 Process helicity information from userbit configuration data.
 
void ProcessEventInputRegisterMode ()
 
void ProcessEventInputMollerMode ()
 
void EncodeEventData (std::vector< UInt_t > &buffer) override
 
void ClearEventData () override
 
void ProcessEvent () override
 
UInt_t GetRandomSeedActual ()
 
UInt_t GetRandomSeedDelayed ()
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 Construct the histograms for this subsystem in a folder with a prefix.
 
VQwSubsystemoperator= (VQwSubsystem *value) override
 Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)
 
virtual void ConstructHistograms ()
 Construct the histograms for this subsystem.
 
virtual void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder.
 
virtual void ConstructHistograms (TString &prefix)
 Construct the histograms for this subsystem with a prefix.
 
virtual void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values)=0
 Construct the branch and tree vector.
 
virtual void ConstructBranchAndVector (TTree *tree, QwRootTreeBranchVector &values)
 Construct the branch and tree vector.
 
- Public Member Functions inherited from QwHelicityBase
 QwHelicityBase (const TString &name)
 Constructor with name.
 
 QwHelicityBase (const QwHelicityBase &source)
 Copy constructor.
 
virtual ~QwHelicityBase () override
 Virtual destructor.
 
void ProcessOptions (QwOptions &options) override
 Process the command line options.
 
Int_t LoadChannelMap (TString mapfile) override
 Mandatory map file definition.
 
Int_t LoadInputParameters (TString pedestalfile) override
 Mandatory parameter file definition.
 
Int_t LoadEventCuts (TString filename) override
 Optional event cut file.
 
Bool_t ApplySingleEventCuts () override
 Apply the single event cuts.
 
Bool_t CheckForBurpFail (const VQwSubsystem *ev_error) override
 Report the number of events failed due to HW and event cut failures.
 
void IncrementErrorCounters () override
 Increment the error counters.
 
void PrintErrorCounters () const override
 
UInt_t GetEventcutErrorFlag () override
 Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
 
void UpdateErrorFlag (const VQwSubsystem *ev_error) override
 update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem
 
Int_t ProcessConfigurationBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 
Int_t ProcessEvBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words)
 TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
 
Int_t ProcessEvBuffer (UInt_t ev_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 
UInt_t GetRandomSeedActual ()
 
UInt_t GetRandomSeedDelayed ()
 
void PredictHelicity ()
 
void RunPredictor ()
 
void SetHelicityDelay (Int_t delay)
 
void SetHelicityBitPattern (TString hex)
 
Int_t GetHelicityReported ()
 
Int_t GetHelicityActual ()
 
Int_t GetHelicityDelayed ()
 
Long_t GetEventNumber ()
 
Long_t GetPatternNumber ()
 
Int_t GetPhaseNumber ()
 
Int_t GetMaxPatternPhase ()
 
Int_t GetMinPatternPhase ()
 
void SetFirstBits (UInt_t nbits, UInt_t firstbits)
 
void SetEventPatternPhase (Int_t event, Int_t pattern, Int_t phase)
 
VQwSubsystemoperator= (VQwSubsystem *value) override
 Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)
 
VQwSubsystemoperator+= (VQwSubsystem *value) override
 
virtual VQwSubsystemoperator-= (VQwSubsystem *value) override
 
void Scale (Double_t factor) override
 
void Ratio (VQwSubsystem *numer, VQwSubsystem *denom) override
 
void AccumulateRunningSum (VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 Update the running sums for devices.
 
void DeaccumulateRunningSum (VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
 remove one entry from the running sums for devices
 
void CalculateRunningAverage () override
 Calculate the average for all good events.
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 Construct the histograms for this subsystem in a folder with a prefix.
 
void FillHistograms () override
 Fill the histograms for this subsystem.
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
 Construct the branch and tree vector.
 
void ConstructBranch (TTree *tree, TString &prefix) override
 Construct the branch and tree vector.
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file) override
 Construct the branch and tree vector based on the trim file.
 
void FillTreeVector (QwRootTreeBranchVector &values) const override
 Fill the tree vector.
 
void Print () const
 
Bool_t IsHelicityIgnored ()
 
virtual Bool_t IsGoodHelicity ()
 
virtual void ConstructHistograms ()
 Construct the histograms for this subsystem.
 
virtual void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder.
 
virtual void ConstructHistograms (TString &prefix)
 Construct the histograms for this subsystem with a prefix.
 
virtual void ConstructBranchAndVector (TTree *tree, QwRootTreeBranchVector &values)
 Construct the branch and tree vector.
 
- Public Member Functions inherited from VQwSubsystemParity
 VQwSubsystemParity (const TString &name)
 Constructor with name.
 
 VQwSubsystemParity (const VQwSubsystemParity &source)
 Copy constructor.
 
 ~VQwSubsystemParity () override
 Default destructor.
 
virtual void FillDB_MPS (QwParityDB *, TString)
 Fill the database with MPS-based variables Note that most subsystems don't need to do this.
 
virtual void FillDB (QwParityDB *, TString)
 Fill the database.
 
virtual void FillErrDB (QwParityDB *, TString)
 
virtual void Sum (VQwSubsystem *value1, VQwSubsystem *value2)
 
virtual void Difference (VQwSubsystem *value1, VQwSubsystem *value2)
 
Int_t LoadEventCuts (TString filename) override
 Load the event cuts file.
 
virtual void LoadEventCuts_Init ()
 
virtual void LoadEventCuts_Line (QwParameterFile &, TString &, Int_t &)
 
virtual void LoadEventCuts_Fin (Int_t &)
 
virtual UInt_t UpdateErrorFlag ()
 Uses the error flags of contained data elements to update Returns the error flag to the top level routines related to stability checks and ErrorFlag updates.
 
virtual void Blind (const QwBlinder *)
 Blind the asymmetry of this subsystem.
 
virtual void Blind (const QwBlinder *, const VQwSubsystemParity *)
 Blind the difference of this subsystem.
 
virtual void PrintValue () const
 Print values of all channels.
 
virtual void WritePromptSummary (QwPromptSummary *, TString)
 
virtual Bool_t CheckForEndOfBurst () const
 
virtual void LoadMockDataParameters (TString)
 
- Public Member Functions inherited from VQwSubsystem
 VQwSubsystem (const TString &name)
 Constructor with name.
 
 VQwSubsystem (const VQwSubsystem &orig)
 Copy constructor by object.
 
 ~VQwSubsystem () override
 Default destructor.
 
TString GetName () const
 
Bool_t HasDataLoaded () const
 
VQwSubsystemGetSibling (const std::string &name) const
 Get the sibling with specified name.
 
virtual std::vector< TString > GetParamFileNameList ()
 
virtual std::map< TString, TString > GetDetectorMaps ()
 
Bool_t PublishByRequest (TString) override
 Try to publish an internal variable matching the submitted name.
 
Bool_t PublishInternalValues () const override
 Publish all variables of the subsystem.
 
virtual Int_t LoadDetectorMaps (QwParameterFile &file)
 Parse parameter file to find the map files.
 
virtual Int_t LoadGeometryDefinition (TString)
 Optional geometry definition.
 
virtual Int_t LoadCrosstalkDefinition (TString)
 Optional crosstalk definition.
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask.
 
UInt_t GetEventTypeMask () const
 Get event type mask.
 
virtual void ExchangeProcessedData ()
 Request processed data from other subsystems for internal use in the second event processing stage. Not all derived classes will require data from other subsystems.
 
virtual void ProcessEvent_2 ()
 Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing.
 
virtual void AtEndOfEventLoop ()
 Perform actions at the end of the event loop.
 
virtual void RandomizeEventData (int=0, double=0.0)
 
virtual void ConstructObjects ()
 Construct the objects for this subsystem.
 
virtual void ConstructObjects (TDirectory *folder)
 Construct the objects for this subsystem in a folder.
 
virtual void ConstructObjects (TString &prefix)
 Construct the objects for this subsystem with a prefix.
 
virtual void ConstructObjects (TDirectory *, TString &)
 Construct the objects for this subsystem in a folder with a prefix.
 
virtual void ConstructTree ()
 Construct the tree for this subsystem.
 
virtual void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder.
 
virtual void ConstructTree (TString &prefix)
 Construct the tree for this subsystem with a prefix.
 
virtual void ConstructTree (TDirectory *, TString &)
 Construct the tree for this subsystem in a folder with a prefix.
 
virtual void FillTree ()
 Fill the tree for this subsystem.
 
virtual void DeleteTree ()
 Delete the tree for this subsystem.
 
virtual void PrintInfo () const
 Print some information about the subsystem.
 
virtual void PrintDetectorMaps (Bool_t status) const
 
void GetMarkerWordList (const ROCID_t roc_id, const BankID_t bank_id, std::vector< UInt_t > &marker) const
 
std::vector< ROCID_tGetROCIds () const
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects.
 
- Public Member Functions inherited from MQwPublishable_child< QwSubsystemArray, VQwSubsystem >
 MQwPublishable_child ()
 Default constructor Initializes the child object and sets up self-reference for publishing.
 
 MQwPublishable_child (const MQwPublishable_child &source)
 Copy constructor.
 
virtual ~MQwPublishable_child ()
 Virtual destructor.
 
void SetParent (QwSubsystemArray *parent)
 Set the parent container for this child object.
 
QwSubsystemArrayGetParent () const
 Get the parent container for this child object.
 
- Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwHelicity >
 ~MQwCloneable () override
 Virtual destructor.
 
VQwSubsystemClone () const override
 Concrete clone method.
 
const VQwFactory< VQwSubsystem > * Factory () const override
 Factory getter.
 
- Public Member Functions inherited from VQwCloneable< VQwSubsystem >
virtual ~VQwCloneable ()
 Virtual destructor.
 
std::string GetClassName () const
 Get demangled name of this class.
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 
- Static Public Member Functions inherited from QwHelicityBase
static void DefineOptions (QwOptions &options)
 Define options function.
 
- Static Public Member Functions inherited from VQwSubsystem
static void DefineOptions ()
 Define options function (note: no virtual static functions in C++)
 
- Static Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwHelicity >
static VQwSubsystemCreate (const std::string &name)
 Object creation.
 
static QwHelicityCast (QwHelicity *type)
 Object dynamic cast.
 

Protected Types

enum  HelicityEncodingType { kHelUserbitMode =0 , kHelInputRegisterMode , kHelLocalyMadeUp , kHelInputMollerMode }
 
enum  InputRegisterBits { kDefaultInputReg_HelPlus = 0x1 , kDefaultInputReg_HelMinus = 0x2 , kDefaultInputReg_PatternSync = 0x4 , kDefaultInputReg_FakeMPS = 0x8000 }
 
- Protected Types inherited from QwHelicityBase
enum  HelicityRootSavingType { kHelSaveMPS = 0 , kHelSavePattern , kHelNoSave }
 

Protected Member Functions

Bool_t CheckIORegisterMask (const UInt_t &ioregister, const UInt_t &mask) const
 
- Protected Member Functions inherited from QwHelicityBase
void CheckPatternNum (VQwSubsystem *value)
 
void MergeCounters (VQwSubsystem *value)
 
void SetHistoTreeSave (const TString &prefix)
 
Bool_t IsGoodPatternNumber ()
 
Bool_t IsGoodEventNumber ()
 
Bool_t MatchActualHelicity (Int_t actual)
 
Bool_t IsGoodPhaseNumber ()
 
Bool_t IsContinuous ()
 
virtual UInt_t GetRandbit (UInt_t &ranseed)
 
UInt_t GetRandbit24 (UInt_t &ranseed)
 
UInt_t GetRandbit30 (UInt_t &ranseed)
 
UInt_t GetRandomSeed (UShort_t *first24randbits)
 
virtual Bool_t CollectRandBits ()
 
Bool_t CollectRandBits24 ()
 
Bool_t CollectRandBits30 ()
 
void ResetPredictor ()
 
Bool_t Compare (VQwSubsystem *source)
 
void ClearErrorCounters ()
 
UInt_t BuildHelicityBitPattern (Int_t patternsize)
 
unsigned int parity (unsigned int v)
 
void ClearAllBankRegistrations ()
 Clear all registration of ROC and Bank IDs for this subsystem.
 
virtual Int_t RegisterROCNumber (const ROCID_t roc_id, const BankID_t bank_id=0)
 Tell the object that it will decode data from this ROC and sub-bank.
 
Int_t RegisterSubbank (const BankID_t bank_id)
 Tell the object that it will decode data from this sub-bank in the ROC currently open for registration.
 
Int_t RegisterMarkerWord (const UInt_t markerword)
 
void RegisterRocBankMarker (QwParameterFile &mapstr)
 
Int_t GetSubbankIndex () const
 
Int_t GetSubbankIndex (const ROCID_t roc_id, const BankID_t bank_id) const
 
void SetDataLoaded (Bool_t flag)
 
template<class T>
Int_t FindIndex (const std::vector< T > &myvec, const T value) const
 
Bool_t Compare (VQwSubsystem *source)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor.
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor.
 
virtual ~MQwHistograms ()
 Virtual destructor.
 
MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram.
 
- Protected Member Functions inherited from MQwPublishable_child< QwSubsystemArray, VQwSubsystem >
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays Get the value corresponding to some variable name from a different data array.
 
const VQwHardwareChannelRequestExternalPointer (const TString &name) const
 Retrieve a pointer to an external variable by name Requests a direct pointer to a variable from sibling subsystems via the parent container.
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwHardwareChannel *element) const
 Publish a variable from this child into the parent container.
 

Protected Attributes

UInt_t fInputReg_FakeMPS
 
UInt_t fInputReg_HelPlus
 
UInt_t fInputReg_HelMinus
 
UInt_t fInputReg_PatternSync
 
UInt_t fInputReg_PairSync
 
- Protected Attributes inherited from QwHelicityBase
std::vector< UInt_t > fHelicityBitPattern
 
std::vector< QwWordfWord
 
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
 
Int_t fHelicityDecodingMode
 
Int_t kUserbit
 
Int_t kScalerCounter
 
Int_t kInputRegister
 
Int_t kPatternCounter
 
Int_t kMpsCounter
 
Int_t kPatternPhase
 
UInt_t kEventTypeHelPlus
 
UInt_t kEventTypeHelMinus
 
Int_t fEventNumberOld
 
Int_t fEventNumber
 
Int_t fPatternPhaseNumberOld
 
Int_t fPatternPhaseNumber
 
Int_t fPatternNumberOld
 
Int_t fPatternNumber
 
Int_t fPatternSeed
 
Int_t fActualPatternPolarity
 True polarity of the current pattern.
 
Int_t fDelayedPatternPolarity
 Reported polarity of the current pattern.
 
Int_t fPreviousPatternPolarity
 True polarity of the previous pattern.
 
Int_t fHelicityReported
 
Int_t fHelicityActual
 
Int_t fHelicityDelayed
 
Bool_t fHelicityBitPlus
 
Bool_t fHelicityBitMinus
 
Bool_t fGoodHelicity
 
Bool_t fGoodPattern
 
Int_t fHistoType
 
size_t fTreeArrayIndex
 
size_t fTreeArrayNumEntries
 
UInt_t n_ranbits
 
UInt_t iseed_Actual
 
UInt_t iseed_Delayed
 
Int_t fHelicityDelay
 
Int_t fMaxPatternPhase
 
Int_t fMinPatternPhase
 
Int_t fRandBits
 
Bool_t fUsePredictor
 
Bool_t fHelicityInfoOK
 
Int_t fPatternPhaseOffset
 
Bool_t fIgnoreHelicity
 
UInt_t fEventType
 
Int_t fEventNumberFirst
 
Int_t fPatternNumberFirst
 
Int_t fNumMissedGates
 
Int_t fNumMissedEventBlocks
 
Int_t fNumMultSyncErrors
 
Int_t fNumHelicityErrors
 
UInt_t fErrorFlag
 
Bool_t fSuppressMPSErrorMsgs
 
- Protected Attributes inherited from VQwSubsystem
std::vector< std::vector< TString > > fPublishList
 
TString fSystemName
 Name of this subsystem.
 
UInt_t fEventTypeMask
 Mask of event types.
 
Bool_t fIsDataLoaded
 Has this subsystem gotten data to be processed?
 
std::vector< TString > fDetectorMapsNames
 Names of loaded detector map files.
 
std::map< TString, TString > fDetectorMaps
 Map of file name to full path or content.
 
ROCID_t fCurrentROC_ID
 ROC ID that is currently being processed.
 
BankID_t fCurrentBank_ID
 Bank ID (and Marker word) that is currently being processed;.
 
std::vector< ROCID_tfROC_IDs
 Vector of ROC IDs associated with this subsystem.
 
std::vector< std::vector< BankID_t > > fBank_IDs
 Vector of Bank IDs per ROC ID associated with this subsystem.
 
std::vector< std::vector< std::vector< UInt_t > > > fMarkerWords
 Vector of marker words per ROC & subbank associated with this subsystem.
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element.
 

Private Member Functions

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

Additional Inherited Members

- Static Protected Attributes inherited from QwHelicityBase
static const std::vector< UInt_t > kDefaultHelicityBitPattern {0x69}
 
static const Bool_t kDEBUG =kFALSE
 
static const Int_t kUndefinedHelicity = -9999
 

Detailed Description

Subsystem for helicity state management and pattern recognition.

Manages helicity information from the polarized electron beam, including helicity state determination, pattern recognition, delayed helicity decoding, and helicity-correlated systematic checks. Supports multiple helicity encoding modes and provides helicity information to other subsystems.

Definition at line 35 of file QwHelicity.h.

Member Enumeration Documentation

◆ HelicityEncodingType

Enumerator
kHelUserbitMode 
kHelInputRegisterMode 
kHelLocalyMadeUp 
kHelInputMollerMode 

Definition at line 92 of file QwHelicity.h.

◆ InputRegisterBits

Enumerator
kDefaultInputReg_HelPlus 
kDefaultInputReg_HelMinus 
kDefaultInputReg_PatternSync 
kDefaultInputReg_FakeMPS 

Definition at line 98 of file QwHelicity.h.

101 kDefaultInputReg_FakeMPS = 0x8000};
@ kDefaultInputReg_FakeMPS
Definition QwHelicity.h:101
@ kDefaultInputReg_PatternSync
Definition QwHelicity.h:100
@ kDefaultInputReg_HelPlus
Definition QwHelicity.h:98
@ kDefaultInputReg_HelMinus
Definition QwHelicity.h:99

Constructor & Destructor Documentation

◆ QwHelicity() [1/3]

QwHelicity::QwHelicity ( )
private

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

References QwHelicity().

Referenced by QwHelicity(), and QwHelicity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QwHelicity() [2/3]

QwHelicity::QwHelicity ( const TString & name)

Constructor with name.

Default helicity bit pattern of 0x69 represents a -++-+–+ octet (event polarity listed in reverse time order), where the LSB of the bit pattern is the first event of the pattern.

Definition at line 33 of file QwHelicity.cc.

34: VQwSubsystem(name),
35 QwHelicityBase(name),
40{
41
43}
UInt_t fInputReg_FakeMPS
Definition QwHelicity.h:105
UInt_t fInputReg_HelMinus
Definition QwHelicity.h:107
UInt_t fInputReg_HelPlus
Definition QwHelicity.h:106
UInt_t fInputReg_PairSync
Definition QwHelicity.h:109
UInt_t fInputReg_PatternSync
Definition QwHelicity.h:108
QwHelicityBase()
Private default constructor (not implemented, will throw linker error on use)

References fInputReg_FakeMPS, fInputReg_HelMinus, fInputReg_HelPlus, fInputReg_PairSync, fInputReg_PatternSync, kDefaultInputReg_FakeMPS, kDefaultInputReg_HelMinus, kDefaultInputReg_HelPlus, kDefaultInputReg_PatternSync, QwHelicityBase::QwHelicityBase(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ QwHelicity() [3/3]

QwHelicity::QwHelicity ( const QwHelicity & source)

Copy constructor.

Definition at line 46 of file QwHelicity.cc.

47: VQwSubsystem(source.GetName()),
48 QwHelicityBase(source.GetName()),
53{
56 // Default helicity delay to two patterns.
58 // Default the EventType flags to HelPlus=1 and HelMinus=4
59 // These are only used in Moller decoding mode.
62 //
66 kUserbit=-1;
72 fHelicityBitPlus=kFALSE;
73 fHelicityBitMinus=kFALSE;
74 fGoodHelicity=kFALSE;
75 fGoodPattern=kFALSE;
77
78 this->fWord.resize(source.fWord.size());
79 for(size_t i=0;i<this->fWord.size();i++)
80 {
81 this->fWord[i].fWordName=source.fWord[i].fWordName;
82 this->fWord[i].fModuleType=source.fWord[i].fModuleType;
83 this->fWord[i].fWordType=source.fWord[i].fWordType;
84 }
91 fEventType = source.fEventType;
93 fRandBits = source.fRandBits;
101 iseed_Actual = source.iseed_Actual;
102 n_ranbits = source.n_ranbits;
103 fEventNumber = source.fEventNumber;
109
110 this->kUserbit = source.kUserbit;
111 this->fIgnoreHelicity = source.fIgnoreHelicity;
112}
TString GetName() const
std::vector< QwWord > fWord
Int_t fActualPatternPolarity
True polarity of the current pattern.
UInt_t kEventTypeHelMinus
Int_t fNumMissedEventBlocks
std::vector< UInt_t > fHelicityBitPattern
Int_t fHelicityDecodingMode
static const Int_t kUndefinedHelicity
Int_t fDelayedPatternPolarity
Reported polarity of the current pattern.
Int_t fPatternPhaseNumberOld
void ClearErrorCounters()

References QwHelicityBase::ClearErrorCounters(), QwHelicityBase::fActualPatternPolarity, QwHelicityBase::fDelayedPatternPolarity, QwHelicityBase::fEventNumber, QwHelicityBase::fEventNumberFirst, QwHelicityBase::fEventNumberOld, QwHelicityBase::fEventType, QwHelicityBase::fGoodHelicity, QwHelicityBase::fGoodPattern, QwHelicityBase::fHelicityActual, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPattern, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityDecodingMode, QwHelicityBase::fHelicityDelay, QwHelicityBase::fHelicityDelayed, QwHelicityBase::fHelicityInfoOK, QwHelicityBase::fHelicityReported, QwHelicityBase::fIgnoreHelicity, fInputReg_HelMinus, fInputReg_HelPlus, fInputReg_PairSync, fInputReg_PatternSync, QwHelicityBase::fMaxPatternPhase, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fNumHelicityErrors, QwHelicityBase::fNumMissedEventBlocks, QwHelicityBase::fNumMissedGates, QwHelicityBase::fNumMultSyncErrors, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternNumberFirst, QwHelicityBase::fPatternNumberOld, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseNumberOld, QwHelicityBase::fPatternPhaseOffset, QwHelicityBase::fRandBits, QwHelicityBase::fUsePredictor, QwHelicityBase::fWord, VQwSubsystem::GetName(), QwHelicityBase::iseed_Actual, QwHelicityBase::iseed_Delayed, QwHelicityBase::kEventTypeHelMinus, QwHelicityBase::kEventTypeHelPlus, QwHelicityBase::kUndefinedHelicity, QwHelicityBase::kUserbit, QwHelicityBase::n_ranbits, QwHelicity(), QwHelicityBase::QwHelicityBase(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ ~QwHelicity()

virtual QwHelicity::~QwHelicity ( )
inlineoverridevirtual

Virtual destructor.

Definition at line 47 of file QwHelicity.h.

47{ }

Member Function Documentation

◆ ApplySingleEventCuts()

Bool_t QwHelicity::ApplySingleEventCuts ( )
overridevirtual

Apply the single event cuts.

Implements VQwSubsystemParity.

Definition at line 253 of file QwHelicity.cc.

253 {
254 //impose single event cuts //Paul's modifications
255
256 return kTRUE;
257}

◆ CheckForBurpFail()

Bool_t QwHelicity::CheckForBurpFail ( const VQwSubsystem * subsys)
inlineoverridevirtual

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

Implements VQwSubsystemParity.

Definition at line 57 of file QwHelicity.h.

57 {
58 return kFALSE;
59 };

References VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ CheckIORegisterMask()

Bool_t QwHelicity::CheckIORegisterMask ( const UInt_t & ioregister,
const UInt_t & mask ) const
inlineprotected

Definition at line 88 of file QwHelicity.h.

88 {
89 return ((mask != 0)&&((ioregister & mask) == mask));
90 };

Referenced by ProcessEventInputRegisterMode().

+ Here is the caller graph for this function:

◆ ClearEventData()

void QwHelicity::ClearEventData ( )
overridevirtual

Reset data by setting the old event number, pattern number and pattern phase to the values of the previous event.

Clear out helicity variables

Set the new event number and pattern number to -1. If we are not reading these correctly from the data stream, -1 will allow us to identify that.

Reimplemented from QwHelicityBase.

Definition at line 202 of file QwHelicity.cc.

203{
204 SetDataLoaded(kFALSE);
205 for (size_t i=0;i<fWord.size();i++)
207
208 /**Reset data by setting the old event number, pattern number and pattern phase
209 to the values of the previous event.*/
210 if (fEventNumberFirst==-1 && fEventNumberOld!= -1){
212 }
216 }
217
221
222 //fIgnoreHelicity = kFALSE;
223
224 /**Clear out helicity variables */
228 fHelicityBitPlus = kFALSE;
229 fHelicityBitMinus = kFALSE;
230 // be careful: it is not that I forgot to reset fActualPatternPolarity
231 // or fDelayedPatternPolarity. One doesn't want to do that here.
232 /** Set the new event number and pattern number to -1. If we are not reading these correctly
233 from the data stream, -1 will allow us to identify that.*/
234 fEventNumber = -1;
236 fPatternNumber = -1;
237 return;
238}
void SetDataLoaded(Bool_t flag)
void ClearEventData() override

References ClearEventData(), QwHelicityBase::fEventNumber, QwHelicityBase::fEventNumberFirst, QwHelicityBase::fEventNumberOld, QwHelicityBase::fHelicityActual, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityDelayed, QwHelicityBase::fHelicityReported, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternNumberFirst, QwHelicityBase::fPatternNumberOld, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseNumberOld, QwHelicityBase::fWord, QwHelicityBase::kUndefinedHelicity, and VQwSubsystem::SetDataLoaded().

Referenced by ClearEventData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructBranchAndVector() [1/2]

virtual void VQwSubsystem::ConstructBranchAndVector ( TTree * tree,
QwRootTreeBranchVector & values )
inlinevirtual

Construct the branch and tree vector.

Reimplemented from VQwSubsystem.

Definition at line 303 of file VQwSubsystem.h.

303 {
304 TString tmpstr("");
305 ConstructBranchAndVector(tree,tmpstr,values);
306 };
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)=0
Construct the branch and tree vector.

◆ ConstructBranchAndVector() [2/2]

virtual void VQwSubsystem::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )
virtual

Construct the branch and tree vector.

Construct the branch and fill the provided values vector.

Parameters
treeOutput ROOT tree to which branches are added.
prefixName prefix for all branch names.
valuesVector that will be filled by FillTreeVector.

Implements VQwSubsystem.

◆ ConstructHistograms() [1/4]

virtual void VQwSubsystem::ConstructHistograms ( )
inlinevirtual

Construct the histograms for this subsystem.

Reimplemented from VQwSubsystem.

Definition at line 270 of file VQwSubsystem.h.

270 {
271 TString tmpstr("");
272 ConstructHistograms((TDirectory*) NULL, tmpstr);
273 };
virtual void ConstructHistograms()
Construct the histograms for this subsystem.

◆ ConstructHistograms() [2/4]

virtual void VQwSubsystem::ConstructHistograms ( TDirectory * folder)
inlinevirtual

Construct the histograms for this subsystem in a folder.

Reimplemented from VQwSubsystem.

Definition at line 275 of file VQwSubsystem.h.

275 {
276 TString tmpstr("");
277 ConstructHistograms(folder, tmpstr);
278 };

◆ ConstructHistograms() [3/4]

void QwHelicity::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

Construct the histograms for this subsystem in a folder with a prefix.

Implements VQwSubsystem.

Definition at line 897 of file QwHelicity.cc.

898{
899 SetHistoTreeSave(prefix);
900 if (folder != NULL) folder->cd();
901 TString basename;
902 size_t index=0;
903
905 {
906 //do nothing
907 }
909 {
910 fHistograms.resize(1+fWord.size(), NULL);
911 basename="pattern_polarity";
912 fHistograms[index] = gQwHists.Construct1DHist(basename);
913 index+=1;
914 for (size_t i=0; i<fWord.size(); i++){
915 basename="hel_"+fWord[i].fWordName;
916 fHistograms[index] = gQwHists.Construct1DHist(basename);
917 index+=1;
918 }
919 }
920 else if(fHistoType==kHelSaveMPS)
921 {
922 fHistograms.resize(4+fWord.size(), NULL);
923 //eventnumber, patternnumber, helicity, patternphase + fWord.size
924 basename=prefix+"delta_event_number";
925 fHistograms[index] = gQwHists.Construct1DHist(basename);
926 index+=1;
927 basename=prefix+"delta_pattern_number";
928 fHistograms[index] = gQwHists.Construct1DHist(basename);
929 index+=1;
930 basename=prefix+"pattern_phase";
931 fHistograms[index] = gQwHists.Construct1DHist(basename);
932 index+=1;
933 basename=prefix+"helicity";
934 fHistograms[index] = gQwHists.Construct1DHist(basename);
935 index+=1;
936 for (size_t i=0; i<fWord.size(); i++){
937 basename=prefix+fWord[i].fWordName;
938 fHistograms[index] = gQwHists.Construct1DHist(basename);
939 index+=1;
940 }
941 }
942 else
943 QwError << "QwHelicity::ConstructHistograms this prefix--" << prefix << "-- is not unknown:: no histo created" << QwLog::endl;
944
945 return;
946}
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
TH1F * Construct1DHist(const TString &inputfile, const TString &name_title)
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
void SetHistoTreeSave(const TString &prefix)

References QwLog::endl(), MQwHistograms::fHistograms, QwHelicityBase::fHistoType, QwHelicityBase::fWord, gQwHists, QwHelicityBase::kHelNoSave, QwHelicityBase::kHelSaveMPS, QwHelicityBase::kHelSavePattern, QwError, and QwHelicityBase::SetHistoTreeSave().

+ Here is the call graph for this function:

◆ ConstructHistograms() [4/4]

virtual void VQwSubsystem::ConstructHistograms ( TString & prefix)
inlinevirtual

Construct the histograms for this subsystem with a prefix.

Reimplemented from VQwSubsystem.

Definition at line 280 of file VQwSubsystem.h.

280 {
281 ConstructHistograms((TDirectory*) NULL, prefix);
282 };

◆ DefineOptions()

void QwHelicity::DefineOptions ( QwOptions & options)
static

Definition at line 115 of file QwHelicity.cc.

116{
117 options.AddOptions("Helicity options")
118 ("helicity.seed", po::value<int>(),
119 "Number of bits in random seed");
120 options.AddOptions("Helicity options")
121 ("helicity.bitpattern", po::value<std::string>(),
122 "Helicity bit pattern: 0x1 (pair), 0x9 (quartet), 0x69 (octet), 0x666999 (hexo-quad), 0x66669999 (octo-quad)");
123 options.AddOptions("Helicity options")
124 ("helicity.patternoffset", po::value<int>(),
125 "Set 1 when pattern starts with 1 or 0 when starts with 0");
126 options.AddOptions("Helicity options")
127 ("helicity.patternphase", po::value<int>(),
128 "Maximum pattern phase");
129 options.AddOptions("Helicity options")
130 ("helicity.delay", po::value<int>(),
131 "Default delay is 2 patterns, set at the helicity map file.");
132 options.AddOptions("Helicity options")
133 ("helicity.toggle-mode", po::value<bool>()->default_bool_value(false),
134 "Activates helicity toggle-mode, overriding the 'delay', 'patternphase', 'bitpattern', and 'seed' options.");
135}
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:170

References QwOptions::AddOptions().

+ Here is the call graph for this function:

◆ EncodeEventData()

void QwHelicity::EncodeEventData ( std::vector< UInt_t > & buffer)
overridevirtual

Reimplemented from VQwSubsystem.

Definition at line 583 of file QwHelicity.cc.

584{
585 std::vector<UInt_t> localbuffer;
586 localbuffer.clear();
587
588 // Userbit mode
589 switch (fHelicityDecodingMode) {
590 case kHelUserbitMode: {
591 UInt_t userbit = 0x0;
592 if (fPatternPhaseNumber == fMinPatternPhase) userbit |= 0x80000000;
593 if (fHelicityDelayed == 1) userbit |= 0x40000000;
594
595 // Write the words to the buffer
596 localbuffer.push_back(0x1); // cleandata
597 localbuffer.push_back(0xa); // scandata1
598 localbuffer.push_back(0xa); // scandata2
599 localbuffer.push_back(0x0); // scalerheader
600 localbuffer.push_back(0x20); // scalercounter (32)
601 localbuffer.push_back(userbit); // userbit
602
603 for (int i = 0; i < 64; i++) localbuffer.push_back(0x0); // (not used)
604 break;
605 }
607 UInt_t input_register = 0x0;
608 if (fHelicityDelayed == 1) input_register |= fInputReg_HelPlus;
609 if (fHelicityDelayed == 0) input_register |= fInputReg_HelMinus;
611
612 // Write the words to the buffer
613 localbuffer.push_back(input_register); // input_register
614 localbuffer.push_back(0x0); // output_register
615 localbuffer.push_back(fEventNumber); // mps_counter
616 localbuffer.push_back(fPatternNumber); // pat_counter
617 localbuffer.push_back(fPatternPhaseNumber - fMinPatternPhase + fPatternPhaseOffset); // pat_phase
618
619 for (int i = 0; i < 17; i++) localbuffer.push_back(0x0); // (not used)
620 break;
621 }
622 default:
623 QwWarning << "QwHelicity::EncodeEventData: Unsupported helicity encoding!" << QwLog::endl;
624 break;
625 }
626
627 // If there is element data, generate the subbank header
628 std::vector<UInt_t> subbankheader;
629 std::vector<UInt_t> rocheader;
630 if (localbuffer.size() > 0) {
631
632 // Form CODA subbank header
633 subbankheader.clear();
634 subbankheader.push_back(localbuffer.size() + 1); // subbank size
635 subbankheader.push_back((fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
636 // subbank tag | subbank type | event number
637
638 // Form CODA bank/roc header
639 rocheader.clear();
640 rocheader.push_back(subbankheader.size() + localbuffer.size() + 1); // bank/roc size
641 rocheader.push_back((fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
642 // bank tag == ROC | bank type | event number
643
644 // Add bank header, subbank header and element data to output buffer
645 buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
646 buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
647 buffer.insert(buffer.end(), localbuffer.begin(), localbuffer.end());
648 }
649}
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
BankID_t fCurrentBank_ID
Bank ID (and Marker word) that is currently being processed;.
ROCID_t fCurrentROC_ID
ROC ID that is currently being processed.

References QwLog::endl(), VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, QwHelicityBase::fEventNumber, QwHelicityBase::fHelicityDecodingMode, QwHelicityBase::fHelicityDelayed, fInputReg_HelMinus, fInputReg_HelPlus, fInputReg_PatternSync, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseOffset, kHelInputRegisterMode, kHelUserbitMode, and QwWarning.

+ Here is the call graph for this function:

◆ GetRandomSeedActual()

UInt_t QwHelicity::GetRandomSeedActual ( )
inline

Definition at line 77 of file QwHelicity.h.

77{ return iseed_Actual; };

References QwHelicityBase::iseed_Actual.

Referenced by main().

+ Here is the caller graph for this function:

◆ GetRandomSeedDelayed()

UInt_t QwHelicity::GetRandomSeedDelayed ( )
inline

Definition at line 78 of file QwHelicity.h.

78{ return iseed_Delayed; };

References QwHelicityBase::iseed_Delayed.

Referenced by main().

+ Here is the caller graph for this function:

◆ LoadChannelMap()

Int_t QwHelicity::LoadChannelMap ( TString mapfile)
overridevirtual

Mandatory map file definition.

Implements VQwSubsystem.

Definition at line 651 of file QwHelicity.cc.

652{
653 Bool_t ldebug=kFALSE;
654
655 Int_t wordsofar=0;
656 Int_t bankindex=-1;
657
658 fPatternPhaseOffset=1;//Phase number offset is set to 1 by default and will be set to 0 if phase number starts from 0
659
660
661 // Default value for random seed is 30 bits
662 fRandBits = 30;
663
664
665 QwParameterFile mapstr(mapfile.Data()); //Open the file
666 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
667 mapstr.EnableGreediness();
668 mapstr.SetCommentChars("!");
669
670 UInt_t value = 0;
671 TString valuestr;
672
673 while (mapstr.ReadNextLine()){
674 RegisterRocBankMarker(mapstr);
675
676 if (mapstr.PopValue("patternphase",value)) {
677 fMaxPatternPhase=value;
679 }
680 if (mapstr.PopValue("patternbits",valuestr)) {
681 SetHelicityBitPattern(valuestr);
682 }
683 if (mapstr.PopValue("inputregmask_fakemps",value)) {
684 fInputReg_FakeMPS = value;
685 }
686 if (mapstr.PopValue("inputregmask_helicity",value)) {
687 fInputReg_HelPlus = value;
689 }
690 if (mapstr.PopValue("inputregmask_helplus",value)) {
691 fInputReg_HelPlus = value;
692 }
693 if (mapstr.PopValue("inputregmask_helminus",value)) {
694 fInputReg_HelMinus = value;
695 }
696 if (mapstr.PopValue("inputregmask_pattsync",value)) {
697 fInputReg_PatternSync = value;
698 }
699 if (mapstr.PopValue("inputregmask_pairsync",value)) {
700 fInputReg_PairSync = value;
701 }
702 if (mapstr.PopValue("fakempsbit",value)) {
703 fInputReg_FakeMPS = value;
704 QwWarning << " fInputReg_FakeMPS 0x" << std::hex << fInputReg_FakeMPS << std::dec << QwLog::endl;
705 }
706 if (mapstr.PopValue("numberpatternsdelayed",value)) {
707 SetHelicityDelay(value);
708 }
709 if (mapstr.PopValue("randseedbits",value)) {
710 if (value==24 || value==30)
711 fRandBits = value;
712 }
713 if (mapstr.PopValue("patternphaseoffset",value)) {
715 }
716 if (mapstr.PopValue("helpluseventtype",value)) {
717 kEventTypeHelPlus = value;
718 }
719 if (mapstr.PopValue("helminuseventtype",value)) {
720 kEventTypeHelMinus = value;
721 }
722 if (mapstr.PopValue("helicitydecodingmode",valuestr)) {
723 if (valuestr=="InputRegisterMode") {
724 QwMessage << " **** Input Register Mode **** " << QwLog::endl;
726 } else if (valuestr=="UserbitMode"){
727 QwMessage << " **** Userbit Mode **** " << QwLog::endl;
729 } else if (valuestr=="HelLocalyMadeUp"){
730 QwMessage << "**** Helicity Locally Made Up ****" << QwLog::endl;
732 } else if (valuestr=="InputMollerMode") {
733 QwMessage << "**** Input Moller Mode ****" << QwLog::endl;
735 } else {
736 QwError << "The helicity decoding mode read in file " << mapfile
737 << " is not recognized in function QwHelicity::LoadChannelMap \n"
738 << " Quitting this execution." << QwLog::endl;
739 }
740 }
741
744 if ((bankindex+1)>0){
745 UInt_t numbanks = UInt_t(bankindex+1);
746 if (fWordsPerSubbank.size()<numbanks){
747 fWordsPerSubbank.resize(numbanks,
748 std::pair<Int_t, Int_t>(fWord.size(),fWord.size()));
749 }
750 }
751 wordsofar=0;
752 }
753 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
754 if (mapstr.LineIsEmpty()) continue;
755
756 // Break this line into tokens to process it.
757 TString modtype = mapstr.GetTypedNextToken<TString>(); // module type
758 Int_t modnum = mapstr.GetTypedNextToken<Int_t>(); //slot number
759 /* Int_t channum = */ mapstr.GetTypedNextToken<Int_t>(); //channel number /* unused */
760 TString dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
761 dettype.ToLower();
762 TString namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
763 namech.ToLower();
764 TString keyword = mapstr.GetTypedNextToken<TString>();
765 keyword.ToLower();
766 // Notice that "namech" and "keyword" are now forced to lower-case.
767
768 if(modtype=="SKIP"){
769 if (modnum<=0) wordsofar+=1;
770 else wordsofar+=modnum;
771 } else if(modtype!="WORD"|| dettype!="helicitydata") {
772 QwError << "QwHelicity::LoadChannelMap: Unknown detector type: "
773 << dettype << ", the detector " << namech << " will not be decoded "
774 << QwLog::endl;
775 continue;
776 } else {
777 QwWord localword;
778 localword.fSubbankIndex=bankindex;
779 localword.fWordInSubbank=wordsofar;
780 wordsofar+=1;
781 // I assume that one data = one word here. But it is not always the case, for
782 // example the triumf adc gives 6 words per channel
783 localword.fModuleType=modtype;
784 localword.fWordName=namech;
785 localword.fWordType=dettype;
786 fWord.push_back(localword);
787 fWordsPerSubbank.at(bankindex).second = fWord.size();
788
789 // Notice that "namech" is in lower-case, so these checks
790 // should all be in lower-case
791 switch (fHelicityDecodingMode)
792 {
793 case kHelUserbitMode :
794 if(namech.Contains("userbit")) kUserbit=fWord.size()-1;
795 if(namech.Contains("scalercounter")) kScalerCounter=fWord.size()-1;
796 break;
798 if(namech.Contains("input_register")) kInputRegister= fWord.size()-1;
799 if(namech.Contains("mps_counter")) kMpsCounter= fWord.size()-1;
800 if(namech.Contains("pat_counter")) kPatternCounter= fWord.size()-1;
801 if(namech.Contains("pat_phase")) kPatternPhase= fWord.size()-1;
802 break;
804 if(namech.Contains("mps_counter")) {
805 kMpsCounter= fWord.size()-1;
806 }
807 if(namech.Contains("pat_counter")) {
808 kPatternCounter = fWord.size()-1;
809 }
810 break;
811 }
812 }
813 }
814
815
816 if(ldebug) {
817 std::cout << "Done with Load map channel \n";
818 for(size_t i=0;i<fWord.size();i++)
819 fWord[i].PrintID();
820 std::cout << " kUserbit=" << kUserbit << "\n";
821 }
822 ldebug=kFALSE;
823
825 // Check to be sure kEventTypeHelPlus and kEventTypeHelMinus are both defined and not equal
829 // Everything is okay
830 QwDebug << "QwHelicity::LoadChannelMap:"
831 << " We are in Moller Helicity Mode, with HelPlusEventType = "
833 << "and HelMinusEventType = " << kEventTypeHelMinus
834 << QwLog::endl;
835 } else {
836 QwError << "QwHelicity::LoadChannelMap:"
837 << " We are in Moller Helicity Mode, and the HelPlus and HelMinus event types are not set properly."
838 << " HelPlusEventType = " << kEventTypeHelPlus
839 << ", HelMinusEventType = " << kEventTypeHelMinus
840 << ". Please correct the helicity map file!"
841 << QwLog::endl;
842 exit(65);
843 }
844 }
845
846std::cout << fHelicityBitPattern.size() << std::endl;
847
848 mapstr.Close(); // Close the file (ifstream)
849 return 0;
850}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
Int_t fWordInSubbank
Definition QwWord.h:38
Int_t fSubbankIndex
Definition QwWord.h:37
TString fWordType
Definition QwWord.h:41
TString fModuleType
Definition QwWord.h:39
TString fWordName
Definition QwWord.h:40
Int_t GetSubbankIndex() const
void RegisterRocBankMarker(QwParameterFile &mapstr)
std::map< TString, TString > fDetectorMaps
Map of file name to full path or content.
void SetHelicityBitPattern(TString hex)
void SetHelicityDelay(Int_t delay)
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
UInt_t BuildHelicityBitPattern(Int_t patternsize)

References QwHelicityBase::BuildHelicityBitPattern(), QwParameterFile::Close(), QwParameterFile::EnableGreediness(), QwLog::endl(), VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, VQwSubsystem::fDetectorMaps, QwHelicityBase::fHelicityBitPattern, QwHelicityBase::fHelicityDecodingMode, fInputReg_FakeMPS, fInputReg_HelMinus, fInputReg_HelPlus, fInputReg_PairSync, fInputReg_PatternSync, QwHelicityBase::fMaxPatternPhase, QwWord::fModuleType, QwHelicityBase::fPatternPhaseOffset, QwHelicityBase::fRandBits, QwWord::fSubbankIndex, QwHelicityBase::fWord, QwWord::fWordInSubbank, QwWord::fWordName, QwHelicityBase::fWordsPerSubbank, QwWord::fWordType, QwParameterFile::GetParamFileNameContents(), VQwSubsystem::GetSubbankIndex(), QwParameterFile::GetTypedNextToken(), QwHelicityBase::kEventTypeHelMinus, QwHelicityBase::kEventTypeHelPlus, kHelInputMollerMode, kHelInputRegisterMode, kHelLocalyMadeUp, kHelUserbitMode, QwHelicityBase::kInputRegister, QwHelicityBase::kMpsCounter, QwHelicityBase::kPatternCounter, QwHelicityBase::kPatternPhase, QwHelicityBase::kScalerCounter, QwHelicityBase::kUserbit, QwParameterFile::LineIsEmpty(), QwParameterFile::PopValue(), QwDebug, QwError, QwMessage, QwWarning, QwParameterFile::ReadNextLine(), VQwSubsystem::RegisterRocBankMarker(), QwParameterFile::SetCommentChars(), QwHelicityBase::SetHelicityBitPattern(), QwHelicityBase::SetHelicityDelay(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ LoadEventCuts()

Int_t QwHelicity::LoadEventCuts ( TString )
overridevirtual

Optional event cut file.

Reimplemented from VQwSubsystem.

Definition at line 853 of file QwHelicity.cc.

853 {
854 return 0;
855}

◆ LoadInputParameters()

Int_t QwHelicity::LoadInputParameters ( TString mapfile)
overridevirtual

Mandatory parameter file definition.

Implements VQwSubsystem.

Definition at line 247 of file QwHelicity.cc.

248{
249 return 0;
250}

◆ operator=()

VQwSubsystem & QwHelicityBase::operator= ( VQwSubsystem * value)
overridevirtual

Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)

Implements VQwSubsystemParity.

Definition at line 120 of file QwHelicityBase.cc.

1541{
1542 Bool_t ldebug = kFALSE;
1543 QwHelicityBase* input= dynamic_cast<QwHelicityBase*>(value);
1544 if (input) {
1545 this->VQwSubsystem::operator=(value);
1546 QwHelicityBase* input= dynamic_cast<QwHelicityBase*>(value);
1547 for(size_t i=0;i<input->fWord.size();i++)
1548 this->fWord[i].fValue=input->fWord[i].fValue;
1549 this->fHelicityActual = input->fHelicityActual;
1550 this->fPatternNumber = input->fPatternNumber;
1551 this->fPatternSeed = input->fPatternSeed;
1553 this->fEventNumber=input->fEventNumber;
1558 this->fHelicityActual=input->fHelicityActual;
1562 this->fGoodHelicity=input->fGoodHelicity;
1563 this->fGoodPattern=input->fGoodPattern;
1564 this->fIgnoreHelicity = input->fIgnoreHelicity;
1565
1566 this->fErrorFlag = input->fErrorFlag;
1567 this->fEventNumberFirst = input->fEventNumberFirst;
1569 this->fNumMissedGates = input->fNumMissedGates;
1573
1574 if(ldebug){
1575 std::cout << "QwHelicityBase::operator = this->fPatternNumber=" << this->fPatternNumber << std::endl;
1576 std::cout << "input->fPatternNumber=" << input->fPatternNumber << "\n";
1577 }
1578 }
1579 return *this;
1580}
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
Int_t fPreviousPatternPolarity
True polarity of the previous pattern.

◆ ProcessConfigurationBuffer()

Int_t QwHelicity::ProcessConfigurationBuffer ( const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )
overridevirtual

Implements VQwSubsystem.

Definition at line 240 of file QwHelicity.cc.

241{
242 //stub function
243 // QwError << " this function QwHelicity::ProcessConfigurationBuffer does nothing yet " << QwLog::endl;
244 return 0;
245}

◆ ProcessEvBuffer() [1/2]

Int_t QwHelicity::ProcessEvBuffer ( const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )
inlineoverridevirtual

TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.

Implements VQwSubsystem.

Definition at line 63 of file QwHelicity.h.

63 {
64 return ProcessEvBuffer(0x1,roc_id,bank_id,buffer,num_words);
65 };
Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
Definition QwHelicity.h:63

References ProcessEvBuffer().

Referenced by ProcessEvBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEvBuffer() [2/2]

Int_t QwHelicity::ProcessEvBuffer ( UInt_t ev_type,
const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )
overridevirtual

Reimplemented from VQwSubsystem.

Definition at line 857 of file QwHelicity.cc.

858{
859 Bool_t lkDEBUG = kFALSE;
860
861 if (((0x1 << (event_type - 1)) & this->GetEventTypeMask()) == 0)
862 return 0;
863 fEventType = event_type;
864
865 Int_t index = GetSubbankIndex(roc_id,bank_id);
866 if (index >= 0 && num_words > 0) {
867 SetDataLoaded(kTRUE);
868 // We want to process this ROC. Begin loopilooping through the data.
869 QwDebug << "QwHelicity::ProcessEvBuffer: "
870 << "Begin processing ROC" << roc_id
871 << " and subbank " << bank_id
872 << " number of words=" << num_words << QwLog::endl;
873
874 for(Int_t i=fWordsPerSubbank.at(index).first; i<fWordsPerSubbank.at(index).second; i++) {
875 if(fWord[i].fWordInSubbank+1<= (Int_t) num_words) {
876 fWord[i].fValue=buffer[fWord[i].fWordInSubbank];
877 } else {
878 QwWarning << "QwHelicity::ProcessEvBuffer: There is not enough word in the buffer to read data for "
879 << fWord[i].fWordName << QwLog::endl;
880 QwWarning << "QwHelicity::ProcessEvBuffer: Words in this buffer:" << num_words
881 << " trying to read word number =" << fWord[i].fWordInSubbank << QwLog::endl;
882 }
883 }
884 if(lkDEBUG) {
885 QwDebug << "QwHelicity::ProcessEvBuffer: Done with Processing this event" << QwLog::endl;
886 for(size_t i=0;i<fWord.size();i++) {
887 std::cout << "QwHelicity::ProcessEvBuffer: word number = " << i << " ";
888 fWord[i].Print();
889 }
890 }
891 }
892 lkDEBUG=kFALSE;
893 return 0;
894}
UInt_t GetEventTypeMask() const
Get event type mask.

References QwLog::endl(), QwHelicityBase::fEventType, QwHelicityBase::fWord, QwHelicityBase::fWordsPerSubbank, VQwSubsystem::GetEventTypeMask(), VQwSubsystem::GetSubbankIndex(), QwDebug, QwWarning, and VQwSubsystem::SetDataLoaded().

+ Here is the call graph for this function:

◆ ProcessEvent()

void QwHelicity::ProcessEvent ( )
overridevirtual

Implements VQwSubsystem.

Definition at line 528 of file QwHelicity.cc.

529{
530 Bool_t ldebug = kFALSE;
531 fErrorFlag = 0;
532
533 if (! HasDataLoaded()) return;
534
535 switch (fHelicityDecodingMode)
536 {
537 case kHelUserbitMode :
539 break;
542 break;
545 break;
546 default:
547 QwError << "QwHelicity::ProcessEvent no instructions on how to decode the helicity !!!!" << QwLog::endl;
548 abort();
549 break;
550 }
551
554
555 // Predict helicity if delay is non zero.
558 } else {
559 // Else use the reported helicity values.
562
567 }
568
569 }
570
571 if(ldebug){
572 std::cout<<"\nevent number= "<<fEventNumber<<std::endl;
573 std::cout<<"pattern number = "<<fPatternNumber<<std::endl;
574 std::cout<<"pattern phase = "<<fPatternPhaseNumber<<std::endl;
575 std::cout<<"max pattern phase = "<<fMaxPatternPhase<<std::endl;
576 std::cout<<"min pattern phase = "<<fMinPatternPhase<<std::endl;
577 }
578
579 return;
580}
Bool_t HasDataLoaded() const
void ProcessEventInputRegisterMode()
void ProcessEventUserbitMode()
Process helicity information from userbit configuration data.
void ProcessEventInputMollerMode()

References QwLog::endl(), QwHelicityBase::fActualPatternPolarity, QwHelicityBase::fDelayedPatternPolarity, QwHelicityBase::fErrorFlag, QwHelicityBase::fEventNumber, QwHelicityBase::fHelicityActual, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityDecodingMode, QwHelicityBase::fHelicityDelayed, QwHelicityBase::fHelicityReported, QwHelicityBase::fIgnoreHelicity, QwHelicityBase::fMaxPatternPhase, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPreviousPatternPolarity, QwHelicityBase::fUsePredictor, VQwSubsystem::HasDataLoaded(), kHelInputMollerMode, kHelInputRegisterMode, kHelUserbitMode, QwHelicityBase::PredictHelicity(), ProcessEventInputMollerMode(), ProcessEventInputRegisterMode(), ProcessEventUserbitMode(), and QwError.

+ Here is the call graph for this function:

◆ ProcessEventInputMollerMode()

void QwHelicity::ProcessEventInputMollerMode ( )

Definition at line 483 of file QwHelicity.cc.

484{
485 static Bool_t firstpattern = kTRUE;
486
487 if(firstpattern && fWord[kPatternCounter].fValue > fPatternNumberOld){
488 firstpattern = kFALSE;
489 }
490
493 Int_t nummissed(fEventNumber - (fEventNumberOld+1));
494 QwError << "QwHelicity::ProcessEvent read event# ("
495 << fEventNumber << ") is not old_event#+1; missed "
496 << nummissed << " gates" << QwLog::endl;
497 fNumMissedGates += nummissed;
499 }
500 if (firstpattern){
501 fPatternNumber = -1;
503 } else {
506 // We are at a new pattern!
508 } else {
510 }
511 }
512
515 // fHelicityReported = (fEventType == 1 ? 0 : 1);
516
517 if (fHelicityReported == 1){
518 fHelicityBitPlus=kTRUE;
519 fHelicityBitMinus=kFALSE;
520 } else {
521 fHelicityBitPlus=kFALSE;
522 fHelicityBitMinus=kTRUE;
523 }
524 return;
525}

References QwLog::endl(), QwHelicityBase::fEventNumber, QwHelicityBase::fEventNumberOld, QwHelicityBase::fEventType, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityReported, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fNumMissedEventBlocks, QwHelicityBase::fNumMissedGates, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternNumberOld, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseNumberOld, QwHelicityBase::fWord, QwHelicityBase::kEventTypeHelMinus, QwHelicityBase::kEventTypeHelPlus, QwHelicityBase::kMpsCounter, QwHelicityBase::kPatternCounter, and QwError.

Referenced by ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEventInputRegisterMode()

void QwHelicity::ProcessEventInputRegisterMode ( )

If we get junk for the mps and pattern information from the run we can enable fake counters for mps, pattern number and pattern phase to get the job done.

In the Input Register Mode, the event number is obtained straight from the wordkMPSCounter.

Extract the reported helicity from the input register for each event.

Definition at line 375 of file QwHelicity.cc.

376{
377 static Bool_t firstevent = kTRUE;
378 static Bool_t firstpattern = kTRUE;
379 static Bool_t fake_the_counters=kFALSE;
380 UInt_t thisinputregister=fWord[kInputRegister].fValue;
381
382 if (firstpattern){
383 // If any of the special counters are negative or zero, setup to
384 // generate the counters internally.
385 fake_the_counters |= (kPatternCounter<=0)
386 || ( kMpsCounter<=0) || (kPatternPhase<=0);
387 }
388
389 if (CheckIORegisterMask(thisinputregister,fInputReg_FakeMPS))
390 fIgnoreHelicity = kTRUE;
391 else
392 fIgnoreHelicity = kFALSE;
393
394 /** If we get junk for the mps and pattern information from the run
395 we can enable fake counters for mps, pattern number and pattern
396 phase to get the job done.
397 */
398 if (!fake_the_counters){
399 /**
400 In the Input Register Mode,
401 the event number is obtained straight from the wordkMPSCounter.
402 */
404 // When we have the minimum phase from the pattern phase word
405 // and the input register minimum phase bit is set
406 // we can select the second pattern as below.
407 if(fWord[kPatternPhase].fValue - fPatternPhaseOffset == 0)
408 if (firstpattern && CheckIORegisterMask(thisinputregister,fInputReg_PatternSync)){
409 firstpattern = kFALSE;
410 }
411
412 // If firstpattern is still TRUE, we are still searching for the first
413 // pattern of the data stream. So set the pattern number = 0
414 if (firstpattern)
415 fPatternNumber = -1;
416 else {
419 }
420 } else {
421 // Use internal variables for all the counters.
423 if (CheckIORegisterMask(thisinputregister,fInputReg_PatternSync)) {
426 } else {
429 }
430 }
431
432
433 if (firstevent){
434 firstevent = kFALSE;
435 } else if(fEventNumber!=(fEventNumberOld+1)){
436 Int_t nummissed(fEventNumber - (fEventNumberOld+1));
438 QwError << "QwHelicity::ProcessEvent read event# ("
439 << fEventNumber << ") is not old_event#+1; missed "
440 << nummissed << " gates" << QwLog::endl;
441 }
442 fNumMissedGates += nummissed;
445 }
446
448 // Quartet bit is set.
449 QwError << "QwHelicity::ProcessEvent: The Multiplet Sync bit is set, but the Pattern Phase is ("
450 << fPatternPhaseNumber << ") not "
451 << fMinPatternPhase << "! Please check the fPatternPhaseOffset in the helicity map file." << QwLog::endl;
454 }
455
457
458 /**
459 Extract the reported helicity from the input register for each event.
460 */
461
462 if (CheckIORegisterMask(thisinputregister,fInputReg_HelPlus)
463 && CheckIORegisterMask(thisinputregister,fInputReg_HelMinus) ){
464 // Both helicity bits are set.
465 QwError << "QwHelicity::ProcessEvent: Both the H+ and H- bits are set: thisinputregister=="
466 << thisinputregister << QwLog::endl;
468 fHelicityBitPlus = kFALSE;
469 fHelicityBitMinus = kFALSE;
470 } else if (CheckIORegisterMask(thisinputregister,fInputReg_HelPlus)){ // HelPlus bit is set.
471 fHelicityReported |= 1; // Set the InputReg HEL+ bit.
472 fHelicityBitPlus = kTRUE;
473 fHelicityBitMinus = kFALSE;
474 } else {
475 fHelicityReported |= 0; // Set the InputReg HEL- bit.
476 fHelicityBitPlus = kFALSE;
477 fHelicityBitMinus = kTRUE;
478 }
479
480 return;
481}
static const UInt_t kErrorFlag_Helicity
Definition QwTypes.h:175
static const UInt_t kGlobalCut
Definition QwTypes.h:182
static const UInt_t kEventCutMode3
Definition QwTypes.h:174
Bool_t CheckIORegisterMask(const UInt_t &ioregister, const UInt_t &mask) const
Definition QwHelicity.h:88
Bool_t fSuppressMPSErrorMsgs

References CheckIORegisterMask(), QwLog::endl(), QwHelicityBase::fErrorFlag, QwHelicityBase::fEventNumber, QwHelicityBase::fEventNumberOld, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityReported, QwHelicityBase::fIgnoreHelicity, fInputReg_FakeMPS, fInputReg_HelMinus, fInputReg_HelPlus, fInputReg_PatternSync, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fNumMissedEventBlocks, QwHelicityBase::fNumMissedGates, QwHelicityBase::fNumMultSyncErrors, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternNumberOld, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseNumberOld, QwHelicityBase::fPatternPhaseOffset, QwHelicityBase::fSuppressMPSErrorMsgs, QwHelicityBase::fWord, kErrorFlag_Helicity, kEventCutMode3, kGlobalCut, QwHelicityBase::kInputRegister, QwHelicityBase::kMpsCounter, QwHelicityBase::kPatternCounter, QwHelicityBase::kPatternPhase, QwHelicityBase::kUndefinedHelicity, and QwError.

Referenced by ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEventUserbitMode()

void QwHelicity::ProcessEventUserbitMode ( )

Process helicity information from userbit configuration data.

This is a complex function (~80 lines) that extracts helicity information from userbit data for injector tests and special configurations. It handles:

Userbit Decoding:

  • Extracts 3-bit userbit pattern from bits 28-30 of userbit word
  • Decodes quartet synchronization bit (bit 3) for pattern timing
  • Decodes helicity bit (bit 2) for spin state determination
  • Manages scaler offset calculations for event counting

Event Counting Logic:

  • Increments event numbers based on scaler counter ratios
  • Handles missed events when scaler offset > 1 (indicates DAQ issues)
  • Maintains pattern phase and pattern number synchronization
  • Resets quartet phase on quartet sync bit assertion

Helicity State Management:

  • Sets fHelicityBitPlus/fHelicityBitMinus based on userbit helicity bit
  • Updates fHelicityReported for downstream processing
  • Maintains helicity predictor state for data quality monitoring

Error Recovery:

  • Detects missed events through scaler offset analysis
  • Resets helicity predictor when event sequence is uncertain
  • Provides debug output for missed event scenarios

Pattern Synchronization:

  • Manages quartet boundaries using sync bits
  • Handles pattern phase wraparound at maximum phase
  • Maintains continuous event numbering across pattern boundaries
Note
This mode is primarily used for injector testing and is not the standard helicity decoding method for production Qweak data analysis.
Warning
Missed events (scaler offset > 1) will reset the helicity predictor and may affect downstream helicity-dependent analyses.

In this version of the code, the helicity is extracted for a userbit configuration. This is not what we plan to have for Qweak but it was done for injector tests and so is useful to have as another option to get helicity information.

Definition at line 298 of file QwHelicity.cc.

299{
300
301 /** In this version of the code, the helicity is extracted for a userbit configuration.
302 This is not what we plan to have for Qweak but it was done for injector tests and
303 so is useful to have as another option to get helicity information. */
304
305 Bool_t ldebug=kFALSE;
306 UInt_t userbits;
307 static UInt_t lastuserbits = 0xFF;
308 UInt_t scaleroffset=fWord[kScalerCounter].fValue/32;
309
310 if(scaleroffset==1 || scaleroffset==0) {
311 userbits = (fWord[kUserbit].fValue & 0xE0000000)>>28;
312
313 // Now fake the input register, MPS counter, QRT counter, and QRT phase.
315
316 lastuserbits = userbits;
317
318 if (lastuserbits==0xFF) {
320 } else {
321 if ((lastuserbits & 0x8) == 0x8) {
322 // Quartet bit is set.
323 fPatternPhaseNumber = fMinPatternPhase; // Reset the QRT phase
324 fPatternNumber=fPatternNumberOld+1; // Increment the QRT counter
325 } else {
326 fPatternPhaseNumber=fPatternPhaseNumberOld+1; // Increment the QRT phase
327 }
328
330
331 if ((lastuserbits & 0x4) == 0x4){ // Helicity bit is set.
332 fHelicityReported |= 1; // Set the InputReg HEL+ bit.
333 fHelicityBitPlus=kTRUE;
334 fHelicityBitMinus=kFALSE;
335 } else {
336 fHelicityReported |= 0; // Set the InputReg HEL- bit.
337 fHelicityBitPlus=kFALSE;
338 fHelicityBitMinus=kTRUE;
339 }
340 }
341 } else {
342 QwError << " QwHelicity::ProcessEvent finding a missed read event in the scaler" << QwLog::endl;
343 if(ldebug) {
344 std::cout << " QwHelicity::ProcessEvent :" << scaleroffset << " events were missed \n";
345 std::cout << " before manipulation \n";
346 Print();
347 }
348 //there was more than one event since the last reading of the scalers
349 //ie we should read only one event at the time,
350 //if not something is wrong
351 fEventNumber=fEventNumberOld+scaleroffset;
352 Int_t localphase=fPatternPhaseNumberOld;
353 Int_t localpatternnumber=fPatternNumberOld;
354 for (UInt_t i=0;i<scaleroffset;i++) {
355 fPatternPhaseNumber=localphase+1;
359 localpatternnumber=fPatternNumber;
360 }
361 localphase=fPatternPhaseNumber;
362 }
363 //Reset helicity predictor because we are not sure of what we are doing
366 if(ldebug) {
367 std::cout << " after manipulation \n";
368 Print();
369 }
370 }
371 return;
372}
void Print() const

References QwLog::endl(), QwHelicityBase::fEventNumber, QwHelicityBase::fEventNumberOld, QwHelicityBase::fHelicityBitMinus, QwHelicityBase::fHelicityBitPlus, QwHelicityBase::fHelicityReported, QwHelicityBase::fMaxPatternPhase, QwHelicityBase::fMinPatternPhase, QwHelicityBase::fPatternNumber, QwHelicityBase::fPatternNumberOld, QwHelicityBase::fPatternPhaseNumber, QwHelicityBase::fPatternPhaseNumberOld, QwHelicityBase::fWord, QwHelicityBase::kScalerCounter, QwHelicityBase::kUserbit, QwHelicityBase::Print(), QwError, and QwHelicityBase::ResetPredictor().

Referenced by ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessOptions()

void QwHelicity::ProcessOptions ( QwOptions & )
overridevirtual

Process the command line options.

Reimplemented from VQwSubsystem.

Definition at line 139 of file QwHelicity.cc.

140{
141 // Read the cmd options and override channel map settings
142 QwMessage << "QwHelicity::ProcessOptions" << QwLog::endl;
143 if (options.HasValue("helicity.patternoffset")) {
144 if (options.GetValue<int>("helicity.patternoffset") == 1
145 || options.GetValue<int>("helicity.patternoffset") == 0) {
146 fPatternPhaseOffset = options.GetValue<int>("helicity.patternoffset");
147 QwMessage << " Pattern Phase Offset = " << fPatternPhaseOffset << QwLog::endl;
148 } else QwError << "Pattern phase offset should be 0 or 1!" << QwLog::endl;
149 }
150
151 if (options.HasValue("helicity.patternphase")) {
152 if (options.GetValue<int>("helicity.patternphase") % 2 == 0) {
153 fMaxPatternPhase = options.GetValue<int>("helicity.patternphase");
154 QwMessage << " Maximum Pattern Phase = " << fMaxPatternPhase << QwLog::endl;
155 } else QwError << "Pattern phase should be an even integer!" << QwLog::endl;
156 }
157
158 if (options.HasValue("helicity.seed")) {
159 if (options.GetValue<int>("helicity.seed") == 24
160 || options.GetValue<int>("helicity.seed") == 30) {
161 QwMessage << " Random Bits = " << options.GetValue<int>("helicity.seed") << QwLog::endl;
162 fRandBits = options.GetValue<int>("helicity.seed");
163 } else QwError << "Number of random seed bits should be 24 or 30!" << QwLog::endl;
164 }
165
166 if (options.HasValue("helicity.delay")) {
167 QwMessage << " Helicity Delay = " << options.GetValue<int>("helicity.delay") << QwLog::endl;
168 SetHelicityDelay(options.GetValue<int>("helicity.delay"));
169 }
170
171 if (options.HasValue("helicity.bitpattern")) {
172 QwMessage << " Helicity Pattern ="
173 << options.GetValue<std::string>("helicity.bitpattern")
174 << QwLog::endl;
175 std::string hex = options.GetValue<std::string>("helicity.bitpattern");
177 } else {
178 }
179
180 if (options.GetValue<bool>("helicity.toggle-mode")) {
181 fHelicityDelay = 0;
182 fUsePredictor = kFALSE;
185 }
186
187 // If we have the default Helicity Bit Pattern & a large fMaxPatternPhase,
188 // try to recompute the Helicity Bit Pattern.
190 }
191
192 // Here we're going to try to get the "online" option which
193 // is defined by QwEventBuffer.
194 if (options.HasValue("online")){
195 fSuppressMPSErrorMsgs = options.GetValue<bool>("online");
196 } else {
197 fSuppressMPSErrorMsgs = kFALSE;
198 }
199}
static const std::vector< UInt_t > kDefaultHelicityBitPattern

References QwLog::endl(), QwHelicityBase::fHelicityBitPattern, QwHelicityBase::fHelicityDelay, QwHelicityBase::fMaxPatternPhase, QwHelicityBase::fPatternPhaseOffset, QwHelicityBase::fRandBits, QwHelicityBase::fSuppressMPSErrorMsgs, QwHelicityBase::fUsePredictor, QwOptions::GetValue(), QwOptions::HasValue(), QwHelicityBase::kDefaultHelicityBitPattern, QwError, QwMessage, QwHelicityBase::SetHelicityBitPattern(), and QwHelicityBase::SetHelicityDelay().

+ Here is the call graph for this function:

Field Documentation

◆ fInputReg_FakeMPS

UInt_t QwHelicity::fInputReg_FakeMPS
protected

Definition at line 105 of file QwHelicity.h.

Referenced by LoadChannelMap(), ProcessEventInputRegisterMode(), and QwHelicity().

◆ fInputReg_HelMinus

UInt_t QwHelicity::fInputReg_HelMinus
protected

◆ fInputReg_HelPlus

UInt_t QwHelicity::fInputReg_HelPlus
protected

◆ fInputReg_PairSync

UInt_t QwHelicity::fInputReg_PairSync
protected

Definition at line 109 of file QwHelicity.h.

Referenced by LoadChannelMap(), QwHelicity(), and QwHelicity().

◆ fInputReg_PatternSync

UInt_t QwHelicity::fInputReg_PatternSync
protected

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