CbmRoot
Loading...
Searching...
No Matches
CbmStsUnpackConfig.cxx
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */
4
6
7#include "CbmStsUnpackAlgo.h"
9
10#include <Logger.h>
11
12#include <Rtypes.h>
13#include <RtypesCore.h>
14
15#include <memory>
16#include <vector>
17
18CbmStsUnpackConfig::CbmStsUnpackConfig(std::string detGeoSetupTag, UInt_t runid)
19 : CbmRecoUnpackConfig("CbmStsUnpackConfig", detGeoSetupTag, runid)
20{
21}
22
24{
25 LOG(debug) << fName << "::~CbmStsUnpackConfig";
26 fWalkMap.clear();
27 LOG(debug) << fName << "::~CbmStsUnpackConfig done";
28}
29
30// ---- Init ----
32{
33 // Set the minimum adc cut
34 fAlgo->SetMinAdcCut(fdAdcCut);
35
36 // Set the minimum adc cut Feb independent
37 for (auto cut = fdAdcCut_perFeb.begin(); cut != fdAdcCut_perFeb.end(); cut++) {
38 fAlgo->SetMinAdcCut(cut->first, cut->second);
39 }
40
41 // Set the single asics time offsets
42 fAlgo->SetAsicTimeOffsetVec(fvdTimeOffsetNsAsics);
43
44 // Set Time Walk Correction map
45 if (!fWalkMap.empty()) {
46 fAlgo->SetWalkMap(fWalkMap);
47 }
48
49 // Set the flags for duplicate digis rejections
50 fAlgo->SetDuplicatesRejection(fbRejectDuplicateDigis, fbDupliWithoutAdc);
51
52 if (fMonitor) {
53 fAlgo->SetMonitor(fMonitor);
54 }
55
56 // Set firmware binning (only relevant for legacy mode)
57 fAlgo->SetFwBinning(fbUseFwBinning);
58
59 // Now we have all information required to initialise the algorithm
60 fAlgo->Init();
61
62 // Mask the noisy channels set by the user
63 for (auto chmask : fvChanMasks)
64 fAlgo->MaskNoisyChannel(chmask.uFeb, chmask.uChan, chmask.bMasked);
65}
66
67// ---- chooseAlgo ----
68std::shared_ptr<CbmStsUnpackAlgoBase> CbmStsUnpackConfig::chooseAlgo()
69{
70 if (fDoLog) LOG(info) << fName << "::Init - chooseAlgo";
71
72 // Non default unpacker selection
73 // Legacy unpacker for data taken before mcbm 2021
74 if (fGeoSetupTag.find("mcbm_beam_2020_03") != fGeoSetupTag.npos) {
75 auto algo = std::make_shared<CbmStsUnpackAlgoLegacy>();
76 LOG(info) << fName << "::chooseAlgo() - selected algo = " << algo->Class_Name();
77 return algo;
78 }
79
80 // Default unpacker selection
81 // Unpacker algo from mcbm 2021 on and hopefully default for a long time.
82 auto algo = std::make_shared<CbmStsUnpackAlgo>();
83 LOG(info) << fName << "::chooseAlgo() - selected algo = " << algo->Class_Name();
84 return algo;
85
86 LOG(error) << fName
87 << "::Init - chooseAlgo() - no algorithm created something went wrong. We can not work like this!";
88 return nullptr;
89}
90
91
ClassImp(CbmConverterManager)
Baseclass for the STS unpacker algorithms.
Configuration class for an unpacker algorithm.
virtual std::shared_ptr< CbmStsUnpackAlgoBase > chooseAlgo()
Choose the derived unpacker algorithm to be used for the DAQ output to Digi translation....
std::vector< double > fvdTimeOffsetNsAsics
Vector with the Asic time offsets.
std::shared_ptr< CbmStsUnpackMonitor > fMonitor
pointer to the monitor object
std::map< uint32_t, uint32_t > fdAdcCut_perFeb
Minimum adc cut per Feb to store a hit.
bool fbUseFwBinning
Enables firmware binning (some implementations ignore this)
virtual ~CbmStsUnpackConfig()
Destroy the Cbm Sts Unpack Task object.
void InitAlgo()
Initialize the algorithm, should include all steps needing te parameter objects to be present....
uint32_t fdAdcCut
Minimum adc cut to store a hit.
CbmStsUnpackConfig(std::string detGeoSetupTag, UInt_t runid=0)
Create the Cbm Sts Unpack Task object.
std::vector< FebChanMaskReco > fvChanMasks
Temporary storage of user parameters.
bool fbRejectDuplicateDigis
Enables the rejection of duplicate digis.
bool fbDupliWithoutAdc
If rejecting duplicate digis, enables rejection even if ADC differs.
std::map< uint32_t, CbmStsParModule > fWalkMap
Time-Walk Parameters map.