ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigTools
IDScanZFinder
src
TrigZFinderAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <vector>
6
#include "
TrigZFinderAlg.h
"
7
#include "
TrigZFinder.h
"
8
#include "
TrigSteeringEvent/TrigRoiDescriptor.h
"
9
#include "
TrigInDetEvent/TrigSiSpacePointBase.h
"
10
// To add identifier
11
#include "
InDetPrepRawData/PixelCluster.h
"
12
13
using namespace
std
;
14
15
TrigZFinderAlg::TrigZFinderAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
16
AthReentrantAlgorithm
(name, pSvcLocator)
17
{
18
}
19
20
TrigZFinderAlg::~TrigZFinderAlg
()
21
{
22
}
23
24
StatusCode
TrigZFinderAlg::initialize
()
25
{
26
ATH_CHECK
(
m_zFinderTools
.retrieve());
27
ATH_CHECK
(
m_pixelSpKey
.initialize());
28
ATH_CHECK
(
m_pixelHelperKey
.initialize());
29
ATH_CHECK
(
m_vertexKey
.initialize());
30
if
(!
m_monTool
.empty())
ATH_CHECK
(
m_monTool
.retrieve());
31
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
TrigZFinderAlg::finalize
()
36
{
37
return
StatusCode::SUCCESS;
38
}
39
40
StatusCode
TrigZFinderAlg::execute
(
const
EventContext& context)
const
41
{
42
vector<TrigSiSpacePointBase> spVec;
43
SG::ReadHandle<SpacePointContainer>
pixelSP(
m_pixelSpKey
, context);
44
45
//For Pixel info decoding
46
SG::ReadHandle<PixelID>
pixelHelper(
m_pixelHelperKey
, context);
47
49
// This loop is to count sp
50
// The z's are found from reconstructing these sp's.
51
for
(
const
auto
pixSPointColl : *pixelSP)
52
{
53
if
(pixSPointColl ==
nullptr
)
54
continue
;
55
56
const
Identifier
pixid = (pixSPointColl)->identify();
57
int
layerId = pixelHelper->layer_disk(pixid);
58
// Set the resolution for r & z in barrel/end cap.
59
if
(pixelHelper->is_barrel(pixid)){
60
const
double
dr = 0.01;
61
const
double
dz = 0.13;
62
63
for
(
const
auto
pSP : *pixSPointColl)
64
{
65
// Store SP into vector
66
spVec.push_back(
TrigSiSpacePointBase
(layerId, pSP->globalPosition().perp(), pSP->globalPosition().phi(), pSP->globalPosition().z(),
67
dr, dz, pSP));
68
}
69
}
70
}
71
ATH_MSG_DEBUG
(
"Size of spVec: "
<< spVec.size());
72
74
TrigRoiDescriptor
fullscan_roi(
true
);
75
76
77
78
// Recording Data
79
auto
zVertexContainer = std::make_unique<xAOD::TrigCompositeContainer>();
80
auto
zVertexContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
81
zVertexContainer->setStore(zVertexContainerAux.get());
82
83
int
toolIndex=0;
84
for
(
auto
& tool:
m_zFinderTools
) {
85
TrigVertexCollection
* vertices = tool->findZ(spVec,
TrigRoiDescriptor
(
true
));
86
87
ATH_MSG_DEBUG
(
"Successfully retrieved size of number of vertices: "
<< vertices->
size
());
88
89
for
(
auto
vertex: *vertices ) {
90
ATH_MSG_DEBUG
(
"z of vertex: "
<< vertex->z() );
91
ATH_MSG_DEBUG
(
"weight vertex: "
<< vertex->cov()[5] );
92
93
xAOD::TrigComposite
*outputVertex =
new
xAOD::TrigComposite
();
94
zVertexContainer->push_back(outputVertex);
95
outputVertex->
setDetail
<
int
>(
"zfinder_tool"
, toolIndex );
96
outputVertex->
setDetail
<
float
>(
"zfinder_vtx_z"
, vertex->z() );
97
outputVertex->
setDetail
<
float
>(
"zfinder_vtx_weight"
, vertex->cov()[5] );
98
// Adding monitoring histograms
99
auto
ZVertex =
Monitored::Scalar
(
"ZVertex"
,vertex->z());
100
auto
ZVertexWeight =
Monitored::Scalar
(
"ZVertexWeight"
,vertex->cov()[5]);
101
102
auto
mon =
Monitored::Group
(
m_monTool
, ZVertex, ZVertexWeight);
103
}
104
toolIndex++;
105
delete
vertices;
106
}
107
if
( zVertexContainer->empty() ) {
108
xAOD::TrigComposite
*emptyVertex =
new
xAOD::TrigComposite
();
109
zVertexContainer->push_back(emptyVertex);
110
emptyVertex->
setDetail
<
int
>(
"zfinder_tool"
, -1 );
111
emptyVertex->
setDetail
<
float
>(
"zfinder_vtx_z"
, -1000.0 );
112
emptyVertex->
setDetail
<
float
>(
"zfinder_vtx_weight"
, -1.0 );
113
}
114
115
SG::WriteHandle<xAOD::TrigCompositeContainer>
vertexHandle(
m_vertexKey
, context);
116
ATH_CHECK
(vertexHandle.
record
(std::move(zVertexContainer), std::move(zVertexContainerAux)));
117
return
StatusCode::SUCCESS;
118
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PixelCluster.h
TrigRoiDescriptor.h
TrigSiSpacePointBase.h
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition
TrigSteeringEventTPCnv.cxx:68
TrigZFinderAlg.h
TrigZFinder.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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.
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Definition
TrigRoiDescriptor.h:48
TrigSiSpacePointBase
Definition
TrigSiSpacePointBase.h:23
TrigVertexCollection
Definition
TrigVertexCollection.h:13
TrigZFinderAlg::~TrigZFinderAlg
virtual ~TrigZFinderAlg() override
Definition
TrigZFinderAlg.cxx:20
TrigZFinderAlg::initialize
virtual StatusCode initialize() override
Definition
TrigZFinderAlg.cxx:24
TrigZFinderAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition
TrigZFinderAlg.cxx:40
TrigZFinderAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
TrigZFinderAlg.h:48
TrigZFinderAlg::m_pixelHelperKey
SG::ReadHandleKey< PixelID > m_pixelHelperKey
Definition
TrigZFinderAlg.h:46
TrigZFinderAlg::m_zFinderTools
ToolHandleArray< TrigZFinder > m_zFinderTools
Definition
TrigZFinderAlg.h:44
TrigZFinderAlg::m_vertexKey
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_vertexKey
Definition
TrigZFinderAlg.h:47
TrigZFinderAlg::m_pixelSpKey
SG::ReadHandleKey< SpacePointContainer > m_pixelSpKey
Definition
TrigZFinderAlg.h:45
TrigZFinderAlg::finalize
virtual StatusCode finalize() override
Definition
TrigZFinderAlg.cxx:35
TrigZFinderAlg::TrigZFinderAlg
TrigZFinderAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TrigZFinderAlg.cxx:15
xAOD::TrigComposite_v1::setDetail
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
Identifier
Definition
IdentifierFieldParser.cxx:14
std
STL namespace.
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition
TrigComposite.h:16
Generated on
for ATLAS Offline Software by
1.17.0