ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
ClusterSort.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
// ClusterSort.cxx
5
// TopoCore
6
// Created by Joerg Stelzer on 11/10/12.
7
// algorithm to create sorted lists for clusters, et order applied
8
//
9
#include "
L1TopoAlgorithms/ClusterSort.h
"
10
#include "
L1TopoEvent/TOBArray.h
"
11
#include "
L1TopoEvent/ClusterTOBArray.h
"
12
#include "
L1TopoEvent/GenericTOB.h
"
13
#include <algorithm>
14
15
REGISTER_ALG_TCS
(ClusterSort)
16
17
bool
SortByEtLargest
(
TCS
::GenericTOB* tob1,
TCS
::GenericTOB* tob2)
18
{
19
return
tob1->Et() > tob2->Et();
20
}
21
22
23
// constructor
24
TCS::ClusterSort::ClusterSort
(
const
std::string &
name
) :
SortingAlg
(
name
) {
25
defineParameter
(
"InputWidth"
, 120 );
// for FW
26
defineParameter
(
"InputWidth1stStage"
, 30 );
// for FW
27
defineParameter
(
"OutputWidth"
, 6);
28
defineParameter
(
"IsoMask"
, 0);
29
defineParameter
(
"MinEta"
, 0);
30
defineParameter
(
"MaxEta"
, 63);
31
defineParameter
(
"DoIsoCut"
, 1);
32
}
33
34
35
// destructor
36
TCS::ClusterSort::~ClusterSort
() {}
37
38
39
TCS::StatusCode
40
TCS::ClusterSort::initialize
() {
41
m_numberOfClusters
=
parameter
(
"OutputWidth"
).value();
42
m_iso
=
parameter
(
"IsoMask"
).value();
43
m_minEta
=
parameter
(
"MinEta"
).value();
44
m_maxEta
=
parameter
(
"MaxEta"
).value();
45
m_doIsoCut
=
parameter
(
"DoIsoCut"
).value();
46
return
TCS::StatusCode::SUCCESS
;
47
}
48
49
50
TCS::StatusCode
51
TCS::ClusterSort::sort
(
const
InputTOBArray
& input,
TOBArray
& output) {
52
53
const
ClusterTOBArray
& clusters =
dynamic_cast<
const
ClusterTOBArray
&
>
(input);
54
55
// fill output array with GenericTOB buildt from clusters
56
for
(
ClusterTOBArray::const_iterator
cl = clusters.begin(); cl!= clusters.end(); ++cl ) {
57
const
GenericTOB
gtob(**cl);
58
59
if
(
parType_t
(std::abs((*cl)->
eta
())) <
m_minEta
)
continue
;
60
if
(
parType_t
(std::abs((*cl)->
eta
())) >
m_maxEta
)
continue
;
61
// isolation cut
62
if
(
m_iso
!= 0 ) {
63
unsigned
int
isobit(0x1 << (
m_iso
-1));
64
if
(
m_doIsoCut
&& ((
parType_t
((*cl)->isolation()) & isobit) != isobit))
continue
;
65
}
66
67
output.push_back( gtob );
68
}
69
70
// sort
71
output.sort(
SortByEtLargest
);
72
73
74
// keep only max number of clusters
75
int
par =
m_numberOfClusters
;
76
unsigned
int
maxNumberOfClusters = std::clamp(par, 0, std::abs(par));
77
if
(maxNumberOfClusters>0) {
78
while
( output.size()> maxNumberOfClusters ) {
79
output.pop_back();
80
}
81
}
82
return
TCS::StatusCode::SUCCESS
;
83
}
84
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
SortByEtLargest
bool SortByEtLargest(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
ClusterSort.cxx:17
ClusterSort.h
ClusterTOBArray.h
GenericTOB.h
TOBArray.h
TCS::ClusterSort::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition
ClusterSort.cxx:51
TCS::ClusterSort::~ClusterSort
virtual ~ClusterSort()
Definition
ClusterSort.cxx:36
TCS::ClusterSort::m_iso
parType_t m_iso
Definition
ClusterSort.h:35
TCS::ClusterSort::m_minEta
parType_t m_minEta
Definition
ClusterSort.h:33
TCS::ClusterSort::initialize
virtual TCS::StatusCode initialize()
Definition
ClusterSort.cxx:40
TCS::ClusterSort::m_doIsoCut
parType_t m_doIsoCut
Definition
ClusterSort.h:36
TCS::ClusterSort::ClusterSort
ClusterSort(const std::string &name)
Definition
ClusterSort.cxx:24
TCS::ClusterSort::m_maxEta
parType_t m_maxEta
Definition
ClusterSort.h:34
TCS::ClusterSort::m_numberOfClusters
parType_t m_numberOfClusters
Definition
ClusterSort.h:32
TCS::ClusterTOBArray
Definition
ClusterTOBArray.h:19
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< ClusterTOB >::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
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