13#include "ROOT/RNTupleModel.hxx"
14#include "ROOT/RField.hxx"
17#ifdef __USE_DATABASE__
48 fSumADC.InitializeChannel(name, datatosave);
68 fSumADC.InitializeChannel(subsystemname,
"QwCombinedPMT", name, datatosave);
77 Bool_t local_debug =
false;
80 TString sumstr = name+TString(
"");
84 if(local_debug) std::cout<<
"linked combined PMT channel "<<
GetElementName()<<std::endl;
104 fSumADC.SetEventData(block, sequencenumber);
112 Bool_t ldebug = kFALSE;
113 Double_t total_weights=0.0;
118 for (
size_t i=0;i<
fElement.size();i++)
134 if (total_weights!=0.0)
135 fSumADC.Scale(1/total_weights);
140 std::cout<<
"QwCombinedPMT::CalculateAverage()"<<std::endl;
147 <<
"\nweighted average of hardware sums = "<<
fSumADC.GetValue()<<
"\n";
149 for (
size_t i=0;i<4;i++)
151 std::cout<<
"weighted average of block["<<i<<
"] = "<<
fSumADC.GetValue(i+1)<<
"\n";
161 Bool_t eventokay=kTRUE;
173 fSumADC.SetSingleEventCuts(errorflag,LL,UL,stability,burplevel);
192 fSumADC.SetDefaultSampleSize((
size_t)sample_size);
208 Bool_t burpstatus = kFALSE;
210 if(
typeid(*ev_error)==
typeid(*
this)) {
217 TString loc=
"Standard exception from QwCombinedPMT::CheckForBurpFail :"+
220 throw std::invalid_argument(loc.Data());
222 }
catch (std::exception& e) {
223 std::cerr<< e.what()<<std::endl;
233 for (
size_t i=0;i<
fElement.size();i++) {
243 if(
typeid(*ev_error)==
typeid(*
this)) {
249 TString loc=
"Standard exception from QwCombinedPMT::UpdateErrorFlag :"+
252 throw std::invalid_argument(loc.Data());
254 }
catch (std::exception& e) {
255 std::cerr<< e.what()<<std::endl;
262 return fSumADC.ApplySingleEventCuts();
278 for (
size_t i=0; i<value.
fElement.size(); i++)
307 for (
size_t i=0; i<value.
fElement.size(); i++)
325 for (
size_t i=0; i<value.
fElement.size(); i++)
384 fSumADC.CalculateRunningAverage();
421 TString sumprefix = prefix+TString(
"");
422 fSumADC.ConstructHistograms(folder, sumprefix);
454 TString sumprefix = prefix+
"";
455 fSumADC.ConstructBranchAndVector(tree, sumprefix,values);
469 TString sumprefix = prefix+
"";
470 fSumADC.ConstructBranch(tree, sumprefix);
479 devicename.ToLower();
486 if (modulelist.
HasValue(devicename)){
487 TString sumprefix = prefix+
"";
488 fSumADC.ConstructBranch(tree, sumprefix);
501 fSumADC.FillTreeVector(values);
506#ifdef HAS_RNTUPLE_SUPPORT
507void QwCombinedPMT::ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs)
515 TString sumprefix = prefix+
"";
516 fSumADC.ConstructNTupleAndVector(model, sumprefix, values, fieldPtrs);
520void QwCombinedPMT::FillNTupleVector(std::vector<Double_t>& values)
const
525 fSumADC.FillNTupleVector(values);
531#ifdef __USE_DATABASE__
540 return fSumADC.GetErrDBEntry();
#define QwMessage
Predefined log drain for regular messages.
Database interface for QwIntegrationPMT and subsystems.
Combined PMT detector using Moller ADC channels.
const TString QwBPMStripline< T >::subelement[4]
static std::ostream & endl(std::ostream &)
End of the line.
Configuration file parser with flexible tokenization and search capabilities.
Bool_t HasValue(TString &vname)
A helper class to manage a vector of branch entries for ROOT trees.
VQwDataElement()
Default constructor.
virtual const TString & GetElementName() const
Get the name of this element.
void SetElementName(const TString &name)
Set the name of this element.
Data blinding utilities for parity violation analysis.
Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t subelement=0) override
Process the CODA event buffer for this element.
void Sum(const QwCombinedPMT &value1, const QwCombinedPMT &value2)
void FillTreeVector(QwRootTreeBranchVector &values) const
void AccumulateRunningSum(const QwCombinedPMT &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
void PrintInfo() const override
Print multiple lines of information about this data element.
void DeaccumulateRunningSum(QwCombinedPMT &value, Int_t ErrorMask=0xFFFFFFF)
QwCombinedPMT & operator=(const QwCombinedPMT &value)
void Normalize(VQwDataElement *denom)
void ClearEventData() override
Clear event-scoped data for the sum channel.
void CalculateRunningAverage()
void ConstructBranch(TTree *tree, TString &prefix)
void Blind(const QwBlinder *blinder)
Blind the asymmetry.
Bool_t CheckForBurpFail(const VQwDataElement *ev_error)
Check for burp failures by delegating to the sum ADC channel.
void ProcessEvent()
Process event by computing the weighted average of members.
void Scale(Double_t factor)
UInt_t UpdateErrorFlag() override
Update the sum ADC error flag from member PMTs.
UInt_t GetEventcutErrorFlag() override
return the error flag on this channel/device
void LinkChannel(TString name)
Link internal sum channel names to the given detector name.
void SetBlindability(Bool_t isblindable)
void PrintErrorCounters()
Bool_t ApplyHWChecks()
Apply hardware checks (none needed at combiner level).
void Ratio(QwCombinedPMT &numer, QwCombinedPMT &denom)
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this data element.
void InitializeChannel(TString name, TString datatosave)
Initialize the combined PMT with a name and data-saving mode.
std::vector< Double_t > fWeights
void PrintValue() const override
Print single line of value and error of this data element.
void SetEventData(Double_t *block, UInt_t sequencenumber)
Set the block data for the current event sequence.
void Difference(const QwCombinedPMT &value1, const QwCombinedPMT &value2)
void Add(QwIntegrationPMT *pmt, Double_t weight)
Add a PMT channel to this combination with a weight.
void SetHardwareSum(Double_t hwsum, UInt_t sequencenumber=0)
Set the hardware-level sum for a sequence (unused for combo).
void SetDefaultSampleSize(Int_t sample_size)
Set default sample size on the sum ADC.
Bool_t ApplySingleEventCuts()
QwCombinedPMT & operator+=(const QwCombinedPMT &value)
std::vector< QwIntegrationPMT * > fElement
used to validate sequence number in the IsGoodEvent()
void CalculateSumAndAverage()
Compute the weighted sum (and average) from member PMTs.
void FillHistograms() override
Fill the histograms for this data element.
std::vector< QwErrDBInterface > GetErrDBEntry()
void SetSingleEventCuts(UInt_t errorflag, Double_t LL, Double_t UL, Double_t stability, Double_t burplevel)
Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit),...
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
std::vector< QwDBInterface > GetDBEntry()
QwCombinedPMT & operator-=(const QwCombinedPMT &value)
Integration PMT providing yield/diff/asym readout from Moller ADC.
void Scale(Double_t factor)