ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JpsiUpsilonTools
src
JpsiAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// JpsiAlg.cxx
6
// Author: James Catmore (James.Catmore@cern.ch), E. Bouhova-Thacker (e.bouhova@cern.ch)
7
// James Walder (jwalder@cern.ch)
8
// This algorithm calls the JpsiFinder tool and writes the resulting ExtendedVxCandidates to
9
// StoreGate. All analyses requiring J/psi and upsilon should therefore call this first in job
10
// options and collect the J/psi candidates from StoreGate. Example is in JpsiExample.
11
12
#include "
JpsiUpsilonTools/JpsiAlg.h
"
13
#include "
xAODTracking/VertexContainer.h
"
14
#include "
xAODTracking/VertexAuxContainer.h
"
15
16
18
19
JpsiAlg::JpsiAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
20
AthAlgorithm
(name, pSvcLocator),
21
m_eventCntr
(0),
m_jpsiCntr
(0),
22
m_jpsiFinder
(
"Analysis::JpsiFinder"
, this),
23
m_jpsiContainerName
(
"JpsiCandidates"
)
24
{
25
26
// Declare user-defined properties - cuts and vertexing method
27
declareProperty
(
"JpsiFinderName"
,
m_jpsiFinder
);
28
declareProperty
(
"JpsiCandidatesOutputName"
,
m_jpsiContainerName
=
"JpsiCandidates"
);
29
}
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
32
33
StatusCode
JpsiAlg::initialize
(){
34
35
36
ATH_MSG_DEBUG
(
"in initialize()"
);
37
38
// get the JpsiFinder tool
39
ATH_CHECK
(
m_jpsiFinder
.retrieve());
40
ATH_CHECK
(
m_jpsiContainerName
.initialize());
41
m_eventCntr
= 0;
42
m_jpsiCntr
= 0;
43
44
return
StatusCode::SUCCESS;
45
}
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
48
49
StatusCode
JpsiAlg::execute
(
const
EventContext& ctx) {
50
51
52
ATH_MSG_DEBUG
(
"in execute()"
);
53
54
// Increment counter
55
++
m_eventCntr
;
56
57
// Jpsi container and its auxilliary store
58
std::unique_ptr<xAOD::VertexContainer> jpsiContainer = std::make_unique<xAOD::VertexContainer>();
59
std::unique_ptr<xAOD::VertexAuxContainer> jpsiAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
60
jpsiContainer->setStore(jpsiAuxContainer.get());
61
// call Jpsi finder
62
if
( !
m_jpsiFinder
->performSearch(ctx, *jpsiContainer).isSuccess() ) {
63
ATH_MSG_FATAL
(
"Jpsi finder ("
<<
m_jpsiFinder
<<
") failed."
);
64
return
StatusCode::FAILURE;
65
}
66
67
// Extracting information from the Jpsi candidates
68
m_jpsiCntr
+= jpsiContainer->size();
// Count the Jpsis
69
70
// save in the StoreGate
71
ATH_MSG_DEBUG
(
"Recording to StoreGate: "
<<
m_jpsiContainerName
.key() <<
" size:"
<<jpsiContainer->size());
72
73
SG::WriteHandle<xAOD::VertexContainer>
whandle (
m_jpsiContainerName
, ctx);
74
ATH_CHECK
(whandle.
record
(std::move(jpsiContainer), std::move(jpsiAuxContainer)));
75
// END OF ANALYSIS
76
return
StatusCode::SUCCESS;
77
}
78
79
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
80
81
StatusCode
JpsiAlg::finalize
() {
82
83
ATH_MSG_DEBUG
(
"in finalize()"
);
84
ATH_MSG_INFO
(
"==================="
);
85
ATH_MSG_INFO
(
"SUMMARY OF ANALYSIS"
);
86
ATH_MSG_INFO
(
"==================="
);
87
ATH_MSG_INFO
(
" "
);
88
ATH_MSG_INFO
(
"Total number of events analysed: "
<<
m_eventCntr
);
89
ATH_MSG_INFO
(
"Total number of jpsi candidates: "
<<
m_jpsiCntr
);
90
91
return
StatusCode::SUCCESS;
92
}
93
94
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
95
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
JpsiAlg.h
VertexAuxContainer.h
VertexContainer.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
JpsiAlg::finalize
StatusCode finalize() override
Definition
JpsiAlg.cxx:81
JpsiAlg::m_jpsiFinder
ToolHandle< Analysis::ICandidateSearch > m_jpsiFinder
Definition
JpsiAlg.h:23
JpsiAlg::m_jpsiCntr
int m_jpsiCntr
Definition
JpsiAlg.h:21
JpsiAlg::JpsiAlg
JpsiAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JpsiAlg.cxx:19
JpsiAlg::m_jpsiContainerName
SG::WriteHandleKey< xAOD::VertexContainer > m_jpsiContainerName
Name of output container to store results.
Definition
JpsiAlg.h:24
JpsiAlg::execute
StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
JpsiAlg.cxx:49
JpsiAlg::initialize
StatusCode initialize() override
Definition
JpsiAlg.cxx:33
JpsiAlg::m_eventCntr
int m_eventCntr
Definition
JpsiAlg.h:20
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.
Generated on
for ATLAS Offline Software by
1.17.0