Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

 EGTransverseMassTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize () override final
 
virtual StatusCode addBranches () const override final
 

Private Member Functions

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

Private Attributes

std::string m_expression1
 
float m_METmin
 
float m_mass1Hypothesis
 
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.

Constructor & Destructor Documentation

◆ EGTransverseMassTool()

DerivationFramework::EGTransverseMassTool::EGTransverseMassTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 35 of file EGTransverseMassTool.cxx.

38  : base_class(t, n, p)
39  , m_expression1("true")
40  , m_METmin(-999.)
41  , m_mass1Hypothesis(0.0)
42 {
43  declareProperty("ObjectRequirements", m_expression1);
44  declareProperty("METmin", m_METmin);
45  declareProperty("ObjectMassHypothesis", m_mass1Hypothesis);
46 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::EGTransverseMassTool::addBranches ( ) const
finaloverridevirtual

Definition at line 83 of file EGTransverseMassTool.cxx.

84 {
85  const EventContext& ctx = Gaudi::Hive::currentContext();
86  SG::WriteHandle<std::vector<float>> writeHandle{ m_sgName, ctx };
87 
88  // create the vector which will hold the values invariant masses
89  auto masses = std::make_unique<std::vector<float>>();
90  // compute the invariant mass values
92 
93  ATH_CHECK(writeHandle.record(std::move(masses)));
94 
95  return StatusCode::SUCCESS;
96 }

◆ getTransverseMasses()

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

Definition at line 99 of file EGTransverseMassTool.cxx.

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

◆ initialize()

StatusCode DerivationFramework::EGTransverseMassTool::initialize ( )
finaloverridevirtual

Definition at line 49 of file EGTransverseMassTool.cxx.

50 {
51  if (m_sgName.key().empty()) {
53  "No SG name provided for the output of the transverse mass tool!");
54  return StatusCode::FAILURE;
55  }
57 
58  if (!m_container1Name.key().empty()) {
59  ATH_CHECK(m_container1Name.initialize());
60  }
61  if (!m_container2Name.key().empty()) {
62  ATH_CHECK(m_container2Name.initialize());
63  }
64  if (!m_pt1BranchName.key().empty()) {
66  }
67  if (!m_phi1BranchName.key().empty()) {
69  }
70  if (!m_pt2BranchName.key().empty()) {
72  }
73  if (!m_phi2BranchName.key().empty()) {
75  }
76 
77  ATH_CHECK(initializeParser(m_expression1));
78 
79  return StatusCode::SUCCESS;
80 }

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 51 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 57 of file EGTransverseMassTool.h.

◆ m_expression1

std::string DerivationFramework::EGTransverseMassTool::m_expression1
private

Definition at line 42 of file EGTransverseMassTool.h.

◆ m_mass1Hypothesis

float DerivationFramework::EGTransverseMassTool::m_mass1Hypothesis
private

Definition at line 44 of file EGTransverseMassTool.h.

◆ m_METmin

float DerivationFramework::EGTransverseMassTool::m_METmin
private

Definition at line 43 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 71 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 85 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 64 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 78 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 46 of file EGTransverseMassTool.h.


The documentation for this class was generated from the following files:
DerivationFramework::EGTransverseMassTool::m_METmin
float m_METmin
Definition: EGTransverseMassTool.h:43
DerivationFramework::EGTransverseMassTool::m_container1Name
SG::ReadHandleKey< xAOD::IParticleContainer > m_container1Name
Definition: EGTransverseMassTool.h:51
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:64
DerivationFramework::EGTransverseMassTool::m_mass1Hypothesis
float m_mass1Hypothesis
Definition: EGTransverseMassTool.h:44
DerivationFramework::EGTransverseMassTool::m_phi2BranchName
SG::ReadHandleKey< std::vector< float > > m_phi2BranchName
Definition: EGTransverseMassTool.h:85
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
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:99
DerivationFramework::EGTransverseMassTool::m_container2Name
SG::ReadHandleKey< xAOD::MissingETContainer > m_container2Name
Definition: EGTransverseMassTool.h:57
DerivationFramework::EGTransverseMassTool::m_expression1
std::string m_expression1
Definition: EGTransverseMassTool.h:42
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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:794
DerivationFramework::EGTransverseMassTool::m_sgName
SG::WriteHandleKey< std::vector< float > > m_sgName
Definition: EGTransverseMassTool.h:46
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:71
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:78