ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
JetSortingAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
// JetSortingAlg.cxx
5
// TopoCore
6
// Created by Joerg Stelzer on 11/10/12.
7
8
#include "
L1TopoAlgorithms/JetSortingAlg.h
"
9
#include "
L1TopoEvent/TOBArray.h
"
10
#include "
L1TopoEvent/JetTOBArray.h
"
11
#include "
L1TopoEvent/GenericTOB.h
"
12
#include <algorithm>
13
14
REGISTER_ALG_TCS
(JetSortingAlg)
15
16
bool
SortByEtLargestFirst2
(
TCS
::GenericTOB* tob1,
TCS
::GenericTOB* tob2)
17
{
18
return
tob1->Et() > tob2->Et();
19
}
20
21
bool
SortByEtSmallestFirst2
(
TCS::GenericTOB
* tob1,
TCS::GenericTOB
* tob2)
22
{
23
return
tob1->
Et
() < tob2->
Et
();
24
}
25
26
// constructor
27
TCS::JetSortingAlg::JetSortingAlg
(
const
std::string &
name
) :
28
SortingAlg
(
name
)
29
{
30
defineParameter
(
"NumberOfJets"
, 0 );
31
defineParameter
(
"ReverseOrder"
, 0 );
32
defineParameter
(
"JetSize"
, 0 );
33
defineParameter
(
"MinEta"
, 0 );
34
defineParameter
(
"MaxEta"
, 49);
35
m_jetsize
=
JetTOB::JS1
;
36
}
37
38
39
TCS::JetSortingAlg::~JetSortingAlg
()
40
{}
41
42
43
44
45
46
47
TCS::StatusCode
48
TCS::JetSortingAlg::sort
(
const
InputTOBArray
& input,
TOBArray
& output) {
49
const
JetTOBArray
& jets =
dynamic_cast<
const
JetTOBArray
&
>
(input);
50
// because hw seems to be using different notation, for now 2 means 8x8 or JS1, and 1 JS2 a 4x4
51
m_jetsize
=
parameter
(
"JetSize"
).value()==2?
JetTOB::JS1
:
JetTOB::JS2
;
52
53
// fill output array with GenericTOBs builds from jets
54
for
(
JetTOBArray::const_iterator
cl = jets.begin(); cl!= jets.end(); ++cl ) {
55
if
(
parType_t
(std::abs((*cl)->
eta
())) <
parameter
(
"MinEta"
).value())
continue
;
56
if
(
parType_t
(std::abs((*cl)->
eta
())) >
parameter
(
"MaxEta"
).value())
continue
;
57
output.push_back(
GenericTOB
(**cl,
m_jetsize
) );
58
}
59
60
// sort, possibly in reversed order
61
int
reverseOrder =
parameter
(
"ReverseOrder"
).value();
62
if
(reverseOrder==1) {
63
output.sort(
SortByEtSmallestFirst2
);
64
}
else
{
65
output.sort(
SortByEtLargestFirst2
);
66
}
67
68
// keep only max number of jets
69
int
par =
parameter
(
"NumberOfJets"
).value();
70
unsigned
int
maxNumberOfJets = std::clamp(par, 0, std::abs(par));
71
if
(maxNumberOfJets>0) {
72
while
( output.size()> maxNumberOfJets ) {
73
output.pop_back();
74
}
75
}
76
return
TCS::StatusCode::SUCCESS
;
77
}
78
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
GenericTOB.h
SortByEtSmallestFirst2
bool SortByEtSmallestFirst2(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
JetSortingAlg.cxx:21
SortByEtLargestFirst2
bool SortByEtLargestFirst2(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
JetSortingAlg.cxx:16
JetSortingAlg.h
JetTOBArray.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< JetTOB >::const_iterator
data_t::const_iterator const_iterator
Definition
DataArrayImpl.h:18
TCS::GenericTOB
Definition
GenericTOB.h:35
TCS::GenericTOB::Et
unsigned int Et() const
Definition
GenericTOB.h:113
TCS::InputTOBArray
Definition
InputTOBArray.h:15
TCS::JetSortingAlg::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition
JetSortingAlg.cxx:48
TCS::JetSortingAlg::m_jetsize
JetTOB::JetSize m_jetsize
Definition
JetSortingAlg.h:33
TCS::JetSortingAlg::~JetSortingAlg
virtual ~JetSortingAlg()
Definition
JetSortingAlg.cxx:39
TCS::JetSortingAlg::JetSortingAlg
JetSortingAlg(const std::string &name)
Definition
JetSortingAlg.cxx:27
TCS::JetTOBArray
Definition
JetTOBArray.h:21
TCS::JetTOB::JS1
@ JS1
Definition
JetTOB.h:21
TCS::JetTOB::JS2
@ JS2
Definition
JetTOB.h:21
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