ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
MuonSort.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
// MuonSort.cxx
5
// TopoCore
6
// Created by Joerg Stelzer on 11/10/12.
7
// algorithm to create sorted lists for muons, et order applied
8
//
9
#include "
L1TopoAlgorithms/MuonSort.h
"
10
#include "
L1TopoEvent/TOBArray.h
"
11
#include "
L1TopoEvent/MuonTOBArray.h
"
12
#include "
L1TopoEvent/GenericTOB.h
"
13
#include <algorithm>
14
15
REGISTER_ALG_TCS
(MuonSort)
16
17
bool
SortByEtLargestM
(
TCS
::GenericTOB* tob1,
TCS
::GenericTOB* tob2)
18
{
19
//Order the TOBs according to Et (high to low), then (in case of equal ET) side (first A, then C). Further ambiguity resolution depends on details of MUCTPI and are currently not taken into account (to be seen if necessary).
20
21
//highest priority: ET
22
if
(tob1->Et() > tob2->Et())
return
true
;
23
if
(tob1->Et() < tob2->Et())
return
false
;
24
//second criterion: A side before C side (here: emulated via signed eta coordinate)
25
if
(tob1->eta() > tob2->eta())
return
true
;
26
if
(tob1->eta() < tob2->eta())
return
false
;
//explicitly indicate tob1 < tob2 in case additional criteria are added
27
return
false
;
28
29
}
30
31
32
// constructor
33
TCS::MuonSort::MuonSort
(
const
std::string &
name
) :
SortingAlg
(
name
) {
34
defineParameter
(
"InputWidth"
, 32 );
// for FW
35
defineParameter
(
"InputWidth1stStage"
, 16 );
// for FW
36
defineParameter
(
"OutputWidth"
, 6 );
37
defineParameter
(
"MinEta"
, 0 );
38
defineParameter
(
"MaxEta"
, 196 );
39
defineParameter
(
"InnerCoinCut"
, 0 );
40
defineParameter
(
"FullStationCut"
, 0 );
41
defineParameter
(
"GoodMFieldCut"
, 0 );
42
}
43
44
45
// destructor
46
TCS::MuonSort::~MuonSort
() {}
47
48
49
TCS::StatusCode
50
TCS::MuonSort::initialize
() {
51
m_numberOfMuons
=
parameter
(
"OutputWidth"
).value();
52
m_minEta
=
parameter
(
"MinEta"
).value();
53
m_maxEta
=
parameter
(
"MaxEta"
).value();
54
m_InnerCoinCut
=
parameter
(
"InnerCoinCut"
).value();
55
m_FullStationCut
=
parameter
(
"FullStationCut"
).value();
56
m_GoodMFieldCut
=
parameter
(
"GoodMFieldCut"
).value();
57
return
TCS::StatusCode::SUCCESS
;
58
}
59
60
61
TCS::StatusCode
62
TCS::MuonSort::sort
(
const
InputTOBArray
& input,
TOBArray
& output) {
63
64
const
MuonTOBArray
& muons =
dynamic_cast<
const
MuonTOBArray
&
>
(input);
65
66
// fill output array with GenericTOB built from muons
67
for
(
MuonTOBArray::const_iterator
muon = muons.
begin
(); muon!= muons.
end
(); ++muon ) {
68
69
if
(
parType_t
(std::abs((*muon)->
eta
())) <
m_minEta
)
continue
;
70
if
(
parType_t
(std::abs((*muon)->
eta
())) >
m_maxEta
)
continue
;
71
72
// Apply flag selection only for TGC muons. The flag selection is applied only if the corresponding parameter from the menu is 1.
73
if
(
parType_t
((*muon)->isTGC()) )
74
{
75
if
(
m_InnerCoinCut
== 1 && ( ! ((
int
)
parType_t
((*muon)->innerCoin()) == (
int
)
m_InnerCoinCut
) ) )
continue
;
76
if
(
m_FullStationCut
== 1 && ( ! ((
int
)
parType_t
((*muon)->bw2or3()) == (
int
)
m_FullStationCut
) ) )
continue
;
77
if
(
m_GoodMFieldCut
== 1 && ( ! ((
int
)
parType_t
((*muon)->goodMF()) == (
int
)
m_GoodMFieldCut
) ) )
continue
;
78
}
79
80
const
GenericTOB
gtob(**muon);
81
output.push_back( gtob );
82
}
83
84
// sort
85
output.sort(
SortByEtLargestM
);
86
87
88
// keep only max number of muons
89
int
par =
m_numberOfMuons
;
90
unsigned
int
maxNumberOfMuons = std::clamp(par, 0, std::abs(par));
91
if
(maxNumberOfMuons>0) {
92
while
( output.size()> maxNumberOfMuons ) {
93
if
(output.size() == (maxNumberOfMuons+1)) {
94
bool
isAmbiguous = output[maxNumberOfMuons-1].EtDouble() == output[maxNumberOfMuons].EtDouble();
95
if
(isAmbiguous) { output.setAmbiguityFlag(
true
); }
96
}
97
output.pop_back();
98
}
99
}
100
return
TCS::StatusCode::SUCCESS
;
101
}
102
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
GenericTOB.h
SortByEtLargestM
bool SortByEtLargestM(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
MuonSort.cxx:17
MuonSort.h
MuonTOBArray.h
if
if(pathvar)
Definition
SealSharedLib.cxx:168
TOBArray.h
TCS::ConfigurableAlg::name
const std::string & name() const
Definition
ConfigurableAlg.h:49
TCS::ConfigurableAlg::parameter
const Parameter & parameter(std::string_view parameterName) const
Definition
ConfigurableAlg.cxx:245
TCS::ConfigurableAlg::defineParameter
void defineParameter(std::string_view name, TCS::parType_t value)
Definition
ConfigurableAlg.cxx:203
TCS::DataArrayImpl::begin
iterator begin()
Definition
DataArrayImpl.h:40
TCS::DataArrayImpl< MuonTOB >::const_iterator
data_t::const_iterator const_iterator
Definition
DataArrayImpl.h:18
TCS::DataArrayImpl::end
iterator end()
Definition
DataArrayImpl.h:43
TCS::GenericTOB
Definition
GenericTOB.h:35
TCS::InputTOBArray
Definition
InputTOBArray.h:15
TCS::MuonSort::m_InnerCoinCut
parType_t m_InnerCoinCut
Definition
MuonSort.h:37
TCS::MuonSort::MuonSort
MuonSort(const std::string &name)
Definition
MuonSort.cxx:33
TCS::MuonSort::m_FullStationCut
parType_t m_FullStationCut
Definition
MuonSort.h:38
TCS::MuonSort::m_maxEta
parType_t m_maxEta
Definition
MuonSort.h:36
TCS::MuonSort::initialize
virtual TCS::StatusCode initialize() override
Definition
MuonSort.cxx:50
TCS::MuonSort::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output) override final
Definition
MuonSort.cxx:62
TCS::MuonSort::m_GoodMFieldCut
parType_t m_GoodMFieldCut
Definition
MuonSort.h:39
TCS::MuonSort::m_minEta
parType_t m_minEta
Definition
MuonSort.h:35
TCS::MuonSort::m_numberOfMuons
parType_t m_numberOfMuons
Definition
MuonSort.h:34
TCS::MuonSort::~MuonSort
virtual ~MuonSort()
Definition
MuonSort.cxx:46
TCS::MuonTOBArray
Definition
MuonTOBArray.h:19
TCS::SortingAlg::SortingAlg
SortingAlg(const std::string &name)
Definition
SortingAlg.h:21
TCS::StatusCode
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::TOBArray
Definition
TOBArray.h:24
TCS
Definition
AnomalyDetectionBDT.h:18
TCS::parType_t
uint32_t parType_t
Definition
Parameter.h:23
Generated on
for ATLAS Offline Software by
1.17.0