ATLAS Offline Software
Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.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  * DeltaRSqrIncl2.cxx
6  * Based on same-named code in L1TopoSimulation
7  *
8  * @brief algorithm calculates the R2-distance between two lists and
9  * applies dR criteria
10  *
11  * @param NumberLeading
12  **********************************/
13 
14 
15 #include "DeltaRSqrIncl2.h"
16 
17 #include "L1TopoSimulationUtils/Kinematics.h" // calcDeltaR2BW()
18 
20 
21 #include "../IO/GenericTOBArray.h"
22 #include "../IO/Decision.h"
23 
24 #include "GaudiKernel/StatusCode.h"
25 #include <sstream>
26 
27 namespace GlobalSim {
28  DeltaRSqrIncl2::DeltaRSqrIncl2(const std::string & name,
29  unsigned int maxTOB1,
30  unsigned int maxTOB2,
31  const std::vector<unsigned int>& minET1,
32  const std::vector<unsigned int>& minET2,
33  const std::vector<unsigned int>& deltaRMin,
34  const std::vector<unsigned int>& deltaRMax,
35  unsigned int NumResultBits):
36 
37  m_name{name},
38  m_MaxTOB1{maxTOB1},
39  m_MaxTOB2{maxTOB2},
40  m_MinET1{minET1},
41  m_MinET2{minET2},
42  m_DeltaRMin{deltaRMin},
43  m_DeltaRMax{deltaRMax},
44  m_NumResultBits{NumResultBits}{
45  }
46 
49  const GlobalSim::GenericTOBArray& tobArray2,
50  std::vector<GenericTOBArray>& output,
51  Decision& decision) {
52 
53  std::size_t count1{0u};
54  std::size_t count2{0u};
55 
56  output.clear();
57  output.reserve(m_NumResultBits);
58  for (std::size_t i = 0; i != m_NumResultBits; ++i) {
59  std::stringstream ss;
60  ss << "SimpleCone bit " << i;
61  output.push_back(GenericTOBArray(ss.str()));
62  }
63 
64 
65  // consider all tob pairs formed by 1 tob from tobArray1 and
66  // 1 tob formed from tobArray2 up to the number of leading tobs
67  for(GenericTOBArray::const_iterator i_tob1 = tobArray1.begin();
68  i_tob1 != tobArray1.end();
69  ++i_tob1) {
70 
71  if (++count1 == m_MaxTOB1) {break;}
72  const auto& tob1 = *i_tob1;
73 
74  for(GenericTOBArray::const_iterator i_tob2 = tobArray2.begin();
75  i_tob2 != tobArray2.end();
76  ++i_tob2) {
77 
78  if (++count2 == m_MaxTOB2) {break;}
79 
80  const auto& tob2 = *i_tob2;
81 
82  // test DeltaR2Min, DeltaR2Max
83  unsigned int deltaR2 = TSU::Kinematics::calcDeltaR2(tob1, tob2);
84 
85  for(unsigned int i=0; i<m_NumResultBits; ++i) {
86  bool accept = false;
87  if( tob1->Et() <= m_MinET1[i]) continue; // ET cut
88  if( tob2->Et() <= m_MinET2[i]) continue; // ET cut
90 
91  if(accept) {
92  decision.setBit(i, true);
93  output[i].push_back(TCS::CompositeTOB(tob1, tob2));
94  }
95 
96  if (accept) {
97  m_DeltaRSqPass[i].push_back(deltaR2);
98  } else {
99  m_DeltaRSqFail[i].push_back(deltaR2);
100  }
101  }
102  }
103  }
104 
105  return StatusCode::SUCCESS;
106  }
107 
108  unsigned int DeltaRSqrIncl2::numResultBits() const {
109  return m_NumResultBits;
110  }
111 
112  const std::vector<double>&
113  DeltaRSqrIncl2::deltaRSqPassByBit(std::size_t bit) const {
114  return m_DeltaRSqPass.at(bit);
115  }
116 
117  const std::vector<double>&
118  DeltaRSqrIncl2::deltaRSqFailByBit(std::size_t bit) const {
119  return m_DeltaRSqFail.at(bit);
120  }
121 
122 
123 
124 
125  std::string DeltaRSqrIncl2::toString() const{
126  std::stringstream ss;
127  ss << "DeltaRSqrIncl2. "
128  << " name: " << m_name
129  << " MaxTOB1 " << m_MaxTOB1
130  << " MaxTOB2 " << m_MaxTOB2
131  << " n result bits " << m_NumResultBits;
132 
133 
134  ss << "\n min deltaR [" << m_DeltaRMin.size() << "]\n";
135 
136  for(const auto& v: m_DeltaRMin){
137  ss << " " << v << " ";
138  }
139 
140  ss << "\n max deltaR[" << m_DeltaRMax.size() << "]:\n";
141 
142  for(const auto& v: m_DeltaRMax){
143  ss << " " << v << " ";
144  }
145 
146  ss << "\n min ET1 [" << m_MinET1.size() << "]:\n";
147  for(const auto& v: m_MinET1){
148  ss << " " << v << " ";
149  }
150 
151  ss << "\n min ET2 [" << m_MinET2.size() << "]:\n";
152 
153 
154  for(const auto& v: m_MinET2){
155  ss << " " << v << " ";
156  }
157 
158  return ss.str();
159  }
160 }
161 
Kinematics.h
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
GlobalSim::DeltaRSqrIncl2::m_DeltaRSqPass
std::vector< std::vector< double > > m_DeltaRSqPass
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:66
GlobalSim::DeltaRSqrIncl2::deltaRSqPassByBit
const std::vector< double > & deltaRSqPassByBit(std::size_t bit) const
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:121
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
GlobalSim::DeltaRSqrIncl2::numResultBits
unsigned int numResultBits() const
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:116
CompositeTOB.h
GlobalSim::DeltaRSqrIncl2::m_DeltaRMin
std::vector< unsigned int > m_DeltaRMin
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:59
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition: xAODP4Helpers.h:111
GlobalSim::DeltaRSqrIncl2::toString
std::string toString() const
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:133
GlobalSim::DeltaRSqrIncl2::run
StatusCode run(const GenericTOBArray &in0, const GenericTOBArray &in1, std::vector< GenericTOBArray > &output, Decision &)
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:56
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
TCS::DataArrayImpl::end
iterator end()
Definition: DataArrayImpl.h:43
GlobalSim::DeltaRSqrIncl2::m_MinET2
std::vector< unsigned int > m_MinET2
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:57
GlobalSim::DeltaRSqrIncl2::m_name
std::string m_name
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:52
GlobalSim::DeltaRSqrIncl2::m_MaxTOB1
unsigned int m_MaxTOB1
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:53
TSU::Kinematics::calcDeltaR2
static unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: Kinematics.cxx:266
GlobalSim::DeltaRSqrIncl2::m_DeltaRSqFail
std::vector< std::vector< double > > m_DeltaRSqFail
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:71
GlobalSim
AlgTool to obtain a GlobalSim::cTAUTOBArray This class uses ReadHandls to jFex and eFex Tau Rois If t...
Definition: dump.h:8
GlobalSim::DeltaRSqrIncl2::m_DeltaRMax
std::vector< unsigned int > m_DeltaRMax
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:60
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TCS::CompositeTOB
Definition: CompositeTOB.h:16
GlobalSim::GenericTOBArray
Definition: GenericTOBArray.h:32
DeltaRSqrIncl2.h
GlobalSim::DeltaRSqrIncl2::deltaRSqFailByBit
const std::vector< double > & deltaRSqFailByBit(std::size_t bit) const
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:126
merge.output
output
Definition: merge.py:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
GlobalSim::DeltaRSqrIncl2::m_MaxTOB2
unsigned int m_MaxTOB2
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:54
TCS::DataArrayImpl::begin
iterator begin()
Definition: DataArrayImpl.h:40
python.PyAthena.v
v
Definition: PyAthena.py:157
GlobalSim::DeltaRSqrIncl2::m_NumResultBits
unsigned int m_NumResultBits
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:62
GlobalSim::DeltaRSqrIncl2::DeltaRSqrIncl2
DeltaRSqrIncl2(const std::string &name, unsigned int MaxTOB1, unsigned int MaxTOB2, const std::vector< unsigned int > &MinET1, const std::vector< unsigned int > &MinET2, const std::vector< unsigned int > &DeltaRMin, const std::vector< unsigned int > &DeltaRMax, unsigned int NumResultBits)
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.cxx:36
GlobalSim::DeltaRSqrIncl2::m_MinET1
std::vector< unsigned int > m_MinET1
Definition: Global/GlobalSimulation/src/L1TopoAlgs/DeltaRSqrIncl2.h:56