ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
EventCommonD3PDMaker
src
DRConeAssociationTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
// STL include(s):
14
#include <cmath>
15
16
#include "
DRConeAssociationTool.h
"
17
#include "
FourMomUtils/P4Helpers.h
"
18
#include "
EventKernel/INavigable4Momentum.h
"
19
#include "
AthenaKernel/errorcheck.h
"
20
#include "GaudiKernel/SystemOfUnits.h"
21
22
23
using
Gaudi::Units::MeV;
24
25
26
namespace
D3PD
{
27
28
35
DRConeAssociationTool::DRConeAssociationTool
36
(
const
std::string&
type
,
37
const
std::string& name,
38
const
IInterface* parent)
39
:
Base
(
type
, name, parent),
40
m_getter
(this),
41
m_p
(0)
42
{
43
declareProperty (
"Getter"
,
m_getter
,
44
"ICollectionGetterTool instance defining "
45
"the target collection"
);
46
declareProperty (
"DRCut"
,
m_drcut
= 999,
47
"DR cut for the association"
);
48
}
49
50
54
StatusCode
DRConeAssociationTool::initialize
()
55
{
56
// Retrieve the getter tool and configure it, saying that we want
57
// to get @c INavigable4Momentum objects from it.
58
CHECK
(
m_getter
.retrieve() );
59
CHECK
(
m_getter
->configureD3PD<
INavigable4Momentum
>() );
60
return
Base::initialize();
61
}
62
63
68
StatusCode
DRConeAssociationTool::reset
(
const
INavigable4Momentum
& p)
69
{
70
m_p
= &p;
71
CHECK
(
m_getter
->reset() );
72
return
StatusCode::SUCCESS;
73
}
74
75
81
const
INavigable4Momentum
*
DRConeAssociationTool::next
()
82
{
83
// Protect against null 4-momenta --- they'll crash deltaR.
84
if
(
m_p
->p() < 1e-3*
MeV
) {
85
m_p
= 0;
86
return
0;
87
}
88
// Protect against infinite eta. It appears in some circumstances.
89
if
( std::isinf(
m_p
->eta() ) ) {
90
m_p
= 0;
91
return
0;
92
}
93
94
while
(
const
INavigable4Momentum
* obj =
95
m_getter
->next<
INavigable4Momentum
>())
96
{
97
if
(obj->p() < 1e-3*
MeV
)
continue
;
98
if
( std::isinf( obj->eta() ) )
continue
;
99
float
dr =
static_cast<
float
>
(
P4Helpers::deltaR
(*
m_p
, *obj));
100
if
(dr <
m_drcut
)
101
return
obj;
102
}
103
m_p
= 0;
104
return
0;
105
}
106
107
108
}
// namespace D3PD
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DRConeAssociationTool.h
Associate all particles within a DR cut.
MeV
static const double MeV
Definition
HIEventSelectionToolRun3.cxx:72
INavigable4Momentum.h
P4Helpers.h
D3PD::DRConeAssociationTool::m_getter
ToolHandle< ICollectionGetterTool > m_getter
Property: The getter for the target collection.
Definition
DRConeAssociationTool.h:80
D3PD::DRConeAssociationTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition
DRConeAssociationTool.cxx:54
D3PD::DRConeAssociationTool::m_drcut
float m_drcut
Property: DR cut.
Definition
DRConeAssociationTool.h:83
D3PD::DRConeAssociationTool::m_p
const INavigable4Momentum * m_p
The input object.
Definition
DRConeAssociationTool.h:86
D3PD::DRConeAssociationTool::next
virtual const INavigable4Momentum * next()
Return a pointer to the next element in the association.
Definition
DRConeAssociationTool.cxx:81
D3PD::DRConeAssociationTool::DRConeAssociationTool
DRConeAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
DRConeAssociationTool.cxx:36
D3PD::DRConeAssociationTool::reset
virtual StatusCode reset(const INavigable4Momentum &p)
Start the iteration for a new association.
Definition
DRConeAssociationTool.cxx:68
D3PD::DRConeAssociationTool::Base
MultiAssociationTool< INavigable4Momentum > Base
Definition
DRConeAssociationTool.h:45
INavigable4Momentum
Definition
INavigable4Momentum.h:21
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
P4Helpers::deltaR
double deltaR(const I4Momentum &p4, double eta, double phi)
from 1 I4Momentum
Definition
P4Helpers.h:209
type
Generated on
for ATLAS Offline Software by
1.17.0