ATLAS Offline Software
Loading...
Searching...
No Matches
HgtdClusterAnalysisAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11namespace ActsTrk {
12
13 HgtdClusterAnalysisAlg::HgtdClusterAnalysisAlg(const std::string& name, ISvcLocator *pSvcLocator)
14 : AthMonitorAlgorithm(name, pSvcLocator)
15 {}
16
18 ATH_MSG_DEBUG( "Initializing " << name() << " ... " );
19
21 ATH_CHECK( m_HGTDDetEleCollKey.initialize() );
22 ATH_CHECK(detStore()->retrieve(m_hgtdID,"HGTD_ID"));
23
24 ATH_MSG_DEBUG("Monitoring settings ...");
26
28 }
29
30 StatusCode HgtdClusterAnalysisAlg::fillHistograms(const EventContext& ctx) const {
31 ATH_MSG_DEBUG( "In " << name() << "::fillHistograms()" );
32
34 const InDetDD::HGTD_DetectorElementCollection* hgtdElements(*hgtdDetEleHandle);
35 if (not hgtdDetEleHandle.isValid() or hgtdElements==nullptr) {
36 ATH_MSG_FATAL(m_HGTDDetEleCollKey.fullKey() << " is not available.");
37 return StatusCode::FAILURE;
38 }
39
41 if (not inputHgtdClusterContainer.isValid()){
42 ATH_MSG_FATAL("xAOD::HGTDClusterContainer with key " << m_hgtdClusterContainerKey.key() << " is not available...");
43 return StatusCode::FAILURE;
44 }
45 const xAOD::HGTDClusterContainer* hgtdClusterContainer = inputHgtdClusterContainer.cptr();
46
47 // IDs variables, e.g. module, disk or any detector-related variable HGTD uses
48 // We can add global position here
49 // Variables like eta, perp
50
51 std::vector<float> global_x (hgtdClusterContainer->size(), 0);
52 std::vector<float> global_y (hgtdClusterContainer->size(), 0);
53 std::vector<float> global_z (hgtdClusterContainer->size(), 0);
54 std::vector<float> global_r (hgtdClusterContainer->size(), 0);
55 std::vector<float> eta (hgtdClusterContainer->size(), 0);
56
57 for (std::size_t i(0ul); i<hgtdClusterContainer->size(); ++i) {
58 const xAOD::HGTDCluster *cluster = hgtdClusterContainer->at(i);
59 const Identifier& id = m_hgtdID->wafer_id(cluster->identifierHash());
60 const auto *element = InDetDD::HGTDDetEl::getDetectorElement(m_hgtdID->wafer_hash(m_hgtdID->wafer_id(id)),*hgtdElements);
61
62 const Amg::Transform3D& T = element->surface().transform();
63 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
64 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
65 double R [3] = {T(0,3),T(1,3),T(2,3)};
66
67 const auto& local_position = cluster->template localPosition<3>();
69 M[0] = local_position(0,0);
70 M[1] = local_position(1,0);
71 Amg::Vector3D globalPos(M[0]*Ax[0]+M[1]*Ay[0]+R[0],M[0]*Ax[1]+M[1]*Ay[1]+R[1],M[0]*Ax[2]+M[1]*Ay[2]+R[2]);
72
73 global_x[i] = globalPos.x();
74 global_y[i] = globalPos.y();
75 global_z[i] = globalPos.z();
76 global_r[i] = std::sqrt(global_x[i]*global_x[i] + global_y[i]*global_y[i]);
77 eta[i] = globalPos.eta();
78 }
79
80 // Local Position
81 auto monitor_localX = Monitored::Collection("localX", *inputHgtdClusterContainer,
82 [] (const auto cluster) -> float
83 {
84 const auto& localPos = cluster->template localPosition<3>();
85 return localPos(0,0);
86 });
87 auto monitor_localY = Monitored::Collection("localY", *inputHgtdClusterContainer,
88 [] (const auto cluster) -> float
89 {
90 const auto& localPos = cluster->template localPosition<3>();
91 return localPos(1,0);
92 });
93
94 auto monitor_localT = Monitored::Collection("localT", *inputHgtdClusterContainer,
95 [] (const auto cluster) -> float
96 {
97 return cluster->time();
98 });
99
100 // Local Covariance
101 auto monitor_localCovXX = Monitored::Collection("localCovXX", *inputHgtdClusterContainer,
102 [] (const auto* cluster) -> float
103 { return cluster->template localCovariance<3>()(0, 0); });
104 auto monitor_localCovYY = Monitored::Collection("localCovYY", *inputHgtdClusterContainer,
105 [] (const auto* cluster) -> float
106 { return cluster->template localCovariance<3>()(1, 1); });
107
108 auto monitor_localCovTT = Monitored::Collection("localCovTT", *inputHgtdClusterContainer,
109 [] (const auto* cluster) -> float
110 { return cluster->timeCovariance(); });
111
112 auto monitor_globalX = Monitored::Collection("globalX", global_x);
113 auto monitor_globalY = Monitored::Collection("globalY", global_y);
114 auto monitor_globalZ = Monitored::Collection("globalZ", global_z);
115 auto monitor_globalR = Monitored::Collection("globalR", global_r);
116 auto monitor_eta = Monitored::Collection("eta", eta);
117
118 fill(m_monGroupName.value(),
119 monitor_localX, monitor_localY, monitor_localT,
120 monitor_localCovXX, monitor_localCovYY, monitor_localCovTT,
121 monitor_globalX, monitor_globalY, monitor_globalZ, monitor_globalR,
122 monitor_eta);
123 return StatusCode::SUCCESS;
124 }
125
126}
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_FATAL(x,...)
Header file to be included by clients of the Monitored infrastructure.
virtual StatusCode initialize() override
initialize
SG::ReadHandleKey< xAOD::HGTDClusterContainer > m_hgtdClusterContainerKey
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Gaudi::Property< std::string > m_monGroupName
HgtdClusterAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< InDetDD::HGTD_DetectorElementCollection > m_HGTDDetEleCollKey
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode initialize() override
initialize
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash).
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::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
const HGTD_DetectorElement * getDetectorElement(const IdentifierHash &hash, const HGTD_DetectorElementCollection &coll)
DataVector< HGTD_DetectorElement > HGTD_DetectorElementCollection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
HGTDClusterContainer_v1 HGTDClusterContainer
Define the version of the HGTD cluster container.
HGTDCluster_v1 HGTDCluster
Define the version of the pixel cluster class.
Definition HGTDCluster.h:13