ATLAS Offline Software
StripClusterAnalysisAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 namespace ActsTrk {
9 
10  StripClusterAnalysisAlg::StripClusterAnalysisAlg(const std::string& name, ISvcLocator *pSvcLocator)
11  : AthMonitorAlgorithm(name, pSvcLocator)
12  {}
13 
15  ATH_MSG_DEBUG( "Initializing " << name() << " ... " );
16 
18  ATH_CHECK(detStore()->retrieve(m_stripID,"SCT_ID"));
19 
20  ATH_MSG_DEBUG("Monitoring settings ...");
22 
24  }
25 
26  StatusCode StripClusterAnalysisAlg::fillHistograms(const EventContext& ctx) const {
27  ATH_MSG_DEBUG(" In " << name() << "::fillHistograms()" );
28 
30  if (!inputStripClusterContainer.isValid()){
31  ATH_MSG_FATAL("xAOD::StripClusterContainer with key " << m_stripClusterContainerKey.key() << " is not available...");
32  return StatusCode::FAILURE;
33  }
34 
35  auto monitor_barrelEndcap = Monitored::Collection("barrelEndcap", *inputStripClusterContainer,
36  [this] (const auto* cluster) -> int
37  {
38  const Identifier& id = m_stripID->wafer_id(cluster->identifierHash());
39  return m_stripID->barrel_ec(id);
40  });
41  auto monitor_layerDisk = Monitored::Collection("layerDisk", *inputStripClusterContainer,
42  [this] (const auto* cluster) -> int
43  {
44  const Identifier& id = m_stripID->wafer_id(cluster->identifierHash());
45  return m_stripID->layer_disk(id);
46  });
47  auto monitor_phiModule = Monitored::Collection("phiModule", *inputStripClusterContainer,
48  [this] (const auto* cluster) -> int
49  {
50  const Identifier& id = m_stripID->wafer_id(cluster->identifierHash());
51  return m_stripID->phi_module(id);
52  });
53  auto monitor_etaModule = Monitored::Collection("etaModule", *inputStripClusterContainer,
54  [this] (const auto* cluster) -> int
55  {
56  const Identifier& id = m_stripID->wafer_id(cluster->identifierHash());
57  return m_stripID->eta_module(id);
58  });
59  auto monitor_sideModule = Monitored::Collection("sideModule", *inputStripClusterContainer,
60  [this] (const auto* cluster) -> int
61  {
62  const Identifier& id = m_stripID->wafer_id(cluster->identifierHash());
63  return m_stripID->side(id);
64  });
65 
66 
67  auto monitor_eta = Monitored::Collection("eta", *inputStripClusterContainer,
68  [] (const auto* cluster) -> double
69  {
70  const auto& globalPos = cluster->globalPosition();
71  Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
72  return globalPosition.eta();
73  });
74  auto monitor_perp = Monitored::Collection("perp", *inputStripClusterContainer,
75  [] (const auto* cluster) -> float
76  {
77  const auto& globalPos = cluster->globalPosition();
78  Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
79  return globalPosition.perp();
80  });
81 
82  auto monitor_globalX = Monitored::Collection("globalX", *inputStripClusterContainer,
83  [] (const auto* cluster) -> float
84  { return cluster->globalPosition()(0, 0); });
85  auto monitor_globalY = Monitored::Collection("globalY", *inputStripClusterContainer,
86  [] (const auto* cluster) -> float
87  { return cluster->globalPosition()(1, 0); });
88  auto monitor_globalZ = Monitored::Collection("globalZ", *inputStripClusterContainer,
89  [] (const auto* cluster) -> float
90  { return cluster->globalPosition()(2, 0); });
91 
92  auto monitor_localX = Monitored::Collection("localX", *inputStripClusterContainer,
93  [] (const auto cluster) -> float
94  {
95  const auto& localPos = cluster->template localPosition<1>();
96  return localPos(0,0);
97  });
98 
99  auto monitor_localCovXX = Monitored::Collection("localCovXX", *inputStripClusterContainer,
100  [] (const auto* cluster) -> float
101  { return cluster->template localCovariance<1>()(0, 0); });
102 
103  auto monitor_sizeX = Monitored::Collection("sizeX", *inputStripClusterContainer,
104  [] (const auto* cluster) -> int
105  { return cluster->channelsInPhi(); });
106 
107  fill(m_monGroupName.value(),
108  monitor_barrelEndcap, monitor_layerDisk,
109  monitor_phiModule, monitor_etaModule, monitor_sideModule,
110  monitor_eta, monitor_perp,
111  monitor_globalX, monitor_globalY, monitor_globalZ,
112  monitor_localX, monitor_localCovXX,
113  monitor_sizeX);
114 
115  return StatusCode::SUCCESS;
116  }
117 
118 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
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
StripClusterAnalysisAlg.h
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
ActsTrk::StripClusterAnalysisAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: StripClusterAnalysisAlg.cxx:14
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
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?
ActsTrk::StripClusterAnalysisAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: StripClusterAnalysisAlg.cxx:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
ActsTrk::StripClusterAnalysisAlg::m_stripID
const SCT_ID * m_stripID
Definition: StripClusterAnalysisAlg.h:32
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
ActsTrk::StripClusterAnalysisAlg::m_stripClusterContainerKey
SG::ReadHandleKey< xAOD::StripClusterContainer > m_stripClusterContainerKey
Definition: StripClusterAnalysisAlg.h:26
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
ActsTrk::StripClusterAnalysisAlg::StripClusterAnalysisAlg
StripClusterAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: StripClusterAnalysisAlg.cxx:10
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
ActsTrk::StripClusterAnalysisAlg::m_monGroupName
Gaudi::Property< std::string > m_monGroupName
Definition: StripClusterAnalysisAlg.h:30
Identifier
Definition: IdentifierFieldParser.cxx:14