ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkBPhys
src
Reco_V0Finder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
5
// Reco_V0Finder.cxx, (c) ATLAS Detector software
7
// Author: Adam Barton
8
#include "
Reco_V0Finder.h
"
9
#include "
xAODTracking/VertexContainer.h
"
10
#include "
xAODTracking/VertexAuxContainer.h
"
11
12
namespace
DerivationFramework
{
13
14
Reco_V0Finder::Reco_V0Finder
(
const
std::string& t,
15
const
std::string& n,
16
const
IInterface* p) :
17
base_class(t,n,p),
18
m_v0FinderTool
(
"InDet::V0FinderTool"
, this)
19
{
20
21
// Declare user-defined properties
22
declareProperty(
"CheckVertexContainers"
,
m_CollectionsToCheck
);
23
declareProperty(
"V0FinderTool"
,
m_v0FinderTool
);
24
}
25
26
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
27
28
StatusCode
Reco_V0Finder::initialize
()
29
{
30
31
ATH_MSG_DEBUG
(
"in initialize()"
);
32
// get the V0Finder tool
33
ATH_CHECK
(
m_v0FinderTool
.retrieve());
34
ATH_CHECK
(
m_v0DecoTool
.retrieve());
35
36
ATH_CHECK
(
m_vertexKey
.initialize());
37
ATH_CHECK
(
m_v0Key
.initialize());
38
ATH_CHECK
(
m_ksKey
.initialize());
39
ATH_CHECK
(
m_laKey
.initialize());
40
ATH_CHECK
(
m_lbKey
.initialize());
41
ATH_CHECK
(
m_eventInfo_key
.initialize());
42
43
return
StatusCode::SUCCESS;
44
45
}
46
47
48
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
49
50
StatusCode
Reco_V0Finder::addBranches
(
const
EventContext& ctx)
const
51
{
52
53
bool
callV0Finder =
false
;
54
// Jpsi container and its auxilliary store
55
for
(
const
auto
&
str
:
m_CollectionsToCheck
){
56
const
xAOD::VertexContainer
* vertContainer =
nullptr
;
57
ATH_CHECK
( evtStore()->retrieve(vertContainer,
str
) );
58
if
(vertContainer->
size
() == 0) {
59
ATH_MSG_DEBUG
(
"Container VertexContainer ("
<<
str
<<
") is empty"
);
60
}
else
{
61
callV0Finder =
true
;
62
ATH_MSG_DEBUG
(
"Container VertexContainer ("
<<
str
<<
") has events N= "
<< vertContainer->
size
());
63
break
;
//No point checking other containers
64
}
65
}
66
67
// InDetV0 container and its auxilliary store
68
//---- Recording section: write the results to StoreGate ---//
69
SG::WriteHandle<xAOD::VertexContainer>
h_V0(
m_v0Key
, ctx );
70
if
( h_V0.
record
(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
71
ATH_MSG_ERROR
(
"Storegate record of v0Container failed."
);
72
return
StatusCode::FAILURE;
73
}
74
75
SG::WriteHandle<xAOD::VertexContainer>
h_Ks(
m_ksKey
, ctx );
76
if
( h_Ks.
record
(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
77
ATH_MSG_ERROR
(
"Storegate record of ksContainer failed."
);
78
return
StatusCode::FAILURE;
79
}
80
81
SG::WriteHandle<xAOD::VertexContainer>
h_La(
m_laKey
, ctx );
82
if
( h_La.
record
(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
83
ATH_MSG_ERROR
(
"Storegate record of laContainer failed."
);
84
return
StatusCode::FAILURE;
85
86
}
87
SG::WriteHandle<xAOD::VertexContainer>
h_Lb(
m_lbKey
, ctx );
88
if
(h_Lb.
record
(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
89
ATH_MSG_ERROR
(
"Storegate record of lbContainer failed."
);
90
return
StatusCode::FAILURE;
91
}
92
93
xAOD::VertexContainer
* v0Container(h_V0.
ptr
());
94
xAOD::VertexContainer
* ksContainer(h_Ks.
ptr
());
95
xAOD::VertexContainer
* laContainer(h_La.
ptr
());
96
xAOD::VertexContainer
* lbContainer(h_Lb.
ptr
());
97
// Call V0Finder
98
if
(callV0Finder) {
99
const
xAOD::Vertex
* primaryVertex(0);
100
SG::ReadHandle<xAOD::VertexContainer>
importedVxContainer(
m_vertexKey
, ctx );
101
ATH_CHECK
(importedVxContainer.
isValid
());
102
103
if
(importedVxContainer->size()==0){
104
ATH_MSG_WARNING
(
"You have no primary vertices: "
<< importedVxContainer->size());
105
}
else
{
106
primaryVertex = (*importedVxContainer)[0];
107
}
108
ATH_CHECK
(
m_v0FinderTool
->performSearch(h_V0.
ptr
(),
109
h_Ks.
ptr
(),
110
h_La.
ptr
(),
111
h_Lb.
ptr
(),
112
primaryVertex, importedVxContainer.
cptr
(), ctx));
113
114
ATH_MSG_DEBUG
(
"Reco_V0Finder v0Container->size() "
<< v0Container->
size
());
115
ATH_MSG_DEBUG
(
"Reco_V0Finder ksContainer->size() "
<< ksContainer->
size
());
116
ATH_MSG_DEBUG
(
"Reco_V0Finder laContainer->size() "
<< laContainer->
size
());
117
ATH_MSG_DEBUG
(
"Reco_V0Finder lbContainer->size() "
<< lbContainer->
size
());
118
119
120
SG::ReadHandle<xAOD::EventInfo>
evt(
m_eventInfo_key
, ctx);
121
if
(v0Container->
size
() > 500){
122
ATH_MSG_WARNING
(
"Event Run: "
<< evt->runNumber() <<
" Event: "
<< evt->eventNumber() <<
" v0Container container size "
<< v0Container->
size
());
123
}
124
if
(ksContainer->
size
() > 500){
125
ATH_MSG_WARNING
(
"Event Run: "
<< evt->runNumber() <<
" Event: "
<< evt->eventNumber() <<
" ksContainer container size "
<< ksContainer->
size
());
126
}
127
if
(laContainer->
size
() > 500){
128
ATH_MSG_WARNING
(
"Event Run: "
<< evt->runNumber() <<
" Event: "
<< evt->eventNumber() <<
" laContainer container size "
<< laContainer->
size
());
129
}
130
ATH_CHECK
(
m_v0DecoTool
->decorateV0(h_V0.
ptr
(), ctx));
131
ATH_CHECK
(
m_v0DecoTool
->decorateks(h_Ks.
ptr
() ,ctx));
132
ATH_CHECK
(
m_v0DecoTool
->decoratela(h_La.
ptr
(), ctx));
133
ATH_CHECK
(
m_v0DecoTool
->decoratelb(h_Lb.
ptr
(), ctx));
134
}
135
136
return
StatusCode::SUCCESS;
137
}
138
}
139
140
141
142
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_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Reco_V0Finder.h
VertexAuxContainer.h
VertexContainer.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DerivationFramework::Reco_V0Finder::m_v0Key
SG::WriteHandleKey< xAOD::VertexContainer > m_v0Key
Definition
Reco_V0Finder.h:38
DerivationFramework::Reco_V0Finder::m_CollectionsToCheck
std::vector< std::string > m_CollectionsToCheck
Definition
Reco_V0Finder.h:32
DerivationFramework::Reco_V0Finder::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition
Reco_V0Finder.h:34
DerivationFramework::Reco_V0Finder::m_v0DecoTool
ToolHandle< InDet::V0MainDecorator > m_v0DecoTool
Definition
Reco_V0Finder.h:45
DerivationFramework::Reco_V0Finder::m_v0FinderTool
ToolHandle< InDet::InDetV0FinderTool > m_v0FinderTool
Definition
Reco_V0Finder.h:33
DerivationFramework::Reco_V0Finder::m_ksKey
SG::WriteHandleKey< xAOD::VertexContainer > m_ksKey
Definition
Reco_V0Finder.h:39
DerivationFramework::Reco_V0Finder::initialize
StatusCode initialize() override
Definition
Reco_V0Finder.cxx:28
DerivationFramework::Reco_V0Finder::m_lbKey
SG::WriteHandleKey< xAOD::VertexContainer > m_lbKey
Definition
Reco_V0Finder.h:42
DerivationFramework::Reco_V0Finder::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override
Definition
Reco_V0Finder.cxx:50
DerivationFramework::Reco_V0Finder::m_vertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
Definition
Reco_V0Finder.h:35
DerivationFramework::Reco_V0Finder::Reco_V0Finder
Reco_V0Finder(const std::string &t, const std::string &n, const IInterface *p)
Definition
Reco_V0Finder.cxx:14
DerivationFramework::Reco_V0Finder::m_laKey
SG::WriteHandleKey< xAOD::VertexContainer > m_laKey
Definition
Reco_V0Finder.h:40
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.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
str
Definition
BTagTrackIpAccessor.cxx:11
xAOD::VertexContainer
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Definition
VertexContainer.h:14
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0