22 ATH_CHECK(m_DetectorManagerKey.initialize());
24 return StatusCode::SUCCESS;
31 std::vector<Muon::sTgcPrepData>&& stripsVect,
32 std::vector<std::unique_ptr<Muon::sTgcPrepData>>& clustersVect)
const
35 ATH_MSG_DEBUG(
"Size of the input vector: " << stripsVect.size());
37 if (stripsVect.empty()) {
39 return StatusCode::SUCCESS;
43 if (!errorCalibDB.isValid()) {
44 ATH_MSG_FATAL(
"Failed to retrieve the parameterized errors "<<m_uncertCalibKey.fullKey());
45 return StatusCode::FAILURE;
51 Identifier chanId = stripsVect.at(0).identify();
52 IdentifierHash
hash = m_idHelperSvc->moduleHash(chanId);
54 int channelType = m_idHelperSvc->stgcIdHelper().channelType(stripsVect.at(0).identify());
59 std::array<std::vector<Muon::sTgcPrepData>, 8> stgcPrdsPerLayer = stgcClusterCommon.
sortSTGCPrdPerLayer(std::move(stripsVect));
62 if(!detManager.isValid()){
63 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
64 return StatusCode::FAILURE;
68 for (std::vector<sTgcPrepData>& unmerged : stgcPrdsPerLayer) {
70 std::vector<std::vector<Muon::sTgcPrepData>> layerClusters = stgcClusterCommon.
findStripCluster(std::move(unmerged),
74 for (std::vector<Muon::sTgcPrepData>& cluster: layerClusters) {
76 std::vector<Identifier> rdoList;
78 std::vector<int> elementsCharge;
79 std::vector<short int> elementsTime;
80 std::vector<uint16_t> elementsChannel;
81 std::vector<double> elementsLocalPositions;
82 std::vector<Identifier> elementsIdentifier;
83 double posY = (cluster.at(0)).localPosition().y();
87 rdoList.push_back(
it.identify());
88 elementsCharge.push_back(
it.charge());
89 elementsChannel.push_back(m_idHelperSvc->stgcIdHelper().channel(
it.identify()));
90 elementsTime.push_back(
it.time());
91 elementsLocalPositions.push_back(
it.localPosition().x());
92 elementsIdentifier.push_back(
it.identify());
98 double reconstructedPosX{0};
100 std::optional<Muon::STgcClusterPosition> optStripCluster = stgcClusterCommon.
caruanaGaussianFitting(cluster,
101 m_positionStripResolution,
102 m_angularStripResolution,
104 if (optStripCluster.has_value()) {
105 clusterId = (*optStripCluster).getClusterId();
106 reconstructedPosX = (*optStripCluster).getMeanPosition();
107 sigmaSq = (*optStripCluster).getErrorSquared();
110 ATH_MSG_DEBUG(
"sTGC cluster reconstruction using the Caruana method failed, reversing to the weighted average");
113 bool isStrip = (channelType == sTgcIdHelper::sTgcChannelTypes::Strip);
119 std::stringstream sstr{};
121 sstr << m_idHelperSvc->stgcIdHelper().print_to_string(prd.identify())
122 <<
", local pos: ("<< prd.localPosition().x() <<
"," << prd.localPosition().y()
123 <<
"), charge: " << prd.charge() <<
", time: " <<
static_cast<int>(prd.time())
126 ATH_MSG_VERBOSE(
"Reject invalid cluster..." << std::endl << std::endl << sstr.str());
132 clusterId = (*optClusterWA).getClusterId();
133 reconstructedPosX = (*optClusterWA).getMeanPosition();
134 sigmaSq = (*optClusterWA).getErrorSquared();
141 <<
" with error on cluster: " << std::sqrt((covN)(0,0)));
143 std::unique_ptr<sTgcPrepData> prdN = std::make_unique<sTgcPrepData>(clusterId,
145 std::move(localPosition),
148 cluster.at(0).detectorElement(),
151 std::move(elementsChannel),
152 std::move(elementsTime),
153 std::move(elementsCharge));
155 clustersVect.push_back(std::move(prdN));
159 ATH_MSG_DEBUG(
"Size of the output cluster vector: " << clustersVect.size());
161 return StatusCode::SUCCESS;
167 std::vector<Muon::sTgcPrepData*>& clustersVect )
const
171 for (
const auto&
it : stripsVect ) {
177 for (
auto *
it : clustersVect ) {