JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwIntegrationPMT.cc
Go to the documentation of this file.
1/**********************************************************\
2* File: QwIntegrationPMT.cc *
3* *
4* Author: *
5* Time-stamp: *
6\**********************************************************/
7
8#include "QwIntegrationPMT.h"
9
10// System headers
11#include <stdexcept>
12
13// ROOT headers
14#ifdef HAS_RNTUPLE_SUPPORT
15#include "ROOT/RNTupleModel.hxx"
16#include "ROOT/RField.hxx"
17#endif // HAS_RNTUPLE_SUPPORT
18
19// Qweak headers
20#ifdef __USE_DATABASE__
21#include "QwDBInterface.h"
22#endif
23
24/********************************************************/
25/**
26 * \brief Set the pedestal value and propagate to the underlying ADC channel.
27 * \param pedestal Pedestal offset to apply to the raw signal.
28 */
29void QwIntegrationPMT::SetPedestal(Double_t pedestal)
30{
31 fPedestal=pedestal;
32 fTriumf_ADC.SetPedestal(fPedestal);
33 return;
34}
35
36/**
37 * \brief Set the calibration factor and propagate to the underlying ADC channel.
38 * \param calib Multiplicative calibration factor.
39 */
41{
42 fCalibration=calib;
43 fTriumf_ADC.SetCalibrationFactor(fCalibration);
44 return;
45}
46/********************************************************/
47/**
48 * \brief Initialize the PMT channel with a name and data-saving mode.
49 * \param name Detector name used for branches and histograms.
50 * \param datatosave Storage mode (e.g., "raw" or "derived").
51 */
52void QwIntegrationPMT::InitializeChannel(TString name, TString datatosave)
53{
54 SetPedestal(0.);
56 fTriumf_ADC.InitializeChannel(name,datatosave);
57 SetElementName(name);
58 SetBlindability(kTRUE);
59 SetNormalizability(kTRUE);
60 return;
61}
62/********************************************************/
63/**
64 * \brief Initialize the PMT channel with subsystem and name.
65 * \param subsystem Subsystem identifier for foldering.
66 * \param name Detector name used for branches and histograms.
67 * \param datatosave Storage mode (e.g., "raw" or "derived").
68 */
69void QwIntegrationPMT::InitializeChannel(TString subsystem, TString name, TString datatosave)
70{
71 SetPedestal(0.);
73 fTriumf_ADC.InitializeChannel(subsystem,"QwIntegrationPMT", name, datatosave);
74 SetElementName(name);
75 SetBlindability(kTRUE);
76 SetNormalizability(kTRUE);
77 return;
78}
79/********************************************************/
80/**
81 * \brief Initialize the PMT channel including an intermediate module tag.
82 * \param subsystem Subsystem identifier.
83 * \param module Module type tag used in ROOT foldering.
84 * \param name Detector name used for branches and histograms.
85 * \param datatosave Storage mode (e.g., "raw" or "derived").
86 */
87void QwIntegrationPMT::InitializeChannel(TString subsystem, TString module, TString name, TString datatosave)
88{
89 SetPedestal(0.);
91 fTriumf_ADC.InitializeChannel(subsystem,module, name, datatosave);
92 SetElementName(name);
93 SetBlindability(kTRUE);
94 SetNormalizability(kTRUE);
95 return;
96}
97/********************************************************/
98/** \brief Clear event-scoped data in the underlying ADC channel. */
100{
101 fTriumf_ADC.ClearEventData();
102 return;
103}
104/********************************************************/
105/** \brief Print accumulated error counters for this PMT. */
107 fTriumf_ADC.PrintErrorCounters();
108}
109/********************************************************/
110/** \brief Use an external random variable source for mock data. */
112{
113 fTriumf_ADC.UseExternalRandomVariable();
114 return;
115}
116/********************************************************/
117/**
118 * \brief Set the external random variable to drive mock data.
119 * \param random_variable External random value.
120 */
122{
123 fTriumf_ADC.SetExternalRandomVariable(random_variable);
124 return;
125}
126/********************************************************/
127/**
128 * \brief Configure deterministic drift parameters applied per event.
129 * \param amplitude Drift amplitude.
130 * \param phase Drift phase in radians.
131 * \param frequency Drift frequency.
132 */
133void QwIntegrationPMT::SetRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
134{
135 fTriumf_ADC.SetRandomEventDriftParameters(amplitude, phase, frequency);
136 return;
137}
138/********************************************************/
139/**
140 * \brief Add additional drift parameters to the existing drift model.
141 * \param amplitude Drift amplitude.
142 * \param phase Drift phase in radians.
143 * \param frequency Drift frequency.
144 */
145void QwIntegrationPMT::AddRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
146{
147 fTriumf_ADC.AddRandomEventDriftParameters(amplitude, phase, frequency);
148 return;
149}
150/********************************************************/
151/**
152 * \brief Configure Gaussian mock data parameters.
153 * \param mean Mean of the generated distribution.
154 * \param sigma Standard deviation of the distribution.
155 */
156void QwIntegrationPMT::SetRandomEventParameters(Double_t mean, Double_t sigma)
157{
158 fTriumf_ADC.SetRandomEventParameters(mean, sigma);
159 return;
160}
161/********************************************************/
162/**
163 * \brief Set an asymmetry parameter applied to helicity states.
164 * \param asymmetry Fractional asymmetry to apply.
165 */
167{
168 fTriumf_ADC.SetRandomEventAsymmetry(asymmetry);
169 return;
170}
171/********************************************************/
172/**
173 * \brief Generate mock data for a single event.
174 * \param helicity Helicity state indicator.
175 * \param time Event time or timestamp proxy.
176 */
177void QwIntegrationPMT::RandomizeEventData(int helicity, double time)
178{
179 fTriumf_ADC.RandomizeEventData(helicity, time);
180 return;
181}
182
183/********************************************************/
184/**
185 * \brief Generate a mock MOLLER detector event using beam parameters.
186 * \param helicity Helicity state indicator.
187 * \param charge Beam charge reference.
188 * \param xpos Beam X position.
189 * \param ypos Beam Y position.
190 * \param xprime Beam X angle.
191 * \param yprime Beam Y angle.
192 * \param energy Beam energy reference.
193 */
194void QwIntegrationPMT::RandomizeMollerEvent(int helicity, const QwBeamCharge& charge, const QwBeamPosition& xpos, const QwBeamPosition& ypos, const QwBeamAngle& xprime, const QwBeamAngle& yprime, const QwBeamEnergy& energy)
195{
197 fTriumf_ADC.ClearEventData();
198
199 temp.AssignScaledValue(xpos, fCoeff_x);
200 fTriumf_ADC += temp;
201
202 temp.AssignScaledValue(ypos, fCoeff_y);
203 fTriumf_ADC += temp;
204
205 temp.AssignScaledValue(xprime, fCoeff_xp);
206 fTriumf_ADC += temp;
207
208 temp.AssignScaledValue(yprime, fCoeff_yp);
209 fTriumf_ADC += temp;
210
211 temp.AssignScaledValue(energy, fCoeff_e);
212 fTriumf_ADC += temp;
213
214//fTriumf_ADC.AddChannelOffset(fBaseRate * (1+helicity*fAsym));
215 fTriumf_ADC.AddChannelOffset(1.0+helicity*fAsym);
216
217 fTriumf_ADC *= charge;
218 fTriumf_ADC.Scale(fNormRate*fVoltPerHz); // After this Scale function, fTriumf_ADC should be the detector signal in volts.
219 fTriumf_ADC.ForceMapfileSampleSize();
220 // Double_t voltage_width = sqrt(fTriumf_ADC.GetValue()*window_length/fVoltPerHz)/(window_length/fVoltPerHz);
221 Double_t voltage_width = sqrt( fTriumf_ADC.GetValue() / (fTriumf_ADC.GetNumberOfSamples()*QwMollerADC_Channel::kTimePerSample/Qw::sec/fVoltPerHz) );
222 //std::cout << "Voltage Width: " << voltage_width << std::endl;
223 fTriumf_ADC.SmearByResolution(voltage_width);
224 fTriumf_ADC.SetRawEventData();
225
226 return;
227
228}
229
230
231/********************************************************/
232/**
233 * \brief Set the hardware-level sum measurement for a sequence.
234 * \param hwsum Hardware sum value.
235 * \param sequencenumber Sequence identifier.
236 */
237void QwIntegrationPMT::SetHardwareSum(Double_t hwsum, UInt_t sequencenumber)
238{
239 fTriumf_ADC.SetHardwareSum(hwsum, sequencenumber);
240 return;
241}
242
243/** \brief Get the integrated value over the current event window. */
245{
246 return fTriumf_ADC.GetValue();
247}
248
249/**
250 * \brief Get the integrated value for a specific block.
251 * \param blocknum Block index within the event.
252 */
253Double_t QwIntegrationPMT::GetValue(Int_t blocknum)
254{
255 return fTriumf_ADC.GetValue(blocknum);
256}
257
258/********************************************************/
259/**
260 * \brief Set the block data for the current event sequence.
261 * \param block Pointer to block data.
262 * \param sequencenumber Sequence identifier.
263 */
264void QwIntegrationPMT::SetEventData(Double_t* block, UInt_t sequencenumber)
265{
266 fTriumf_ADC.SetEventData(block, sequencenumber);
267 return;
268}
269/********************************************************/
270/** \brief Encode current event data into an output buffer. */
271void QwIntegrationPMT::EncodeEventData(std::vector<UInt_t> &buffer)
272{
273 fTriumf_ADC.EncodeEventData(buffer);
274}
275/********************************************************/
276/** \brief Apply hardware checks and process the event for this PMT. */
278{
279 ApplyHWChecks();//first apply HW checks and update HW error flags.
280 fTriumf_ADC.ProcessEvent();
281
282 return;
283}
284/********************************************************/
285/**
286 * \brief Apply hardware checks and return whether the event is valid.
287 * \return kTRUE if no hardware error was detected; otherwise kFALSE.
288 */
290{
291 Bool_t eventokay=kTRUE;
292
293 UInt_t deviceerror=fTriumf_ADC.ApplyHWChecks();//will check for consistency between HWSUM and SWSUM also check for sample size
294 eventokay=(deviceerror & 0x0);//if no HW error return true
295
296
297 return eventokay;
298}
299/********************************************************/
300
301/**
302 * \brief Set basic single-event cut limits.
303 * \param LL Lower limit.
304 * \param UL Upper limit.
305 * \return 1 on success.
306 */
307Int_t QwIntegrationPMT::SetSingleEventCuts(Double_t LL=0, Double_t UL=0){//std::vector<Double_t> & dEventCuts){//two limits and sample size
308 fTriumf_ADC.SetSingleEventCuts(LL,UL);
309 return 1;
310}
311
312/********************************************************/
313/**
314 * \brief Configure detailed single-event cuts for this PMT.
315 * \param errorflag Device-specific error flag mask to set.
316 * \param LL Lower limit.
317 * \param UL Upper limit.
318 * \param stability Stability threshold.
319 * \param burplevel Burp detection threshold.
320 */
321void QwIntegrationPMT::SetSingleEventCuts(UInt_t errorflag, Double_t LL=0, Double_t UL=0, Double_t stability=0, Double_t burplevel=0){
322 //set the unique tag to identify device type (bcm,bpm & etc)
323 errorflag|=kPMTErrorFlag;
324 QwMessage<<"QwIntegrationPMT Error Code passing to QwMollerADC_Ch "<<errorflag<<QwLog::endl;
325 fTriumf_ADC.SetSingleEventCuts(errorflag,LL,UL,stability,burplevel);
326
327}
328
329/********************************************************/
330
331/** \brief Set the default sample size used by the ADC channel. */
333 fTriumf_ADC.SetDefaultSampleSize((size_t)sample_size);
334}
335
336/********************************************************/
337/** \brief Set the saturation voltage limit for the ADC front-end. */
338void QwIntegrationPMT::SetSaturationLimit(Double_t saturation_volt){
339 fTriumf_ADC.SetMollerADCSaturationLimt(saturation_volt);
340}
341//*/
342
343/********************************************************/
344/**
345 * \brief Apply single-event cuts for this PMT and return pass/fail.
346 * \return kTRUE if event passes, otherwise kFALSE.
347 */
349
350
351//std::cout<<" QwBCM::SingleEventCuts() "<<std::endl;
352 Bool_t status=kTRUE;
353
354 if (fTriumf_ADC.ApplySingleEventCuts()){
355 status=kTRUE;
356 //std::cout<<" BCM Sample size "<<fTriumf_ADC.GetNumberOfSamples()<<std::endl;
357 }
358 else{
359 status&=kFALSE;//kTRUE;//kFALSE;
360 }
361
362 return status;
363
364}
365
366/********************************************************/
367
368/** \brief Print error counters (const overload). */
369void QwIntegrationPMT::PrintErrorCounters() const{// report number of events failed due to HW and event cut failure
370 fTriumf_ADC.PrintErrorCounters();
371}
372
373/*********************************************************/
374
375/**
376 * \brief Check for burp failures by comparing against a reference PMT.
377 * \param ev_error Reference PMT to compare error conditions.
378 * \return kTRUE if a burp failure was detected; otherwise kFALSE.
379 */
381 Bool_t burpstatus = kFALSE;
382 try {
383 if(typeid(*ev_error)==typeid(*this)) {
384 //std::cout<<" Here in QwIntegrationPMT::CheckForBurpFail \n";
385 if (this->GetElementName()!="") {
386 const QwIntegrationPMT* value_pmt = dynamic_cast<const QwIntegrationPMT* >(ev_error);
387 burpstatus |= fTriumf_ADC.CheckForBurpFail(&(value_pmt->fTriumf_ADC));
388 }
389 } else {
390 TString loc="Standard exception from QwIntegrationPMT::CheckForBurpFail :"+
391 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
392 +"same type";
393 throw std::invalid_argument(loc.Data());
394 }
395 } catch (std::exception& e) {
396 std::cerr<< e.what()<<std::endl;
397 }
398 return burpstatus;
399};
400
401/********************************************************/
402/**
403 * \brief Merge error flags from a reference PMT into this instance.
404 * \param ev_error Reference PMT whose flags are merged.
405 */
407 try {
408 if(typeid(*ev_error)==typeid(*this)) {
409 // std::cout<<" Here in QwIntegrationPMT::UpdateErrorFlag \n";
410 if (this->GetElementName()!="") {
411 fTriumf_ADC.UpdateErrorFlag(ev_error->fTriumf_ADC);
412 }
413 } else {
414 TString loc="Standard exception from QwIntegrationPMT::UpdateErrorFlag :"+
415 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
416 +"same type";
417 throw std::invalid_argument(loc.Data());
418 }
419 } catch (std::exception& e) {
420 std::cerr<< e.what()<<std::endl;
421 }
422};
423
424/********************************************************/
425
426
427/**
428 * \brief Process the raw event buffer and decode into the ADC channel.
429 * \return The updated buffer word position.
430 */
431Int_t QwIntegrationPMT::ProcessEvBuffer(UInt_t* buffer, UInt_t word_position_in_buffer, UInt_t subelement)
432{
433 fTriumf_ADC.ProcessEvBuffer(buffer,word_position_in_buffer);
434
435 return word_position_in_buffer;
436} Double_t fULimit, fLLimit;
437
438/********************************************************/
439/** \brief Copy-assign from another PMT (event-scoped data). */
441{
442// std::cout<<" Here in QwIntegrationPMT::operator= \n";
443 if (GetElementName()!="")
444 {
445 this->fTriumf_ADC=value.fTriumf_ADC;
446 this->fPedestal=value.fPedestal;
447 this->fCalibration=value.fCalibration;
448 }
449// std::cout<<" to be copied \n";
450// value.Print();
451// std::cout<<" copied \n";
452// this->Print();
453
454 return *this;
455}
456
457/** \brief Add-assign from another PMT (sum raw channels). */
459{
460 if (GetElementName()!="")
461 {
462 this->fTriumf_ADC+=value.fTriumf_ADC;
463 this->fPedestal+=value.fPedestal;
464 this->fCalibration=0;
465 }
466 return *this;
467}
468
470{
471 if (GetElementName()!="")
472 {
473 this->fTriumf_ADC-=value.fTriumf_ADC;
474 this->fPedestal-=value.fPedestal;
475 this->fCalibration=0;
476 }
477 return *this;
478}
479
480void QwIntegrationPMT::Sum(const QwIntegrationPMT &value1, const QwIntegrationPMT &value2) {
481 *this = value1;
482 *this += value2;
483}
484
486 *this = value1;
487 *this -= value2;
488}
489
491{
492 // std::cout<<"QwIntegrationPMT::Ratio element name ="<<GetElementName()<<" \n";
493 if (GetElementName()!="")
494 {
495 // std::cout<<"here in \n";
496 this->fTriumf_ADC.Ratio(numer.fTriumf_ADC,denom.fTriumf_ADC);
497 this->fPedestal=0;
498 this->fCalibration=0;
499 }
500 return;
501}
502
503void QwIntegrationPMT::Scale(Double_t factor)
504{
505 fTriumf_ADC.Scale(factor);
506 return;
507}
508
510{
511 if (fIsNormalizable) {
512 QwMollerADC_Channel* denom_ptr = dynamic_cast<QwMollerADC_Channel*>(denom);
513 QwMollerADC_Channel vqwk_denom(*denom_ptr);
514 fTriumf_ADC.DivideBy(vqwk_denom);
515 }
516}
517
519{
520 fTriumf_ADC.PrintValue();
521}
522
524{
525 //std::cout<<"QwMollerADC_Channel Info " <<std::endl;
526 //std::cout<<" Running AVG "<<GetElementName()<<" current running AVG "<<IntegrationPMT_Running_AVG<<std::endl;
527 std::cout<<"QwMollerADC_Channel Info " <<std::endl;
528 fTriumf_ADC.PrintInfo();
529 std::cout<< "Blindability is " << (fIsBlindable?"TRUE":"FALSE")
530 <<std::endl;
531 std::cout<< "Normalizability is " << (fIsNormalizable?"TRUE":"FALSE")
532 <<std::endl;
533 std::cout << "fNormRate=" << fNormRate << "fVoltPerHz=" << fVoltPerHz
534 << " Asym=" << fAsym << " C_x=" << fCoeff_x << " C_y=" << fCoeff_y
535 << " C_xp=" << fCoeff_xp << " C_yp=" << fCoeff_yp
536 << " C_e=" << fCoeff_e << std::endl;
537 return;
538}
539
540/********************************************************/
541void QwIntegrationPMT::ConstructHistograms(TDirectory *folder, TString &prefix)
542{
543 if (GetElementName()=="")
544 {
545 // This channel is not used, so skip filling the histograms.
546 }
547 else
548 {
549 fTriumf_ADC.ConstructHistograms(folder, prefix);
550 }
551 return;
552}
553
555{
556 if (GetElementName()=="")
557 {
558 // This channel is not used, so skip filling the histograms.
559 }
560 else
561 {
562 fTriumf_ADC.FillHistograms();
563 }
564
565
566 return;
567}
568
570{
571 if (GetElementName()==""){
572 // This channel is not used, so skip filling the histograms.
573 } else
574 {
575 fTriumf_ADC.ConstructBranchAndVector(tree, prefix,values);
576 }
577 return;
578}
579
580void QwIntegrationPMT::ConstructBranch(TTree *tree, TString &prefix)
581{
582 if (GetElementName()==""){
583 // This channel is not used, so skip filling the histograms.
584 } else
585 {
586 fTriumf_ADC.ConstructBranch(tree, prefix);
587 }
588 return;
589}
590
591void QwIntegrationPMT::ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& modulelist)
592{
593 TString devicename;
594 devicename=GetElementName();
595 devicename.ToLower();
596 if (GetElementName()==""){
597 // This channel is not used, so skip filling the histograms.
598 } else {
599 if (modulelist.HasValue(devicename)){
600 fTriumf_ADC.ConstructBranch(tree, prefix);
601 QwMessage <<"QwIntegrationPMT Tree leave added to "<<devicename<<QwLog::endl;
602 }
603
604 }
605 return;
606}
607
608
610{
611 if (GetElementName()==""){
612 // This channel is not used, so skip filling the histograms.
613 } else {
614 fTriumf_ADC.FillTreeVector(values);
615 }
616}
617
618#ifdef HAS_RNTUPLE_SUPPORT
619void QwIntegrationPMT::ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs)
620{
621 if (GetElementName()==""){
622 // This channel is not used, so skip RNTuple construction.
623 } else
624 {
625 fTriumf_ADC.ConstructNTupleAndVector(model, prefix, values, fieldPtrs);
626 }
627}
628
629void QwIntegrationPMT::FillNTupleVector(std::vector<Double_t>& values) const
630{
631 if (GetElementName()==""){
632 // This channel is not used, so skip filling the RNTuple.
633 } else {
634 fTriumf_ADC.FillNTupleVector(values);
635 }
636}
637#endif // HAS_RNTUPLE_SUPPORT
638
640{
641 fTriumf_ADC.CalculateRunningAverage();
642}
643
644void QwIntegrationPMT::AccumulateRunningSum(const QwIntegrationPMT& value, Int_t count, Int_t ErrorMask)
645{
646 fTriumf_ADC.AccumulateRunningSum(value.fTriumf_ADC, count, ErrorMask);
647}
648
650{
651 fTriumf_ADC.DeaccumulateRunningSum(value.fTriumf_ADC, ErrorMask);
652}
653
654
656{
657 if (fIsBlindable) fTriumf_ADC.Blind(blinder);
658}
659
660void QwIntegrationPMT::Blind(const QwBlinder *blinder, const QwIntegrationPMT& yield)
661{
662 if (fIsBlindable) fTriumf_ADC.Blind(blinder, yield.fTriumf_ADC);
663}
664
665#ifdef __USE_DATABASE__
666std::vector<QwDBInterface> QwIntegrationPMT::GetDBEntry()
667{
668 std::vector <QwDBInterface> row_list;
669 row_list.clear();
671 return row_list;
672
673}
674
675std::vector<QwErrDBInterface> QwIntegrationPMT::GetErrDBEntry()
676{
677 std::vector <QwErrDBInterface> row_list;
678 row_list.clear();
679 fTriumf_ADC.AddErrEntriesToList(row_list);
680 return row_list;
681};
682#endif
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
class QwMollerADC_Channel QwBeamCharge
Definition QwTypes.h:321
class QwMollerADC_Channel QwBeamEnergy
Definition QwTypes.h:324
static const UInt_t kPMTErrorFlag
Definition QwTypes.h:171
class QwMollerADC_Channel QwBeamAngle
Definition QwTypes.h:323
class QwMollerADC_Channel QwBeamPosition
Definition QwTypes.h:322
Database interface for QwIntegrationPMT and subsystems.
Integration PMT detector for charge and asymmetry measurements.
Double_t fLLimit
Double_t fULimit
const TString QwBPMStripline< T >::subelement[4]
static const double sec
Definition QwUnits.h:80
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Concrete hardware channel for Moller ADC modules (6x32-bit words)
static const Double_t kTimePerSample
void AssignScaledValue(const QwMollerADC_Channel &value, Double_t scale)
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.
Definition QwRootFile.h:53
VQwDataElement()
Default constructor.
virtual const TString & GetElementName() const
Get the name of this element.
void AddEntriesToList(std::vector< QwDBInterface > &row_list)
Data blinding utilities for parity violation analysis.
Definition QwBlinder.h:57
QwIntegrationPMT & operator-=(const QwIntegrationPMT &value)
Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t subelement=0) override
Process the raw event buffer and decode into the ADC channel.
void FillHistograms() override
Fill the histograms for this data element.
void SetCalibrationFactor(Double_t calib)
Set the calibration factor and propagate to the underlying ADC channel.
void RandomizeMollerEvent(int helicity, const QwBeamCharge &charge, const QwBeamPosition &xpos, const QwBeamPosition &ypos, const QwBeamAngle &xprime, const QwBeamAngle &yprime, const QwBeamEnergy &energy)
Generate a mock MOLLER detector event using beam parameters.
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
Bool_t ApplyHWChecks()
Apply hardware checks and return whether the event is valid.
void PrintInfo() const override
Print multiple lines of information about this data element.
void RandomizeEventData(int helicity=0, double time=0.0)
Generate mock data for a single event.
void SetHardwareSum(Double_t hwsum, UInt_t sequencenumber=0)
Set the hardware-level sum measurement for a sequence.
void SetSaturationLimit(Double_t saturation_volt)
Set the saturation voltage limit for the ADC front-end.
Bool_t CheckForBurpFail(const VQwDataElement *ev_error)
Check for burp failures by comparing against a reference PMT.
QwIntegrationPMT & operator=(const QwIntegrationPMT &value)
Copy-assign from another PMT (event-scoped data).
void Difference(const QwIntegrationPMT &value1, const QwIntegrationPMT &value2)
void PrintErrorCounters()
Print accumulated error counters for this PMT.
void DeaccumulateRunningSum(QwIntegrationPMT &value, Int_t ErrorMask=0xFFFFFFF)
void InitializeChannel(TString name, TString datatosave)
Initialize the PMT channel with a name and data-saving mode.
void UseExternalRandomVariable()
Use an external random variable source for mock data.
void Sum(const QwIntegrationPMT &value1, const QwIntegrationPMT &value2)
void FillTreeVector(QwRootTreeBranchVector &values) const
void AddRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
Add additional drift parameters to the existing drift model.
void SetBlindability(Bool_t isblindable)
void SetDefaultSampleSize(Int_t sample_size)
Set the default sample size used by the ADC channel.
void SetElementName(const TString &name)
void ConstructBranch(TTree *tree, TString &prefix)
void Scale(Double_t factor)
UInt_t UpdateErrorFlag() override
Update the error flag based on the error flags of internally contained objects Return parameter is th...
void SetExternalRandomVariable(Double_t random_variable)
Set the external random variable to drive mock data.
void SetRandomEventAsymmetry(Double_t asymmetry)
Set an asymmetry parameter applied to helicity states.
std::vector< QwErrDBInterface > GetErrDBEntry()
void AccumulateRunningSum(const QwIntegrationPMT &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
void SetEventData(Double_t *block, UInt_t sequencenumber)
Set the block data for the current event sequence.
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this data element.
QwIntegrationPMT & operator+=(const QwIntegrationPMT &value)
Add-assign from another PMT (sum raw channels).
void SetNormalizability(Bool_t isnormalizable)
Double_t GetValue()
Get the integrated value over the current event window.
QwMollerADC_Channel fTriumf_ADC
void SetRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
Configure deterministic drift parameters applied per event.
void EncodeEventData(std::vector< UInt_t > &buffer)
Encode current event data into an output buffer.
Bool_t ApplySingleEventCuts()
Apply single-event cuts for this PMT and return pass/fail.
void ClearEventData() override
Clear event-scoped data in the underlying ADC channel.
void SetPedestal(Double_t ped)
Set the pedestal value and propagate to the underlying ADC channel.
void Ratio(QwIntegrationPMT &numer, QwIntegrationPMT &denom)
void ProcessEvent()
Apply hardware checks and process the event for this PMT.
void PrintValue() const override
Print single line of value and error of this data element.
std::vector< QwDBInterface > GetDBEntry()
void SetRandomEventParameters(Double_t mean, Double_t sigma)
Configure Gaussian mock data parameters.
void Blind(const QwBlinder *blinder)
Blind the asymmetry.
void Normalize(VQwDataElement *denom)
Int_t SetSingleEventCuts(Double_t, Double_t)
Set basic single-event cut limits.