ATLAS Offline Software
Trigger
TrigMonitoring
TrigMinBiasMonitoring
src
Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
Utils.h
"
6
7
namespace
Utils
{
8
double
z0wrtPV
(
const
xAOD::TrackParticle
* trk,
const
xAOD::Vertex
* vtx) {
9
return
(trk->
z0
() + trk->
vz
() - vtx->
z
()) *
std::sin
(trk->
theta
());
10
}
11
12
const
xAOD::Vertex
*
selectPV
(
SG::ReadHandle<xAOD::VertexContainer>
& container) {
13
if
(not container.
isValid
()) {
14
return
nullptr
;
15
}
16
17
for
(
const
xAOD::Vertex
* vtx : *container) {
18
if
(vtx->vertexType() ==
xAOD::VxType::PriVtx
) {
19
return
vtx;
20
}
21
}
22
23
return
nullptr
;
24
}
25
26
const
xAOD::Jet
*
findLeadingJet
(
SG::ReadHandle<xAOD::JetContainer>
& container) {
27
auto
compareJetPt = [](
const
auto
& jet1,
const
auto
& jet2) {
return
jet1->
pt
() < jet2->pt(); };
28
29
const
auto
leadingJet = std::max_element(container->
begin
(), container->
end
(), compareJetPt);
30
if
(leadingJet == container->
end
()) {
31
return
nullptr
;
32
}
33
34
return
*leadingJet;
35
}
36
37
}
// namespace Utils
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
xAOD::TrackParticle_v1::vz
float vz() const
The z origin for the parameters.
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
Utils::findLeadingJet
const xAOD::Jet * findLeadingJet(SG::ReadHandle< xAOD::JetContainer > &container)
Find leading jet.
Definition:
Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx:26
Utils.h
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition:
TrackingPrimitives.h:571
xAOD::Vertex_v1::z
float z() const
Returns the z position.
Utils::z0wrtPV
double z0wrtPV(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
Provide the trk DCA w.r.t. the PV.
Definition:
Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx:8
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Utils::selectPV
const xAOD::Vertex * selectPV(SG::ReadHandle< xAOD::VertexContainer > &container)
Finds the Primary Vertex.
Definition:
Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx:12
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::Jet_v1
Class describing a jet.
Definition:
Jet_v1.h:57
xAOD::Vertex_v1
Class describing a Vertex.
Definition:
Vertex_v1.h:42
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
drawFromPickle.sin
sin
Definition:
drawFromPickle.py:36
Utils
Definition:
CaloCellSelectorUtils.cxx:10
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition:
Jet_v1.cxx:44
xAOD::TrackParticle_v1::theta
float theta() const
Returns the parameter, which has range 0 to .
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Generated on Thu Jul 4 2024 21:32:19 for ATLAS Offline Software by
1.8.18