CbmRoot
Loading...
Searching...
No Matches
CbmDevTrigger.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dominik Smith[committer] */
4
12#ifndef CBMDEVICETRIGGER_H_
13#define CBMDEVICETRIGGER_H_
14
16#include "CbmDefs.h"
17#include "TimeClusterTrigger.h"
18
20#include "FairMQDevice.h"
21
23#include "Rtypes.h"
24#include "TObjArray.h"
25
27#include <chrono>
28#include <gsl/span>
29#include <vector>
30
34
35class CbmDevTrigger : public FairMQDevice {
36 public:
38 virtual ~CbmDevTrigger(){};
39
40 protected:
41 virtual void InitTask();
42 bool HandleData(FairMQParts&, int);
43
44 private:
48
50 std::string fChannelNameDataInput = "";
51 std::string fChannelNameDataOutput = "";
52
54 uint64_t fNumMessages = 0;
55
57 std::unique_ptr<cbm::algo::evbuild::TimeClusterTrigger> fTriggerAlgo;
58
59 // Trigger algorithm params
60 double fTriggerWindow = 0.;
61 int32_t fMinNumDigis = 0;
62 double fDeadTime = 0.;
63
64 bool SendTriggers(const std::vector<double>& vTriggers, FairMQParts& partsIn);
65
66 // --- Extract digi times into to a vector
67 template<class TDigi>
68 std::vector<double> GetDigiTimes(gsl::span<const TDigi> digiVec)
69 {
70 std::vector<double> digiTimes(digiVec.size());
71 std::transform(digiVec.begin(), digiVec.end(), digiTimes.begin(), [](const TDigi& digi) { return digi.GetTime(); });
72 return digiTimes;
73 }
74
75 // Get trigger times using trigger algorithm
76 std::vector<double> GetTriggerTimes(const CbmDigiTimeslice& ts);
77
78 // Get detector type from string containing name
79 ECbmModuleId GetDetectorId(std::string detName);
80};
81
82#endif /* CBMDEVICETRIGGER_H_ */
ECbmModuleId
Definition CbmDefs.h:39
@ kNotExist
If not found.
std::string fChannelNameDataOutput
std::vector< double > GetTriggerTimes(const CbmDigiTimeslice &ts)
ECbmModuleId GetDetectorId(std::string detName)
std::unique_ptr< cbm::algo::evbuild::TimeClusterTrigger > fTriggerAlgo
Processing algos.
virtual ~CbmDevTrigger()
virtual void InitTask()
uint64_t fNumMessages
Statistics.
bool HandleData(FairMQParts &, int)
bool SendTriggers(const std::vector< double > &vTriggers, FairMQParts &partsIn)
ECbmModuleId fTriggerDet
int32_t fMinNumDigis
std::string fChannelNameDataInput
message queues
double fTriggerWindow
std::vector< double > GetDigiTimes(gsl::span< const TDigi > digiVec)
Collection of digis from all detector systems within one timeslice.