ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterSelect.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4// ClusterSelect.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(ClusterSelect)
16
17// constructor
19 defineParameter( "InputWidth", 120 ); // for fw
20 defineParameter( "InputWidth1stStage", 30 ); // for fw
21 defineParameter( "OutputWidth", 6 );
22 defineParameter( "MinET", 0 );
23 defineParameter( "IsoMask", 0);
24 defineParameter( "MinEta", 0 );
25 defineParameter( "MaxEta", 63);
26 defineParameter( "DoIsoCut", 1);
27}
28
29
30// destructor
32
35 m_numberOfClusters = parameter("OutputWidth").value();
36 m_et = parameter("MinET").value();
37 m_iso = parameter("IsoMask").value();
38 m_minEta = parameter("MinEta").value();
39 m_maxEta = parameter("MaxEta").value();
40 m_doIsoCut = parameter("DoIsoCut").value();
42}
43
46
47 const ClusterTOBArray & clusters = dynamic_cast<const ClusterTOBArray&>(input);
48
49 // fill output array with GenericTOB buildt from clusters
50 for(ClusterTOBArray::const_iterator cl = clusters.begin(); cl!= clusters.end(); ++cl ) {
51 const GenericTOB gtob(**cl);
52
53 if( parType_t((*cl)->Et()) <= m_et ) continue; // ET cut
54 // isolation cut
55 if (m_doIsoCut && (m_iso != 0 )) {
56 if((parType_t((*cl)->isolation()) & m_iso) != m_iso ) continue;
57 }
58 // eta cut
59 if (parType_t(std::abs((*cl)-> eta())) < m_minEta) continue;
60 if (parType_t(std::abs((*cl)-> eta())) > m_maxEta) continue;
61
62 output.push_back( gtob );
63 }
64
65
66 // keep only max number of clusters
67 int par = m_numberOfClusters ;
68 unsigned int maxNumberOfClusters = std::clamp(par, 0, std::abs(par));
69 if(maxNumberOfClusters>0) {
70
71 if (output.size()> maxNumberOfClusters) {setOverflow(true);}
72
73 while( output.size()> maxNumberOfClusters ) {
74 output.pop_back();
75 }
76 }
78}
79
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
Scalar eta() const
pseudorapidity method
parType_t m_numberOfClusters
ClusterSelect(const std::string &name)
virtual TCS::StatusCode initialize()
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
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 & setOverflow(const bool v)
setter, to propagate bit from input event
Definition SortingAlg.h:37
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
uint32_t parType_t
Definition Parameter.h:22
STL namespace.