CbmRoot
Loading...
Searching...
No Matches
CbmTaskTriggerDigi.h
Go to the documentation of this file.
1/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
5#ifndef CBMTASKTRIGGERDIGI_H
6#define CBMTASKTRIGGERDIGI_H 1
7
8#include "CbmDefs.h"
9#include "CbmDigiBranchBase.h"
10#include "TimeClusterTrigger.h"
11
12#include <FairTask.h>
13
14#include <TStopwatch.h>
15
16#include <boost/any.hpp>
17
18#include <vector>
19
21class CbmDigiManager;
23
24using namespace std;
25
35class CbmTaskTriggerDigi : public FairTask {
36
37
38 public:
41
42
45
46
48 virtual ~CbmTaskTriggerDigi();
49
50
52 virtual void Exec(Option_t* opt);
53
54
56 virtual void Finish();
57
58
61
62
68
73 {
74 if (std::find(fSystems.begin(), fSystems.end(), system) != fSystems.end()) return;
75 fSystems.push_back(system);
76 }
77
78 private: // methods
80 virtual InitStatus Init();
81
85 template<class TDigi>
86 std::vector<double> GetDigiTimes(const CbmDigiBranchBase* digiBranch)
87 {
88 TStopwatch timerStep;
89 // --- Get input digi vector
90 const vector<TDigi>* digiVec = boost::any_cast<const vector<TDigi>*>(digiBranch->GetBranchContainer());
91 assert(digiVec);
92
93 // --- Extract digi times into to a vector
94 timerStep.Start();
95 std::vector<double> digiTimes(digiVec->size());
96 std::transform(digiVec->begin(), digiVec->end(), digiTimes.begin(),
97 [](const TDigi& digi) { return digi.GetTime(); });
98 timerStep.Stop();
99 fTimeExtract += timerStep.RealTime();
100 return digiTimes;
101 }
102
103
108 std::vector<double> GetDigiTimes(ECbmModuleId system);
109
110
111 private: // members
112 const CbmDigiTimeslice* fTimeslice = nullptr;
114 std::vector<ECbmModuleId> fSystems{}; // List of detector systems
115 std::vector<double>* fTriggers = nullptr;
116 std::unique_ptr<cbm::algo::evbuild::TimeClusterTrigger> fAlgo = nullptr;
117 std::unique_ptr<cbm::algo::evbuild::DigiTriggerConfig> fConfig = nullptr;
118 double fTriggerWindow = 0.;
119 int32_t fMinNumDigis = 0;
120 double fDeadTime = 0.;
121 size_t fNumTs = 0; // Number of processed time slices
122 size_t fNumDigis = 0; // Number of digis from trigger detector
123 size_t fNumTriggers = 0; // Number of found triggers
124 double fTimeExtract = 0.;
125 double fTimeFind = 0.;
126 double fTimeTot = 0.;
127
128
130};
131
132#endif /* CBMTASKTRIGGERDIGI_H */
ECbmModuleId
Definition CbmDefs.h:39
Abstract base class for CBM digi branches.
virtual boost::any GetBranchContainer() const
Get branch pointer.
CbmDigiManager.
Collection of digis from all detector systems within one timeslice.
Task class for minimum-bias event trigger from time-distribution of digi data.
ClassDef(CbmTaskTriggerDigi, 1)
CbmDigiManager * fDigiMan
Input data (from unpacking)
std::vector< ECbmModuleId > fSystems
Input data (from simulation)
void AddSystem(ECbmModuleId system)
Add a detector system to the trigger algorithm.
CbmTaskTriggerDigi(const CbmTaskTriggerDigi &)=delete
Copy constructor (disabled)
std::vector< double > * fTriggers
void SetConfig(const cbm::algo::evbuild::DigiTriggerConfig &config)
Configure the trigger algorithm.
std::unique_ptr< cbm::algo::evbuild::TimeClusterTrigger > fAlgo
Output data.
virtual void Exec(Option_t *opt)
Task execution.
virtual void Finish()
Finish timeslice.
CbmTaskTriggerDigi & operator=(const CbmTaskTriggerDigi &)=delete
Assignment operator (disabled)
virtual ~CbmTaskTriggerDigi()
Destructor.
double fTriggerWindow
Configuration / parameters.
const CbmDigiTimeslice * fTimeslice
std::unique_ptr< cbm::algo::evbuild::DigiTriggerConfig > fConfig
Algorithm.
CbmTaskTriggerDigi()
Constructor.
std::vector< double > GetDigiTimes(const CbmDigiBranchBase *digiBranch)
Extract digi times from digi branch.
virtual InitStatus Init()
Task initialisation.
Configuration of the digi trigger class (TimeClusterTrigger)
Hash for CbmL1LinkKey.