18#ifdef __USE_DATABASE__
50 QwError <<
"QwMollerADC_Channel::GetBufferOffset: Invalid module index,"
52 <<
". Must be zero or greater."
54 }
else if (channelindex<0 || channelindex>=channels_per_module){
55 QwError <<
"QwMollerADC_Channel::GetBufferOffset: Invalid channel index,"
57 <<
". Must be in range [0," << channels_per_module - 1 <<
"]."
61 + ( (moduleindex * channels_per_module) + channelindex )
71 Bool_t fEventIsGood=kTRUE;
299 if (input !=
static_cast<UInt_t
>(
kOldMock)
301 QwError <<
"QwMollerADC_Channel::SetDecodeMode: Invalid "
302 <<
"MOLLERADC_decode_mode " << input
303 <<
". Valid values are 0 (old mock) and 1 (new reshuffled)."
305 throw std::runtime_error(
"Invalid MOLLERADC_decode_mode");
310 QwError <<
"QwMollerADC_Channel::SetDecodeMode: Inconsistent "
311 <<
"MOLLERADC_decode_mode. First mode was "
313 <<
", but a later map/config requested " << input
314 <<
". Mixed MOLLERADC decode modes are not supported "
316 throw std::runtime_error(
"Inconsistent MOLLERADC_decode_mode");
325 if (paramfile.
ReturnValue(
"molleradc_decode_mode", value)
336 <<
" cannot set the default sample size."
340 UInt_t NumberOfBlocks = 0;
342 if (paramfile.
ReturnValue(
"NumberOfBlocks", NumberOfBlocks)
343 || paramfile.
ReturnValue(
"numberofblocks", NumberOfBlocks)) {
344 if (NumberOfBlocks >
static_cast<UInt_t
>(
kMaxBlock)) {
346 <<
": NumberOfBlocks (" << NumberOfBlocks
347 <<
") is greater than kMaxBlock (" <<
kMaxBlock
348 <<
") and has been forced to kMaxBlock."
352 if (NumberOfBlocks == 0) {
354 <<
": NumberOfBlocks is zero. Defaulting to "
396 Double_t drift = 0.0;
495 fNumberOfSamples = fNumberOfSamples_map;
496 fHardwareBlockSum_raw = 0;
499 for (Int_t i = 0; i < fBlocksPerEvent; i++)
501 Double_t block_raw = (fBlock[i] / fCalibrationFactor + fPedestal) * fNumberOfSamples / (fBlocksPerEvent * 1.0);
502 if (std::abs(block_raw) >= pow(2,29)) {
503 block_raw = std::copysign(pow(2,29)-1, block_raw);
504 QwWarning <<
"QwMollerADC_Channel::SetRawEventData: Overflow in conversion to raw data for channel "
505 << this->GetElementName() <<
": ("
506 <<
"fBlock[i] = " << fBlock[i] <<
" / "
507 <<
"fCalibrationFactor = " << fCalibrationFactor <<
" + "
508 <<
"fPedestal = " << fPedestal <<
") * "
509 <<
"fNumberOfSamples = " << fNumberOfSamples <<
" / "
510 <<
"fBlocksPerEvent = " << fBlocksPerEvent <<
". "
511 <<
"Capping value to " << block_raw <<
"."
514 fBlock_raw[i] = Int_t(block_raw);
515 fHardwareBlockSum_raw += fBlock_raw[i];
517 double_t block = fBlock[i] / fCalibrationFactor;
518 double_t sigma = fMockGaussianSigma / fCalibrationFactor;
519 fBlockSumSq_raw[i] = (sigma*sigma + block*block)*fNumberOfSamples_map / (fBlocksPerEvent * 1.0);
520 fBlock_min[i] = (block - 3.0 * sigma) * double_t(fNumberOfSamples_map) / (fBlocksPerEvent * 1.0);
521 fBlock_max[i] = (block + 3.0 * sigma) * double_t(fNumberOfSamples_map) / (fBlocksPerEvent * 1.0);
523 fBlockSumSq_raw[4] += fBlockSumSq_raw[i];
524 fBlock_min[4] = TMath::Min(fBlock_min[i],fBlock_min[4]);
525 fBlock_max[4] = TMath::Max(fBlock_max[i],fBlock_max[4]);
530 fSoftwareBlockSum_raw = fHardwareBlockSum_raw;
544 for (Int_t i = 0; i < 4; i++) {
564 buffer.push_back(localbuf[i]);
583 UInt_t words_read = 0;
595 std::cerr <<
"QwMollerADC_Channel::ProcessEvBuffer_oldmock: "
596 <<
"Not enough words for old mock MOLLER ADC channel "
600 <<
", have " << num_words_left <<
")!"
608 raw_u32[i] = buffer[i];
609 raw_i32[i] =
static_cast<Int_t
>(raw_u32[i]);
614 for (Int_t blockindex = 0; blockindex <
fBlocksPerEvent; blockindex++) {
615 const Int_t base = blockindex * 5;
617 Int_t ch_sum_block = raw_i32[base];
618 Long64_t ch_sumsq_block =
static_cast<Long64_t
>(raw_i32[base + 1]);
619 ch_sumsq_block +=
static_cast<Long64_t
>(raw_i32[base + 2]) << 32;
621 Int_t ch_min_20 = raw_i32[base + 3];
622 Int_t ch_max_20 = raw_i32[base + 4];
633 Long64_t ch_sum_win =
static_cast<Long64_t
>(raw_i32[20]);
641 UInt_t ch_misc = raw_u32[25];
648 const UInt_t block_samples =
650 for (Int_t blockindex = 0; blockindex <
fBlocksPerEvent; blockindex++) {
660 UInt_t num_words_left,
685 if (num_words_left < need_u32) {
687 <<
"QwMollerADC_Channel::ProcessEvBuffer: Not enough words for "
688 <<
"MOLLER ADC integrating mode channel (need "
689 << need_u32 <<
", have " << num_words_left <<
")!\n";
696 auto read_be64_from_u32 = [&](UInt_t* p)->uint64_t {
697 uint64_t hi =
static_cast<uint64_t
>(p[1]);
698 uint64_t lo =
static_cast<uint64_t
>(p[0]);
699 uint64_t be64 = (hi << 32) | lo;
707 uint64_t ch_misc = read_be64_from_u32(p + 0);
708 uint64_t ch_sample_count_win = read_be64_from_u32(p + 2);
709 int64_t ch_sum_win =
static_cast<int64_t
>(read_be64_from_u32(p + 4));
710 uint64_t ch_sumsq_win = read_be64_from_u32(p + 6);
711 uint64_t ch_sample_count_block = read_be64_from_u32(p + 8);
712 int64_t ch_sum_block =
static_cast<int64_t
>(read_be64_from_u32(p + 10));
713 uint64_t ch_sumsq_block = read_be64_from_u32(p + 12);
715if (ch_sample_count_block == 0) {
716 std::cerr <<
"QwMollerADC_Channel::ProcessEvBuffer: "
717 <<
"ch_sample_count_block == 0, cannot compute blockindex!\n";
722int blockindex =
static_cast<int>(std::round(
static_cast<double>(ch_sample_count_win) / ch_sample_count_block) - 1.0);
743 auto sign_extend20 = [](int32_t v20)->int32_t {
751 int32_t ch_min_20 = sign_extend20(
752 static_cast<int32_t
>((ch_misc >> 20) & 0xFFFFF));
753 int32_t ch_max_20 = sign_extend20(
754 static_cast<int32_t
>( ch_misc & 0xFFFFF));
761if (blockindex < 0 || blockindex >=
kMaxBlock) {
762 std::cerr <<
"QwMollerADC_Channel::ProcessEvBuffer: "
763 <<
"Computed bad blockindex = " << blockindex
764 <<
" (kMaxBlock = " <<
kMaxBlock <<
")\n";
781 if (blockindex == 0) {
788fBlockSample[blockindex] =
static_cast<UInt_t
>(ch_sample_count_block);
793long double win_mean = 0.0L;
794long double win_mean_sq = 0.0L;
795long double win_var = 0.0L;
797double block_mean = 0.0;
798double block_mean_sq = 0.0;
799double block_var = 0.0;
802if (ch_sample_count_win > 0) {
803 win_mean =
static_cast<double>(ch_sum_win) /
static_cast<double>(ch_sample_count_win);
804 win_mean_sq =
static_cast<double>(ch_sumsq_win) /
static_cast<double>(ch_sample_count_win);
805 win_var = win_mean_sq - win_mean * win_mean;
806 if (win_var < 0.0) win_var = 0.0;
813if (ch_sample_count_block > 0) {
814 block_mean =
static_cast<double>(ch_sum_block) /
static_cast<double>(ch_sample_count_block);
815 block_mean_sq =
static_cast<double>(ch_sumsq_block) /
static_cast<double>(ch_sample_count_block);
816 block_var = block_mean_sq - block_mean * block_mean;
817 if (block_var < 0.0) block_var = 0.0;
818 fBlockRMS[blockindex] = std::sqrt(block_var);
874 QwWarning <<
"QwMollerADC_Channel::ProcessEvent: Channel "
876 <<
" has fNumberOfSamples==0 but has valid data in the hardware sum. "
877 <<
"Flag this as an error."
909 std::cout<<
"***************************************"<<
"\n";
911 std::cout<<
"Beam Instrument Type: "<<
GetModuleType()<<
"\n"<<
"\n";
913 std::cout<<
"fPedestal= "<<
fPedestal<<
"\n";
918 std::cout<<
"fBlock_raw ";
925 std::cout<<
"fBlock ";
927 std::cout <<
" : " <<std::setprecision(8) <<
fBlock[i];
928 std::cout << std::endl;
930 std::cout <<
"fHardwareBlockSum = "<<std::setprecision(8) <<
fHardwareBlockSum << std::endl;
940 if (folder != NULL) folder->cd();
1051 TString basename = prefix(0, (prefix.First(
"|") >= 0)? prefix.First(
"|"): prefix.Length()) +
GetElementName();
1067 if (save_new_decoder_fields) {
1078 values.
push_back(Form(
"block%d", i),
'D');
1079 if (save_new_decoder_fields) {
1080 values.
push_back(Form(
"block%d_rms", i),
'D');
1089 if (save_new_decoder_fields) {
1091 values.
push_back(
"region_timestamp",
'D');
1092 values.
push_back(
"header_num_words",
'D');
1093 values.
push_back(
"header_block_number",
'D');
1094 values.
push_back(
"header_packet_count",
'D');
1095 values.
push_back(
"header_tsamples",
'D');
1099 values.
push_back(
"Device_Error_Code",
'i');
1104 values.
push_back(
"hw_sum_raw", save_new_decoder_fields ?
'L' :
'I');
1108 values.
push_back(Form(
"block%d_raw",i), save_new_decoder_fields ?
'L' :
'I');
1115 values.
push_back(Form(
"SumSq_%d", i),
'L');
1116 values.
push_back(Form(
"RawMin_%d", i),
'I');
1117 values.
push_back(Form(
"RawMax_%d", i),
'I');
1122 values.
push_back(
"sequence_number",
'i');
1130 if (
gQwHists.MatchDeviceParamsFromList(basename.Data())
1135 if (leaf_list ==
"hw_sum/D")
1136 leaf_list = basename+
"/D";
1141 tree->Branch(basename, &(values[
fTreeArrayIndex]), leaf_list.c_str());
1145 std::cerr <<
"QwMollerADC_Channel::ConstructBranchAndVector: fTreeArrayIndex==" <<
fTreeArrayIndex
1147 <<
"; values.size()==" << values.
size()
1148 <<
"; list==" << leaf_list
1161 std::cerr <<
"QwMollerADC_Channel::ConstructBranchAndVector: fTreeArrayIndex==" <<
fTreeArrayIndex
1175 if (
bDEBUG) std::cerr <<
"QwMollerADC_Channel::FillTreeVector: fTreeArrayNumEntries=="
1178 if (
bDEBUG) std::cerr <<
"QwMollerADC_Channel::FillTreeVector: values.size()=="
1180 <<
"; fTreeArrayIndex+fTreeArrayNumEntries=="
1191 if (save_new_decoder_fields) {
1203 if (save_new_decoder_fields) {
1213 if (save_new_decoder_fields) {
1230 if (save_new_decoder_fields) {
1240 if (save_new_decoder_fields) {
1269#ifdef HAS_RNTUPLE_SUPPORT
1270void QwMollerADC_Channel::ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs)
1296 TString basename = prefix(0, (prefix.First(
"|") >= 0)? prefix.First(
"|"): prefix.Length()) +
GetElementName();
1302 values.resize(values.size() + 1, 0.0);
1303 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum").Data()));
1312 values.push_back(0.0);
1313 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum").Data()));
1314 values.push_back(0.0);
1315 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum_m2").Data()));
1316 values.push_back(0.0);
1317 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum_err").Data()));
1322 values.push_back(0.0);
1323 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_block%d", i)).Data()));
1328 values.push_back(0.0);
1329 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_num_samples").Data()));
1333 values.push_back(0.0);
1334 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_Device_Error_Code").Data()));
1343 size_t numElements = 0;
1361 size_t oldSize = values.size();
1362 values.resize(oldSize + numElements, 0.0);
1363 fieldPtrs.reserve(fieldPtrs.size() + numElements);
1368 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum").Data()));
1373 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_block%d", i)).Data()));
1379 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_num_samples").Data()));
1384 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_Device_Error_Code").Data()));
1390 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_hw_sum_raw").Data()));
1395 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_block%d_raw", i)).Data()));
1400 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_sumsq%d_low", i)).Data()));
1401 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_sumsq%d_high", i)).Data()));
1402 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_min%d", i)).Data()));
1403 fieldPtrs.push_back(model->MakeField<Double_t>((basename + Form(
"_max%d", i)).Data()));
1408 fieldPtrs.push_back(model->MakeField<Double_t>((basename +
"_sequence_number").Data()));
1416void QwMollerADC_Channel::FillNTupleVector(std::vector<Double_t>& values)
const
1421 if (
bDEBUG) std::cerr <<
"QwMollerADC_Channel::FillNTupleVector: fTreeArrayNumEntries=="
1424 if (
bDEBUG) std::cerr <<
"QwMollerADC_Channel::FillNTupleVector: values.size()=="
1426 <<
"; fTreeArrayIndex+fTreeArrayNumEntries=="
1490 if(
this ==&value)
return *
this;
1533 if(
this == &value)
return;
1558 TString loc=
"Standard exception from QwMollerADC_Channel::AssignValueFrom = "
1560 throw std::invalid_argument(loc.Data());
1570 TString loc=
"Standard exception from QwMollerADC_Channel::AddValueFrom = "
1572 throw std::invalid_argument(loc.Data());
1582 TString loc=
"Standard exception from QwMollerADC_Channel::SubtractValueFrom = "
1584 throw std::invalid_argument(loc.Data());
1594 TString loc=
"Standard exception from QwMollerADC_Channel::MultiplyBy = "
1596 throw std::invalid_argument(loc.Data());
1606 TString loc=
"Standard exception from QwMollerADC_Channel::DivideBy = "
1608 throw std::invalid_argument(loc.Data());
1714 TString loc=
"Standard exception from QwMollerADC_Channel::operator+= "
1717 throw(std::invalid_argument(loc.Data()));
1728 TString loc=
"Standard exception from QwMollerADC_Channel::operator-= "
1731 throw(std::invalid_argument(loc.Data()));
1742 TString loc=
"Standard exception from QwMollerADC_Channel::operator*= "
1745 throw(std::invalid_argument(loc.Data()));
1756 TString loc=
"Standard exception from QwMollerADC_Channel::operator/= "
1759 throw(std::invalid_argument(loc.Data()));
1805 variance = ratio * ratio *
1810 }
else if (this->
fBlock[i] == 0.0) {
1814 QwVerbose <<
"Attempting to divide by zero block in "
1822 variance = ratio * ratio *
1831 QwVerbose <<
"Attempting to divide by zero sum in "
2035 }
else if (n2 == -1) {
2047 fBlock[i] -= (M12 - M11) / n;
2050 }
else if (n == 1) {
2061 fBlock[i] -= (M12 - M11) / n;
2063 if (fabs(
fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
2066 }
else if (n == 0) {
2080 if (fabs(
fBlock[i]) < 10.*std::numeric_limits<double>::epsilon())
2082 if (fabs(
fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
2088 }
else if (n2 == 1) {
2099 fBlock[i] += (M12 - M11) / n;
2102 }
else if (n2 > 1) {
2112 fBlock[i] += n2 * (M12 - M11) / n;
2113 fBlockM2[i] += M22 + n1 * n2 * (M12 - M11) * (M12 - M11) / n;
2167 << std::setw(12) << std::left <<
GetBlockValue(0) <<
" +/- "
2169 << std::setw(12) << std::left <<
GetBlockValue(1) <<
" +/- "
2171 << std::setw(12) << std::left <<
GetBlockValue(2) <<
" +/- "
2173 << std::setw(12) << std::left <<
GetBlockValue(3) <<
" +/- "
2237 Bool_t status = kTRUE;
2246 Bool_t status = kTRUE;
2251 std::cerr <<
"QwMollerADC_Channel::MatchNumberOfSamples: Channel "
2254 <<
" and was supposed to have " << numsamp
2264 Bool_t status = kFALSE;
2317 message = Form(
"%30s",
"Device name");
2318 message += Form(
"%9s",
"HW Sat");
2319 message += Form(
"%9s",
"Sample");
2320 message += Form(
"%9s",
"SW_HW");
2321 message += Form(
"%9s",
"Sequence");
2322 message += Form(
"%9s",
"SameHW");
2323 message += Form(
"%9s",
"ZeroHW");
2324 message += Form(
"%9s",
"EventCut");
2325 QwMessage <<
"---------------------------------------------------------------------------------------------" <<
QwLog::endl;
2327 QwMessage <<
"---------------------------------------------------------------------------------------------" <<
QwLog::endl;
2333 QwMessage <<
"---------------------------------------------------------------------------------------------" <<
QwLog::endl;
2351 message +=
" >>>>> No Pedestal or Gain in map file";
2380 }
else if (input == NULL && value != NULL) {
2381 TString loc=
"Standard exception from QwMollerADC_Channel::ScaledAdd "
2384 throw(std::invalid_argument(loc.Data()));
2397 TString loc=
"Standard exception from QwMollerADC_Channel::CopyParameters"
2400 throw(std::invalid_argument(loc.Data()));
2404#ifdef __USE_DATABASE__
2415 row_list.push_back(row);
2421 row_list.push_back(row);
2427 row_list.push_back(row);
2434 row_list.push_back(row);
2441 row_list.push_back(row);
2447 row_list.push_back(row);
2454 row_list.push_back(row);
Helper functions and utilities for ROOT histogram management.
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
static const UInt_t kBeamStabilityError
static const UInt_t kErrorFlag_ZeroHW
static const UInt_t kStabilityCut
static const UInt_t kErrorFlag_EventCut_L
static const UInt_t kErrorFlag_EventCut_U
static const UInt_t kErrorFlag_SW_HW
static const UInt_t kErrorFlag_sample
static const UInt_t kPreserveError
static const UInt_t kErrorFlag_VQWK_Sat
static const UInt_t kErrorFlag_SameHW
static const UInt_t kErrorFlag_Sequence
Physical units and constants for Qweak analysis.
A logfile class, based on an identical class in the Hermes analyzer.
#define QwVerbose
Predefined log drain for verbose messages.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
Decoding and management for Moller ADC channels (6x32-bit datawords)
Database interface for QwIntegrationPMT and subsystems.
std::ostream & operator<<(std::ostream &stream, const QwMollerADC_Channel &channel)
__attribute__((no_sanitize("signed-integer-overflow"))) void QwMollerADC_Channel
A class for blinding data, adapted from G0 blinder class.
static const double pi
Angles: base unit is radian.
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
std::vector< Double_t > fMockDriftAmplitude
Harmonic drift amplitude.
std::vector< Double_t > fMockDriftFrequency
Harmonic drift frequency.
Double_t fMockAsymmetry
Helicity asymmetry.
bool fUseExternalRandomVariable
Flag to use an externally provided normal random variable.
Double_t fMockGaussianSigma
Sigma of normal distribution.
Double_t fMockGaussianMean
Mean of normal distribution.
std::vector< Double_t > fMockDriftPhase
Harmonic drift phase.
Double_t GetRandomValue()
void SetDeviceName(TString &in)
void SetErrorCodeId(UInt_t in)
Bool_t MatchVQWKElementFromList(const std::string &subsystemname, const std::string &moduletype, const std::string &devicename)
static std::ostream & endl(std::ostream &)
End of the line.
Concrete hardware channel for Moller ADC modules (6x32-bit words)
Int_t GetRawSoftwareSum() const
static EDecodeMode fDecodeMode
Int_t ProcessEvBuffer_oldmock(UInt_t *buffer, UInt_t num_words_left, UInt_t index=0)
Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t num_words_left, UInt_t index=0) override
Decode the event data from a CODA buffer.
Double_t GetHardwareSumM2() const
static constexpr Int_t kOldMockWordsPerChannel
const QwMollerADC_Channel operator*(const QwMollerADC_Channel &value) const
void AssignValueFrom(const VQwDataElement *valueptr) override
Int_t fErrorCount_SW_HW
HW_sum==SW_sum check.
VQwHardwareChannel & operator/=(const VQwHardwareChannel &input) override
void AddChannelOffset(Double_t Offset)
void SetHardwareSum(Double_t hwsum, UInt_t sequencenumber=0)
static void PrintErrorCounterHead()
void LoadChannelParameters(QwParameterFile ¶mfile) override
static Int_t GetWordsPerChannel()
static Int_t GetDefaultBlocksPerEvent()
static void SetDecodeMode(UInt_t input)
Bool_t bDevice_Error_Code
QwMollerADC_Channel & operator+=(const QwMollerADC_Channel &value)
UInt_t fSequenceNumber
Event sequence number for this channel.
void RandomizeEventData(int helicity=0.0, double time=0.0) override
Internally generate random event data.
ULong64_t fRegionTimestamp
static const Bool_t kDEBUG
QwMollerADC_Channel & operator=(const QwMollerADC_Channel &value)
Double_t fPrev_HardwareBlockSum
Previous Module-based sum of the four sub-blocks.
QwMollerADC_Channel & operator*=(const QwMollerADC_Channel &value)
const QwMollerADC_Channel operator-(const QwMollerADC_Channel &value) const
static constexpr Int_t kOldMockDefaultBlocks
Double_t fBlockM2[kMaxBlock]
Second moment of the sub-block.
Bool_t ApplySingleEventCuts() override
void MultiplyBy(const VQwHardwareChannel *valueptr) override
void PrintValue() const override
Print single line of value and error of this data element.
void ScaledAdd(Double_t scale, const VQwHardwareChannel *value) override
void Sum(const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
void ProcessEvent() override
Process the event data according to pedestal and calibration factor.
Int_t fSequenceNo_Counter
Internal counter to keep track of the sequence number.
static constexpr Int_t kNewReshuffledDefaultBlocks
Double_t fBlockError[kMaxBlock]
Uncertainty on the sub-block.
Int_t GetRawBlockValue(size_t blocknum) const
QwMollerADC_Channel & operator-=(const QwMollerADC_Channel &value)
static Int_t GetModuleHeaderWords()
void PrintErrorCounters() const override
report number of events failed due to HW and event cut failure
Bool_t MatchSequenceNumber(size_t seqnum)
Double_t fHardwareBlockSum
Module-based sum of the four sub-blocks.
void InitializeChannel(TString name, TString datatosave) override
Initialize the fields in this object.
Double_t GetBlockErrorValue(size_t blocknum) const
Int_t fErrorCount_sample
for sample size check
static const Int_t kMaxChannels
UInt_t fNumberOfSamples_map
Number of samples in the expected to read through the module. This value is set in the QwBeamline map...
void SetDefaultSampleSize(size_t num_samples_map)
void Blind(const QwBlinder *blinder)
Blind this channel as an asymmetry.
Int_t fErrorCount_ZeroHW
check to see ADC returning zero
void ArcTan(const QwMollerADC_Channel &value)
UInt_t fHeaderBlockNumber
static constexpr Int_t kMaxBlock
void DivideBy(const VQwHardwareChannel *valueptr) override
Int_t fBlock_min[kMaxBlock+1]
Int_t fNumEvtsWithEventCutsRejected
Counts the Event cut rejected events.
void SetEventData(Double_t *block, UInt_t sequencenumber=0)
Int_t fBlock_max[kMaxBlock+1]
void Scale(Double_t Offset) override
Long64_t fSoftwareBlockSum_raw
Sum of the data in the four sub-blocks raw.
Double_t GetMollerADCSaturationLimt()
Int_t fErrorCount_HWSat
check to see ADC channel is saturated
void Ratio(const QwMollerADC_Channel &numer, const QwMollerADC_Channel &denom)
void CopyParameters(const VQwHardwareChannel *valueptr) override
void SetRawEventData() override
static const Double_t kTimePerSample
void EncodeEventData(std::vector< UInt_t > &buffer) override
Encode the event data into a CODA buffer.
void AddValueFrom(const VQwHardwareChannel *valueptr) override
static constexpr Int_t kNewReshuffledChannelsPerModule
Long64_t fHardwareBlockSum_raw
Module-based sum of the four sub-blocks as read from the module.
Double_t fHardwareBlockSumRMS
static constexpr Int_t kOldMockChannelsPerModule
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
Long64_t fBlock_raw[kMaxBlock]
Array of the sub-block data as read from the module.
Double_t GetHardwareSumRMS() const
Int_t fErrorCount_SameHW
check to see ADC returning same HW value
void FillHistograms() override
Fill the histograms for this data element.
Int_t GetRawHardwareSum() const
ULong64_t fHeaderPacketCount
static Bool_t fDecodeModeHasBeenSet
static const Int_t kModuleHeaderWords
Int_t ApplyHWChecks() override
ULong64_t fHeaderTSamples
Int_t fErrorCount_Sequence
sequence number check
static void PrintErrorCounterTail()
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this data element.
UInt_t fPreviousSequenceNumber
Previous event sequence number for this channel.
Double_t GetValueWidth() const
Double_t GetBlockRMS(Int_t i) const
void IncrementErrorCounters() override
Double_t fHardwareBlockSumError
Uncertainty on the hardware sum.
UInt_t fBlockSample[kMaxBlock+1]
Double_t GetBlockValue(size_t blocknum) const
Int_t ProcessEvBuffer_newreshuffled(UInt_t *buffer, UInt_t num_words_left, UInt_t index=0)
void PrintInfo() const override
Print multiple lines of information about this data element.
void SubtractValueFrom(const VQwHardwareChannel *valueptr) override
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Double_t GetHardwareSum() const
void FillTreeVector(QwRootTreeBranchVector &values) const override
Int_t fADC_Same_NumEvt
Keep track of how many events with same ADC value returned.
size_t GetNumberOfSamples() const
void CalculateRunningAverage() override
Long64_t fBlockSumSq_raw[kMaxBlock+1]
void AccumulateRunningSum(const QwMollerADC_Channel &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
const QwMollerADC_Channel operator+(const QwMollerADC_Channel &value) const
Double_t fBlockRMS[kMaxBlock+1]
static const Bool_t bDEBUG
debugging display purposes
Double_t GetHardwareSumWidth() const
Double_t GetAverageVolts() const
static constexpr Int_t kNewReshuffledWordsPerChannel
Int_t fSequenceNo_Prev
Keep the sequence number of the last event.
void Product(const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
void AssignScaledValue(const QwMollerADC_Channel &value, Double_t scale)
void SmearByResolution(double resolution) override
Double_t fHardwareBlockSumM2
Second moment of the hardware sum.
static const Double_t kMollerADC_VoltsPerBit
void ClearEventData() override
Clear the event data in this element.
void Difference(const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
size_t GetSequenceNumber() const
UInt_t fNumberOfSamples
Number of samples read through the module.
Bool_t MatchNumberOfSamples(size_t numsamp)
static Int_t GetChannelsPerModule()
Double_t GetHardwareSumError() const
void ConstructBranch(TTree *tree, TString &prefix) override
Double_t fBlock[kMaxBlock]
Array of the sub-block data.
Configuration file parser with flexible tokenization and search capabilities.
Bool_t ReturnValue(const std::string keyname, T &retvalue)
A helper class to manage a vector of branch entries for ROOT trees.
size_type size() const noexcept
std::string LeafList(size_type start_index=0) const
void push_back(const std::string &name, const char type='D')
void SetValue(size_type index, Double_t val)
UInt_t fGoodEventCount
Number of good events accumulated in this element.
VQwDataElement()
Default constructor.
UInt_t fErrorConfigFlag
contains the global/local/stability flags
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
virtual const TString & GetElementName() const
Get the name of this element.
UInt_t fErrorFlag
This the standard error code generated for the channel that contains the global/local/stability flags...
void SetElementName(const TString &name)
Set the name of this element.
Bool_t IsNameEmpty() const
Is the name of this element empty?
TString GetSubsystemName() const
Return the name of the inheriting subsystem name.
UInt_t GetGoodEventCount() const
TString GetModuleType() const
Return the type of the beam instrument.
void SetModuleType(TString ModuleType)
set the type of the beam instrument
void SetDataToSave(TString datatosave)
Set the flag indicating if raw or derived values are in this data element.
Double_t fCalibrationFactor
void SetNumberOfSubElements(const size_t elements)
Set the number of data words in this data element.
size_t fTreeArrayNumEntries
VQwHardwareChannel & operator=(const VQwHardwareChannel &value)
Arithmetic assignment operator: Should only copy event-based data.
void SetNumberOfDataWords(const UInt_t &numwords)
Set the number of data words in this data element.
virtual void AddErrEntriesToList(std::vector< QwErrDBInterface > &)
UInt_t fNumberOfDataWords
Number of raw data words in this data element.
void SetDataToSaveByPrefix(const TString &prefix)
Set the flag indicating if raw or derived values are in this data element based on prefix.
Data blinding utilities for parity violation analysis.
const Bool_t & IsBlinderOkay() const
void ModifyThisErrorCode(UInt_t &errorcode) const
void BlindValue(Double_t &value) const
Asymmetry blinding.
static constexpr const Double_t kValue_BlinderFail