ATLAS Offline Software
Global/GlobalSimulation/src/L1TopoAlgs/SimpleCone.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 /*********************************
5  * SimpleCone.cpp
6  *
7  * @brief algorithm calculates the sum of jets ET around each jet within
8  * radius R, makes cut on leading sum ET
9  *
10  **********************************/
11 
12 #include "SimpleCone.h"
15 
16 #include "../IO/GenericTOBArray.h"
17 #include "../IO/Decision.h"
18 
19 #include <sstream>
20 #include <algorithm>
21 
22 namespace GlobalSim {
23  SimpleCone::SimpleCone(const std::string & name,
24  unsigned int InputWidth,
25  unsigned int MaxRSqr,
26  unsigned int MinET,
27  const std::vector<unsigned int>& MinSumET) :
28  m_name{name},
29  m_InputWidth{InputWidth},
30  m_MaxRSqr{MaxRSqr},
31  m_MinET{MinET},
32  m_MinSumET{MinSumET} {
33  }
34 
37  std::vector<GenericTOBArray>& output,
38  Decision& decision) {
39 
40 
41 
42  auto numberOutputBits = m_MinSumET.size();
43  output.clear();
44  output.reserve(numberOutputBits);
45  for (std::size_t i = 0; i != numberOutputBits; ++i) {
46  std::stringstream ss;
47  ss << "SimpleCone bit " << i;
48  output.push_back(GenericTOBArray(ss.str()));
49  }
50 
51  decision.setNBits(numberOutputBits);
52 
53  unsigned int leadingET = 0;
54 
55  auto end = std::min(input.begin() + m_InputWidth, input.end());
56  for( GenericTOBArray::const_iterator itr0 = input.begin();
57  itr0 != end;
58  ++itr0) {
59 
60  if((*itr0)->Et() <= m_MinET ) continue; // E_T cut
61 
62  unsigned int tmp_SumET = (*itr0)->Et();
63 
64  for(GenericTOBArray::const_iterator itr1 = input.begin();
65  itr1 != end;
66  ++itr1) {
67 
68  if( itr1 == itr0 ) {
69  continue; // Avoid double counting of central jet
70  }
71  if((*itr1)->Et() <= m_MinET) continue; // E_T cut
72 
73  unsigned int deltaR2 = TSU::Kinematics::calcDeltaR2BW(*itr1, *itr0);
74 
75  if (deltaR2 > m_MaxRSqr) {
76  continue; // Exclude jets outside cone
77  }
78 
79  tmp_SumET += (*itr1)->Et();
80  }
81 
82  if (tmp_SumET > leadingET) {
83  leadingET = tmp_SumET;
84  }
85  }
86 
87  for(unsigned int i=0; i< numberOutputBits; ++i) {
88 
89  bool accept = leadingET > m_MinSumET[i];
90  decision.setBit(i, accept);
91 
92  if(accept) {
94  m_ETPassByBit[i].push_back(leadingET);
95  } else{
96  m_ETFailByBit[i].push_back(leadingET);
97  }
98  }
99 
100  return StatusCode::SUCCESS;
101  }
102 
103  const std::vector<double>& SimpleCone::ETPassByBit(std::size_t i) const {
104  return m_ETPassByBit.at(i);
105  }
106 
107  const std::vector<double>& SimpleCone::ETFailByBit(std::size_t i) const {
108  return m_ETFailByBit.at(i);
109  }
110 
111  std::string SimpleCone::toString() const {
112  std::stringstream ss;
113  ss << "SimpleCone. name: " << m_name << '\n'
114  << " InputWidth: " << m_InputWidth
115  << " MaxRSqr " << m_MaxRSqr
116  << " MinET " << m_MinET
117  << " MinSumET [" << m_MinSumET.size() << "]: ";
118 
119 
120  for (const auto& et : m_MinSumET) {
121  ss << et << " ";
122  }
123 
124  return ss.str();
125  };
126 
127 }
Kinematics.h
et
Extra patterns decribing particle interation process.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TCS::DataArrayImpl< TCS::GenericTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
CompositeTOB.h
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
TSU::Kinematics::calcDeltaR2BW
static unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: Kinematics.cxx:131
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition: xAODP4Helpers.h:111
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TCS::GenericTOB::createOnHeap
static GenericTOB * createOnHeap(const GenericTOB &)
Definition: GenericTOB.cxx:264
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TCS::CompositeTOB
Definition: CompositeTOB.h:16
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
GlobalSim::GenericTOBArray
Definition: GenericTOBArray.h:32
SimpleCone.h
merge.output
output
Definition: merge.py:17
TCS::GenericTOB
Definition: GenericTOB.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
GlobalSim::SimpleCone::SimpleCone
SimpleCone(const std::string &name, unsigned int InputWidth, unsigned int MaxRSqr, unsigned int MinET, const std::vector< unsigned int > &MinSumET)
Definition: Global/GlobalSimulation/src/L1TopoAlgs/SimpleCone.cxx:29