ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
ClusterSortingAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
// ClusterSortingAlg.cxx
5
// TopoCore
6
// Created by V Sorin, Joerg Stelzer .
7
// algorithm to make list of cluster, pt order applied
8
//
9
#include "
L1TopoAlgorithms/ClusterSortingAlg.h
"
10
#include "
L1TopoEvent/TOBArray.h
"
11
#include "
L1TopoEvent/ClusterTOBArray.h
"
12
#include "
L1TopoEvent/GenericTOB.h
"
13
#include <algorithm>
14
15
REGISTER_ALG_TCS
(ClusterSortingAlg)
16
17
bool
SortByEtLargestFirst
(
TCS
::GenericTOB* tob1,
TCS
::GenericTOB* tob2)
18
{
19
return
tob1->Et() > tob2->Et();
20
}
21
22
bool
SortByEtSmallestFirst
(
TCS::GenericTOB
* tob1,
TCS::GenericTOB
* tob2)
23
{
24
return
tob1->
Et
() < tob2->
Et
();
25
}
26
27
// constructor
28
TCS::ClusterSortingAlg::ClusterSortingAlg
(
const
std::string &
name
) :
SortingAlg
(
name
) {
29
defineParameter
(
"NumberOfClusters"
, 0 );
30
defineParameter
(
"ReverseOrder"
, 0 );
31
defineParameter
(
"MinIsolation"
, 0);
32
defineParameter
(
"MinEta"
, 0 );
33
defineParameter
(
"MaxEta"
, 49);
34
}
35
36
37
// destructor
38
TCS::ClusterSortingAlg::~ClusterSortingAlg
() {}
39
40
TCS::StatusCode
41
TCS::ClusterSortingAlg::sort
(
const
InputTOBArray
& input,
TOBArray
& output) {
42
43
const
ClusterTOBArray
& clusters =
dynamic_cast<
const
ClusterTOBArray
&
>
(input);
44
45
// fill output array with GenericTOB buildt from clusters
46
for
(
ClusterTOBArray::const_iterator
cl = clusters.begin(); cl!= clusters.end(); ++cl ) {
47
const
GenericTOB
gtob(**cl);
48
49
if
(
parType_t
(std::abs((*cl)->
eta
())) <
parameter
(
"MinEta"
).value())
continue
;
50
if
(
parType_t
(std::abs((*cl)->
eta
())) >
parameter
(
"MaxEta"
).value())
continue
;
51
52
// isolation cut
53
if
(
parType_t
((*cl)->isolation()) <
parameter
(
"MinIsolation"
).value())
continue
;
54
55
output.push_back( gtob );
56
}
57
58
// sort, possibly in reversed order
59
int
reverseOrder =
parameter
(
"ReverseOrder"
).value();
60
if
(reverseOrder==1) {
61
output.sort(
SortByEtSmallestFirst
);
62
}
else
{
63
output.sort(
SortByEtLargestFirst
);
64
}
65
66
// keep only max number of clusters
67
int
par =
parameter
(
"NumberOfClusters"
).value();
68
unsigned
int
maxNumberOfClusters = std::clamp(par, 0, std::abs(par));
69
if
(maxNumberOfClusters>0) {
70
while
( output.size()> maxNumberOfClusters ) {
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
SortByEtSmallestFirst
bool SortByEtSmallestFirst(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
ClusterSortingAlg.cxx:22
SortByEtLargestFirst
bool SortByEtLargestFirst(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition
ClusterSortingAlg.cxx:17
ClusterSortingAlg.h
ClusterTOBArray.h
GenericTOB.h
TOBArray.h
TCS::ClusterSortingAlg::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition
ClusterSortingAlg.cxx:41
TCS::ClusterSortingAlg::ClusterSortingAlg
ClusterSortingAlg(const std::string &name)
Definition
ClusterSortingAlg.cxx:28
TCS::ClusterSortingAlg::~ClusterSortingAlg
virtual ~ClusterSortingAlg()
Definition
ClusterSortingAlg.cxx:38
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::GenericTOB::Et
unsigned int Et() const
Definition
GenericTOB.h:113
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