CbmRoot
Loading...
Searching...
No Matches
HitMultTrigger.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer], Dominik Smith */
4
5#include "HitMultTrigger.h"
6
7#include "CbmStsHit.h"
8#include "CbmTofHit.h"
9#include "CbmTrdHit.h"
10
11#include <iterator>
12#include <sstream>
13
14#include <xpu/host.h>
15
16namespace cbm::algo::evbuild
17{
18
19 // ----- Execution ------------------------------------------------------
21 {
22
23 xpu::push_timer("HitMultTrigger");
24 xpu::t_add_bytes(1);
25
26 Result result;
27 auto hitTimes = GetHitTimes(recoData, fConfig.Detector());
28 auto [triggers, moniData] = fAlgo(hitTimes);
29 result.first = std::move(triggers);
30 result.second = std::move(moniData);
31 result.second.time = xpu::pop_timer();
32
33 L_(info) << "HitMultTrigger: hits " << hitTimes.size() << ", triggers " << result.first.size();
34
35 return result;
36 };
37 // --------------------------------------------------------------------------
38
39
40 // ----- Get hit times from reconstructed data --------------------------
41 std::vector<double> HitMultTrigger::GetHitTimes(const RecoResults& recoResults, ECbmModuleId system) const
42 {
43 std::vector<double> result;
44 switch (system) {
45 case ECbmModuleId::kSts: return GetTimeStamps<cbm::algo::sts::Hit>(recoResults.stsHits.Data()); break;
46 case ECbmModuleId::kTrd: return GetTimeStamps<cbm::algo::trd::Hit>(recoResults.trdHits.Data()); break;
47 case ECbmModuleId::kTof: return GetTimeStamps<cbm::algo::tof::Hit>(recoResults.tofHits.Data()); break;
48 default: {
49 L_(error) << "HitMultTrigger::GetHitTimes: Unknown system " << system;
50 break;
51 }
52 } //? system
53
54 return result;
55 }
56 // --------------------------------------------------------------------------
57
58
59 // ----- Info to string ---------------------------------------------------
60 std::string HitMultTrigger::ToString() const
61 {
62 std::stringstream out;
63 out << "--- Using Hit Multiplicity Trigger with trigger detector " << ::ToString(fConfig.Detector());
64 out << "\n" << fAlgo.ToString();
65 return out.str();
66 }
67 // --------------------------------------------------------------------------
68
69
70} // namespace cbm::algo::evbuild
#define L_(level)
ECbmModuleId
Definition CbmDefs.h:39
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
Data class for a reconstructed hit in the STS.
Class for hits in TRD detector.
ECbmModuleId Detector() const
Trigger detector.
std::string ToString() const
Info to string.
std::pair< std::vector< double >, TimeClusterTriggerMonitorData > Result
std::vector< double > GetTimeStamps(const gsl::span< const T > data) const
Get vector of time stamps from a data container [template].
DigiTriggerConfig fConfig
Configuration.
TimeClusterTrigger fAlgo
Algorithm.
std::vector< double > GetHitTimes(const RecoResults &recoData, ECbmModuleId system) const
Extract the hit time stamps for the selected trigger detector.
Result operator()(const RecoResults &recoData) const
Execution.
std::string ToString() const
Info to string.
PartitionedVector< trd::Hit > trdHits
Definition RecoResults.h:43
PartitionedVector< tof::Hit > tofHits
Definition RecoResults.h:42
PartitionedSpan< sts::Hit > stsHits
Definition RecoResults.h:41