ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterAbbreviated.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4// ClusterAbbreviated.cxx
5// TopoCore
6// Created by V Sorin, Joerg Stelzer
7// Algorithm to select the abbreviated list of clusters , no order is applied
8//
13#include <algorithm>
14
15REGISTER_ALG_TCS(ClusterAbbreviated)
16
17// constructor
19 defineParameter( "NumberOfClusters", 0 );
20 defineParameter( "MinIsolation", 0);
21 defineParameter( "MinEta", 0 );
22 defineParameter( "MaxEta", 49);
23}
24
25
26// destructor
28
31
32 const ClusterTOBArray & clusters = dynamic_cast<const ClusterTOBArray&>(input);
33
34 // fill output array with GenericTOB buildt from clusters
35 for(ClusterTOBArray::const_iterator cl = clusters.begin(); cl!= clusters.end(); ++cl ) {
36 const GenericTOB gtob(**cl);
37
38 // isolation cut
39 if((*cl)->isolation() < parameter("MinIsolation").value()) continue;
40 // eta cut
41 if (parType_t(std::abs((*cl)-> eta())) < parameter("MinEta").value()) continue;
42 if (parType_t(std::abs((*cl)-> eta())) > parameter("MaxEta").value()) continue;
43
44 output.push_back( gtob );
45 }
46
47
48 // keep only max number of clusters
49 int par = parameter("NumberOfClusters").value();
50 unsigned int maxNumberOfClusters = std::clamp(par, 0, std::abs(par));
51 if(maxNumberOfClusters>0) {
52 while( output.size()> maxNumberOfClusters ) {
53 output.pop_back();
54 }
55 }
57}
58
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
Scalar eta() const
pseudorapidity method
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
ClusterAbbreviated(const std::string &name)
const Parameter & parameter(const std::string &parameterName) const
const std::string & name() const
void defineParameter(const std::string &name, TCS::parType_t value)
data_t::const_iterator const_iterator
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
uint32_t parType_t
Definition Parameter.h:22
STL namespace.