17 #include "TLorentzVector.h"
25 , m_expression1(
"true")
26 , m_expression2(
"true")
27 , m_mass1Hypothesis(0.0)
28 , m_mass2Hypothesis(0.0)
31 , m_doTransverseMass(false)
33 declareInterface<DerivationFramework::IAugmentationTool>(
this);
47 ATH_MSG_ERROR(
"No SG name provided for the output of EGInvariantMassTool!");
48 return StatusCode::FAILURE;
79 return StatusCode::SUCCESS;
86 const EventContext& ctx = Gaudi::Hive::currentContext();
90 auto masses = std::make_unique<std::vector<float>>();
96 return StatusCode::SUCCESS;
101 std::vector<float>&
masses)
const
104 const std::vector<float>* pt1 =
nullptr;
107 pt1 = readHandle.ptr();
109 const std::vector<float>* pt2 =
nullptr;
112 pt2 = readHandle.ptr();
115 const std::vector<float>*
eta1 =
nullptr;
118 eta1 = readHandle.ptr();
120 const std::vector<float>*
eta2 =
nullptr;
123 eta2 = readHandle.ptr();
126 const std::vector<float>* phi1 =
nullptr;
129 phi1 = readHandle.ptr();
131 const std::vector<float>* phi2 =
nullptr;
134 phi2 = readHandle.ptr();
146 unsigned int nEntries1 = entries1.size();
148 unsigned int nEntries2 = entries2.size();
152 if (nEntries1 == 0 || nEntries2 == 0) {
153 return StatusCode::SUCCESS;
157 if (particles1->
size() != nEntries1) {
159 return StatusCode::FAILURE;
161 if (particles2->
size() != nEntries2) {
163 return StatusCode::FAILURE;
165 if ((pt1 && pt1->size() != nEntries1) ||
167 eta1->size() != nEntries1) ||
168 (phi1 && phi1->size() != nEntries1)) {
170 return StatusCode::FAILURE;
172 if ((pt2 && pt2->size() != nEntries2) ||
174 eta2->size() != nEntries2) ||
175 (phi2 && phi2->size() != nEntries2)) {
177 return StatusCode::FAILURE;
181 unsigned int outerIt, innerIt;
182 std::vector<std::vector<int>>
pairs;
183 for (outerIt = 0; outerIt < nEntries1; ++outerIt) {
184 for (innerIt = 0; innerIt < nEntries2; ++innerIt) {
185 std::vector<int> tmpPair;
186 if (entries1[outerIt] == 1 && entries2[innerIt] == 1) {
187 tmpPair.push_back(outerIt);
188 tmpPair.push_back(innerIt);
189 pairs.push_back(tmpPair);
200 type1 = ((*particles1)[0])->
type();
201 type2 = ((*particles2)[0])->
type();
205 "Cannot check charge for particles not of type electron or muon");
206 return StatusCode::FAILURE;
210 for (
const auto& pair :
pairs) {
211 unsigned int first = pair[0];
212 unsigned int second = pair[1];
213 float apt1 = pt1 ? (*pt1)[
first] : ((*particles1)[
first])->p4().Pt();
214 float apt2 = pt2 ? (*pt2)[
second] : ((*particles2)[
second])->p4().Pt();
215 float aeta1(-999.), aeta2(-999.);
217 aeta1 =
eta1 ? (*eta1)[
first] : ((*particles1)[
first])->p4().Eta();
220 float aphi1 = phi1 ? (*phi1)[
first] : ((*particles1)[
first])->p4().Phi();
221 float aphi2 = phi2 ? (*phi2)[
second] : ((*particles2)[
second])->p4().Phi();
224 float deta = aeta1 - aeta2;
225 float dphi = abs(aphi1 - aphi2);
226 if (dphi > TMath::Pi()) {
227 dphi = TMath::TwoPi() - dphi;
229 if (sqrt(deta * deta + dphi * dphi) <
m_mindR) {
235 float q1(0.), q2(0.);
240 ->primaryTrackParticle()
247 ->primaryTrackParticle()
254 TLorentzVector v1,
v2,
v;
262 float mass = (v1 +
v2).M();
265 return StatusCode::SUCCESS;