ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Columnar
ColumnarCore
ColumnarCore
MomentumHelpers.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
#ifndef COLUMNAR_CORE_MOMENTUM_HELPERS_H
9
#define COLUMNAR_CORE_MOMENTUM_HELPERS_H
10
11
#include <
ColumnarCore/MomentumAccessors.h
>
12
#include <
FourMomUtils/xAODP4Helpers.h
>
13
14
namespace
columnar
15
{
20
22
inline
23
double
deltaPhi
(
double
phiA,
double
phiB )
24
{
25
return
-
remainder
( -phiA + phiB, 2*
M_PI
);
26
}
27
28
29
31
template
<ContainerIdConcept CI1,ContainerIdConcept CI2,
typename
CM>
32
double
deltaRapidity
(
const
MomentumAccessors<CI1,CM>
& momAcc1,
ObjectId<CI1,CM>
p1,
const
MomentumAccessors<CI2,CM>
& momAcc2,
ObjectId<CI2,CM>
p2,
bool
useRapidity=
true
)
33
{
34
if
(useRapidity)
35
return
momAcc1.
rapidity
(p1) - momAcc2.
rapidity
(p2);
36
else
37
return
momAcc1.
eta
(p1) - momAcc2.
eta
(p2);
38
}
39
40
41
45
template
<ContainerIdConcept CI1,ContainerIdConcept CI2,
typename
CM>
46
bool
isInDeltaR
(
const
MomentumAccessors<CI1,CM>
& momAcc1,
ObjectId<CI1,CM>
p1,
const
MomentumAccessors<CI2,CM>
& momAcc2,
ObjectId<CI2,CM>
p2,
47
double
dR,
bool
useRapidity=
true
)
48
{
49
const
double
dPhi = std::abs(
xAOD::P4Helpers::deltaPhi
(momAcc1.
phi
(p1),momAcc2.
phi
(p2)) );
// in [-pi,pi)
50
if
(
CxxUtils::fpcompare::greater
(dPhi,dR) )
return
false
;
// <==
51
const
double
dRapidity = std::abs(
deltaRapidity
(momAcc1,p1,momAcc2,p2,useRapidity) );
52
if
(
CxxUtils::fpcompare::greater
(dRapidity,dR) )
return
false
;
// <==
53
const
double
deltaR2 = dRapidity*dRapidity + dPhi*dPhi;
54
if
(
CxxUtils::fpcompare::greater
(deltaR2,dR*dR) )
return
false
;
// <==
55
return
true
;
56
}
57
}
58
59
#endif
M_PI
#define M_PI
Definition
ActiveFraction.h:14
MomentumAccessors.h
columnar::MomentumAccessors
a handle to hold a IMomentumAccessors object
Definition
MomentumAccessors.h:290
columnar::MomentumAccessors::rapidity
double rapidity(ObjectId< CI, CM > object) const
Definition
MomentumAccessors.h:321
columnar::MomentumAccessors::phi
double phi(ObjectId< CI, CM > object) const
Definition
MomentumAccessors.h:315
columnar::MomentumAccessors::eta
double eta(ObjectId< CI, CM > object) const
Definition
MomentumAccessors.h:313
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition
ContainerId.h:205
remainder
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
Definition
compareFlatTrees.cxx:44
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition
fpcompare.h:140
columnar
Definition
ClusterDef.h:16
columnar::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition
MomentumHelpers.h:23
columnar::isInDeltaR
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.
Definition
MomentumHelpers.h:46
columnar::deltaRapidity
double deltaRapidity(const MomentumAccessors< CI1, CM > &momAcc1, ObjectId< CI1, CM > p1, const MomentumAccessors< CI2, CM > &momAcc2, ObjectId< CI2, CM > p2, bool useRapidity=true)
Computes efficiently .
Definition
MomentumHelpers.h:32
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition
xAODP4Helpers.h:69
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0