79{
80
81 const std::vector<float>* pt1 = nullptr;
84 pt1 = readHandle.
ptr();
85 }
86 const std::vector<float>* pt2 = nullptr;
89 pt2 = readHandle.
ptr();
90 }
91
92 const std::vector<float>*
eta1 =
nullptr;
96 }
97 const std::vector<float>*
eta2 =
nullptr;
101 }
102
103 const std::vector<float>* phi1 = nullptr;
106 phi1 = readHandle.
ptr();
107 }
108 const std::vector<float>* phi2 = nullptr;
111 phi2 = readHandle.
ptr();
112 }
113
115 ctx };
117 ctx };
120
121
122 std::vector<int> entries1 = m_parser[
kParser1]->evaluateAsVector();
123 unsigned int nEntries1 = entries1.size();
124 std::vector<int> entries2 = m_parser[
kParser2]->evaluateAsVector();
125 unsigned int nEntries2 = entries2.size();
126
127
128
129 if (nEntries1 == 0 || nEntries2 == 0) {
130 return StatusCode::SUCCESS;
131 }
132
133
134 if (particles1->
size() != nEntries1) {
136 return StatusCode::FAILURE;
137 }
138 if (particles2->
size() != nEntries2) {
140 return StatusCode::FAILURE;
141 }
142 if ((pt1 && pt1->size() != nEntries1) ||
144 eta1->size() != nEntries1) ||
145 (phi1 && phi1->size() != nEntries1)) {
147 return StatusCode::FAILURE;
148 }
149 if ((pt2 && pt2->size() != nEntries2) ||
151 eta2->size() != nEntries2) ||
152 (phi2 && phi2->size() != nEntries2)) {
154 return StatusCode::FAILURE;
155 }
156
157
158 unsigned int outerIt, innerIt;
159 std::vector<std::vector<int>>
pairs;
160 for (outerIt = 0; outerIt < nEntries1; ++outerIt) {
161 for (innerIt = 0; innerIt < nEntries2; ++innerIt) {
162 std::vector<int> tmpPair;
163 if (entries1[outerIt] == 1 && entries2[innerIt] == 1) {
164 tmpPair.push_back(outerIt);
165 tmpPair.push_back(innerIt);
166 pairs.push_back(tmpPair);
167 }
168 }
169 }
170
171
172
173
177 type1 = ((*particles1)[0])->
type();
178 type2 = ((*particles2)[0])->
type();
182 "Cannot check charge for particles not of type electron or muon");
183 return StatusCode::FAILURE;
184 }
185 }
186
187 for (const auto& pair : pairs) {
188 unsigned int first = pair[0];
189 unsigned int second = pair[1];
190 float apt1 = pt1 ? (*pt1)[
first] : ((*particles1)[
first])->p4().Pt();
191 float apt2 = pt2 ? (*pt2)[
second] : ((*particles2)[
second])->p4().Pt();
192 float aeta1(-999.), aeta2(-999.);
194 aeta1 =
eta1 ? (*eta1)[
first] : ((*particles1)[
first])->p4().Eta();
196 }
197 float aphi1 = phi1 ? (*phi1)[
first] : ((*particles1)[
first])->p4().Phi();
198 float aphi2 = phi2 ? (*phi2)[
second] : ((*particles2)[
second])->p4().Phi();
199
201 float deta = aeta1 - aeta2;
202 float dphi = abs(aphi1 - aphi2);
203 if (dphi > TMath::Pi()) {
204 dphi = TMath::TwoPi() - dphi;
205 }
206 if (sqrt(deta * deta + dphi * dphi) <
m_mindR) {
207 continue;
208 }
209 }
210
212 float q1(0.), q2(0.);
217 ->primaryTrackParticle()
218 ->charge();
219 }
224 ->primaryTrackParticle()
225 ->charge();
226 }
227 if (q1 * q2 > 0.) {
228 continue;
229 }
230 }
231 TLorentzVector v1,
v2,
v;
235 } else {
238 }
239 float mass = (v1 +
v2).M();
241 }
242 return StatusCode::SUCCESS;
243}
#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.