ATLAS Offline Software
JetSortingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 // JetSortingAlg.cxx
5 // TopoCore
6 // Created by Joerg Stelzer on 11/10/12.
7 
9 #include "L1TopoEvent/TOBArray.h"
11 #include "L1TopoEvent/GenericTOB.h"
12 #include <algorithm>
13 
14 REGISTER_ALG_TCS(JetSortingAlg)
15 
16 bool SortByEtLargestFirst2(TCS::GenericTOB* tob1, TCS::GenericTOB* tob2)
17 {
18  return tob1->Et() > tob2->Et();
19 }
20 
22 {
23  return tob1->Et() < tob2->Et();
24 }
25 
26 // constructor
29 {
30  defineParameter( "NumberOfJets", 0 );
31  defineParameter( "ReverseOrder", 0 );
32  defineParameter( "JetSize", 0 );
33  defineParameter( "MinEta", 0 );
34  defineParameter( "MaxEta", 49);
36 }
37 
38 
40 {}
41 
42 
43 
44 
45 
46 
49  const JetTOBArray & jets = dynamic_cast<const JetTOBArray&>(input);
50  // because hw seems to be using different notation, for now 2 means 8x8 or JS1, and 1 JS2 a 4x4
51  m_jetsize = parameter("JetSize").value()==2?JetTOB::JS1:JetTOB::JS2;
52 
53  // fill output array with GenericTOBs builds from jets
54  for(JetTOBArray::const_iterator cl = jets.begin(); cl!= jets.end(); ++cl ) {
55  if (parType_t(std::abs((*cl)-> eta())) < parameter("MinEta").value()) continue;
56  if (parType_t(std::abs((*cl)-> eta())) > parameter("MaxEta").value()) continue;
57  output.push_back( GenericTOB(**cl, m_jetsize) );
58  }
59 
60  // sort, possibly in reversed order
61  int reverseOrder = parameter("ReverseOrder").value();
62  if(reverseOrder==1) {
64  } else {
66  }
67 
68  // keep only max number of jets
69  int par = parameter("NumberOfJets").value();
70  unsigned int maxNumberOfJets = std::clamp(par, 0, std::abs(par));
71  if(maxNumberOfJets>0) {
72  while( output.size()> maxNumberOfJets ) {
73  output.pop_back();
74  }
75  }
77 }
78 
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::DataArrayImpl< JetTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
JetSortingAlg.h
TCS::JetTOB::JS2
@ JS2
Definition: JetTOB.h:21
athena.value
value
Definition: athena.py:122
TCS::JetTOB::JS1
@ JS1
Definition: JetTOB.h:21
TCS::GenericTOB::Et
unsigned int Et() const
Definition: GenericTOB.h:113
SortByEtSmallestFirst2
bool SortByEtSmallestFirst2(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition: JetSortingAlg.cxx:21
JetTOBArray.h
SortByEtLargestFirst2
bool SortByEtLargestFirst2(TCS::GenericTOB *tob1, TCS::GenericTOB *tob2)
Definition: JetSortingAlg.cxx:16
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::JetSortingAlg::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition: JetSortingAlg.cxx:48
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:192
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
TCS::SortingAlg
Definition: SortingAlg.h:18
TCS::JetSortingAlg::~JetSortingAlg
virtual ~JetSortingAlg()
Definition: JetSortingAlg.cxx:39
GenericTOB.h
TCS::JetSortingAlg::JetSortingAlg
JetSortingAlg(const std::string &name)
Definition: JetSortingAlg.cxx:27
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
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::JetSortingAlg::m_jetsize
JetTOB::JetSize m_jetsize
Definition: JetSortingAlg.h:33
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15