ATLAS Offline Software
JetSort.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 // JetSort.cxx
5 // TopoCore
6 // Created by Joerg Stelzer on 11/10/12.
7 // algorithm to make sorted Jets lists
8 //
10 #include "L1TopoEvent/TOBArray.h"
12 #include "L1TopoEvent/GenericTOB.h"
13 #include <algorithm>
14 
15 REGISTER_ALG_TCS(JetSort)
16 
17 bool SortByEtLargest2(TCS::GenericTOB* tob1, TCS::GenericTOB* tob2)
18 {
19  return tob1->Et() > tob2->Et();
20 }
21 
22 
23 // constructor
24 TCS::JetSort::JetSort(const std::string & name) :
26 {
27  defineParameter( "InputWidth", 64 ); // for FW
28  defineParameter( "InputWidth1stStage", 16 ); // for FW
29  defineParameter( "OutputWidth", 10 );
30  defineParameter( "JetSize", 2 );
31  defineParameter( "MinEta", 0 );
32  defineParameter( "MaxEta", 31);
33  defineParameter( "DoEtaCut", 1);
35 }
36 
37 
39 {}
40 
41 
42 
45  m_numberOfJets = parameter("OutputWidth").value();
46  m_jsize = parameter("JetSize").value();
47  m_minEta = parameter("MinEta").value();
48  m_maxEta = parameter("MaxEta").value();
49  m_doEtaCut = parameter("DoEtaCut").value();
51 }
52 
53 
56  const JetTOBArray & jets = dynamic_cast<const JetTOBArray&>(input);
57  // because hw seems to be using different notation, for now 2 means 8x8 or JS1, and 1 JS2 a 4x4
58  m_jetsize = m_jsize==2?JetTOB::JS1:JetTOB::JS2;
59 
60  // fill output array with GenericTOBs builds from jets
61  for(JetTOBArray::const_iterator cl = jets.begin(); cl!= jets.end(); ++cl ) {
62  if (m_doEtaCut && (parType_t(std::abs((*cl)-> eta())) < m_minEta)) continue;
63  if (m_doEtaCut && (parType_t(std::abs((*cl)-> eta())) > m_maxEta)) continue;
64  output.push_back( GenericTOB(**cl, m_jetsize) );
65  }
66 
67  // sort
69 
70 
71  // keep only max number of jets
72  int par = m_numberOfJets;
73  unsigned int maxNumberOfJets = std::clamp(par, 0, std::abs(par));
74  if(maxNumberOfJets>0) {
75  while( output.size()> maxNumberOfJets ) {
76  output.pop_back();
77  }
78  }
80 }
81 
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::JetSort::m_jetsize
JetTOB::JetSize m_jetsize
Definition: JetSort.h:40
TCS::DataArrayImpl< JetTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
TCS::JetSort::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition: JetSort.cxx:55
TCS::JetTOB::JS2
@ JS2
Definition: JetTOB.h:21
TCS::JetTOB::JS1
@ JS1
Definition: JetTOB.h:21
SortByEtLargest2
bool SortByEtLargest2(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition: JetSort.cxx:17
JetTOBArray.h
TCS::JetSort::JetSort
JetSort(const std::string &name)
Definition: JetSort.cxx:24
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::JetSort::initialize
virtual TCS::StatusCode initialize()
Definition: JetSort.cxx:44
merge.output
output
Definition: merge.py:17
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
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TCS::JetTOBArray
Definition: JetTOBArray.h:21
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
TCS::JetSort::~JetSort
virtual ~JetSort()
Definition: JetSort.cxx:38
JetSort.h
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