54 ATH_MSG_DEBUG(
" ***************** Start of process STGC Collection with hash Id: " <<
hash);
56 auto stgcPrepDataContainer = xAODcontainers.prd;
58 if ( stgcPrepDataContainer->indexFindPtr(
hash) !=
nullptr ) {
59 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the sTGC PrepData container");
60 return StatusCode::FAILURE;
67 if(
lock.OnlineAndPresentInAnotherView() ) {
68 ATH_MSG_DEBUG(
"In processCollection: collection already available in the sTgc PrepData container (via cache)");
69 return StatusCode::SUCCESS;
73 std::unique_ptr<sTgcPrepDataCollection> prdColl = std::make_unique<sTgcPrepDataCollection>(
hash);
78 int getId = id_helper.
get_id(
hash, moduleId, &context);
86 std::vector<sTgcPrepData> sTgcStripPrds;
87 std::vector<sTgcPrepData> sTgcWirePrds;
88 std::vector<sTgcPrepData> sTgcPadPrds;
89 sTgcStripPrds.reserve(rdoColl->
size());
90 sTgcPadPrds.reserve(rdoColl->
size());
91 sTgcWirePrds.reserve(rdoColl->
size());
106 std::vector<Identifier> rdoList{rdoId};
113 if (channelType < 0 || channelType > 2) {
115 return StatusCode::FAILURE;
119 return StatusCode::FAILURE;
129 int calibratedCharge =
static_cast<int>(calibStrip.
charge);
130 if (calibratedCharge < 0 && channelType == 1) {
131 if (!hitNegativeCharge) {
132 ATH_MSG_DEBUG(
"One sTGC RDO or more, such as one with pdo = "<<rdo->charge() <<
" counts, corresponds to a negative charge (" << calibratedCharge <<
"). Skipping these RDOs");
133 hitNegativeCharge =
true;
139 if (channelType == sTgcIdHelper::sTgcChannelTypes::Pad) {
163 std::vector<sTgcPrepData>& sTgcPrds = channelType ==
sTgcIdHelper::Pad ? sTgcPadPrds :
167 auto it = std::find_if(sTgcPrds.begin(), sTgcPrds.end(), [&rdoId](
const sTgcPrepData& prd) {
168 return (prd.identify() == rdoId);
170 if (
it == sTgcPrds.end()) {
171 sTgcPrds.emplace_back(rdoId,
hash, std::move(localPos), std::move(rdoList), std::move(
cov), detEl, calibratedCharge, calibStrip.
time);
173 }
else if (
it->time() > calibStrip.
time) {
174 *
it =
sTgcPrepData(rdoId,
hash, std::move(localPos), std::move(rdoList), std::move(
cov), detEl, calibratedCharge, calibStrip.
time);
182 prdColl->
push_back(std::make_unique<sTgcPrepData>(rdoId,
195 std::vector<std::unique_ptr<Muon::sTgcPrepData>> sTgcStripClusters;
198 for ( std::unique_ptr<Muon::sTgcPrepData>&
it : sTgcStripClusters ) {
204 prdColl->
push_back(std::make_unique<sTgcPrepData>(std::move(prd)));
208 prdColl->
push_back(std::make_unique<sTgcPrepData>(std::move(prd)));
223 <<
", cov: "<<prd->localCovariance()(0,0)
226 outHit = xAODcontainers.pad->push_back(std::make_unique<xAOD::sTgcPadHit>());
228 lCov(0,0) = prd->localCovariance()(0,0);
231 outHit->setMeasurement<2>(
m_idHelperSvc->detElementHash(prdId),
235 outHit = xAODcontainers.wire->push_back(std::make_unique<xAOD::sTgcWireHit>());
237 auto stripHit = xAODcontainers.strip->push_back(std::make_unique<xAOD::sTgcStripCluster>());
238 stripHit->setStripCharges(prd->stripCharges());
239 stripHit->setStripNumbers(prd->stripNumbers());
240 stripHit->setStripTimes(prd->stripTimes());
246 if (
chType != sTgcIdHelper::sTgcChannelTypes::Pad){
249 lCov(0,0) = prd->localCovariance()(0,0);
250 outHit->setMeasurement<1>(
m_idHelperSvc->detElementHash(prdId),
255 outHit->setChannelNumber(
channel);
256 outHit->setGasGap(
gasGap);
257 outHit->setAuthor(prd->author());
258 outHit->setTime(prd->time());
259 outHit->setCharge(prd->charge());
260 outHit->setIdentifier(prdId.get_compact());
262 outHit->setReadoutElement(
m_detMgrR4->getsTgcReadoutElement(prdId));
272 return StatusCode::SUCCESS;