ATLAS Offline Software
Loading...
Searching...
No Matches
PixelClusterAnalysisAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace ActsTrk {
9
10 PixelClusterAnalysisAlg::PixelClusterAnalysisAlg(const std::string& name, ISvcLocator *pSvcLocator)
11 : AthMonitorAlgorithm(name, pSvcLocator)
12 {}
13
15 ATH_MSG_DEBUG( "Initializing " << name() << " ... " );
16
18
19 ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID"));
20
21 ATH_MSG_DEBUG("Monitoring settings ...");
23
25 }
26
27 StatusCode PixelClusterAnalysisAlg::fillHistograms(const EventContext& ctx) const {
28 ATH_MSG_DEBUG( "In " << name() << "::fillHistograms()" );
29
31 if (!inputPixelClusterContainer.isValid()){
32 ATH_MSG_FATAL("xAOD::PixelClusterContainer with key " << m_pixelClusterContainerKey.key() << " is not available...");
33 return StatusCode::FAILURE;
34 }
35
36 auto monitor_barrelEndcap = Monitored::Collection("barrelEndcap", *inputPixelClusterContainer,
37 [this] (const auto* cluster) -> int
38 {
39 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
40 return m_pixelID->barrel_ec(id);
41 });
42 auto monitor_layerDisk = Monitored::Collection("layerDisk", *inputPixelClusterContainer,
43 [this] (const auto* cluster) -> int
44 {
45 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
46 return m_pixelID->layer_disk(id);
47 });
48 auto monitor_phiModule = Monitored::Collection("phiModule", *inputPixelClusterContainer,
49 [this] (const auto* cluster) -> int
50 {
51 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
52 return m_pixelID->phi_module(id);
53 });
54 auto monitor_etaModule = Monitored::Collection("etaModule", *inputPixelClusterContainer,
55 [this] (const auto* cluster) -> int
56 {
57 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
58 return m_pixelID->eta_module(id);
59 });
60 auto monitor_isInnermost = Monitored::Collection("isInnermost", *inputPixelClusterContainer,
61 [this] (const auto* cluster) -> int
62 {
63 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
64 int pixLayerDisk = m_pixelID->layer_disk(id);
65 return int(pixLayerDisk==0);
66 });
67 auto monitor_isNextToInnermost = Monitored::Collection("isNextToInnermost", *inputPixelClusterContainer,
68 [this] (const auto* cluster) -> int
69 {
70 const Identifier& id = m_pixelID->wafer_id(cluster->identifierHash());
71 int pixLayerDisk = m_pixelID->layer_disk(id);
72 int pixBrlEc = m_pixelID->barrel_ec(id);
73 return int((pixLayerDisk==1) or (pixBrlEc!=0 and pixLayerDisk==2));
74 });
75
76 auto monitor_eta = Monitored::Collection("eta", *inputPixelClusterContainer,
77 [] (const auto* cluster) -> double
78 {
79 const auto& globalPos = cluster->globalPosition();
80 Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
81 return globalPosition.eta();
82 });
83 auto monitor_perp = Monitored::Collection("perp", *inputPixelClusterContainer,
84 [] (const auto* cluster) -> float
85 {
86 const auto& globalPos = cluster->globalPosition();
87 Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
88 return globalPosition.perp();
89 });
90
91 auto monitor_globalX = Monitored::Collection("globalX", *inputPixelClusterContainer,
92 [] (const auto* cluster) -> float
93 { return cluster->globalPosition()(0, 0); });
94 auto monitor_globalY = Monitored::Collection("globalY", *inputPixelClusterContainer,
95 [] (const auto* cluster) -> float
96 { return cluster->globalPosition()(1, 0); });
97 auto monitor_globalZ = Monitored::Collection("globalZ", *inputPixelClusterContainer,
98 [] (const auto* cluster) -> float
99 { return cluster->globalPosition()(2, 0); });
100
101 auto monitor_localX = Monitored::Collection("localX", *inputPixelClusterContainer,
102 [] (const auto cluster) -> float
103 {
104 const auto& localPos = cluster->template localPosition<2>();
105 return localPos(0,0);
106 });
107 auto monitor_localY = Monitored::Collection("localY", *inputPixelClusterContainer,
108 [] (const auto cluster) -> float
109 {
110 const auto& localPos = cluster->template localPosition<2>();
111 return localPos(1,0);
112 });
113
114 auto monitor_localCovXX = Monitored::Collection("localCovXX", *inputPixelClusterContainer,
115 [] (const auto* cluster) -> float
116 { return cluster->template localCovariance<2>()(0, 0); });
117 auto monitor_localCovYY = Monitored::Collection("localCovYY", *inputPixelClusterContainer,
118 [] (const auto* cluster) -> float
119 { return cluster->template localCovariance<2>()(1, 1); });
120
121 auto monitor_sizeX = Monitored::Collection("sizeX", *inputPixelClusterContainer,
122 [] (const auto* cluster) -> int
123 { return cluster->channelsInPhi(); });
124 auto monitor_sizeY = Monitored::Collection("sizeY", *inputPixelClusterContainer,
125 [] (const auto* cluster) -> int
126 { return cluster->channelsInEta(); });
127
128 auto monitor_widthY = Monitored::Collection("widthY", *inputPixelClusterContainer,
129 [] (const auto* cluster) -> float
130 { return cluster->widthInEta(); });
131
132 fill(m_monGroupName.value(),
133 monitor_barrelEndcap, monitor_layerDisk,
134 monitor_phiModule, monitor_etaModule,
135 monitor_isInnermost, monitor_isNextToInnermost,
136 monitor_eta, monitor_perp,
137 monitor_globalX, monitor_globalY, monitor_globalZ,
138 monitor_localX, monitor_localY,
139 monitor_localCovXX, monitor_localCovYY,
140 monitor_sizeX, monitor_sizeY,
141 monitor_widthY);
142
143 return StatusCode::SUCCESS;
144 }
145
146}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
PixelClusterAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
virtual StatusCode initialize() override
initialize
Gaudi::Property< std::string > m_monGroupName
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClusterContainerKey
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode initialize() override
initialize
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Eigen::Matrix< double, 3, 1 > Vector3D
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.