ATLAS Offline Software
MuonTrackParticleAssociationTool.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$
16 
17 
18 namespace D3PD {
19 
20 
28  (const std::string& type,
29  const std::string& name,
30  const IInterface* parent)
31  : Base (type, name, parent),
32  m_type (PRIMARY)
33 {
34  declareProperty ("Type", m_typeprop = "Primary",
35  "Which TrackParticle to return. One of "
36  "Primary, Combined, "
37  "InDet, InDetOrPrimary, MuonSpectrometer");
38 }
39 
40 
45 {
47 
48  if (m_typeprop == "Primary")
49  m_type = PRIMARY;
50  else if (m_typeprop == "Combined")
51  m_type = COMBINED;
52  else if (m_typeprop == "InDet")
53  m_type = INDET;
54  else if (m_typeprop == "InDetOrPrimary")
56  else if (m_typeprop == "MuonSpectrometer") {
58  REPORT_MESSAGE(MSG::INFO) << "called with type : MuonSpectrometer" << m_typeprop;
59  }
60  else {
61  REPORT_MESSAGE(MSG::ERROR) << "Bad type property " << m_typeprop;
62  return StatusCode::FAILURE;
63  }
64  return StatusCode::SUCCESS;
65 }
66 
67 
76 {
77  switch (m_type) {
78  case PRIMARY:
79  return p.primaryTrackParticle();
80  case COMBINED:
81  return p.trackParticle (xAOD::Muon::CombinedTrackParticle);
82  case INDET:
83  return p.trackParticle (xAOD::Muon::InnerDetectorTrackParticle);
84  case MUONSPECTROMETER:
85  return p.trackParticle (xAOD::Muon::MuonSpectrometerTrackParticle);
86  case INDET_OR_PRIMARY:
87  {
88  const xAOD::TrackParticle* t = p.trackParticle (xAOD::Muon::InnerDetectorTrackParticle);
89  if (!t)
90  t = p.primaryTrackParticle();
91  return t;
92  }
93  }
94  std::abort();
95 }
96 
97 
98 } // namespace D3PD
D3PD::MuonTrackParticleAssociationTool::get
virtual const xAOD::TrackParticle * get(const xAOD::Muon &p)
Return the target object.
Definition: MuonTrackParticleAssociationTool.cxx:75
D3PD::MuonTrackParticleAssociationTool::m_typeprop
std::string m_typeprop
Property: Which track particle should we return.
Definition: MuonTrackParticleAssociationTool.h:65
MuonTrackParticleAssociationTool.h
Associate from an egamma to its primary TrackParticle.
initialize
void initialize()
Definition: run_EoverP.cxx:894
D3PD::MuonTrackParticleAssociationTool::PRIMARY
@ PRIMARY
Definition: MuonTrackParticleAssociationTool.h:68
D3PD::SingleAssociationTool< xAOD::Muon, xAOD::TrackParticle >
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
D3PD::MuonTrackParticleAssociationTool::MUONSPECTROMETER
@ MUONSPECTROMETER
Definition: MuonTrackParticleAssociationTool.h:72
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
D3PD::MuonTrackParticleAssociationTool::INDET
@ INDET
Definition: MuonTrackParticleAssociationTool.h:70
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::MuonTrackParticleAssociationTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition: MuonTrackParticleAssociationTool.cxx:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::MuonTrackParticleAssociationTool::MuonTrackParticleAssociationTool
MuonTrackParticleAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: MuonTrackParticleAssociationTool.cxx:28
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::MuonTrackParticleAssociationTool::COMBINED
@ COMBINED
Definition: MuonTrackParticleAssociationTool.h:69
D3PD::MuonTrackParticleAssociationTool::m_type
enum D3PD::MuonTrackParticleAssociationTool::@196 m_type
D3PD::MuonTrackParticleAssociationTool::INDET_OR_PRIMARY
@ INDET_OR_PRIMARY
Definition: MuonTrackParticleAssociationTool.h:71
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43