ATLAS Offline Software
Loading...
Searching...
No Matches
DeltaRMatcher.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Framework includes
7
8// Local includes
10
11namespace ORUtils
12{
13
14 //---------------------------------------------------------------------------
15 // DeltaRMatcher constructor
16 //---------------------------------------------------------------------------
17 DeltaRMatcher::DeltaRMatcher(double dR, bool useRapidity)
18 : m_dR(dR),
19 m_useRapidity(useRapidity)
20 {}
21
24 {
27 return StatusCode::SUCCESS;
28 }
29
30 //---------------------------------------------------------------------------
31 // Check if particles match in dR
32 //---------------------------------------------------------------------------
35 bool /*swapArgs*/) const
36 {
38 }
39
40 //---------------------------------------------------------------------------
41 // SlidingDeltaRMatcher constructor
42 //---------------------------------------------------------------------------
44 double maxCone, bool useRapidity)
45 : m_c1(c1), m_c2(c2), m_maxCone(maxCone), m_useRapidity(useRapidity)
46 {}
47
50 {
53 return StatusCode::SUCCESS;
54 }
55
56 //---------------------------------------------------------------------------
57 // Check if particles match in sliding dR
58 //---------------------------------------------------------------------------
61 bool swapArgs) const
62 {
63 // Calculate the dR cone to match with
64 double pt1 = swapArgs ? m_momAcc2.pt(p2) : m_momAcc1.pt(p1);
65 double dR = m_c1 + (m_c2 / pt1);
66 // Apply upper limit to the dR match cone
67 dR = std::min(dR, m_maxCone);
69 }
70
71} // namespace ORUtils
virtual StatusCode setObjectTypes(xAODType::ObjectType type1, xAODType::ObjectType type2) override
Set the object types to be used in the association.
columnar::MomentumAccessors< columnar::ContainerId::particle2 > m_momAcc2
DeltaRMatcher(double dR, bool useRapidity=true)
Constructor.
virtual bool objectsMatch(columnar::Particle1Id p1, columnar::Particle2Id p2, bool swapArgs=false) const override
Check if particles match in dR.
columnar::MomentumAccessors< columnar::ContainerId::particle1 > m_momAcc1
Columnar accessors.
double m_c1
Sliding dR constant c1.
columnar::MomentumAccessors< columnar::ContainerId::particle1 > m_momAcc1
Columnar accessors.
double m_c2
Sliding dR constant c2.
bool m_useRapidity
Toggle rapidity usage.
columnar::MomentumAccessors< columnar::ContainerId::particle2 > m_momAcc2
SlidingDeltaRMatcher(double c1, double c2, double maxCone=std::numeric_limits< double >::max(), bool useRapidity=true)
Constructor.
double m_maxCone
Maximum sliding cone size.
virtual StatusCode setObjectTypes(xAODType::ObjectType type1, xAODType::ObjectType type2) override
Set the object types to be used in the association.
virtual bool objectsMatch(columnar::Particle1Id p1, columnar::Particle2Id p2, bool swapArgs=false) const override
Check if particles match in dR.
ObjectId< ContainerId::particle1 > Particle1Id
Definition ParticleDef.h:48
void resetObjectType(MomentumAccessors< CI, CM > &accessors, ColumnarTool< CM > &columnarTool, xAODType::ObjectType type)
bool isInDeltaR(const MomentumAccessors< CI1, CM > &momAcc1, ObjectId< CI1, CM > p1, const MomentumAccessors< CI2, CM > &momAcc2, ObjectId< CI2, CM > p2, double dR, bool useRapidity=true)
Check if 2 particles are in a cone.
ObjectId< ContainerId::particle2 > Particle2Id
Definition ParticleDef.h:54
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32