ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigJiveXML
src
TrigSiSpacePointRetriever.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigJiveXML/TrigSiSpacePointRetriever.h
"
6
7
#include <string>
8
9
#include "CLHEP/Units/SystemOfUnits.h"
10
11
#include "
TrigInDetEvent/TrigSiSpacePointCollection.h
"
12
#include "
TrigInDetEvent/TrigSiSpacePoint.h
"
13
#include "
InDetIdentifier/SCT_ID.h
"
14
#include "
InDetIdentifier/PixelID.h
"
15
16
namespace
JiveXML
{
17
18
//--------------------------------------------------------------------------
19
20
TrigSiSpacePointRetriever::TrigSiSpacePointRetriever
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent):
21
AthAlgTool
(
type
, name, parent),
22
m_typeName
(
"TrigS3D"
),
23
m_pixelHelper
(nullptr),
24
m_sctHelper
(nullptr),
25
m_pixelSpContainerName
(
"TrigPixelSpacePoints"
),
26
m_SCT_SpContainerName
(
"TrigSCT_SpacePoints"
)
27
{
28
29
declareInterface<IDataRetriever>(
this
);
30
31
declareProperty
(
"PixelSpacePoints"
,
m_pixelSpContainerName
);
32
declareProperty
(
"SCTSpacePoints"
,
m_SCT_SpContainerName
);
33
}
34
35
//--------------------------------------------------------------------------
36
37
StatusCode
TrigSiSpacePointRetriever::retrieve
(ToolHandle<IFormatTool> &FormatTool) {
38
39
const
TrigSiSpacePointContainer
* pCont;
40
41
DataVect
x
;
42
DataVect
y
;
43
DataVect
z
;
44
DataVect
layer;
45
DataVect
clustersVec;
46
std::string clustersStr =
"clusters multiple=\"2\""
;
47
48
if
(
evtStore
()->
retrieve
(pCont,
m_pixelSpContainerName
).isFailure() ) {
49
if
(
msgLvl
(MSG::DEBUG))
msg
(MSG::DEBUG) <<
"Trig SP Pixel container not found at "
50
<<
m_pixelSpContainerName
<<
endmsg
;
51
// return StatusCode::SUCCESS; // not exit here (as in original code)
52
}
else
{
53
if
(
msgLvl
(MSG::DEBUG))
msg
(MSG::DEBUG) <<
" Retrieving TrigSPPixel with size "
54
<< pCont->
size
() <<
" from "
<<
m_pixelSpContainerName
<<
endmsg
;
55
56
int
maxHash =
m_pixelHelper
->wafer_hash_max();
57
for
(
int
id
=0;
id
<maxHash;++id){
58
auto
spCollIt=pCont->
indexFindPtr
(
id
);
59
if
(spCollIt==
nullptr
)
continue
;
60
for
(
TrigSiSpacePointCollection::const_iterator
spIt=spCollIt->begin(); spIt!=spCollIt->end();++spIt){
61
x
.push_back(
DataType
((*spIt)->x() /10.));
62
y
.push_back(
DataType
((*spIt)->y() /10.));
63
z
.push_back(
DataType
((*spIt)->z() /10.));
64
layer.push_back(
DataType
(
calcPixelLayer
( (*spIt)->identify() ) ) );
65
clustersVec.push_back(
DataType
(((*spIt)->clusters()).first->identify().get_compact()));
66
clustersVec.push_back(
DataType
(-1));
67
}
68
}
69
}
70
if
(
evtStore
()->
retrieve
(pCont,
m_SCT_SpContainerName
).isFailure() ) {
71
if
(
msgLvl
(MSG::DEBUG))
msg
(MSG::DEBUG) <<
"Trig SP Pixel container not found at "
72
<<
m_SCT_SpContainerName
<<
endmsg
;
73
// return StatusCode::SUCCESS; // not exit here (as in original code)
74
}
else
{
75
if
(
msgLvl
(MSG::DEBUG))
msg
(MSG::DEBUG) <<
" Retrieving TrigSPPixel with size "
76
<< pCont->
size
() <<
" from "
<<
m_SCT_SpContainerName
<<
endmsg
;
77
78
int
maxHash =
m_sctHelper
->wafer_hash_max();
79
for
(
int
id
=0;
id
<maxHash;++id){
80
auto
spCollIt=pCont->
indexFindPtr
(
id
);
81
if
(spCollIt==
nullptr
)
continue
;
82
for
(
TrigSiSpacePointCollection::const_iterator
spIt=spCollIt->begin(); spIt!=spCollIt->end();++spIt){
83
x
.push_back(
DataType
((*spIt)->x() /10.));
84
y
.push_back(
DataType
((*spIt)->y() /10.));
85
z
.push_back(
DataType
((*spIt)->z() /10.));
86
layer.push_back(
DataType
(
calcSCTLayer
( (*spIt)->identify() ) ) );
87
clustersVec.push_back(
DataType
(((*spIt)->clusters()).first->identify().get_compact()));
88
clustersVec.push_back(
DataType
(((*spIt)->clusters()).second->identify().get_compact()));
89
}
90
}
91
}
92
DataMap
myDataMap;
93
myDataMap[
"x"
] =
x
;
94
myDataMap[
"y"
] =
y
;
95
myDataMap[
"z"
] =
z
;
96
myDataMap[
"layer"
] = layer;
97
myDataMap[clustersStr] = clustersVec;
98
99
if
(
msgLvl
(MSG::DEBUG))
msg
(MSG::DEBUG) <<
dataTypeName
() <<
": "
<<
x
.size() <<
endmsg
;
100
101
//forward data to formating tool
102
std::string emptyStr=
""
;
103
return
FormatTool->AddToEvent(
dataTypeName
(), emptyStr, &myDataMap);
104
}
105
//--------------------------------------------------------------------------
106
107
StatusCode
TrigSiSpacePointRetriever::initialize
(){
108
109
//migration: https://twiki.cern.ch/twiki/bin/view/Atlas/InDetPkgFixing
110
if
(
detStore
()->
retrieve
(
m_pixelHelper
,
"PixelID"
).isFailure() ){
111
if
(
msgLvl
(MSG::ERROR))
msg
(MSG::ERROR) <<
"Could not get Pixel ID helper"
<<
endmsg
;
112
return
StatusCode::RECOVERABLE;
113
}
114
115
if
(
detStore
()->
retrieve
(
m_sctHelper
,
"SCT_ID"
).isFailure() ){
116
if
(
msgLvl
(MSG::ERROR))
msg
(MSG::ERROR) <<
"Could not get SCT ID helper"
<<
endmsg
;
117
return
StatusCode::RECOVERABLE;
118
}
119
120
return
StatusCode::SUCCESS;
121
}
122
123
//--------------------------------------------------------------------------
124
125
int
TrigSiSpacePointRetriever::calcPixelLayer
(
const
Identifier
&
id
)
126
{
127
int
layer =
m_pixelHelper
->layer_disk(
id
);
128
if
(
m_pixelHelper
->barrel_ec(
id
) ) layer += 3;
129
// Endcap Pixels 3,4,5
130
return
layer;
131
}
132
133
//--------------------------------------------------------------------------
134
135
int
TrigSiSpacePointRetriever::calcSCTLayer
(
const
Identifier
&
id
)
136
{
137
int
layer =
m_sctHelper
->layer_disk(
id
);
138
if
(
m_sctHelper
->barrel_ec(
id
) ) layer += 11;
139
// Endcap SCT 11,12,13,14,15,16,17,18,19
140
else
layer += 7;
141
// Barrel SCT 7,8,9,10
142
return
layer;
143
}
144
145
//--------------------------------------------------------------------------
146
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition
CTPResultByteStreamTool.cxx:22
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
TrigSiSpacePointCollection.h
TrigSiSpacePointContainer
Trk::PrepRawDataContainer< TrigSiSpacePointCollection > TrigSiSpacePointContainer
Definition
TrigSiSpacePointCollection.h:18
TrigSiSpacePointRetriever.h
TrigSiSpacePoint.h
y
#define y
x
#define x
z
#define z
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
Trk::PrepRawDataCollection< TrigSiSpacePoint >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
IdentifiableContainerMT::indexFindPtr
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Definition
IdentifiableContainerMT.h:298
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition
IdentifiableContainerMT.h:209
JiveXML::TrigSiSpacePointRetriever::TrigSiSpacePointRetriever
TrigSiSpacePointRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition
TrigSiSpacePointRetriever.cxx:20
JiveXML::TrigSiSpacePointRetriever::m_sctHelper
const SCT_ID * m_sctHelper
Definition
TrigSiSpacePointRetriever.h:45
JiveXML::TrigSiSpacePointRetriever::m_SCT_SpContainerName
std::string m_SCT_SpContainerName
Definition
TrigSiSpacePointRetriever.h:48
JiveXML::TrigSiSpacePointRetriever::initialize
virtual StatusCode initialize()
Definition
TrigSiSpacePointRetriever.cxx:107
JiveXML::TrigSiSpacePointRetriever::calcSCTLayer
int calcSCTLayer(const Identifier &)
Definition
TrigSiSpacePointRetriever.cxx:135
JiveXML::TrigSiSpacePointRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition
TrigSiSpacePointRetriever.cxx:37
JiveXML::TrigSiSpacePointRetriever::m_typeName
const std::string m_typeName
The data type that is generated by this retriever.
Definition
TrigSiSpacePointRetriever.h:39
JiveXML::TrigSiSpacePointRetriever::m_pixelSpContainerName
std::string m_pixelSpContainerName
Definition
TrigSiSpacePointRetriever.h:47
JiveXML::TrigSiSpacePointRetriever::calcPixelLayer
int calcPixelLayer(const Identifier &)
Definition
TrigSiSpacePointRetriever.cxx:125
JiveXML::TrigSiSpacePointRetriever::m_pixelHelper
const PixelID * m_pixelHelper
Definition
TrigSiSpacePointRetriever.h:44
JiveXML::TrigSiSpacePointRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition
TrigSiSpacePointRetriever.h:32
Identifier
Definition
IdentifierFieldParser.cxx:14
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition
BadLArRetriever.cxx:22
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition
DataType.h:59
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition
DataType.h:58
type
Generated on
for ATLAS Offline Software by
1.17.0