ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterNoSort.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4// ClusterNoSort.cxx
5// TopoCore
6// Created by V Sorin, Joerg Stelzer
7// Algorithm to create the all list of clusters , no order is applied
8//
13#include <algorithm>
14
15REGISTER_ALG_TCS(ClusterNoSort)
16
17// constructor
19 defineParameter( "InputWidth", 120 ); // for fw
20 defineParameter( "OutputWidth", 120 );
21 defineParameter( "IsoMask", 0);
22}
23
24
25// destructor
27
30 m_numberOfClusters = parameter("OutputWidth").value();
31 m_iso = parameter("IsoMask").value();
33}
34
37
38 const ClusterTOBArray & clusters = dynamic_cast<const ClusterTOBArray&>(input);
39
40 // fill output array with GenericTOB buildt from clusters
41 for(ClusterTOBArray::const_iterator cl = clusters.begin(); cl!= clusters.end(); ++cl ) {
42 const GenericTOB gtob(**cl);
43
44 // isolation cut
45 if (m_iso != 0 ) {
46 unsigned int isobit(0x1 << (m_iso-1));
47 if((parType_t((*cl)->isolation()) & isobit) != isobit ) continue;
48 }
49
50 output.push_back( gtob );
51 }
52
53
54 // keep only max number of clusters
55 int par = m_numberOfClusters ;
56 unsigned int maxNumberOfClusters = std::clamp(par, 0, std::abs(par));
57 if(maxNumberOfClusters>0) {
58 while( output.size()> maxNumberOfClusters ) {
59 output.pop_back();
60 }
61 }
63}
64
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
ClusterNoSort(const std::string &name)
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
virtual TCS::StatusCode initialize()
parType_t m_numberOfClusters
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.