ATLAS Offline Software
Loading...
Searching...
No Matches
TrigSiSpacePointRetriever.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9#include "CLHEP/Units/SystemOfUnits.h"
10
15#include <string>
16namespace 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 "
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 "
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 const std::size_t n = x.size();
94 myDataMap["x"] = std::move(x);
95 myDataMap["y"] = std::move(y);
96 myDataMap["z"] = std::move(z);
97 myDataMap["layer"] = std::move(layer);
98 myDataMap[clustersStr] = std::move(clustersVec);
99
100 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< n << endmsg;
101
102 //forward data to formating tool
103 std::string emptyStr="";
104 return FormatTool->AddToEvent(dataTypeName(), emptyStr, &myDataMap);
105 }
106 //--------------------------------------------------------------------------
107
109
110//migration: https://twiki.cern.ch/twiki/bin/view/Atlas/InDetPkgFixing
111 if ( detStore()->retrieve(m_pixelHelper, "PixelID").isFailure() ){
112 if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get Pixel ID helper" << endmsg;
113 return StatusCode::RECOVERABLE;
114 }
115
116 if ( detStore()->retrieve(m_sctHelper, "SCT_ID").isFailure() ){
117 if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get SCT ID helper" << endmsg;
118 return StatusCode::RECOVERABLE;
119 }
120
121 return StatusCode::SUCCESS;
122 }
123
124 //--------------------------------------------------------------------------
125
127 {
128 int layer = m_pixelHelper->layer_disk( id );
129 if ( m_pixelHelper->barrel_ec( id ) ) layer += 3;
130 // Endcap Pixels 3,4,5
131 return layer;
132 }
133
134 //--------------------------------------------------------------------------
135
137 {
138 int layer = m_sctHelper->layer_disk( id );
139 if ( m_sctHelper->barrel_ec( id ) ) layer += 11;
140 // Endcap SCT 11,12,13,14,15,16,17,18,19
141 else layer += 7;
142 // Barrel SCT 7,8,9,10
143 return layer;
144 }
145
146 //--------------------------------------------------------------------------
147}
#define endmsg
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
Trk::PrepRawDataContainer< TrigSiSpacePointCollection > TrigSiSpacePointContainer
#define y
#define x
#define z
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:861
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,...
size_t size() const
Duplicate of fullSize for backwards compatability.
TrigSiSpacePointRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
const std::string m_typeName
The data type that is generated by this retriever.
virtual std::string dataTypeName() const
Return the name of the data type.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58