ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DerivationFramework::EGTransverseMassTool Class Reference

#include <EGTransverseMassTool.h>

Inheritance diagram for DerivationFramework::EGTransverseMassTool:
Collaboration diagram for DerivationFramework::EGTransverseMassTool:

Public Member Functions

virtual StatusCode initialize () override final
 
virtual StatusCode addBranches (const EventContext &ctx) const override final
 

Private Member Functions

StatusCode getTransverseMasses (const EventContext &ctx, std::vector< float > &) const
 

Private Attributes

Gaudi::Property< std::string > m_expression1 {this, "ObjectRequirements", "true"}
 
Gaudi::Property< float > m_METmin {this, "METmin", -999.f}
 
Gaudi::Property< float > m_mass1Hypothesis {this, "ObjectMassHypothesis", 0.f}
 
SG::WriteHandleKey< std::vector< float > > m_sgName
 
SG::ReadHandleKey< xAOD::IParticleContainerm_container1Name
 
SG::ReadHandleKey< xAOD::MissingETContainerm_container2Name
 
SG::ReadHandleKey< std::vector< float > > m_pt1BranchName
 
SG::ReadHandleKey< std::vector< float > > m_phi1BranchName
 
SG::ReadHandleKey< std::vector< float > > m_pt2BranchName
 
SG::ReadHandleKey< std::vector< float > > m_phi2BranchName
 

Detailed Description

Definition at line 27 of file EGTransverseMassTool.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::EGTransverseMassTool::addBranches ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 70 of file EGTransverseMassTool.cxx.

71 {
72  SG::WriteHandle<std::vector<float>> writeHandle{ m_sgName, ctx };
73 
74  // create the vector which will hold the values invariant masses
75  auto masses = std::make_unique<std::vector<float>>();
76  // compute the invariant mass values
78 
79  ATH_CHECK(writeHandle.record(std::move(masses)));
80 
81  return StatusCode::SUCCESS;
82 }

◆ getTransverseMasses()

StatusCode DerivationFramework::EGTransverseMassTool::getTransverseMasses ( const EventContext &  ctx,
std::vector< float > &  masses 
) const
private

Definition at line 85 of file EGTransverseMassTool.cxx.

87 {
88  // Get optional payload
89  const std::vector<float>* pt1 = nullptr;
90  if (!m_pt1BranchName.key().empty()) {
92  pt1 = readHandle.ptr();
93  }
94  const std::vector<float>* pt2 = nullptr;
95  if (!m_pt2BranchName.key().empty()) {
97  pt2 = readHandle.ptr();
98  }
99 
100  const std::vector<float>* phi1 = nullptr;
101  if (!m_phi1BranchName.key().empty()) {
103  phi1 = readHandle.ptr();
104  }
105  const std::vector<float>* phi2 = nullptr;
106  if (!m_phi2BranchName.key().empty()) {
108  phi2 = readHandle.ptr();
109  }
110 
111  // Get the input particle and MET
113  ctx };
115  ctx };
116  const xAOD::IParticleContainer* particles1 = inputParticles1.ptr();
117  const xAOD::MissingETContainer* particles2 = inputParticles2.ptr();
118 
119  // compute MET
120  if (particles2->empty()) {
121  if (!pt2) {
122  ATH_MSG_WARNING("No MET info found");
123  return StatusCode::SUCCESS;
124  }
125  if (pt2->empty()) {
126  ATH_MSG_WARNING("No MET info found");
127  return StatusCode::SUCCESS;
128  }
129  }
130 
131  float MET = pt2 ? (*pt2)[0] : particles2->at(0)->met();
132  float MET_phi = phi2 ? (*phi2)[0] : particles2->at(0)->phi();
133 
134  // apply MET requirement
135  if (MET < m_METmin)
136  return StatusCode::SUCCESS;
137 
138  // get the positions of the particles which pass the requirement
139  std::vector<int> entries1 = m_parser->evaluateAsVector();
140  unsigned int nEntries1 = entries1.size();
141 
142  // if there are no particles in one of the two lists to combine, just leave
143  // function
144  if (nEntries1 == 0)
145  return StatusCode::SUCCESS;
146 
147  // check that the sizes are compatible
148  if (particles1->size() != nEntries1) {
149  ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
150  return StatusCode::FAILURE;
151  }
152  if ((pt1 && pt1->size() != nEntries1) ||
153  (phi1 && phi1->size() != nEntries1)) {
154  ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
155  return StatusCode::FAILURE;
156  }
157 
158  // Loop over the objects and calculate the transverse mass
159  unsigned int iter;
160  for (iter = 0; iter < nEntries1; ++iter) {
161  if (entries1[iter] != 1)
162  continue;
163  float apt1 = pt1 ? (*pt1)[iter] : ((*particles1)[iter])->p4().Pt();
164  float aphi1 = phi1 ? (*phi1)[iter] : ((*particles1)[iter])->p4().Phi();
165 
166  TLorentzVector v1, v2;
167  v1.SetPtEtaPhiM(apt1, 0., aphi1, m_mass1Hypothesis);
168  v2.SetPtEtaPhiM(MET, 0., MET_phi, 0.);
169  float mass = (v1 + v2).M();
170  masses.push_back(mass);
171  }
172  return StatusCode::SUCCESS;
173 }

◆ initialize()

StatusCode DerivationFramework::EGTransverseMassTool::initialize ( )
finaloverridevirtual

Definition at line 36 of file EGTransverseMassTool.cxx.

37 {
38  if (m_sgName.key().empty()) {
40  "No SG name provided for the output of the transverse mass tool!");
41  return StatusCode::FAILURE;
42  }
44 
45  if (!m_container1Name.key().empty()) {
46  ATH_CHECK(m_container1Name.initialize());
47  }
48  if (!m_container2Name.key().empty()) {
49  ATH_CHECK(m_container2Name.initialize());
50  }
51  if (!m_pt1BranchName.key().empty()) {
53  }
54  if (!m_phi1BranchName.key().empty()) {
56  }
57  if (!m_pt2BranchName.key().empty()) {
59  }
60  if (!m_phi2BranchName.key().empty()) {
62  }
63 
64  ATH_CHECK(initializeParser(m_expression1));
65 
66  return StatusCode::SUCCESS;
67 }

Member Data Documentation

◆ m_container1Name

SG::ReadHandleKey<xAOD::IParticleContainer> DerivationFramework::EGTransverseMassTool::m_container1Name
private
Initial value:
{
this,
"ObjectContainerName",
"",
"SG key of first container"
}

Definition at line 48 of file EGTransverseMassTool.h.

◆ m_container2Name

SG::ReadHandleKey<xAOD::MissingETContainer> DerivationFramework::EGTransverseMassTool::m_container2Name
private
Initial value:
{
this,
"METContainerName",
"MET_LocHadTopo",
"SG key of second container"
}

Definition at line 54 of file EGTransverseMassTool.h.

◆ m_expression1

Gaudi::Property<std::string> DerivationFramework::EGTransverseMassTool::m_expression1 {this, "ObjectRequirements", "true"}
private

Definition at line 39 of file EGTransverseMassTool.h.

◆ m_mass1Hypothesis

Gaudi::Property<float> DerivationFramework::EGTransverseMassTool::m_mass1Hypothesis {this, "ObjectMassHypothesis", 0.f}
private

Definition at line 41 of file EGTransverseMassTool.h.

◆ m_METmin

Gaudi::Property<float> DerivationFramework::EGTransverseMassTool::m_METmin {this, "METmin", -999.f}
private

Definition at line 40 of file EGTransverseMassTool.h.

◆ m_phi1BranchName

SG::ReadHandleKey<std::vector<float> > DerivationFramework::EGTransverseMassTool::m_phi1BranchName
private
Initial value:
{
this,
"ObjectPhiBranchName",
"",
"Phi1 if different than default"
}

Definition at line 68 of file EGTransverseMassTool.h.

◆ m_phi2BranchName

SG::ReadHandleKey<std::vector<float> > DerivationFramework::EGTransverseMassTool::m_phi2BranchName
private
Initial value:
{
this,
"METPhiBranchName",
"",
"Phi2 if different than default"
}

Definition at line 82 of file EGTransverseMassTool.h.

◆ m_pt1BranchName

SG::ReadHandleKey<std::vector<float> > DerivationFramework::EGTransverseMassTool::m_pt1BranchName
private
Initial value:
{
this,
"ObjectPtBranchName",
"",
"Pt1 if different than default"
}

Definition at line 61 of file EGTransverseMassTool.h.

◆ m_pt2BranchName

SG::ReadHandleKey<std::vector<float> > DerivationFramework::EGTransverseMassTool::m_pt2BranchName
private
Initial value:
{
this,
"METPtBranchName",
"",
"Pt2 if different than default"
}

Definition at line 75 of file EGTransverseMassTool.h.

◆ m_sgName

SG::WriteHandleKey<std::vector<float> > DerivationFramework::EGTransverseMassTool::m_sgName
private
Initial value:
{ this,
"StoreGateEntryName",
"",
"SG key of output object" }

Definition at line 43 of file EGTransverseMassTool.h.


The documentation for this class was generated from the following files:
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
DerivationFramework::EGTransverseMassTool::m_container1Name
SG::ReadHandleKey< xAOD::IParticleContainer > m_container1Name
Definition: EGTransverseMassTool.h:48
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::EGTransverseMassTool::m_pt1BranchName
SG::ReadHandleKey< std::vector< float > > m_pt1BranchName
Definition: EGTransverseMassTool.h:61
DerivationFramework::EGTransverseMassTool::m_phi2BranchName
SG::ReadHandleKey< std::vector< float > > m_phi2BranchName
Definition: EGTransverseMassTool.h:82
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::EGTransverseMassTool::getTransverseMasses
StatusCode getTransverseMasses(const EventContext &ctx, std::vector< float > &) const
Definition: EGTransverseMassTool.cxx:85
DerivationFramework::EGTransverseMassTool::m_container2Name
SG::ReadHandleKey< xAOD::MissingETContainer > m_container2Name
Definition: EGTransverseMassTool.h:54
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::EGTransverseMassTool::m_mass1Hypothesis
Gaudi::Property< float > m_mass1Hypothesis
Definition: EGTransverseMassTool.h:41
DerivationFramework::EGTransverseMassTool::m_METmin
Gaudi::Property< float > m_METmin
Definition: EGTransverseMassTool.h:40
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
DerivationFramework::EGTransverseMassTool::m_sgName
SG::WriteHandleKey< std::vector< float > > m_sgName
Definition: EGTransverseMassTool.h:43
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
MET
Definition: MET.py:1
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
DerivationFramework::EGTransverseMassTool::m_phi1BranchName
SG::ReadHandleKey< std::vector< float > > m_phi1BranchName
Definition: EGTransverseMassTool.h:68
DerivationFramework::EGTransverseMassTool::m_expression1
Gaudi::Property< std::string > m_expression1
Definition: EGTransverseMassTool.h:39
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
SUSY_SimplifiedModel_PreInclude.masses
dictionary masses
Definition: SUSY_SimplifiedModel_PreInclude.py:7
DerivationFramework::EGTransverseMassTool::m_pt2BranchName
SG::ReadHandleKey< std::vector< float > > m_pt2BranchName
Definition: EGTransverseMassTool.h:75