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

Combines multiple integration PMTs into weighted sum/average. More...

#include <QwCombinedPMT.h>

+ Inheritance diagram for QwCombinedPMT:
+ Collaboration diagram for QwCombinedPMT:

Public Member Functions

 QwCombinedPMT ()
 
 QwCombinedPMT (TString name)
 
 QwCombinedPMT (TString subsystemname, TString name)
 
 QwCombinedPMT (const QwCombinedPMT &source)
 
 ~QwCombinedPMT () override
 
void InitializeChannel (TString name, TString datatosave)
 Initialize the combined PMT with a name and data-saving mode.
 
void InitializeChannel (TString subsystem, TString name, TString datatosave)
 Initialize the combined PMT with subsystem and name.
 
void LinkChannel (TString name)
 Link internal sum channel names to the given detector name.
 
const QwMollerADC_ChannelGetChannel (const TString name) const
 
void Add (QwIntegrationPMT *pmt, Double_t weight)
 Add a PMT channel to this combination with a weight.
 
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 ClearEventData () override
 Clear event-scoped data for the sum channel.
 
void PrintErrorCounters ()
 
void CalculateSumAndAverage ()
 Compute the weighted sum (and average) from member PMTs.
 
void SetRandomEventParameters (Double_t mean, Double_t sigma)
 
void SetRandomEventAsymmetry (Double_t asymmetry)
 
void RandomizeEventData (int helicity)
 
void SetHardwareSum (Double_t hwsum, UInt_t sequencenumber=0)
 Set the hardware-level sum for a sequence (unused for combo).
 
void SetEventData (Double_t *block, UInt_t sequencenumber)
 Set the block data for the current event sequence.
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 
void ProcessEvent ()
 Process event by computing the weighted average of members.
 
Bool_t ApplyHWChecks ()
 Apply hardware checks (none needed at combiner level).
 
Bool_t ApplySingleEventCuts ()
 
void PrintErrorCounters () const override
 Print error counters aggregated by the sum ADC.
 
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), stability % and the error flag on this channel.
 
void SetDefaultSampleSize (Int_t sample_size)
 Set default sample size on the sum ADC.
 
void SetEventCutMode (Int_t bcuts)
 
UInt_t GetEventcutErrorFlag () override
 return the error flag on this channel/device
 
void IncrementErrorCounters ()
 
Bool_t CheckForBurpFail (const VQwDataElement *ev_error)
 Check for burp failures by delegating to the sum ADC channel.
 
UInt_t UpdateErrorFlag () override
 Update the sum ADC error flag from member PMTs.
 
void UpdateErrorFlag (const QwCombinedPMT *ev_error)
 Merge error flags from a reference combined PMT.
 
void PrintInfo () const override
 Print multiple lines of information about this data element.
 
void PrintValue () const override
 Print single line of value and error of this data element.
 
QwCombinedPMToperator= (const QwCombinedPMT &value)
 
QwCombinedPMToperator+= (const QwCombinedPMT &value)
 
QwCombinedPMToperator-= (const QwCombinedPMT &value)
 
void Sum (const QwCombinedPMT &value1, const QwCombinedPMT &value2)
 
void Difference (const QwCombinedPMT &value1, const QwCombinedPMT &value2)
 
void Ratio (QwCombinedPMT &numer, QwCombinedPMT &denom)
 
void Scale (Double_t factor)
 
void Normalize (VQwDataElement *denom)
 
void AccumulateRunningSum (const QwCombinedPMT &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void DeaccumulateRunningSum (QwCombinedPMT &value, Int_t ErrorMask=0xFFFFFFF)
 
void CalculateRunningAverage ()
 
void SetBlindability (Bool_t isblindable)
 
void SetNormalizability (Bool_t isnormalizable)
 
void Blind (const QwBlinder *blinder)
 Blind the asymmetry.
 
void Blind (const QwBlinder *blinder, const QwCombinedPMT &yield)
 Blind the difference using the yield.
 
void SetPedestal (Double_t ped)
 
void SetCalibrationFactor (Double_t calib)
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 Construct the histograms for this data element.
 
void FillHistograms () override
 Fill the histograms for this data element.
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
 
void ConstructBranch (TTree *tree, TString &prefix)
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist)
 
void FillTreeVector (QwRootTreeBranchVector &values) const
 
std::vector< QwDBInterfaceGetDBEntry ()
 
std::vector< QwErrDBInterfaceGetErrDBEntry ()
 
- Public Member Functions inherited from VQwDataElement
 VQwDataElement ()
 Default constructor.
 
 VQwDataElement (const VQwDataElement &value)
 Copy constructor.
 
 ~VQwDataElement () override
 Virtual destructor.
 
void CopyFrom (const VQwDataElement &value)
 
Bool_t IsNameEmpty () const
 Is the name of this element empty?
 
void SetElementName (const TString &name)
 Set the name of this element.
 
virtual const TString & GetElementName () const
 Get the name of this element.
 
virtual void LoadChannelParameters (QwParameterFile &)
 
virtual void LoadMockDataParameters (QwParameterFile &)
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element.
 
UInt_t GetGoodEventCount () const
 
virtual void AssignValueFrom (const VQwDataElement *)
 
VQwDataElementoperator+= (const VQwDataElement &)
 Addition-assignment operator.
 
VQwDataElementoperator-= (const VQwDataElement &)
 Subtraction-assignment operator.
 
void Sum (const VQwDataElement &, const VQwDataElement &)
 Sum operator (base class fallback throws runtime error)
 
void Difference (const VQwDataElement &, const VQwDataElement &)
 Difference operator (base class fallback throws runtime error)
 
void Ratio (const VQwDataElement &, const VQwDataElement &)
 Ratio operator (base class fallback throws runtime error)
 
void SetSingleEventCuts (UInt_t, Double_t, Double_t, Double_t)
 set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel
 
Bool_t CheckForBurpFail (const VQwDataElement *)
 
virtual void SetNeedsExternalClock (Bool_t)
 
virtual Bool_t NeedsExternalClock ()
 
virtual std::string GetExternalClockName ()
 
virtual void SetExternalClockPtr (const VQwHardwareChannel *)
 
virtual void SetExternalClockName (const std::string)
 
virtual Double_t GetNormClockValue ()
 
TString GetSubsystemName () const
 Return the name of the inheriting subsystem name.
 
void SetSubsystemName (TString sysname)
 Set the name of the inheriting subsystem name.
 
TString GetModuleType () const
 Return the type of the beam instrument.
 
void SetModuleType (TString ModuleType)
 set the type of the beam instrument
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects.
 

Private Attributes

Int_t fDataToSave
 
Double_t fCalibration
 
Double_t fULimit
 
Double_t fLLimit
 
Double_t fSequenceNo_Prev
 
Bool_t fGoodEvent
 
std::vector< QwIntegrationPMT * > fElement
 used to validate sequence number in the IsGoodEvent()
 
std::vector< Double_t > fWeights
 
QwIntegrationPMT fSumADC
 
Int_t fDevice_flag
 
Int_t fDeviceErrorCode
 
Bool_t bEVENTCUTMODE
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 

Additional Inherited Members

- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0 , kDerived , kMoments }
 
- Protected Member Functions inherited from VQwDataElement
void SetNumberOfDataWords (const UInt_t &numwords)
 Set the number of data words in this data element.
 
VQwDataElementoperator= (const VQwDataElement &value)
 Arithmetic assignment operator: Should only copy event-based data.
 
void UpdateErrorFlag (const UInt_t &error)
 
- 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 Attributes inherited from VQwDataElement
TString fElementName
 Name of this data element.
 
UInt_t fNumberOfDataWords
 Number of raw data words in this data element.
 
UInt_t fGoodEventCount
 Number of good events accumulated in this element.
 
TString fSubsystemName
 
TString fModuleType
 
UInt_t fErrorFlag
 This the standard error code generated for the channel that contains the global/local/stability flags and the Device error code (Unique error code for HW failures)
 
UInt_t fErrorConfigFlag
 contains the global/local/stability flags
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element.
 

Detailed Description

Combines multiple integration PMTs into weighted sum/average.

Definition at line 31 of file QwCombinedPMT.h.

Constructor & Destructor Documentation

◆ QwCombinedPMT() [1/4]

QwCombinedPMT::QwCombinedPMT ( )
inline

Definition at line 34 of file QwCombinedPMT.h.

34 {
35 InitializeChannel("", "derived");
36 };
void InitializeChannel(TString name, TString datatosave)
Initialize the combined PMT with a name and data-saving mode.

References InitializeChannel().

Referenced by AccumulateRunningSum(), Blind(), CheckForBurpFail(), DeaccumulateRunningSum(), Difference(), operator+=(), operator-=(), operator=(), QwCombinedPMT(), Ratio(), Sum(), and UpdateErrorFlag().

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

◆ QwCombinedPMT() [2/4]

QwCombinedPMT::QwCombinedPMT ( TString name)
inline

Definition at line 38 of file QwCombinedPMT.h.

38 {
39 InitializeChannel(name, "derived");
40 };

References InitializeChannel().

+ Here is the call graph for this function:

◆ QwCombinedPMT() [3/4]

QwCombinedPMT::QwCombinedPMT ( TString subsystemname,
TString name )
inline

Definition at line 42 of file QwCombinedPMT.h.

42 {
43 SetSubsystemName(subsystemname);
44 InitializeChannel(subsystemname, name, "derived");
45 };
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.

References InitializeChannel(), and VQwDataElement::SetSubsystemName().

+ Here is the call graph for this function:

◆ QwCombinedPMT() [4/4]

QwCombinedPMT::QwCombinedPMT ( const QwCombinedPMT & source)
inline

Definition at line 46 of file QwCombinedPMT.h.

47 : VQwDataElement(source),
49 fElement(source.fElement),
50 fWeights(source.fWeights),
51 fSumADC(source.fSumADC)
52 { }
VQwDataElement()
Default constructor.
QwIntegrationPMT fSumADC
std::vector< Double_t > fWeights
Double_t fCalibration
std::vector< QwIntegrationPMT * > fElement
used to validate sequence number in the IsGoodEvent()

References fCalibration, fElement, fSumADC, fWeights, QwCombinedPMT(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ ~QwCombinedPMT()

QwCombinedPMT::~QwCombinedPMT ( )
inlineoverride

Definition at line 53 of file QwCombinedPMT.h.

53{ };

Member Function Documentation

◆ AccumulateRunningSum()

void QwCombinedPMT::AccumulateRunningSum ( const QwCombinedPMT & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )

Definition at line 350 of file QwCombinedPMT.cc.

351{
352 fSumADC.AccumulateRunningSum(value.fSumADC, count, ErrorMask);
353}

References fSumADC, and QwCombinedPMT().

+ Here is the call graph for this function:

◆ Add()

void QwCombinedPMT::Add ( QwIntegrationPMT * pmt,
Double_t weight )

Add a PMT channel to this combination with a weight.

Parameters
pmtPointer to the PMT to include.
weightWeight applied to the PMT in the sum/average.

Definition at line 26 of file QwCombinedPMT.cc.

27{
28 //std::cout<<"QwCombinedPMT: Got "<<pmt->GetElementName()<<" and weight ="<<weight<<"\n";
29 fElement.push_back(pmt);
30 fWeights.push_back(weight);
31}

References fElement, and fWeights.

◆ ApplyHWChecks()

Bool_t QwCombinedPMT::ApplyHWChecks ( )

Apply hardware checks (none needed at combiner level).

Definition at line 159 of file QwCombinedPMT.cc.

160{
161 Bool_t eventokay=kTRUE;
162
163
164 return eventokay;
165}

◆ ApplySingleEventCuts()

Bool_t QwCombinedPMT::ApplySingleEventCuts ( )

Definition at line 261 of file QwCombinedPMT.cc.

261 {
262 return fSumADC.ApplySingleEventCuts();
263}

References fSumADC.

◆ Blind() [1/2]

void QwCombinedPMT::Blind ( const QwBlinder * blinder)

Blind the asymmetry.

Definition at line 388 of file QwCombinedPMT.cc.

389{
390 fSumADC.Blind(blinder);
391// fAvgADC.Blind(blinder);
392}

References fSumADC.

◆ Blind() [2/2]

void QwCombinedPMT::Blind ( const QwBlinder * blinder,
const QwCombinedPMT & yield )

Blind the difference using the yield.

Definition at line 394 of file QwCombinedPMT.cc.

395{
396 fSumADC.Blind(blinder, yield.fSumADC);
397// fAvgADC.Blind(blinder, yield.fAvgADC);
398}

References fSumADC, and QwCombinedPMT().

+ Here is the call graph for this function:

◆ CalculateRunningAverage()

void QwCombinedPMT::CalculateRunningAverage ( )

Definition at line 382 of file QwCombinedPMT.cc.

383{
384 fSumADC.CalculateRunningAverage();
385// fAvgADC.CalculateRunningAverage();
386}

References fSumADC.

◆ CalculateSumAndAverage()

void QwCombinedPMT::CalculateSumAndAverage ( )

Compute the weighted sum (and average) from member PMTs.

Definition at line 109 of file QwCombinedPMT.cc.

110{
111
112 Bool_t ldebug = kFALSE;
113 Double_t total_weights=0.0;
114
115 fSumADC.ClearEventData();
116 static QwIntegrationPMT tmpADC("tmpADC");
117
118 for (size_t i=0;i<fElement.size();i++)
119 {
120 //std::cout<<"=========fElement["<<i<<"]=========="<<std::endl;
121 //fElement[i]->Print();
122 tmpADC = *(fElement[i]);
123 //std::cout<<"=========tmpADC========="<<std::endl;
124 //tmpADC->Print();
125 tmpADC.Scale(fWeights[i]);
126 fSumADC += tmpADC;
127 total_weights += fWeights[i];
128 }
129
130// fAvgADC = fSumADC;
131// if (total_weights!=0.0)
132// fAvgADC.Scale(1/total_weights);
133
134 if (total_weights!=0.0)
135 fSumADC.Scale(1/total_weights);
136
137
138 if (ldebug)
139 {
140 std::cout<<"QwCombinedPMT::CalculateAverage()"<<std::endl;
141// fAvgADC.PrintInfo();
142 fSumADC.PrintInfo();
143
144// std::cout<<"QwCombinedPMT: "<<GetElementName()
145// <<"\nweighted average of hardware sums = "<<fAvgADC.GetValue()<<"\n";
146 std::cout<<"QwCombinedPMT: "<<GetElementName()
147 <<"\nweighted average of hardware sums = "<<fSumADC.GetValue()<<"\n";
148
149 for (size_t i=0;i<4;i++)
150 {
151 std::cout<<"weighted average of block["<<i<<"] = "<<fSumADC.GetValue(i+1)<<"\n";
152 }
153 }
154
155}
virtual const TString & GetElementName() const
Get the name of this element.

References fElement, fSumADC, fWeights, VQwDataElement::GetElementName(), and QwIntegrationPMT::Scale().

Referenced by ProcessEvent().

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

◆ CheckForBurpFail()

Bool_t QwCombinedPMT::CheckForBurpFail ( const VQwDataElement * ev_error)

Check for burp failures by delegating to the sum ADC channel.

Parameters
ev_errorReference combined PMT to compare against.
Returns
kTRUE if a burp failure was detected; otherwise kFALSE.

Definition at line 207 of file QwCombinedPMT.cc.

207 {
208 Bool_t burpstatus = kFALSE;
209 try {
210 if(typeid(*ev_error)==typeid(*this)) {
211 //std::cout<<" Here in QwCombinedPMT::CheckForBurpFail \n";
212 if (this->GetElementName()!="") {
213 const QwCombinedPMT* value_pmt = dynamic_cast<const QwCombinedPMT* >(ev_error);
214 burpstatus |= fSumADC.CheckForBurpFail(&(value_pmt->fSumADC));
215 }
216 } else {
217 TString loc="Standard exception from QwCombinedPMT::CheckForBurpFail :"+
218 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
219 +"same type";
220 throw std::invalid_argument(loc.Data());
221 }
222 } catch (std::exception& e) {
223 std::cerr<< e.what()<<std::endl;
224 }
225 return burpstatus;
226};

References fSumADC, VQwDataElement::GetElementName(), QwCombinedPMT(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ ClearEventData()

void QwCombinedPMT::ClearEventData ( )
overridevirtual

Clear event-scoped data for the sum channel.

Reimplemented from VQwDataElement.

Definition at line 88 of file QwCombinedPMT.cc.

89{
90 fSumADC.ClearEventData();
91// fAvgADC.ClearEventData();
92}

References fSumADC.

◆ ConstructBranch() [1/2]

void QwCombinedPMT::ConstructBranch ( TTree * tree,
TString & prefix )

Definition at line 461 of file QwCombinedPMT.cc.

462{
463 if (GetElementName()=="")
464 {
465 // This channel is not used, so skip
466 }
467 else
468 {
469 TString sumprefix = prefix+"";
470 fSumADC.ConstructBranch(tree, sumprefix);
471 }
472 return;
473}

References fSumADC, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ ConstructBranch() [2/2]

void QwCombinedPMT::ConstructBranch ( TTree * tree,
TString & prefix,
QwParameterFile & modulelist )

Definition at line 475 of file QwCombinedPMT.cc.

476{
477 TString devicename;
478 devicename=GetElementName();
479 devicename.ToLower();
480 if (GetElementName()=="")
481 {
482 // This channel is not used, so skip
483 }
484 else
485 {
486 if (modulelist.HasValue(devicename)){
487 TString sumprefix = prefix+"";
488 fSumADC.ConstructBranch(tree, sumprefix);
489 QwMessage <<" Tree leave added to "<<devicename<<QwLog::endl;
490 }
491 }
492 return;
493}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Bool_t HasValue(TString &vname)

References QwLog::endl(), fSumADC, VQwDataElement::GetElementName(), QwParameterFile::HasValue(), and QwMessage.

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

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

Definition at line 446 of file QwCombinedPMT.cc.

447{
448 if (GetElementName()=="")
449 {
450 // This channel is not used, so skip
451 }
452 else
453 {
454 TString sumprefix = prefix+"";
455 fSumADC.ConstructBranchAndVector(tree, sumprefix,values);
456
457 }
458 return;
459}

References fSumADC, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ ConstructHistograms()

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

Construct the histograms for this data element.

Implements VQwDataElement.

Definition at line 413 of file QwCombinedPMT.cc.

414{
415 if (GetElementName()=="")
416 {
417 // This channel is not used, so skip filling the histograms.
418 }
419 else
420 {
421 TString sumprefix = prefix+TString("");
422 fSumADC.ConstructHistograms(folder, sumprefix);
423// TString avgprefix = prefix+TString("");
424// fAvgADC.ConstructHistograms(folder, avgprefix);
425 }
426 return;
427
428}

References fSumADC, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum()

void QwCombinedPMT::DeaccumulateRunningSum ( QwCombinedPMT & value,
Int_t ErrorMask = 0xFFFFFFF )

Definition at line 355 of file QwCombinedPMT.cc.

356{
357 fSumADC.DeaccumulateRunningSum(value.fSumADC, ErrorMask);
358}

References fSumADC, and QwCombinedPMT().

+ Here is the call graph for this function:

◆ Difference()

void QwCombinedPMT::Difference ( const QwCombinedPMT & value1,
const QwCombinedPMT & value2 )

Definition at line 345 of file QwCombinedPMT.cc.

345 {
346 *this = value1;
347 *this -= value2;
348}

References QwCombinedPMT().

+ Here is the call graph for this function:

◆ EncodeEventData()

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

◆ FillHistograms()

void QwCombinedPMT::FillHistograms ( )
overridevirtual

Fill the histograms for this data element.

Implements VQwDataElement.

Definition at line 430 of file QwCombinedPMT.cc.

431{
432 if (GetElementName()=="")
433 {
434 // This channel is not used, so skip filling the histograms.
435 }
436 else
437 {
438 fSumADC.FillHistograms();
439// fAvgADC.FillHistograms();
440 }
441
442
443 return;
444}

References fSumADC, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ FillTreeVector()

void QwCombinedPMT::FillTreeVector ( QwRootTreeBranchVector & values) const

Definition at line 496 of file QwCombinedPMT.cc.

497{
498 if (GetElementName()=="") {
499 // This channel is not used, so skip filling the histograms.
500 } else {
501 fSumADC.FillTreeVector(values);
502// fAvgADC.FillTreeVector(values);
503 }
504}

References fSumADC, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ GetChannel()

const QwMollerADC_Channel * QwCombinedPMT::GetChannel ( const TString name) const
inline

Definition at line 60 of file QwCombinedPMT.h.

60 {
61 if (fSumADC.GetElementName() == name) return fSumADC.GetChannel(name);
62 else return 0;
63 };

References fSumADC.

Referenced by VQwDetectorArray::PublishInternalValues().

+ Here is the caller graph for this function:

◆ GetDBEntry()

std::vector< QwDBInterface > QwCombinedPMT::GetDBEntry ( )

◆ GetErrDBEntry()

std::vector< QwErrDBInterface > QwCombinedPMT::GetErrDBEntry ( )

◆ GetEventcutErrorFlag()

UInt_t QwCombinedPMT::GetEventcutErrorFlag ( )
inlineoverridevirtual

return the error flag on this channel/device

Reimplemented from VQwDataElement.

Definition at line 93 of file QwCombinedPMT.h.

93 {//return the error flag
94 return fSumADC.GetEventcutErrorFlag();
95 }

References fSumADC.

Referenced by UpdateErrorFlag().

+ Here is the caller graph for this function:

◆ IncrementErrorCounters()

void QwCombinedPMT::IncrementErrorCounters ( )
inline

Definition at line 97 of file QwCombinedPMT.h.

97 {
98 fSumADC.IncrementErrorCounters();
99 }

References fSumADC.

◆ InitializeChannel() [1/2]

void QwCombinedPMT::InitializeChannel ( TString name,
TString datatosave )

Initialize the combined PMT with a name and data-saving mode.

Parameters
nameDetector name used for branches and histograms.
datatosaveStorage mode (e.g., "raw" or "derived").

Definition at line 39 of file QwCombinedPMT.cc.

40{
41 SetElementName(name);
42 //SetPedestal(0.);
43 //SetCalibrationFactor(1.);
44 if (datatosave=="raw") fDataToSave=kRaw;
45 else
46 if (datatosave=="derived") fDataToSave=kDerived;
47
48 fSumADC.InitializeChannel(name, datatosave);
49 SetBlindability(kTRUE);
50 return;
51}
void SetElementName(const TString &name)
Set the name of this element.
void SetBlindability(Bool_t isblindable)

References fDataToSave, fSumADC, VQwDataElement::kDerived, VQwDataElement::kRaw, SetBlindability(), and VQwDataElement::SetElementName().

Referenced by QwCombinedPMT(), QwCombinedPMT(), and QwCombinedPMT().

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

◆ InitializeChannel() [2/2]

void QwCombinedPMT::InitializeChannel ( TString subsystemname,
TString name,
TString datatosave )

Initialize the combined PMT with subsystem and name.

Parameters
subsystemnameSubsystem identifier.
nameDetector name used for branches and histograms.
datatosaveStorage mode (e.g., "raw" or "derived").

Definition at line 59 of file QwCombinedPMT.cc.

60{
61 SetElementName(name);
62 //SetPedestal(0.);
63 //SetCalibrationFactor(1.);
64 if (datatosave=="raw") fDataToSave=kRaw;
65 else
66 if (datatosave=="derived") fDataToSave=kDerived;
67
68 fSumADC.InitializeChannel(subsystemname, "QwCombinedPMT", name, datatosave);
69 SetBlindability(kTRUE);
70
71 return;
72}

References fDataToSave, fSumADC, VQwDataElement::kDerived, VQwDataElement::kRaw, SetBlindability(), and VQwDataElement::SetElementName().

+ Here is the call graph for this function:

◆ LinkChannel()

void QwCombinedPMT::LinkChannel ( TString name)

Link internal sum channel names to the given detector name.

Definition at line 75 of file QwCombinedPMT.cc.

76{
77 Bool_t local_debug = false;
78 SetElementName(name);
79// TString sumstr = name+TString("_sum");
80 TString sumstr = name+TString("");
81 fSumADC.SetElementName(sumstr);
82// TString avgstr = name+TString("_avg");
83// fAvgADC.SetElementName(avgstr);
84 if(local_debug) std::cout<<"linked combined PMT channel "<< GetElementName()<<std::endl;
85}

References fSumADC, VQwDataElement::GetElementName(), and VQwDataElement::SetElementName().

+ Here is the call graph for this function:

◆ Normalize()

void QwCombinedPMT::Normalize ( VQwDataElement * denom)

Definition at line 374 of file QwCombinedPMT.cc.

375{
376 fSumADC.Normalize(denom);
377
378 return;
379}

References fSumADC, and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ operator+=()

QwCombinedPMT & QwCombinedPMT::operator+= ( const QwCombinedPMT & value)

Definition at line 302 of file QwCombinedPMT.cc.

303{
304 //std::cout<<"Calling QwCombinedPMT::operator+="<<std::endl;
305 if ( (GetElementName()!="") && (this->fElement.size()==value.fElement.size()) )
306 {
307 for (size_t i=0; i<value.fElement.size(); i++)
308 {
309 *(this->fElement[i]) += *(value.fElement[i]);
310 this->fWeights[i] += value.fWeights[i];
311 }
312
313 this->fSumADC+=value.fSumADC;
314// this->fAvgADC+=value.fAvgADC;
315 }
316
317 return *this;
318}

References fElement, fSumADC, fWeights, VQwDataElement::GetElementName(), and QwCombinedPMT().

+ Here is the call graph for this function:

◆ operator-=()

QwCombinedPMT & QwCombinedPMT::operator-= ( const QwCombinedPMT & value)

Definition at line 320 of file QwCombinedPMT.cc.

321{
322 //std::cout<<"Calling QwCombinedPMT::operator-="<<std::endl;
323 if ( (GetElementName()!="") && (this->fElement.size()==value.fElement.size()) )
324 {
325 for (size_t i=0; i<value.fElement.size(); i++)
326 {
327 *(this->fElement[i]) -= *(value.fElement[i]);
328 this->fWeights[i] -= value.fWeights[i];
329 }
330
331 this->fSumADC-=value.fSumADC;
332// this->fAvgADC-=value.fAvgADC;
333 //value.fSumADC.Print();
334 //fSumADC.Print();
335 }
336
337 return *this;
338}

References fElement, fSumADC, fWeights, VQwDataElement::GetElementName(), and QwCombinedPMT().

+ Here is the call graph for this function:

◆ operator=()

QwCombinedPMT & QwCombinedPMT::operator= ( const QwCombinedPMT & value)

Definition at line 273 of file QwCombinedPMT.cc.

274{
275 //std::cout<<"Calling QwCombinedPMT::operator="<<std::endl;
276 if ( (GetElementName()!="") && (this->fElement.size()==value.fElement.size()) )
277 {
278 for (size_t i=0; i<value.fElement.size(); i++)
279 {
280 //std::cout<<"value.fWeight["<<i<<"]="<<value.fWeights[i]<<std::endl;
281 //std::cout<<"=========value.fElement["<<i<<"]=========="<<std::endl;
282 //value.fElement[i]->Print();
283 (this->fElement[i]) = (value.fElement[i]);
284 this->fWeights[i] = value.fWeights[i];
285 //std::cout<<"this->fWeight["<<i<<"]="<<fWeights[i]<<std::endl;
286 //std::cout<<"=========this->fElement["<<i<<"]=========="<<std::endl;
287 //fElement[i]->Print();
288 }
289
290 this->fSumADC=value.fSumADC;
291// this->fAvgADC=value.fAvgADC;
292
293 //std::cout<<"value.fSumADC"<<std::endl;
294 //value.fSumADC.Print();
295 //std::cout<<"this->fSumADC"<<std::endl;
296 //fSumADC.Print();
297 }
298
299 return *this;
300}

References fElement, fSumADC, fWeights, VQwDataElement::GetElementName(), and QwCombinedPMT().

+ Here is the call graph for this function:

◆ PrintErrorCounters() [1/2]

void QwCombinedPMT::PrintErrorCounters ( )

◆ PrintErrorCounters() [2/2]

void QwCombinedPMT::PrintErrorCounters ( ) const
overridevirtual

Print error counters aggregated by the sum ADC.

Reimplemented from VQwDataElement.

Definition at line 197 of file QwCombinedPMT.cc.

198{
199 fSumADC.PrintErrorCounters();
200}

References fSumADC.

◆ PrintInfo()

void QwCombinedPMT::PrintInfo ( ) const
overridevirtual

Print multiple lines of information about this data element.

Reimplemented from VQwDataElement.

Definition at line 406 of file QwCombinedPMT.cc.

407{
408 fSumADC.PrintInfo();
409// fAvgADC.PrintInfo();
410}

References fSumADC.

◆ PrintValue()

void QwCombinedPMT::PrintValue ( ) const
overridevirtual

Print single line of value and error of this data element.

Reimplemented from VQwDataElement.

Definition at line 400 of file QwCombinedPMT.cc.

401{
402 fSumADC.PrintValue();
403// fAvgADC.PrintValue();
404}

References fSumADC.

◆ ProcessEvBuffer()

Int_t QwCombinedPMT::ProcessEvBuffer ( UInt_t * buffer,
UInt_t num_words_left,
UInt_t subelement = 0 )
overridevirtual

Process the CODA event buffer for this element.

Implements VQwDataElement.

Definition at line 267 of file QwCombinedPMT.cc.

268{
269 return 0;
270}

References QwBPMStripline< T >::subelement.

◆ ProcessEvent()

void QwCombinedPMT::ProcessEvent ( )

Process event by computing the weighted average of members.

Definition at line 179 of file QwCombinedPMT.cc.

180{
181//Calculate the weigted averages of the hardware sum and each of the four blocks.
183 //fSumADC.ProcessEvent(); //This is not necessary for combined devices-Rakitha 11-15-2010
184
185 return;
186}
void CalculateSumAndAverage()
Compute the weighted sum (and average) from member PMTs.

References CalculateSumAndAverage().

+ Here is the call graph for this function:

◆ RandomizeEventData()

void QwCombinedPMT::RandomizeEventData ( int helicity)

◆ Ratio()

void QwCombinedPMT::Ratio ( QwCombinedPMT & numer,
QwCombinedPMT & denom )

Definition at line 360 of file QwCombinedPMT.cc.

361{
362 //std::cout<<"Calling QwCombinedPMT::Ratio"<<std::endl;
363 fSumADC.Ratio(numer.fSumADC,denom.fSumADC);
364// fAvgADC.Ratio(numer.fAvgADC,denom.fAvgADC);
365 return;
366}

References fSumADC, and QwCombinedPMT().

+ Here is the call graph for this function:

◆ Scale()

void QwCombinedPMT::Scale ( Double_t factor)

Definition at line 368 of file QwCombinedPMT.cc.

369{
370 fSumADC.Scale(factor);
371// fAvgADC.Scale(factor);
372 return;
373}

References fSumADC.

◆ SetBlindability()

void QwCombinedPMT::SetBlindability ( Bool_t isblindable)
inline

Definition at line 121 of file QwCombinedPMT.h.

121{fSumADC.SetBlindability(isblindable);};

References fSumADC.

Referenced by InitializeChannel(), InitializeChannel(), and VQwDetectorArray::LoadChannelMap().

+ Here is the caller graph for this function:

◆ SetCalibrationFactor()

void QwCombinedPMT::SetCalibrationFactor ( Double_t calib)

◆ SetDefaultSampleSize()

void QwCombinedPMT::SetDefaultSampleSize ( Int_t sample_size)

Set default sample size on the sum ADC.

Definition at line 190 of file QwCombinedPMT.cc.

191{
192 fSumADC.SetDefaultSampleSize((size_t)sample_size);
193}

References fSumADC.

◆ SetEventCutMode()

void QwCombinedPMT::SetEventCutMode ( Int_t bcuts)
inline

Definition at line 89 of file QwCombinedPMT.h.

89 {
90 bEVENTCUTMODE=bcuts;
91 fSumADC.SetEventCutMode(bcuts);
92 }

References bEVENTCUTMODE, and fSumADC.

◆ SetEventData()

void QwCombinedPMT::SetEventData ( Double_t * block,
UInt_t sequencenumber )

Set the block data for the current event sequence.

Definition at line 102 of file QwCombinedPMT.cc.

103{
104 fSumADC.SetEventData(block, sequencenumber);
105// fAvgADC.SetEventData(block, sequencenumber);
106}

References fSumADC.

◆ SetHardwareSum()

void QwCombinedPMT::SetHardwareSum ( Double_t hwsum,
UInt_t sequencenumber = 0 )

Set the hardware-level sum for a sequence (unused for combo).

Definition at line 96 of file QwCombinedPMT.cc.

97{
98
99}

◆ SetNormalizability()

void QwCombinedPMT::SetNormalizability ( Bool_t isnormalizable)
inline

Definition at line 122 of file QwCombinedPMT.h.

122{fSumADC.SetNormalizability(isnormalizable);};

References fSumADC.

Referenced by VQwDetectorArray::LoadChannelMap().

+ Here is the caller graph for this function:

◆ SetPedestal()

void QwCombinedPMT::SetPedestal ( Double_t ped)

◆ SetRandomEventAsymmetry()

void QwCombinedPMT::SetRandomEventAsymmetry ( Double_t asymmetry)

◆ SetRandomEventParameters()

void QwCombinedPMT::SetRandomEventParameters ( Double_t mean,
Double_t sigma )

◆ SetSingleEventCuts()

void QwCombinedPMT::SetSingleEventCuts ( UInt_t errorflag,
Double_t LL = 0,
Double_t UL = 0,
Double_t stability = 0,
Double_t burplevel = 0 )

Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.

Configure detailed single-event cuts forwarded to the sum ADC.

Definition at line 169 of file QwCombinedPMT.cc.

169 {
170 //set the unique tag to identify device type (Int.PMT & Comb. PMT)
171 //errorflag|=kPMTErrorFlag;
172 QwMessage<<"QwCombinedPMT Error Code passing to QwIntegrationPMT "<<errorflag<<QwLog::endl;
173 fSumADC.SetSingleEventCuts(errorflag,LL,UL,stability,burplevel);
174
175}

References QwLog::endl(), fSumADC, and QwMessage.

+ Here is the call graph for this function:

◆ Sum()

void QwCombinedPMT::Sum ( const QwCombinedPMT & value1,
const QwCombinedPMT & value2 )

Definition at line 340 of file QwCombinedPMT.cc.

340 {
341 *this = value1;
342 *this += value2;
343}

References QwCombinedPMT().

+ Here is the call graph for this function:

◆ UpdateErrorFlag() [1/2]

UInt_t QwCombinedPMT::UpdateErrorFlag ( )
overridevirtual

Update the sum ADC error flag from member PMTs.

Reimplemented from VQwDataElement.

Definition at line 231 of file QwCombinedPMT.cc.

232{
233 for (size_t i=0;i<fElement.size();i++) {
234 fSumADC.UpdateErrorFlag(fElement[i]);
235 }
236 return GetEventcutErrorFlag();
237}
UInt_t GetEventcutErrorFlag() override
return the error flag on this channel/device

References fElement, fSumADC, and GetEventcutErrorFlag().

+ Here is the call graph for this function:

◆ UpdateErrorFlag() [2/2]

void QwCombinedPMT::UpdateErrorFlag ( const QwCombinedPMT * ev_error)

Merge error flags from a reference combined PMT.

Definition at line 241 of file QwCombinedPMT.cc.

241 {
242 try {
243 if(typeid(*ev_error)==typeid(*this)) {
244 // std::cout<<" Here in QwCombinedPMT::UpdateErrorFlag \n";
245 if (this->GetElementName()!="") {
246 fSumADC.UpdateErrorFlag(&(ev_error->fSumADC));
247 }
248 } else {
249 TString loc="Standard exception from QwCombinedPMT::UpdateErrorFlag :"+
250 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
251 +"same type";
252 throw std::invalid_argument(loc.Data());
253 }
254 } catch (std::exception& e) {
255 std::cerr<< e.what()<<std::endl;
256 }
257};

References fSumADC, VQwDataElement::GetElementName(), and QwCombinedPMT().

+ Here is the call graph for this function:

Field Documentation

◆ bDEBUG

const Bool_t QwCombinedPMT::bDEBUG =kFALSE
staticprivate

If this set to kFALSE then Event cuts do not depend on HW checks. This is set externally through the qweak_beamline_eventcuts.map

Definition at line 177 of file QwCombinedPMT.h.

◆ bEVENTCUTMODE

Bool_t QwCombinedPMT::bEVENTCUTMODE
private

keep the device HW status using a unique code from the QwMollerADC_Channel::fDeviceErrorCode

Definition at line 173 of file QwCombinedPMT.h.

Referenced by SetEventCutMode().

◆ fCalibration

Double_t QwCombinedPMT::fCalibration
private

Definition at line 154 of file QwCombinedPMT.h.

Referenced by QwCombinedPMT().

◆ fDataToSave

Int_t QwCombinedPMT::fDataToSave
private

Definition at line 153 of file QwCombinedPMT.h.

Referenced by InitializeChannel(), and InitializeChannel().

◆ fDevice_flag

Int_t QwCombinedPMT::fDevice_flag
private

Definition at line 166 of file QwCombinedPMT.h.

◆ fDeviceErrorCode

Int_t QwCombinedPMT::fDeviceErrorCode
private

sets the event cut level for the device fDevice_flag=1 Event cuts & HW check, fDevice_flag=0 HW check, fDevice_flag=-1 no check

Definition at line 170 of file QwCombinedPMT.h.

◆ fElement

std::vector<QwIntegrationPMT*> QwCombinedPMT::fElement
private

used to validate sequence number in the IsGoodEvent()

Definition at line 160 of file QwCombinedPMT.h.

Referenced by Add(), CalculateSumAndAverage(), operator+=(), operator-=(), operator=(), QwCombinedPMT(), and UpdateErrorFlag().

◆ fGoodEvent

Bool_t QwCombinedPMT::fGoodEvent
private

Definition at line 158 of file QwCombinedPMT.h.

◆ fLLimit

Double_t QwCombinedPMT::fLLimit
private

Definition at line 155 of file QwCombinedPMT.h.

◆ fSequenceNo_Prev

Double_t QwCombinedPMT::fSequenceNo_Prev
private

Definition at line 156 of file QwCombinedPMT.h.

◆ fSumADC

◆ fULimit

Double_t QwCombinedPMT::fULimit
private

Definition at line 155 of file QwCombinedPMT.h.

◆ fWeights

std::vector<Double_t> QwCombinedPMT::fWeights
private

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