ATLAS Offline Software
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 
8 namespace 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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ActsTrk::PixelClusterAnalysisAlg::PixelClusterAnalysisAlg
PixelClusterAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PixelClusterAnalysisAlg.cxx:10
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
PixelClusterAnalysisAlg.h
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthMonitorAlgorithm::fill
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.
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
ActsTrk::PixelClusterAnalysisAlg::m_pixelClusterContainerKey
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClusterContainerKey
Definition: PixelClusterAnalysisAlg.h:26
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition: PixelID.h:651
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ActsTrk::PixelClusterAnalysisAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: PixelClusterAnalysisAlg.cxx:27
ActsTrk::PixelClusterAnalysisAlg::m_monGroupName
Gaudi::Property< std::string > m_monGroupName
Definition: PixelClusterAnalysisAlg.h:30
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
ActsTrk::PixelClusterAnalysisAlg::m_pixelID
const PixelID * m_pixelID
Definition: PixelClusterAnalysisAlg.h:32
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
ActsTrk::PixelClusterAnalysisAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: PixelClusterAnalysisAlg.cxx:14