ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkBPhys
src
Reco_mumu.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Reco_mumu.cxx
8
// Author: Daniel Scheirich <daniel.scheirich@cern.ch>
9
// Based on the Integrated Simulation Framework
10
//
11
// Basic Jpsi->mu mu derivation example
12
13
#include "
Reco_mumu.h
"
14
#include "
xAODTracking/VertexContainer.h
"
15
#include "
xAODTracking/VertexAuxContainer.h
"
16
#include "
TrkVertexAnalysisUtils/V0Tools.h
"
17
#include "
BPhysPVTools.h
"
18
19
20
namespace
DerivationFramework
{
21
22
Reco_mumu::Reco_mumu
(
const
std::string& t,
23
const
std::string& n,
24
const
IInterface* p) :
25
base_class(t,n,p) {
26
}
27
28
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29
30
StatusCode
Reco_mumu::initialize
()
31
{
32
33
ATH_MSG_DEBUG
(
"in initialize()"
);
34
35
// retrieve V0 tools
36
CHECK
(
m_v0Tools
.retrieve() );
37
38
// get the JpsiFinder tool
39
CHECK
(
m_jpsiFinder
.retrieve() );
40
41
// get the PrimaryVertexRefitter tool
42
CHECK
(
m_pvRefitter
.retrieve() );
43
44
// Get the beam spot service
45
CHECK
(
m_eventInfo_key
.initialize() );
46
47
ATH_CHECK
(
m_CollectionsToCheck
.initialize());
48
ATH_CHECK
(
m_pvContainerKey
.initialize());
49
ATH_CHECK
(
m_outContainerKey
.initialize());
50
ATH_CHECK
(
m_refContainerKey
.initialize(
m_refitPV
));
51
return
StatusCode::SUCCESS;
52
}
53
54
55
56
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
57
58
StatusCode
Reco_mumu::addBranches
(
const
EventContext& ctx)
const
59
{
60
bool
callJpsiFinder =
true
;
61
if
(
m_checkCollections
) {
62
for
(
SG::ReadHandle<xAOD::VertexContainer>
vertContainer :
m_CollectionsToCheck
.makeHandles(ctx)){
63
if
(!vertContainer.isValid()){
64
ATH_MSG_FATAL
(
"Failed to retrieve "
<<vertContainer.key());
65
return
StatusCode::FAILURE;
66
}
67
if
(vertContainer->size() == 0) {
68
callJpsiFinder =
false
;
69
ATH_MSG_DEBUG
(
"Container VertexContainer ("
<< vertContainer.key() <<
") is empty"
);
70
break
;
//No point checking other containers
71
}
72
}
73
}
74
75
// Jpsi container and its auxilliary store
76
std::unique_ptr<xAOD::VertexContainer> vtxContainer = std::make_unique<xAOD::VertexContainer>();
77
std::unique_ptr<xAOD::VertexAuxContainer> vtxAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
78
vtxContainer->setStore(vtxAuxContainer.get());
79
80
std::unique_ptr<xAOD::VertexContainer> refPvContainer =std::make_unique<xAOD::VertexContainer>();
81
std::unique_ptr<xAOD::VertexAuxContainer> refPvAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
82
refPvContainer->setStore(refPvAuxContainer.get());
83
84
85
if
(callJpsiFinder) {
86
//----------------------------------------------------
87
// call Jpsi finder
88
//----------------------------------------------------
89
ATH_CHECK
(
m_jpsiFinder
->performSearch(ctx, *vtxContainer));
90
91
//----------------------------------------------------
92
// retrieve primary vertices
93
//----------------------------------------------------
94
SG::ReadHandle<xAOD::VertexContainer>
pvContainer{
m_pvContainerKey
,ctx};
95
if
(!pvContainer.
isValid
()){
96
ATH_MSG_FATAL
(
"Failed to retrieve "
<<
m_pvContainerKey
.fullKey());
97
return
StatusCode::FAILURE;
98
}
99
//----------------------------------------------------
100
// Try to retrieve refitted primary vertices
101
//----------------------------------------------------
102
103
// Give the helper class the ptr to v0tools and beamSpotsSvc to use
104
SG::ReadHandle<xAOD::EventInfo>
evt(
m_eventInfo_key
, ctx);
105
if
(not evt.isValid())
ATH_MSG_ERROR
(
"Cannot Retrieve "
<<
m_eventInfo_key
.key() );
106
107
// Give the helper class the ptr to v0tools and beamSpotsSvc to use
108
BPhysPVTools
helper(&(*
m_v0Tools
), evt.cptr());
109
helper.SetMinNTracksInPV(
m_PV_minNTracks
);
110
helper.SetSave3d(
m_do3d
);
111
112
if
(
m_refitPV
&& vtxContainer->size()){
113
ATH_CHECK
(helper.FillCandwithRefittedVertices(vtxContainer.get(), pvContainer.
cptr
(), refPvContainer.get(), &(*
m_pvRefitter
) ,
m_PV_max
,
m_DoVertexType
));
114
}
else
if
(!
m_refitPV
&& vtxContainer->size()){
115
ATH_CHECK
(helper.FillCandExistingVertices(vtxContainer.get(), pvContainer.
cptr
(),
m_DoVertexType
));
116
}
117
if
(vtxContainer->size() > 500){
118
ATH_MSG_WARNING
(
"Event Run: "
<< evt->runNumber() <<
" Event: "
<< evt->eventNumber() <<
" vtxContainer container size "
<< vtxContainer->size());
119
}
120
if
(refPvContainer->size() > 500){
121
ATH_MSG_WARNING
(
"Event Run: "
<< evt->runNumber() <<
" Event: "
<< evt->eventNumber() <<
" refPvContainer container size "
<< refPvContainer->size());
122
}
123
}
124
//----------------------------------------------------
125
// save in the StoreGate
126
//----------------------------------------------------
127
SG::WriteHandle<xAOD::VertexContainer>
out_handle{
m_outContainerKey
, ctx};
128
ATH_CHECK
(out_handle.
record
(std::move(vtxContainer), std::move(vtxAuxContainer)));
129
if
(
m_refitPV
) {
130
SG::WriteHandle<xAOD::VertexContainer>
refitHandle{
m_refContainerKey
,ctx};
131
ATH_CHECK
(refitHandle.
record
(std::move(refPvContainer), std::move(refPvAuxContainer)));
132
}
133
134
return
StatusCode::SUCCESS;
135
}
136
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
BPhysPVTools.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Reco_mumu.h
V0Tools.h
VertexAuxContainer.h
VertexContainer.h
DerivationFramework::BPhysPVTools
Definition
BPhysPVTools.h:25
DerivationFramework::Reco_mumu::m_pvContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerKey
Definition
Reco_mumu.h:54
DerivationFramework::Reco_mumu::m_checkCollections
Gaudi::Property< bool > m_checkCollections
Definition
Reco_mumu.h:51
DerivationFramework::Reco_mumu::m_jpsiFinder
ToolHandle< Analysis::ICandidateSearch > m_jpsiFinder
Definition
Reco_mumu.h:39
DerivationFramework::Reco_mumu::m_PV_max
Gaudi::Property< int > m_PV_max
Definition
Reco_mumu.h:47
DerivationFramework::Reco_mumu::initialize
StatusCode initialize() override
Definition
Reco_mumu.cxx:30
DerivationFramework::Reco_mumu::m_pvRefitter
PublicToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition
Reco_mumu.h:40
DerivationFramework::Reco_mumu::Reco_mumu
Reco_mumu(const std::string &t, const std::string &n, const IInterface *p)
Definition
Reco_mumu.cxx:22
DerivationFramework::Reco_mumu::m_do3d
Gaudi::Property< bool > m_do3d
Definition
Reco_mumu.h:50
DerivationFramework::Reco_mumu::m_outContainerKey
SG::WriteHandleKey< xAOD::VertexContainer > m_outContainerKey
Definition
Reco_mumu.h:57
DerivationFramework::Reco_mumu::m_PV_minNTracks
Gaudi::Property< unsigned int > m_PV_minNTracks
Definition
Reco_mumu.h:49
DerivationFramework::Reco_mumu::m_CollectionsToCheck
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_CollectionsToCheck
Definition
Reco_mumu.h:53
DerivationFramework::Reco_mumu::m_refitPV
Gaudi::Property< bool > m_refitPV
Definition
Reco_mumu.h:46
DerivationFramework::Reco_mumu::m_refContainerKey
SG::WriteHandleKey< xAOD::VertexContainer > m_refContainerKey
Definition
Reco_mumu.h:56
DerivationFramework::Reco_mumu::m_v0Tools
PublicToolHandle< Trk::V0Tools > m_v0Tools
tools
Definition
Reco_mumu.h:38
DerivationFramework::Reco_mumu::addBranches
StatusCode addBranches(const EventContext &ctx) const override
Definition
Reco_mumu.cxx:58
DerivationFramework::Reco_mumu::m_DoVertexType
Gaudi::Property< int > m_DoVertexType
Definition
Reco_mumu.h:48
DerivationFramework::Reco_mumu::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition
Reco_mumu.h:41
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
Generated on
for ATLAS Offline Software by
1.17.0