ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
jLJetSort.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
// jLJetSort.cxx
5
// TopoCore
6
// algorithm to make sorted jLJets lists
7
//
8
#include "
L1TopoAlgorithms/jLJetSort.h
"
9
#include "
L1TopoEvent/TOBArray.h
"
10
#include "
L1TopoEvent/jLJetTOBArray.h
"
11
#include "
L1TopoEvent/GenericTOB.h
"
12
#include <algorithm>
13
14
REGISTER_ALG_TCS
(jLJetSort)
15
16
bool
SortByEtLargestjLJet
(
TCS
::GenericTOB* tob1,
TCS
::GenericTOB* tob2)
17
{
18
return
tob1->Et() > tob2->Et();
19
}
20
21
// constructor
22
TCS::jLJetSort::jLJetSort
(
const
std::string &
name
) :
23
SortingAlg
(
name
)
24
{
25
defineParameter
(
"InputWidth"
, 64 );
// for FW
26
defineParameter
(
"InputWidth1stStage"
, 16 );
// for FW
27
defineParameter
(
"OutputWidth"
, 10 );
28
defineParameter
(
"MinEta"
, 0 );
29
defineParameter
(
"MaxEta"
, 196 );
30
}
31
32
33
TCS::jLJetSort::~jLJetSort
()
34
{}
35
36
37
38
TCS::StatusCode
39
TCS::jLJetSort::initialize
() {
40
m_numberOfJets
=
parameter
(
"OutputWidth"
).value();
41
m_minEta
=
parameter
(
"MinEta"
).value();
42
m_maxEta
=
parameter
(
"MaxEta"
).value();
43
return
TCS::StatusCode::SUCCESS
;
44
}
45
46
47
TCS::StatusCode
48
TCS::jLJetSort::sort
(
const
InputTOBArray
& input,
TOBArray
& output) {
49
50
const
jLJetTOBArray
& jets =
dynamic_cast<
const
jLJetTOBArray
&
>
(input);
51
52
// fill output array with GenericTOBs builds from jets
53
for
(
jLJetTOBArray::const_iterator
jet
= jets.begin();
jet
!= jets.end(); ++
jet
) {
54
if
(
parType_t
(std::abs((*jet)->
eta
())) <
m_minEta
)
continue
;
55
if
(
parType_t
(std::abs((*jet)->
eta
())) >
m_maxEta
)
continue
;
56
output.push_back(
GenericTOB
(**
jet
) );
57
}
58
59
// sort
60
output.sort(
SortByEtLargestjLJet
);
61
62
// keep only max number of jets
63
int
par =
m_numberOfJets
;
64
unsigned
int
maxNumberOfJets = std::clamp(par, 0, std::abs(par));
65
if
(maxNumberOfJets>0) {
66
while
( output.size()> maxNumberOfJets ) {
67
if
(output.size() == (maxNumberOfJets+1)) {
68
bool
isAmbiguous = output[maxNumberOfJets-1].EtDouble() == output[maxNumberOfJets].EtDouble();
69
if
(isAmbiguous) { output.setAmbiguityFlag(
true
); }
70
}
71
output.pop_back();
72
}
73
}
74
return
TCS::StatusCode::SUCCESS
;
75
}
76
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
GenericTOB.h
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< jLJetTOB >::const_iterator
data_t::const_iterator const_iterator
Definition
DataArrayImpl.h:18
TCS::GenericTOB
Definition
GenericTOB.h:35
TCS::InputTOBArray
Definition
InputTOBArray.h:15
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::jLJetSort::m_numberOfJets
parType_t m_numberOfJets
Definition
jLJetSort.h:31
TCS::jLJetSort::m_maxEta
parType_t m_maxEta
Definition
jLJetSort.h:33
TCS::jLJetSort::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output) override final
Definition
jLJetSort.cxx:48
TCS::jLJetSort::~jLJetSort
virtual ~jLJetSort()
Definition
jLJetSort.cxx:33
TCS::jLJetSort::m_minEta
parType_t m_minEta
Definition
jLJetSort.h:32
TCS::jLJetSort::jLJetSort
jLJetSort(const std::string &name)
Definition
jLJetSort.cxx:22
TCS::jLJetSort::initialize
virtual TCS::StatusCode initialize() override
Definition
jLJetSort.cxx:39
TCS::jLJetTOBArray
Definition
jLJetTOBArray.h:19
SortByEtLargestjLJet
bool SortByEtLargestjLJet(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
jLJetSort.cxx:16
jLJetSort.h
jLJetTOBArray.h
TCS
Definition
AnomalyDetectionBDT.h:18
TCS::parType_t
uint32_t parType_t
Definition
Parameter.h:23
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
Generated on
for ATLAS Offline Software by
1.17.0