ATLAS Offline Software
Loading...
Searching...
No Matches
PhysValTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "src/PhysValTool.h"
6
7namespace ActsTrk {
8
9 PhysValTool::PhysValTool(const std::string & type,
10 const std::string& name,
11 const IInterface* parent)
12 : ManagedMonitorToolBase(type, name, parent)
13 {}
14
16 {
17 ATH_MSG_DEBUG("Initializing " << name() << " ... ");
18
20 ATH_CHECK(m_eventInfo.initialize());
21
25
29
31
32 ATH_MSG_DEBUG("Properties:");
39
40 std::string folder = m_folder.value();
42 std::string subdir = m_pixelClustersDir.empty() ?
44 m_pixelClustersDir.value();
46 std::make_unique< ActsTrk::PixelClusterValidationPlots >(nullptr,
47 Form("%s/%s/", folder.c_str(), subdir.c_str()));
48 }
49
51 std::string subdir = m_stripClustersDir.empty() ?
53 m_stripClustersDir.value();
55 std::make_unique< ActsTrk::StripClusterValidationPlots >(nullptr,
56 Form("%s/%s/", folder.c_str(), subdir.c_str()));
57 }
58
60 std::string subdir = m_pixelSPDir.empty() ?
62 m_pixelSPDir.value();
64 std::make_unique< ActsTrk::PixelSpacePointValidationPlots >(nullptr,
65 Form("%s/%s/", folder.c_str(), subdir.c_str()));
66 }
67
69 std::string subdir = m_stripSPDir.empty() ?
71 m_stripSPDir.value();
73 std::make_unique< ActsTrk::StripSpacePointValidationPlots >(nullptr,
74 Form("%s/%s/", folder.c_str(), subdir.c_str()),
75 "Strip");
76 }
77
79 std::string subdir = m_stripOSPDir.empty() ?
81 m_stripOSPDir.value();
83 std::make_unique< ActsTrk::StripSpacePointValidationPlots >(nullptr,
84 Form("%s/%s/", folder.c_str(), subdir.c_str()),
85 "StripOverlap");
86 }
87
88 // Schedule HGTD objects
89 if (m_doHgtdClusters) {
90 std::string subdir = m_hgtdClustersDir.empty() ?
92 m_hgtdClustersDir.value();
94 std::make_unique< ActsTrk::HgtdClusterValidationPlots >(nullptr,
95 Form("%s/%s/", folder.c_str(), subdir.c_str()));
96 }
97
99 ATH_CHECK(detStore()->retrieve(m_pixelID, "PixelID"));
101 ATH_CHECK(detStore()->retrieve(m_stripID, "SCT_ID"));
103 ATH_CHECK(detStore()->retrieve(m_hgtdID, "HGTD_ID"));
104
105 return StatusCode::SUCCESS;
106 }
107
122
123 StatusCode PhysValTool::fillHgtdClusters(const EventContext& ctx,
124 float beamSpotWeight) {
125 ATH_MSG_DEBUG("Analysing HGTD Clusters");
127 if (not inputHgtdClusterContainer.isValid()) {
128 ATH_MSG_FATAL("xAOD::HGTDClusterContainer with key " << m_hgtdClusterContainerKey.key() << " is not available...");
129 return StatusCode::FAILURE;
130 }
131 const xAOD::HGTDClusterContainer *hgtdClusterContainer = inputHgtdClusterContainer.cptr();
132
134 const InDetDD::HGTD_DetectorElementCollection* hgtdElements(*hgtdDetEleHandle);
135 if (not hgtdDetEleHandle.isValid() or hgtdElements==nullptr) {
136 ATH_MSG_FATAL(m_HGTDDetEleCollKey.fullKey() << " is not available.");
137 return StatusCode::FAILURE;
138 }
139
140 // Fill plots
141 for (const xAOD::HGTDCluster* cluster : *hgtdClusterContainer) {
142 m_hgtdClusterValidationPlots->fill(cluster, *hgtdElements, beamSpotWeight, m_hgtdID);
143 }
144
145 return StatusCode::SUCCESS;
146 }
147
148 StatusCode PhysValTool::fillPixelClusters(const EventContext& ctx,
149 float beamSpotWeight) {
150 ATH_MSG_DEBUG("Analysing Pixel Clusters");
152 if (not inputPixelClusterContainer.isValid()) {
153 ATH_MSG_FATAL("xAOD::PixelClusterContainer with key " << m_pixelClusterContainerKey.key() << " is not available...");
154 return StatusCode::FAILURE;
155 }
156 const xAOD::PixelClusterContainer *pixelClusterContainer = inputPixelClusterContainer.cptr();
157
158 for (const xAOD::PixelCluster* cluster : *pixelClusterContainer) {
159 m_pixelClusterValidationPlots->fill(cluster, beamSpotWeight, m_pixelID);
160 }
161
162 return StatusCode::SUCCESS;
163 }
164
165 StatusCode PhysValTool::fillStripClusters(const EventContext& ctx,
166 float beamSpotWeight) {
167 ATH_MSG_DEBUG("Analysing Strip Clusters");
169 if (not inputStripClusterContainer.isValid()) {
170 ATH_MSG_FATAL("xAOD::StripClusterContainer with key " << m_stripClusterContainerKey.key() << " is not available...");
171 return StatusCode::FAILURE;
172 }
173 const xAOD::StripClusterContainer *stripClusterContainer = inputStripClusterContainer.cptr();
174
175 for (const xAOD::StripCluster* cluster : *stripClusterContainer) {
176 m_stripClusterValidationPlots->fill(cluster, beamSpotWeight, m_stripID);
177 }
178
179 return StatusCode::SUCCESS;
180 }
181
182
183 StatusCode PhysValTool::fillPixelSpacePoints(const EventContext& ctx,
184 float beamSpotWeight) {
185 ATH_MSG_DEBUG("Analysing Pixel Space Points");
187 if (not inputPixelSpacePointContainer.isValid()) {
188 ATH_MSG_FATAL("xAOD::SpacePointContainer with key " << m_pixelSpacePointContainerKey.key() << " is not available...");
189 return StatusCode::FAILURE;
190 }
191 const xAOD::SpacePointContainer *pixelSpacePointContainer = inputPixelSpacePointContainer.cptr();
192
193 for (const xAOD::SpacePoint* spacePoint : *pixelSpacePointContainer) {
194 m_pixelSpacePointValidationPlots->fill(spacePoint, beamSpotWeight, m_pixelID);
195 }
196
197 return StatusCode::SUCCESS;
198 }
199
200 StatusCode PhysValTool::fillStripSpacePoints(const EventContext& ctx,
201 float beamSpotWeight) {
202 ATH_MSG_DEBUG("Analysing Strip Space Points");
204 if (not inputStripSpacePointContainer.isValid()) {
205 ATH_MSG_FATAL("xAOD::SpacePointContainer with key " << m_stripSpacePointContainerKey.key() << " is not available...");
206 return StatusCode::FAILURE;
207 }
208 const xAOD::SpacePointContainer *stripSpacePointContainer = inputStripSpacePointContainer.cptr();
209
210 for (const xAOD::SpacePoint* spacePoint : *stripSpacePointContainer) {
211 m_stripSpacePointValidationPlots->fill(spacePoint, beamSpotWeight, m_stripID);
212 }
213
214 return StatusCode::SUCCESS;
215 }
216
217 StatusCode PhysValTool::fillStripOverlapSpacePoints(const EventContext& ctx,
218 float beamSpotWeight) {
219 ATH_MSG_DEBUG("Analysing Strip Overlap Space Points");
221 if (not inputStripOverlapSpacePointContainer.isValid()) {
222 ATH_MSG_FATAL("xAOD::SpacePointContainer with key " << m_stripOverlapSpacePointContainerKey.key() << " is not available...");
223 return StatusCode::FAILURE;
224 }
225 const xAOD::SpacePointContainer *stripOverlapSpacePointContainer = inputStripOverlapSpacePointContainer.cptr();
226
227 for(const xAOD::SpacePoint* spacePoint : *stripOverlapSpacePointContainer) {
228 m_stripOverlapSpacePointValidationPlots->fill(spacePoint, beamSpotWeight, m_stripID);
229 }
230
231 return StatusCode::SUCCESS;
232 }
233
234
236 {
237 ATH_MSG_DEBUG("Filling histograms for " << name() << " ... ");
238
239 const EventContext& ctx = Gaudi::Hive::currentContext();
240
241 // Get Event Info
243 if (not eventInfoHandle.isValid()) {
244 ATH_MSG_FATAL("Could not retrieve EventInfo with key " << m_eventInfo.key());
245 return StatusCode::FAILURE;
246 }
247 const xAOD::EventInfo* eventInfo = eventInfoHandle.cptr();
248 float beamSpotWeight = eventInfo->beamSpotWeight();
249
250 if (m_doPixelClusters) ATH_CHECK(fillPixelClusters(ctx, beamSpotWeight));
251 if (m_doStripClusters) ATH_CHECK(fillStripClusters(ctx, beamSpotWeight));
252 if (m_doHgtdClusters) ATH_CHECK(fillHgtdClusters(ctx, beamSpotWeight));
253
254 if (m_doPixelSpacePoints) ATH_CHECK(fillPixelSpacePoints(ctx, beamSpotWeight));
255 if (m_doStripSpacePoints) ATH_CHECK(fillStripSpacePoints(ctx, beamSpotWeight));
257
258 return StatusCode::SUCCESS;
259 }
260
262 {
263 ATH_MSG_DEBUG("Finalising hists for " << name() << "...");
270 return StatusCode::SUCCESS;
271 }
272
273}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
StatusCode fillStripClusters(const EventContext &ctx, float beamSpotWeight)
const SCT_ID * m_stripID
SG::ReadCondHandleKey< InDetDD::HGTD_DetectorElementCollection > m_HGTDDetEleCollKey
Definition PhysValTool.h:74
std::unique_ptr< ActsTrk::StripSpacePointValidationPlots > m_stripSpacePointValidationPlots
Definition PhysValTool.h:98
virtual StatusCode fillHistograms() override
An inheriting class should either override this function or fillHists().
std::unique_ptr< ActsTrk::StripClusterValidationPlots > m_stripClusterValidationPlots
Definition PhysValTool.h:94
Gaudi::Property< std::string > m_pixelSPDir
Definition PhysValTool.h:89
SG::ReadHandleKey< xAOD::SpacePointContainer > m_stripOverlapSpacePointContainerKey
Definition PhysValTool.h:71
const PixelID * m_pixelID
StatusCode bookCollection(external_collection_t *)
SG::ReadHandleKey< xAOD::StripClusterContainer > m_stripClusterContainerKey
Definition PhysValTool.h:62
SG::ReadHandleKey< xAOD::HGTDClusterContainer > m_hgtdClusterContainerKey
Definition PhysValTool.h:64
virtual StatusCode procHistograms() override
An inheriting class should either override this function or finalHists().
Gaudi::Property< std::string > m_stripClustersDir
Definition PhysValTool.h:87
Gaudi::Property< std::string > m_pixelClustersDir
If these propeties are empty (default) the directories are created with the same name of the correspo...
Definition PhysValTool.h:86
Gaudi::Property< bool > m_doStripClusters
Definition PhysValTool.h:78
virtual StatusCode bookHistograms() override
An inheriting class should either override this function or bookHists().
Gaudi::Property< std::string > m_stripSPDir
Definition PhysValTool.h:90
PhysValTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< bool > m_doStripSpacePoints
Definition PhysValTool.h:81
virtual StatusCode initialize() override
std::unique_ptr< ActsTrk::PixelSpacePointValidationPlots > m_pixelSpacePointValidationPlots
Definition PhysValTool.h:97
Gaudi::Property< std::string > m_hgtdClustersDir
Definition PhysValTool.h:88
SG::ReadHandleKey< xAOD::SpacePointContainer > m_stripSpacePointContainerKey
Definition PhysValTool.h:69
Gaudi::Property< bool > m_doHgtdClusters
Definition PhysValTool.h:79
StatusCode fillStripOverlapSpacePoints(const EventContext &ctx, float beamSpotWeight)
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClusterContainerKey
Definition PhysValTool.h:60
StatusCode fillStripSpacePoints(const EventContext &ctx, float beamSpotWeight)
StatusCode fillPixelClusters(const EventContext &ctx, float beamSpotWeight)
Gaudi::Property< bool > m_doPixelSpacePoints
Definition PhysValTool.h:80
Gaudi::Property< bool > m_doStripOverlapSpacePoints
Definition PhysValTool.h:82
Gaudi::Property< std::string > m_stripOSPDir
Definition PhysValTool.h:91
Gaudi::Property< bool > m_doPixelClusters
Definition PhysValTool.h:77
Gaudi::Property< std::string > m_folder
Definition PhysValTool.h:84
const HGTD_ID * m_hgtdID
std::unique_ptr< ActsTrk::HgtdClusterValidationPlots > m_hgtdClusterValidationPlots
Definition PhysValTool.h:95
std::unique_ptr< ActsTrk::StripSpacePointValidationPlots > m_stripOverlapSpacePointValidationPlots
Definition PhysValTool.h:99
StatusCode fillPixelSpacePoints(const EventContext &ctx, float beamSpotWeight)
std::unique_ptr< ActsTrk::PixelClusterValidationPlots > m_pixelClusterValidationPlots
Definition PhysValTool.h:93
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition PhysValTool.h:57
StatusCode fillHgtdClusters(const EventContext &ctx, float beamSpotWeight)
SG::ReadHandleKey< xAOD::SpacePointContainer > m_pixelSpacePointContainerKey
Definition PhysValTool.h:67
const ServiceHandle< StoreGateSvc > & detStore() const
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
float beamSpotWeight() const
Weight for beam spot size reweighting.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
DataVector< HGTD_DetectorElement > HGTD_DetectorElementCollection
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
HGTDClusterContainer_v1 HGTDClusterContainer
Define the version of the HGTD cluster container.
EventInfo_v1 EventInfo
Definition of the latest event info version.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
HGTDCluster_v1 HGTDCluster
Define the version of the pixel cluster class.
Definition HGTDCluster.h:13