Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
7 namespace ActsTrk {
8 
9  PhysValTool::PhysValTool(const std::string & type,
10  const std::string& name,
11  const IInterface* parent)
13  {}
14 
16  {
17  ATH_MSG_DEBUG("Initializing " << name() << " ... ");
18 
21 
25 
29 
31 
32  ATH_MSG_DEBUG("Properties:");
39 
40  std::string folder = m_folder.value();
41  if (m_doPixelClusters) {
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 
50  if (m_doStripClusters) {
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"));
102  if (m_doHgtdClusters)
103  ATH_CHECK(detStore()->retrieve(m_hgtdID, "HGTD_ID"));
104 
105  return StatusCode::SUCCESS;
106  }
107 
109  {
110  ATH_MSG_DEBUG("Booking histograms for " << name() << " ... " );
111 
115 
119 
120  return StatusCode::SUCCESS;
121  }
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 
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 
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 
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 
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 
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ActsTrk::PhysValTool::m_pixelClusterContainerKey
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClusterContainerKey
Definition: PhysValTool.h:60
ActsTrk::PhysValTool::m_stripOverlapSpacePointContainerKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_stripOverlapSpacePointContainerKey
Definition: PhysValTool.h:71
ActsTrk::PhysValTool::m_HGTDDetEleCollKey
SG::ReadCondHandleKey< InDetDD::HGTD_DetectorElementCollection > m_HGTDDetEleCollKey
Definition: PhysValTool.h:74
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ActsTrk::PhysValTool::m_hgtdClusterContainerKey
SG::ReadHandleKey< xAOD::HGTDClusterContainer > m_hgtdClusterContainerKey
Definition: PhysValTool.h:64
ActsTrk::PhysValTool::m_stripClusterContainerKey
SG::ReadHandleKey< xAOD::StripClusterContainer > m_stripClusterContainerKey
Definition: PhysValTool.h:62
ActsTrk::PhysValTool::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: PhysValTool.h:57
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ActsTrk::PhysValTool::bookHistograms
virtual StatusCode bookHistograms() override
An inheriting class should either override this function or bookHists().
Definition: PhysValTool.cxx:108
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
ActsTrk::PhysValTool::initialize
virtual StatusCode initialize() override
Definition: PhysValTool.cxx:15
PhysValTool.h
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:73
ActsTrk::PhysValTool::m_stripSpacePointContainerKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_stripSpacePointContainerKey
Definition: PhysValTool.h:69
ActsTrk::PhysValTool::fillPixelSpacePoints
StatusCode fillPixelSpacePoints(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:183
ActsTrk::PhysValTool::m_doStripSpacePoints
Gaudi::Property< bool > m_doStripSpacePoints
Definition: PhysValTool.h:81
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
ActsTrk::PhysValTool::fillPixelClusters
StatusCode fillPixelClusters(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:148
ActsTrk::PhysValTool::fillHgtdClusters
StatusCode fillHgtdClusters(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:123
ActsTrk::PhysValTool::m_stripSPDir
Gaudi::Property< std::string > m_stripSPDir
Definition: PhysValTool.h:90
ActsTrk::PhysValTool::m_doStripOverlapSpacePoints
Gaudi::Property< bool > m_doStripOverlapSpacePoints
Definition: PhysValTool.h:82
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:210
ActsTrk::PhysValTool::m_stripSpacePointValidationPlots
std::unique_ptr< ActsTrk::StripSpacePointValidationPlots > m_stripSpacePointValidationPlots
Definition: PhysValTool.h:98
xAOD::SpacePoint_v1
Definition: SpacePoint_v1.h:29
xAOD::HGTDCluster_v1
Definition: HGTDCluster_v1.h:23
ActsTrk::PhysValTool::m_stripClusterValidationPlots
std::unique_ptr< ActsTrk::StripClusterValidationPlots > m_stripClusterValidationPlots
Definition: PhysValTool.h:94
ActsTrk::PhysValTool::m_doHgtdClusters
Gaudi::Property< bool > m_doHgtdClusters
Definition: PhysValTool.h:79
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
ActsTrk::PhysValTool::m_folder
Gaudi::Property< std::string > m_folder
Definition: PhysValTool.h:84
ActsTrk::PhysValTool::m_hgtdClustersDir
Gaudi::Property< std::string > m_hgtdClustersDir
Definition: PhysValTool.h:88
ActsTrk::PhysValTool::fillHistograms
virtual StatusCode fillHistograms() override
An inheriting class should either override this function or fillHists().
Definition: PhysValTool.cxx:235
ActsTrk::PhysValTool::m_doPixelClusters
Gaudi::Property< bool > m_doPixelClusters
Definition: PhysValTool.h:77
ActsTrk::PhysValTool::m_stripClustersDir
Gaudi::Property< std::string > m_stripClustersDir
Definition: PhysValTool.h:87
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:617
ActsTrk::PhysValTool::procHistograms
virtual StatusCode procHistograms() override
An inheriting class should either override this function or finalHists().
Definition: PhysValTool.cxx:261
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ActsTrk::PhysValTool::m_hgtdID
const HGTD_ID * m_hgtdID
Definition: PhysValTool.h:103
ActsTrk::PhysValTool::m_doPixelSpacePoints
Gaudi::Property< bool > m_doPixelSpacePoints
Definition: PhysValTool.h:80
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::PhysValTool::m_pixelID
const PixelID * m_pixelID
Definition: PhysValTool.h:101
ActsTrk::PhysValTool::bookCollection
StatusCode bookCollection(external_collection_t *)
Definition: PhysValTool.h:107
xAOD::StripCluster_v1
Definition: StripCluster_v1.h:17
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::PhysValTool::m_pixelSpacePointValidationPlots
std::unique_ptr< ActsTrk::PixelSpacePointValidationPlots > m_pixelSpacePointValidationPlots
Definition: PhysValTool.h:97
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::PhysValTool::m_pixelSPDir
Gaudi::Property< std::string > m_pixelSPDir
Definition: PhysValTool.h:89
ActsTrk::PhysValTool::m_stripOSPDir
Gaudi::Property< std::string > m_stripOSPDir
Definition: PhysValTool.h:91
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrk::PhysValTool::m_pixelClusterValidationPlots
std::unique_ptr< ActsTrk::PixelClusterValidationPlots > m_pixelClusterValidationPlots
Definition: PhysValTool.h:93
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
ActsTrk::PhysValTool::fillStripSpacePoints
StatusCode fillStripSpacePoints(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:200
xAOD::PixelCluster_v1
Definition: PixelCluster_v1.h:17
ActsTrk::PhysValTool::m_stripID
const SCT_ID * m_stripID
Definition: PhysValTool.h:102
ActsTrk::PhysValTool::m_pixelClustersDir
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
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
ActsTrk::PhysValTool::m_pixelSpacePointContainerKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_pixelSpacePointContainerKey
Definition: PhysValTool.h:67
ActsTrk::PhysValTool::PhysValTool
PhysValTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PhysValTool.cxx:9
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:55
ActsTrk::PhysValTool::fillStripClusters
StatusCode fillStripClusters(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:165
ActsTrk::PhysValTool::m_hgtdClusterValidationPlots
std::unique_ptr< ActsTrk::HgtdClusterValidationPlots > m_hgtdClusterValidationPlots
Definition: PhysValTool.h:95
ActsTrk::PhysValTool::m_stripOverlapSpacePointValidationPlots
std::unique_ptr< ActsTrk::StripSpacePointValidationPlots > m_stripOverlapSpacePointValidationPlots
Definition: PhysValTool.h:99
python.LumiCalcRecover.subdir
subdir
Definition: LumiCalcRecover.py:25
ActsTrk::PhysValTool::fillStripOverlapSpacePoints
StatusCode fillStripOverlapSpacePoints(const EventContext &ctx, float beamSpotWeight)
Definition: PhysValTool.cxx:217
ActsTrk::PhysValTool::m_doStripClusters
Gaudi::Property< bool > m_doStripClusters
Definition: PhysValTool.h:78