ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <string>
8
9#include "CLHEP/Units/SystemOfUnits.h"
10
15
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 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
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
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
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}
#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:838
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