ATLAS Offline Software
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$
13 // STL include(s):
14 #include <cmath>
15 
16 #include "DRConeAssociationTool.h"
17 #include "FourMomUtils/P4Helpers.h"
20 #include "GaudiKernel/SystemOfUnits.h"
21 
22 
23 using Gaudi::Units::MeV;
24 
25 
26 namespace D3PD {
27 
28 
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 
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 
69 {
70  m_p = &p;
71  CHECK( m_getter->reset() );
72  return StatusCode::SUCCESS;
73 }
74 
75 
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 =
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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
INavigable4Momentum.h
D3PD::DRConeAssociationTool::DRConeAssociationTool
DRConeAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: DRConeAssociationTool.cxx:36
initialize
void initialize()
Definition: run_EoverP.cxx:894
I4Momentum::p
virtual double p() const =0
momentum magnitude
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
D3PD::MultiAssociationTool< INavigable4Momentum >
D3PD::DRConeAssociationTool::m_getter
ToolHandle< ICollectionGetterTool > m_getter
Property: The getter for the target collection.
Definition: DRConeAssociationTool.h:80
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
P4Helpers::deltaR
double deltaR(const I4Momentum &p4, double eta, double phi)
from 1 I4Momentum
Definition: P4Helpers.h:196
DRConeAssociationTool.h
Associate all particles within a DR cut.
P4Helpers.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::DRConeAssociationTool::m_drcut
float m_drcut
Property: DR cut.
Definition: DRConeAssociationTool.h:83
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
D3PD::DRConeAssociationTool::m_p
const INavigable4Momentum * m_p
The input object.
Definition: DRConeAssociationTool.h:86
INavigable4Momentum
Definition: INavigable4Momentum.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::DRConeAssociationTool::next
virtual const INavigable4Momentum * next()
Return a pointer to the next element in the association.
Definition: DRConeAssociationTool.cxx:81
D3PD::DRConeAssociationTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition: DRConeAssociationTool.cxx:54
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.PyAthena.obj
obj
Definition: PyAthena.py:135
D3PD::DRConeAssociationTool::reset
virtual StatusCode reset(const INavigable4Momentum &p)
Start the iteration for a new association.
Definition: DRConeAssociationTool.cxx:68