80{
81
82 const std::vector<float>* pt1 = nullptr;
85 pt1 = readHandle.
ptr();
86 }
87 const std::vector<float>* pt2 = nullptr;
90 pt2 = readHandle.
ptr();
91 }
92
93 const std::vector<float>*
eta1 =
nullptr;
97 }
98 const std::vector<float>*
eta2 =
nullptr;
102 }
103
104 const std::vector<float>* phi1 = nullptr;
107 phi1 = readHandle.
ptr();
108 }
109 const std::vector<float>* phi2 = nullptr;
112 phi2 = readHandle.
ptr();
113 }
114
116 ctx };
118 ctx };
121
122
123 std::vector<int> entries1 = m_parser[
kParser1]->evaluateAsVector();
124 unsigned int nEntries1 = entries1.size();
125 std::vector<int> entries2 = m_parser[
kParser2]->evaluateAsVector();
126 unsigned int nEntries2 = entries2.size();
127
128
129
130 if (nEntries1 == 0 || nEntries2 == 0) {
131 return StatusCode::SUCCESS;
132 }
133
134
135 if (particles1->
size() != nEntries1) {
137 return StatusCode::FAILURE;
138 }
139 if (particles2->
size() != nEntries2) {
141 return StatusCode::FAILURE;
142 }
143 if ((pt1 && pt1->size() != nEntries1) ||
145 eta1->size() != nEntries1) ||
146 (phi1 && phi1->size() != nEntries1)) {
148 return StatusCode::FAILURE;
149 }
150 if ((pt2 && pt2->size() != nEntries2) ||
152 eta2->size() != nEntries2) ||
153 (phi2 && phi2->size() != nEntries2)) {
155 return StatusCode::FAILURE;
156 }
157
158
159 unsigned int outerIt, innerIt;
160 std::vector<std::vector<int>>
pairs;
161 for (outerIt = 0; outerIt < nEntries1; ++outerIt) {
162 for (innerIt = 0; innerIt < nEntries2; ++innerIt) {
163 std::vector<int> tmpPair;
164 if (entries1[outerIt] == 1 && entries2[innerIt] == 1) {
165 tmpPair.push_back(outerIt);
166 tmpPair.push_back(innerIt);
167 pairs.push_back(std::move(tmpPair));
168 }
169 }
170 }
171
172
173
174
178 type1 = ((*particles1)[0])->
type();
179 type2 = ((*particles2)[0])->
type();
183 "Cannot check charge for particles not of type electron or muon");
184 return StatusCode::FAILURE;
185 }
186 }
187
188 for (const auto& pair : pairs) {
189 unsigned int first = pair[0];
190 unsigned int second = pair[1];
191 float apt1 = pt1 ? (*pt1)[
first] : ((*particles1)[
first])->p4().Pt();
192 float apt2 = pt2 ? (*pt2)[
second] : ((*particles2)[
second])->p4().Pt();
193 float aeta1(-999.), aeta2(-999.);
195 aeta1 =
eta1 ? (*eta1)[
first] : ((*particles1)[
first])->p4().Eta();
197 }
198 float aphi1 = phi1 ? (*phi1)[
first] : ((*particles1)[
first])->p4().Phi();
199 float aphi2 = phi2 ? (*phi2)[
second] : ((*particles2)[
second])->p4().Phi();
200
202 float deta = aeta1 - aeta2;
203 float dphi = std::abs(aphi1 - aphi2);
204 if (dphi > std::numbers::pi) {
205 dphi = (2*std::numbers::pi) - dphi;
206 }
207 if (std::sqrt(deta * deta + dphi * dphi) <
m_mindR) {
208 continue;
209 }
210 }
211
213 float q1(0.), q2(0.);
218 ->trackParticle(xAOD::Muon::TrackParticleType::Primary)
219 ->charge();
220 }
225 ->trackParticle(xAOD::Muon::TrackParticleType::Primary)
226 ->charge();
227 }
228 if (q1 * q2 > 0.) {
229 continue;
230 }
231 }
232 TLorentzVector v1,
v2,
v;
236 } else {
239 }
240 float mass = (v1 +
v2).M();
242 }
243 return StatusCode::SUCCESS;
244}
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
size_type size() const noexcept
Returns the number of elements in the collection.
const_pointer_type ptr()
Dereference the pointer.
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ Other
An object not falling into any of the other categories.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
setEt setPhi setE277 setWeta2 eta1
Muon_v1 Muon
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.