JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwHelicity.h
Go to the documentation of this file.
1/**********************************************************\
2* File: QwHelicity.h *
3* *
4* Contributor: Arindam Sen (asen@jlab.org) *
5* Time-stamp: November, 2025 *
6\**********************************************************/
7
8/*!
9 * \file QwHelicity.h
10 * \brief Helicity state management and pattern recognition
11 */
12
13#pragma once
14
15// System headers
16#include <vector>
17
18// ROOT headers
19#include "TTree.h"
20
21// Qweak headers
22#include "QwWord.h"
23#include "QwHelicityBase.h"
24
25/**
26 * \class QwHelicity
27 * \ingroup QwAnalysis_BeamLine
28 * \brief Subsystem for helicity state management and pattern recognition
29 *
30 * Manages helicity information from the polarized electron beam, including
31 * helicity state determination, pattern recognition, delayed helicity decoding,
32 * and helicity-correlated systematic checks. Supports multiple helicity
33 * encoding modes and provides helicity information to other subsystems.
34 */
35class QwHelicity: public QwHelicityBase, public MQwSubsystemCloneable<QwHelicity> {
36
37 private:
38 /// Private default constructor (not implemented, will throw linker error on use)
40
41 public:
42 /// Constructor with name
43 QwHelicity(const TString& name);
44 /// Copy constructor
45 QwHelicity(const QwHelicity& source);
46 /// Virtual destructor
47 virtual ~QwHelicity() override { }
48
49
50 static void DefineOptions(QwOptions &options);
51 void ProcessOptions(QwOptions &options) override;
52 Int_t LoadChannelMap(TString mapfile) override;
53 Int_t LoadInputParameters(TString pedestalfile) override;
54 Int_t LoadEventCuts(TString filename) override;//Loads event cuts applicable to QwHelicity class, derived from VQwSubsystemParity
55 Bool_t ApplySingleEventCuts() override;//Apply event cuts in the QwHelicity class, derived from VQwSubsystemParity
56
57 Bool_t CheckForBurpFail(const VQwSubsystem *ev_error) override{
58 return kFALSE;
59 };
60
61 Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id,
62 UInt_t* buffer, UInt_t num_words) override;
63 Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override {
64 return ProcessEvBuffer(0x1,roc_id,bank_id,buffer,num_words);
65 };
66 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;
67 void ProcessEventUserbitMode();//ProcessEvent has two modes Userbit and Inputregister modes
70
71 void EncodeEventData(std::vector<UInt_t> &buffer) override;
72
73
74 void ClearEventData() override;
75 void ProcessEvent() override;
76
77 UInt_t GetRandomSeedActual() { return iseed_Actual; };
78 UInt_t GetRandomSeedDelayed() { return iseed_Delayed; };
79
80 using QwHelicityBase::operator=;
82 void ConstructHistograms(TDirectory *folder, TString &prefix) override;
83
85
86 protected:
87
88 Bool_t CheckIORegisterMask(const UInt_t& ioregister, const UInt_t& mask) const {
89 return ((mask != 0)&&((ioregister & mask) == mask));
90 };
91
96 // this values allow to switch the code between different helicity encoding mode.
97
102
103
104
110
111};
112
113// Register this subsystem with the factory
Word-level data manipulation and bit operations.
#define REGISTER_SUBSYSTEM_FACTORY(A)
Definition QwFactory.h:270
ULong64_t BankID_t
Definition QwTypes.h:21
UInt_t ROCID_t
Definition QwTypes.h:20
Helicity state management and pattern recognition.
Command-line and configuration file options processor.
Definition QwOptions.h:141
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
VQwSubsystem(const TString &name)
Constructor with name.
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)=0
Construct the branch and tree vector.
Subsystem for helicity state management and pattern recognition.
Definition QwHelicity.h:35
virtual ~QwHelicity() override
Virtual destructor.
Definition QwHelicity.h:47
Int_t LoadEventCuts(TString filename) override
Optional event cut file.
Bool_t CheckIORegisterMask(const UInt_t &ioregister, const UInt_t &mask) const
Definition QwHelicity.h:88
void ProcessEventInputRegisterMode()
void ProcessOptions(QwOptions &options) override
Process the command line options.
void ClearEventData() override
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
UInt_t fInputReg_FakeMPS
Definition QwHelicity.h:105
UInt_t GetRandomSeedDelayed()
Definition QwHelicity.h:78
Int_t LoadInputParameters(TString pedestalfile) override
Mandatory parameter file definition.
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Int_t LoadChannelMap(TString mapfile) override
Mandatory map file definition.
QwHelicity()
Private default constructor (not implemented, will throw linker error on use)
UInt_t fInputReg_HelMinus
Definition QwHelicity.h:107
@ kDefaultInputReg_FakeMPS
Definition QwHelicity.h:101
@ kDefaultInputReg_PatternSync
Definition QwHelicity.h:100
@ kDefaultInputReg_HelPlus
Definition QwHelicity.h:98
@ kDefaultInputReg_HelMinus
Definition QwHelicity.h:99
@ kHelInputMollerMode
Definition QwHelicity.h:95
@ kHelInputRegisterMode
Definition QwHelicity.h:93
@ kHelUserbitMode
Definition QwHelicity.h:92
@ kHelLocalyMadeUp
Definition QwHelicity.h:94
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
UInt_t fInputReg_HelPlus
Definition QwHelicity.h:106
void ProcessEventUserbitMode()
Process helicity information from userbit configuration data.
UInt_t GetRandomSeedActual()
Definition QwHelicity.h:77
UInt_t fInputReg_PairSync
Definition QwHelicity.h:109
UInt_t fInputReg_PatternSync
Definition QwHelicity.h:108
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
void ProcessEventInputMollerMode()
void ProcessEvent() override
Bool_t CheckForBurpFail(const VQwSubsystem *ev_error) override
Report the number of events failed due to HW and event cut failures.
Definition QwHelicity.h:57
void EncodeEventData(std::vector< UInt_t > &buffer) override
QwHelicityBase()
Private default constructor (not implemented, will throw linker error on use)