DABC (Data Acquisition Backbone Core)  2.9.9
TdcCalibrationModule.h
Go to the documentation of this file.
1 // $Id: TdcCalibrationModule.h 4700 2021-02-24 08:56:05Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef STREAM_TdcCalibrationModule
17 #define STREAM_TdcCalibrationModule
18 
19 #ifndef DABC_ModuleAsync
20 #include "dabc/ModuleAsync.h"
21 #endif
22 
23 #ifndef DABC_timing
24 #include "dabc/timing.h"
25 #endif
26 
27 #ifndef STREAM_DabcProcMgr
28 #include "stream/DabcProcMgr.h"
29 #endif
30 
31 //#ifndef DABC_Profiler
32 //#include "dabc/Profiler.h"
33 //#endif
34 
35 
36 #include "hadaq/TrbProcessor.h"
37 
38 
39 namespace stream {
40 
41 
48 
49  protected:
50  DabcProcMgr *fProcMgr{nullptr};
51  bool fOwnProcMgr;
52  hadaq::TrbProcessor *fTrbProc{nullptr};
53  bool fDummy;
54  int fDebug{0};
55  bool fReplace;
59  std::string fCalibrFile;
60  unsigned fCalibrMask{0};
61  bool fDoingTdcCalibr{false};
62  bool fEnableProgressUpdate{false};
63  std::vector<int64_t> fDisabledCh;
64  int fDummyCounter{0};
66  int fAutoTdcMode{0};
67  int fAutoToTRange{0};
69  std::vector<uint64_t> fTDCs;
70  unsigned fTRB{0};
71  int fProgress;
72  std::string fState;
73  double fQuality;
74  std::vector<std::string> fLogMessages;
75  int fFineMin{0};
76  int fFineMax{0};
77  std::vector<uint64_t> fTdcMin;
78  std::vector<uint64_t> fTdcMax;
79  int fNumCh{33};
80  int fEdges{1};
81  bool fRecheckTdcs{false};
82  int fWarningCnt{0};
83  int fTotStatLimit{0};
84  double fTotRMSLimit{0};
85 
86  // dabc::Profiler fProfiler; ///< profiler of build event performance
87 
88  bool retransmit();
89 
90  int ExecuteCommand(dabc::Command cmd) override;
91 
92  void ConfigureNewTDC(hadaq::TdcProcessor *tdc);
93 
94  bool MatchTdcId(uint32_t tdcid);
95 
96  bool RecordTRBStatus(bool do_store, dabc::Hierarchy &logitem);
97 
98  public:
99 
100  TdcCalibrationModule(const std::string &name, dabc::Command cmd = nullptr);
101  virtual ~TdcCalibrationModule();
102 
103  void ProcessTimerEvent(unsigned) override;
104 
105  bool ProcessBuffer(unsigned) override { return retransmit(); }
106 
107  bool ProcessRecv(unsigned) override { return retransmit(); }
108 
109  bool ProcessSend(unsigned) override { return retransmit(); }
110 
111  void BeforeModuleStart() override;
112  void AfterModuleStop() override;
113 
114  static void SetTRBStatus(dabc::Hierarchy &item, dabc::Hierarchy &logitem, hadaq::TrbProcessor *trb,
115  bool change_progress = true,
116  int *res_progress = nullptr, double *res_quality = nullptr,
117  std::string *res_state = nullptr, std::vector<std::string> *res_msgs = nullptr,
118  bool acknowledge_quality = false);
119 
120  };
121 
122 }
123 
124 #endif
Represents command with its arguments.
Definition: Command.h:99
Represents objects hierarchy of remote (or local) DABC process.
Definition: Hierarchy.h:285
Base class for user-derived code, implementing event-processing.
Definition: ModuleAsync.h:32
Perform calibration of FPGA TDC data.
bool ProcessSend(unsigned) override
Method called by framework when at least one buffer can be send to output port.
bool fDoingTdcCalibr
indicates if module doing explicit TDC calibrations
std::vector< uint64_t > fTDCs
remember TDCs in the beginning
bool fEnableProgressUpdate
set true to enable trb progress update
int fCountLinear
number of count for liner calibrations when starting explicitly
unsigned fCalibrMask
mask to used for triggers
int fTotStatLimit
limit for ToT statistic
int fLinearNumPoints
number of points used in linear calibration
bool fOwnProcMgr
if created in the module
int fFineMin
configure min value
static void SetTRBStatus(dabc::Hierarchy &item, dabc::Hierarchy &logitem, hadaq::TrbProcessor *trb, bool change_progress=true, int *res_progress=nullptr, double *res_quality=nullptr, std::string *res_state=nullptr, std::vector< std::string > *res_msgs=nullptr, bool acknowledge_quality=false)
bool ProcessBuffer(unsigned) override
Method called by framework when at least one buffer available in pool handle.
int ExecuteCommand(dabc::Command cmd) override
Main method where commands are executed.
int fProgress
total calibration progress
std::vector< std::string > fLogMessages
log messages
std::string fState
current state
bool RecordTRBStatus(bool do_store, dabc::Hierarchy &logitem)
int fNumCh
configured number of channel
int fAutoTdcMode
automatic mode of TDC creation 0 - off, 1 - with linear calibr, 2 - with normal calibr
int fWarningCnt
counter for warnings
dabc::TimeStamp fLastCalibr
use not to check for calibration very often
DabcProcMgr * fProcMgr
stream process manager
unsigned fTRB
remember TRB id, used in module name
int fAutoToTRange
ToT range, 0 - normal, 1 - DiRICH.
void ProcessTimerEvent(unsigned) override
Method called by framework when timer event is produced.
double fQuality
current calibration quality
std::vector< uint64_t > fTdcMax
configured max TDC id
bool ProcessRecv(unsigned) override
Method called by framework when at least one buffer available in input port.
std::string fCalibrFile
names to load/store calibrations
double fTotRMSLimit
limit for ToT RMS calibration
hadaq::TrbProcessor * fTrbProc
TRB processor.
int fAutoCalibr
amount of statistic for the auto calibration in channels
std::vector< int64_t > fDisabledCh
disabled for calibrations channels
int fFineMax
configure max value
int fCountNormal
number of counts for normal calibrations when starting explicitly
bool fRecheckTdcs
check for missing tdcs, done once 5 sec
bool fReplace
replace hit messages (true) or add calibration messages (false)
void ConfigureNewTDC(hadaq::TdcProcessor *tdc)
bool fDummy
module creates all TDCs but do not perform any transformation
int fDebug
when specified, provides more debug output and special mode
std::vector< uint64_t > fTdcMin
configured min TDC id
TdcCalibrationModule(const std::string &name, dabc::Command cmd=nullptr)
Support for stream framework in DABC
Definition: DabcProcMgr.h:25
Class for acquiring and holding timestamps.
Definition: timing.h:40