CbmRoot
Loading...
Searching...
No Matches
BmonHitfindQaParameters.cxx
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
11
13#include "CbmTofAddress.h"
14
18
19// ---------------------------------------------------------------------------------------------------------------------
20//
22{
23
24 this->selectionMask = calSetup.selectionMask;
25 if (this->selectionMask != hitSetup.selectionMask) {
26 throw std::runtime_error("Mismatch of the selection bitmask in the BMON CalibrateSetup and HitfindSetup configs");
27 }
28
29 auto nDiamonds = calSetup.diamonds.size();
30 if (nDiamonds != hitSetup.diamonds.size()) {
31 throw std::runtime_error("Mismatch of number of diamonds in the BMON CalibrateSetup and HitfindSetup configs");
32 }
33
34 if (nDiamonds > 1) {
35 while (!((this->selectionMask >> fSelectionBitsOffset) % 2)) {
37 }
38 }
39
40 this->diamonds.resize(nDiamonds);
41 for (const auto& calDiamond : calSetup.diamonds) {
42 uint32_t address = calDiamond.refAddress & ~CbmTofAddress::GetChannelIdBitmask();
43 auto& thisDiamond = this->diamonds[GetDiamondIndex(address)];
44 thisDiamond.address = address;
45 thisDiamond.nChannels = calDiamond.chanPar.size();
46 }
47
48 for (const auto& hitDiamond : hitSetup.diamonds) {
49 int32_t address = hitDiamond.refAddress & ~CbmTofAddress::GetChannelIdBitmask();
50 auto& thisDiamond = this->diamonds[GetDiamondIndex(address)];
51 if (thisDiamond.address != address) {
52 throw std::runtime_error("Mismatch between diamond addresses in BMON CalibrateSetup and HitfindSetup configs");
53 }
54 thisDiamond.deadStrips = hitDiamond.deadStrips;
55 thisDiamond.timeRes = hitDiamond.timeRes;
56 thisDiamond.maxTimeDist = hitDiamond.maxTimeDist;
57 }
58}
A BMON hitfinder QA parameter configuration.
CBM ToF interface class to the unique address.
BMON calibration per channel.
A structure to handle BMON QA parameters.
HitfindQaParameters()=default
Default constructor.
size_t GetDiamondIndex(uint32_t address) const
Returns an index of the diamond by the address.
uint32_t selectionMask
A bitmask to distinguish different diamonds.
uint32_t fSelectionBitsOffset
Number of bits to the right from the first bit in the selection mask.
Parameters for the BMON hitfinder.
std::vector< Diamond > diamonds