ATLAS Offline Software
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 //
10 #include "L1TopoEvent/TOBArray.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
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
37 
38 
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();
47 }
48 
49 
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  }
83 }
84 
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::parType_t
uint32_t parType_t
Definition: Parameter.h:22
TCS::ClusterSort::ClusterSort
ClusterSort(const std::string &name)
Definition: ClusterSort.cxx:24
TCS::DataArrayImpl< ClusterTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
TCS::ClusterTOBArray
Definition: ClusterTOBArray.h:19
ClusterTOBArray.h
SortByEtLargest
bool SortByEtLargest(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition: ClusterSort.cxx:17
TCS::ConfigurableAlg::defineParameter
void defineParameter(const std::string &name, TCS::parType_t value)
Definition: ConfigurableAlg.cxx:201
TCS::InputTOBArray
Definition: InputTOBArray.h:15
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TOBArray.h
TCS::TOBArray
Definition: TOBArray.h:24
TCS::ClusterSort::initialize
virtual TCS::StatusCode initialize()
Definition: ClusterSort.cxx:40
merge.output
output
Definition: merge.py:17
ClusterSort.h
TCS::GenericTOB
Definition: GenericTOB.h:35
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition: AlgFactory.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
TCS::SortingAlg
Definition: SortingAlg.h:18
GenericTOB.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
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15