43 {
44 ATH_MSG_DEBUG(
" ***************** Start of process MM Collection");
46
48
49 const IdentifierHash
hash = rdoColl->identifierHash();
50
51
52 if (!idsToDecode.empty() and std::find(idsToDecode.begin(), idsToDecode.end(),
53 hash) == idsToDecode.end()) {
54 ATH_MSG_DEBUG(
"Hash ID " << hash <<
" not in input list, ignore");
55 return StatusCode::SUCCESS;
56 } else
58
59
60 if (mmPrepDataContainer->
indexFindPtr(hash) !=
nullptr) {
61
62 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the MM PrepData container");
63 return StatusCode::SUCCESS;
64 }
65
66
68
69
70 if (lock.OnlineAndPresentInAnotherView()) {
71 ATH_MSG_DEBUG(
"In processCollection: collection already available in the MM PrepData container (via cache)");
72 return StatusCode::SUCCESS;
73 }
74 auto prdColl = std::make_unique<MMPrepDataCollection>(hash);
75
76
78 Identifier moduleId{};
79 if (id_helper.
get_id(hash, moduleId, &context) != 0) {
80 ATH_MSG_ERROR(
"Could not convert the hash Id: " << hash <<
" to identifier");
81 } else {
83 prdColl->setIdentifier(moduleId);
84 }
85
86
87 SG::ReadCondHandle<MuonGM::MuonDetectorManager> MuonDetMgr{
m_muDetMgrKey, ctx};
89 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
90 return StatusCode::FAILURE;
91 }
92
93 std::vector<MMPrepData> MMprds;
94
95 for (const MM_RawData* rdo : *rdoColl) {
97
98 const Identifier rdoId = rdo->identify();
99
100
101
103 std::vector<Identifier> rdoList;
105 ATH_MSG_DEBUG(
" channel RDO " << channel <<
" channel from rdoID " << id_helper.
channel(rdoId));
106 rdoList.push_back(prdId);
107
108
109 const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(prdId);
111
113 if (!getLocalPos) {
114 if (msgLvl(MSG::DEBUG)) {
116 }
117 continue;
118 }
119
122 if (!getGlobalPos) {
124 continue;
125 }
126 NSWCalib::CalibratedStrip calibStrip;
128 if (calibStrip.
charge < 0) {
129 if (!hitNegativeCharge || msgLvl(MSG::DEBUG)) {
130 ATH_MSG_DEBUG(
"One MM RDO or more, such as one with pdo = "<< rdo->charge()
131 <<
" counts, corresponds to a negative charge ("<< calibStrip.
charge <<
"). Skipping these RDOs");
132 hitNegativeCharge = true;
133 }
134 continue;
135 }
136
137 Trk::LocalDirection localDir;
138 const Trk::PlaneSurface& psurf = detEl->
surface(prdId);
142
145
147 ATH_MSG_DEBUG(
" MM detector surface direction phi "<< gdir.phi() <<
" global radius hit " << globalPos.perp()
148 << " phi pos " << globalPos.phi() << " global z "<< globalPos.z());
149
154 localPos.x() += calibStrip.
dx;
155
156 if (!merge) {
157
158 auto mpd = std::make_unique<MMPrepData>(prdId, hash,
159 std::move(localPos), std::move(rdoList), std::move(cov),
160 detEl,
163
164 prdColl->push_back(std::move(mpd));
165
166 } else {
168
169 continue;
170 }
171
172 MMPrepData mpd(prdId, hash, std::move(localPos), std::move(rdoList),
173 std::move(cov), detEl, calibStrip.
time, calibStrip.
charge,
175
176
177 mpd.setHashAndIndex(hash, 0);
179 MMprds.push_back(std::move(mpd));
180 }
181 }
182
183 if (merge) {
184 std::vector<std::unique_ptr<MMPrepData>>
clusters;
185
188
189 for (std::unique_ptr<MMPrepData>& prdN : clusters) {
190 prdN->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
191 prdColl->push_back(std::move(prdN));
192 }
193 }
194
195 if (xAODContainer) {
196
197 std::vector<const MMPrepData*> sortMe{prdColl->begin(), prdColl->end()};
198 std::ranges::sort(sortMe, IdentifierByDetElSorter{
m_idHelperSvc.get()});
219 }
220 }
221
222 ATH_CHECK(lock.addOrDelete(std::move(prdColl)));
223 ATH_MSG_DEBUG(
"PRD hash " << hash <<
" has been moved to container");
224
225 return StatusCode::SUCCESS;
226}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
int multilayer(const Identifier &id) const
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
IdContext module_context() const
id for module
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
void setDriftDist(float value)
Sets the drift distance.
void setStripDriftDist(const std::vector< float > &stripDriftDist)
void setStripDriftErrors(const std::vector< DriftCov_t > &stripDriftErrors)
void setStripNumbers(const std::vector< uint16_t > &stripNumbers)
void setStripCharges(const std::vector< int > &stripCharges)
void setAuthor(Author author)
void setChiSqProb(float value)
Sets the microTPC chisq probability.
void setTime(uint16_t value)
Sets the TDC counts.
void setAngle(float value)
Sets the microTPC angle.
void setQuality(Quality quality)
void setStripTimes(const std::vector< int16_t > &stripTimes)
void setChannelNumber(uint16_t strip)
void setGasGap(uint8_t gap)
void setCharge(uint32_t value)
Sets the calibrated charge.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.