ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CTP
src
ThresholdMap.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./ThresholdMap.h
"
6
7
#include <cstdlib>
8
9
10
LVL1CTP::ThresholdMap::ThresholdMap
(
const
TrigConf::L1Menu
* l1menu )
11
{
12
//unsigned int start = 0;
13
for
(
auto
& thr : l1menu->thresholds() ) {
14
CTPTriggerThreshold
* ctpThr =
new
CTPTriggerThreshold
(thr->name());
15
/*
16
defining the start and stop bit is much more complex now, as
17
the CTP has many more inputs and the precise mapping of the
18
inputs to the TIP vector has to be worked out
19
*/
20
m_mapByName
[ctpThr->
name
()] = ctpThr;
21
}
22
}
23
24
25
LVL1CTP::ThresholdMap::ThresholdMap
(
const
std::vector< TrigConf::TriggerThreshold* >& threshold_vector)
26
{
27
unsigned
int
start = 0;
28
for
(
TrigConf::TriggerThreshold
* thr : threshold_vector ) {
29
CTPTriggerThreshold
* ctpThr =
new
CTPTriggerThreshold
(thr->name());
30
unsigned
int
end = start + abs( thr->cableStart() - thr->cableEnd() );
31
ctpThr->
setStartBit
( start );
32
ctpThr->
setEndBit
( end );
33
start = end + 1;
34
m_mapByName
[thr->name()] = ctpThr;
35
}
36
}
37
38
LVL1CTP::ThresholdMap::ThresholdMap
(
const
std::vector< TrigConf::TriggerThreshold* >& threshold_vector,
39
const
std::vector< TrigConf::PIT* >& pit_vector)
40
{
41
for
(
TrigConf::TriggerThreshold
* thr : threshold_vector ) {
42
CTPTriggerThreshold
* ctpThr =
new
CTPTriggerThreshold
(thr->name());
43
//default pit values: used if threshold doesn't have a corresponding pit bit
44
int
pit_start=999;
45
int
pit_end=-999;
46
for
(
TrigConf::PIT
* pit : pit_vector ) {
47
if
( pit->thresholdName() != thr->name() )
48
continue
;
49
if
( pit->pitNumber() < pit_start )
50
pit_start = pit->pitNumber();
51
if
( pit->pitNumber() > pit_end )
52
pit_end = pit->pitNumber();
53
}
54
ctpThr->
setStartBit
( pit_start );
55
ctpThr->
setEndBit
( pit_end );
56
m_mapByName
[thr->name()] = ctpThr;
57
}
58
}
59
60
61
LVL1CTP::ThresholdMap::ThresholdMap
(
const
std::vector< TrigConf::TriggerThreshold* >& threshold_vector,
62
const
std::vector< TrigConf::TIP* >& tip_vector)
63
{
64
for
(
TrigConf::TriggerThreshold
* thr : threshold_vector ) {
65
CTPTriggerThreshold
* ctpThr =
new
CTPTriggerThreshold
(thr->name());
66
//default pit values: used if threshold doesn't have a corresponding pit bit
67
int
tip_start=999;
68
int
tip_end=-999;
69
for
(
TrigConf::TIP
* tip : tip_vector){
70
if
( tip->thresholdName() != thr->name() )
71
continue
;
72
if
( tip->tipNumber() < tip_start)
73
tip_start = tip->tipNumber();
74
if
( tip->tipNumber() > tip_end )
75
tip_end = tip->tipNumber();
76
}
77
ctpThr->
setStartBit
( tip_start );
78
ctpThr->
setEndBit
( tip_end );
79
m_mapByName
[thr->name()] = ctpThr;
80
}
81
}
82
83
LVL1CTP::ThresholdMap::~ThresholdMap
() {
84
for
(
auto
& entry :
m_mapByName
) {
85
delete
entry.second;
86
}
87
}
88
89
std::vector<std::string>
90
LVL1CTP::ThresholdMap::getThresholdNames
()
const
{
91
std::vector<std::string> thrNames;
92
thrNames.reserve(
m_mapByName
.size());
93
for
(
auto
& entry :
m_mapByName
) {
94
thrNames.emplace_back(entry.first);
95
}
96
return
thrNames;
97
}
98
99
const
LVL1CTP::CTPTriggerThreshold
&
100
LVL1CTP::ThresholdMap::getCTPThreshold
(
const
std::string & thrName )
const
{
101
try
{
102
return
*
m_mapByName
.at( thrName );
103
}
104
catch
(std::exception&) {
105
throw
std::runtime_error(
"Threshold "
+ thrName +
" not present in CTPSimulation's internal threshold map"
);
106
}
107
}
108
ThresholdMap.h
LVL1CTP::CTPTriggerThreshold
Helper class holding trigger threshold multiplicity.
Definition
CTPTriggerThreshold.h:17
LVL1CTP::CTPTriggerThreshold::name
const std::string & name() const
Definition
CTPTriggerThreshold.h:24
LVL1CTP::CTPTriggerThreshold::setStartBit
void setStartBit(unsigned int start)
Set the start position of the threshold.
Definition
CTPTriggerThreshold.cxx:30
LVL1CTP::CTPTriggerThreshold::setEndBit
void setEndBit(unsigned int end)
Set the end position of the threshold.
Definition
CTPTriggerThreshold.cxx:40
LVL1CTP::ThresholdMap::ThresholdMap
ThresholdMap()=delete
LVL1CTP::ThresholdMap::getCTPThreshold
const CTPTriggerThreshold & getCTPThreshold(const std::string &thrName) const
Definition
ThresholdMap.cxx:100
LVL1CTP::ThresholdMap::m_mapByName
std::map< std::string, const CTPTriggerThreshold * > m_mapByName
map storing the accosiation between threshold name and CTPTriggerThreshold
Definition
ThresholdMap.h:53
LVL1CTP::ThresholdMap::getThresholdNames
std::vector< std::string > getThresholdNames() const
Definition
ThresholdMap.cxx:90
LVL1CTP::ThresholdMap::~ThresholdMap
~ThresholdMap()
default destructor
Definition
ThresholdMap.cxx:83
TrigConf::L1Menu
L1 menu configuration.
Definition
L1Menu.h:29
TrigConf::PIT
Definition
PIT.h:13
TrigConf::TIP
Definition
TIP.h:13
TrigConf::TriggerThreshold
Definition
TriggerThreshold.h:20
Generated on
for ATLAS Offline Software by
1.17.0