JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwScanData.h
Go to the documentation of this file.
1#pragma once
2
3
5#include "QwWord.h"
6#include "QwFactory.h"
7#include <vector>
8#include <TString.h>
9
10// Forward Declerations
12
13
14class QwScanData : public VQwSubsystemParity, public MQwSubsystemCloneable<QwScanData>
15{
17 {
18 Int_t fIndex{-1};
19 static char const* const fCleanWordName;
20 bool operator==(CleanDataIndex const& other) const;
21 };
22 enum class CleanDataVal : bool { kUNCLEAN = false, kCLEAN = true };
23 std::vector<QwWord> fWords;
25 Int_t fTreeArrayIndex{-1};
26
27public:
28 QwScanData(TString const& name);
29 QwScanData(QwScanData const& other);
30 ~QwScanData() = default;
31
32
33
34 void FillDB_MPS(QwParityDB*, TString) override { throw std::runtime_error("QwScanData::FillDB_MPS() is not supported"); }
35 void FillDB(QwParityDB* , TString) override { throw std::runtime_error("QwScanData::FillDB() is not supported" ); }
36 void FillErrDB(QwParityDB* , TString) override { throw std::runtime_error("QwScanData::FillErrDB() is not supported"); }
37
38 void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override;
39 void Scale(Double_t factor) override;
40 void AccumulateRunningSum(VQwSubsystem* value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override;
41 void DeaccumulateRunningSum(VQwSubsystem* value, Int_t ErrorMask=0xFFFFFFF) override;
42 void CalculateRunningAverage() override;
47
48 VQwSubsystem& operator= (VQwSubsystem *value) override;
49 VQwSubsystem& operator+= (VQwSubsystem *value) override;
50 VQwSubsystem& operator-= (VQwSubsystem *value) override;
51
52
53 Int_t LoadChannelMap(TString mapfile) override;
54 /// Mandatory parameter file definition
55 Int_t LoadInputParameters(TString mapfile) override { throw std::runtime_error("QwScanData::LoadInputParameters() is not supported"); return 0; }
56 Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override { throw std::runtime_error("QwScanData::ProcessConfigurationBuffer() is not supported"); return 0; }
57 Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override;
58 void ProcessEvent() override;
59 void ConstructHistograms() override { std::runtime_error("QwScanData::ConstructHistograms() is not supported"); }
60 void ConstructHistograms(TDirectory *folder, TString &prefix) override { std::runtime_error("QwScanData::ConstructHistograms() is not supported"); }
61 void FillHistograms() override { std::runtime_error("QwScanData::FillHistograms() is not supported"); }
62
63private:
65 void SetSaveType(TString const& prefix);
67
68public:
69 void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override;
70 void FillTreeVector(QwRootTreeBranchVector &values) const override;
71 void ConstructBranch(TTree *tree, TString& prefix) override { throw std::runtime_error("QwScanData::ConstructBranch() is not supported"); };
72 void ConstructBranch(TTree *tree, TString& prefix, QwParameterFile& trim_file) override { throw std::runtime_error("QwScanData::ConstructBranch() is not supported"); };
73
74#ifdef HAS_RNTUPLE_SUPPORT
75 void ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs) override;
76 void FillNTupleVector(std::vector<Double_t>& values) const override;
77#endif
78
79 void ClearEventData() override;
80 Bool_t ApplySingleEventCuts() override;
81 Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override;
82 void PrintErrorCounters() const override;
83 void IncrementErrorCounters() override;
84 UInt_t GetEventcutErrorFlag() override;
85 void UpdateErrorFlag(const VQwSubsystem *ev_error) override;
86private:
87 // Clean Data Utility Functions
88 bool CheckCleanDataIndex() const;
89 void SetCleanDataIndex(Int_t index);
90 bool SetCleanData(CleanDataVal clean_flag);
91};
92// Register this subsystem with the factory
Factory pattern implementation for creating analysis objects.
#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
Word-level data manipulation and bit operations.
Virtual base class for parity analysis subsystems.
Configuration file parser with flexible tokenization and search capabilities.
A helper class to manage a vector of branch entries for ROOT trees.
Definition QwRootFile.h:55
Base class for subsystems implementing container-delegation pattern.
RootSaveType fSaveType
Definition QwScanData.h:66
void PrintErrorCounters() const override
void ProcessEvent() override
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override
void ConstructHistograms() override
Construct the histograms for this subsystem.
Definition QwScanData.h:59
void FillDB(QwParityDB *, TString) override
Fill the database.
Definition QwScanData.h:35
void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile &trim_file) override
Construct the branch and tree vector based on the trim file.
Definition QwScanData.h:72
void IncrementErrorCounters() override
Increment the error counters.
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this subsystem in a folder with a prefix.
Definition QwScanData.h:60
VQwSubsystem & operator+=(VQwSubsystem *value) override
Definition QwScanData.cc:77
void ConstructBranch(TTree *tree, TString &prefix) override
Construct the branch and tree vector.
Definition QwScanData.h:71
void Scale(Double_t factor) override
void CalculateRunningAverage() override
Calculate the average for all good events.
void SetSaveType(TString const &prefix)
void FillDB_MPS(QwParityDB *, TString) override
Fill the database with MPS-based variables Note that most subsystems don't need to do this.
Definition QwScanData.h:34
Int_t fTreeArrayIndex
Definition QwScanData.h:25
VQwSubsystem & operator=(VQwSubsystem *value) override
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
Definition QwScanData.cc:64
UInt_t GetEventcutErrorFlag() override
Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Construct the branch and tree vector.
void FillHistograms() override
Fill the histograms for this subsystem.
Definition QwScanData.h:61
Int_t LoadChannelMap(TString mapfile) override
Mandatory map file definition.
Definition QwScanData.cc:18
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
Definition QwScanData.h:56
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
void FillTreeVector(QwRootTreeBranchVector &values) const override
Fill the tree vector.
void AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
Update the running sums for devices.
Int_t LoadInputParameters(TString mapfile) override
Mandatory parameter file definition.
Definition QwScanData.h:55
std::vector< QwWord > fWords
Definition QwScanData.h:23
~QwScanData()=default
void SetCleanDataIndex(Int_t index)
CleanDataIndex fCleanDataIndex
Definition QwScanData.h:24
bool SetCleanData(CleanDataVal clean_flag)
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
remove one entry from the running sums for devices
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...
void ClearEventData() override
bool CheckCleanDataIndex() const
void FillErrDB(QwParityDB *, TString) override
Definition QwScanData.h:36
VQwSubsystem & operator-=(VQwSubsystem *value) override
Definition QwScanData.cc:97
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override
Report the number of events failed due to HW and event cut failures.
QwScanData(TString const &name)
Definition QwScanData.cc:6
static char const *const fCleanWordName
Definition QwScanData.h:19
bool operator==(CleanDataIndex const &other) const
virtual void LoadEventCuts_Init()
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
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 rou...
Int_t LoadEventCuts(TString filename) override
Load the event cuts file.
virtual void LoadEventCuts_Line(QwParameterFile &, TString &, Int_t &)