JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwMollerDetector.h
Go to the documentation of this file.
1/*!
2 * \file QwMollerDetector.h
3 * \brief Moller detector analysis implementation
4 * \author Andrew Kubera
5 * \date 2010-06-07
6 * \ingroup QwMoller
7 */
8
9#pragma once
10
11// System headers
12#include <vector>
13
14// Boost multi array
15#include <boost/multi_array.hpp>
16
17// ROOT headers
18#include "TTree.h"
19#include "TFile.h"
20#ifdef HAS_RNTUPLE_SUPPORT
21#include "ROOT/RNTupleModel.hxx"
22#include "ROOT/RField.hxx"
23#endif // HAS_RNTUPLE_SUPPORT
24
25// Qweak headers
26#include "VQwSubsystemParity.h"
27#include "QwVQWK_Channel.h"
28#include "QwScaler_Channel.h"
29
30/**
31 * \class QwMollerChannelID
32 * \ingroup QwMoller
33 * \brief Mapping info for Moller detector channels
34 */
36{
37 public:
40
41 int fIndex; // index of this detector in the vector containing all the detector of same type
43
44 int fWordInSubbank; //first word reported for this channel in the subbank
45 //(eg VQWK channel report 6 words for each event, scalers only report one word per event)
46 // The first word of the subbank gets fWordInSubbank=0
47
49
50 TString fModuleType;
52 TString fChannelName;
54
55 void Print(){
56 QwMessage << "***************************************" << std::endl;
57 QwMessage << " QwMoller channel: " << fChannelName << std::endl;
58 QwMessage << " Detector Type: " << fDetectorType << std::endl;
59 QwMessage << " Channel #: " << fChannelNumber << std::endl;
60 QwMessage << " Word In Sub: " << fWordInSubbank << std::endl;
61 QwMessage << " Index: " << fIndex << std::endl;
62 };
63
64};
65
66/**
67 * \class QwMollerDetector
68 * \ingroup QwMoller
69 * \brief Subsystem for analyzing Moller detector readout
70 */
72 public VQwSubsystemParity,
73 public MQwSubsystemCloneable<QwMollerDetector> {
74
75 private:
76 /// Private default constructor (not implemented, will throw linker error on use)
78
79 public:
80
81 /// Constructor with name
82 QwMollerDetector(const TString& name)
83 : VQwSubsystem(name), VQwSubsystemParity(name)
84 { };
85 /// Copy constructor
90 /// Virtual destructor
91 ~QwMollerDetector() override { };
92
93 /* derived from VQwSubsystem */
94 void ProcessOptions(QwOptions &options) override; //Handle command line options
95 Int_t LoadChannelMap(TString mapfile) override;
96 Int_t LoadInputParameters(TString pedestalfile) override;
97 Int_t LoadEventCuts(TString & filename);
99 Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override;
100 Int_t ProcessConfigurationBuffer(UInt_t ev_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words);
101 Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override;
102 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;
103 void ClearEventData() override;
104 void ProcessEvent() override;
105
107 void ConstructHistograms(TDirectory *folder, TString &prefix) override;
108 void FillHistograms() override;
109
110 VQwSubsystem& operator= (VQwSubsystem *value) override;
111 VQwSubsystem& operator+= (VQwSubsystem *value) override;
112 VQwSubsystem& operator-= (VQwSubsystem *value) override;
113 void Ratio(VQwSubsystem *value1, VQwSubsystem *value2) override;
114 void Scale(Double_t) override;
115 void AccumulateRunningSum(VQwSubsystem* value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override;
116 //remove one entry from the running sums for devices
117 void DeaccumulateRunningSum(VQwSubsystem* value, Int_t ErrorMask=0xFFFFFFF) override{
118 };
119 void CalculateRunningAverage() override;
120 Int_t LoadEventCuts(TString filename) override;
121 Bool_t ApplySingleEventCuts() override;
122 void IncrementErrorCounters() override {};
123 void PrintErrorCounters() const override;
124 UInt_t GetEventcutErrorFlag() override;
125
126 Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override{
127 return kFALSE;
128 };
129
130 //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
131 void UpdateErrorFlag(const VQwSubsystem *ev_error) override{
132 };
133
135 void ConstructBranchAndVector(TTree*, TString&, QwRootTreeBranchVector&) override;
136 void ConstructBranch(TTree *tree, TString& prefix) override { };
137 void ConstructBranch(TTree *tree, TString& prefix, QwParameterFile& trim_file) override { };
138 void FillTreeVector(QwRootTreeBranchVector &values) const override;
139
140 // RNTuple methods
141#ifdef HAS_RNTUPLE_SUPPORT
142 void ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs) override;
143 void FillNTupleVector(std::vector<Double_t>& values) const override;
144#endif // HAS_RNTUPLE_SUPPORT
145
146 Bool_t Compare(VQwSubsystem *source);
147 void print();
148 void PrintValue() const override;
149 float* GetRawChannelArray();
150
151 Int_t GetChannelIndex(TString channelName, UInt_t module_number);
152 float GetDataForChannelInModule(Int_t module_number, Int_t channel_index){
153 return fSTR7200_Channel[module_number][channel_index].GetValue();
154 }
155
156 float GetDataForChannelInModule(Int_t module_number, TString channel_name){
157 return GetDataForChannelInModule(module_number, GetChannelIndex(channel_name,module_number));
158 }
159
160 protected:
161 //Array of ChannelIDs which contain the map file
162 std::vector<QwMollerChannelID> fMollerChannelID;
163
164 //the running total scaler structure
165 std::vector< std::vector<QwSTR7200_Channel> > fSTR7200_Channel;
166 std::vector< std::vector<QwSTR7200_Channel> > fPrevious_STR7200_Channel;
167
168 private:
170 static const Bool_t bDEBUG = kFALSE;
171 UInt_t fNumberOfEvents; //! Number of triggered events
172
173};
Base and derived classes for scaler channel data handling.
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
Decoding and management for VQWK ADC channels (6x32-bit datawords)
ULong64_t BankID_t
Definition QwTypes.h:21
UInt_t ROCID_t
Definition QwTypes.h:20
Virtual base class for parity analysis subsystems.
Command-line and configuration file options processor.
Definition QwOptions.h:141
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:53
Base class for subsystems implementing container-delegation pattern.
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
VQwSubsystem(const TString &name)
Constructor with name.
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)=0
Construct the branch and tree vector.
void ConstructBranch(TTree *tree, TString &prefix) override
Construct the branch and tree vector.
std::vector< std::vector< QwSTR7200_Channel > > fPrevious_STR7200_Channel
void FillHistograms() override
Fill the histograms for this subsystem.
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override
Report the number of events failed due to HW and event cut failures.
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...
QwMollerDetector(const TString &name)
Constructor with name.
std::vector< std::vector< QwSTR7200_Channel > > fSTR7200_Channel
void CalculateRunningAverage() override
Calculate the average for all good events.
void ProcessOptions(QwOptions &options) override
Process the command line options.
static const Bool_t bDEBUG
VQwSubsystem & operator-=(VQwSubsystem *value) override
void IncrementErrorCounters() override
Increment the error counters.
Bool_t SingleEventCuts()
void Ratio(VQwSubsystem *value1, VQwSubsystem *value2) override
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Bool_t Compare(VQwSubsystem *source)
UInt_t GetEventcutErrorFlag() override
Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
void PrintValue() const override
Print values of all channels.
void ProcessEvent() override
void PrintErrorCounters() const override
VQwSubsystem & operator=(VQwSubsystem *value) override
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile &trim_file) override
Construct the branch and tree vector based on the trim file.
Int_t LoadEventCuts(TString &filename)
float GetDataForChannelInModule(Int_t module_number, Int_t channel_index)
void AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
Update the running sums for devices.
Int_t LoadInputParameters(TString pedestalfile) override
Mandatory parameter file definition.
~QwMollerDetector() override
Virtual destructor.
void UpdateErrorFlag(const VQwSubsystem *ev_error) override
update the error flag in the subsystem level from the top level routines related to stability checks....
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
void ConstructBranchAndVector(TTree *, TString &, QwRootTreeBranchVector &) override
Construct the branch and tree vector.
void Scale(Double_t) override
VQwSubsystem & operator+=(VQwSubsystem *value) override
QwMollerDetector(const QwMollerDetector &source)
Copy constructor.
Int_t LoadChannelMap(TString mapfile) override
void ClearEventData() override
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
remove one entry from the running sums for devices
QwMollerDetector()
Private default constructor (not implemented, will throw linker error on use)
float GetDataForChannelInModule(Int_t module_number, TString channel_name)
Int_t GetChannelIndex(TString channelName, UInt_t module_number)
void FillTreeVector(QwRootTreeBranchVector &values) const override
Fill the tree vector.
std::vector< QwMollerChannelID > fMollerChannelID
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)