46 {
47 ATH_MSG_DEBUG(
" ***************** Start of process MM Collection");
49
51
52 const IdentifierHash
hash = rdoColl->identifierHash();
53
54
55 if (!idsToDecode.empty() and std::find(idsToDecode.begin(), idsToDecode.end(),
56 hash) == idsToDecode.end()) {
57 ATH_MSG_DEBUG(
"Hash ID " << hash <<
" not in input list, ignore");
58 return StatusCode::SUCCESS;
59 } else
61
62
63 if (mmPrepDataContainer->
indexFindPtr(hash) !=
nullptr) {
64
65 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the MM PrepData container");
66 return StatusCode::SUCCESS;
67 }
68
69
71
72
73 if (lock.OnlineAndPresentInAnotherView()) {
74 ATH_MSG_DEBUG(
"In processCollection: collection already available in the MM PrepData container (via cache)");
75 return StatusCode::SUCCESS;
76 }
77 auto prdColl = std::make_unique<MMPrepDataCollection>(hash);
78
79
81 Identifier moduleId{};
82 if (id_helper.
get_id(hash, moduleId, &context) != 0) {
83 ATH_MSG_ERROR(
"Could not convert the hash Id: " << hash <<
" to identifier");
84 } else {
86 prdColl->setIdentifier(moduleId);
87 }
88
89 const MuonGM::MuonDetectorManager* MuonDetMgr{};
91
92 std::vector<MMPrepData> MMprds;
93
94 for (const MM_RawData* rdo : *rdoColl) {
96
97 const Identifier rdoId = rdo->identify();
98
99
100
102 std::vector<Identifier> rdoList;
104 ATH_MSG_DEBUG(
" channel RDO " << channel <<
" channel from rdoID " << id_helper.
channel(rdoId));
105 rdoList.push_back(prdId);
106
107
110
112 if (!getLocalPos) {
113 if (msgLvl(MSG::DEBUG)) {
115 }
116 continue;
117 }
118
121 if (!getGlobalPos) {
123 continue;
124 }
125 NSWCalib::CalibratedStrip calibStrip;
127 if (calibStrip.
charge < 0) {
128 if (!hitNegativeCharge || msgLvl(MSG::DEBUG)) {
129 ATH_MSG_DEBUG(
"One MM RDO or more, such as one with pdo = "<< rdo->charge()
130 <<
" counts, corresponds to a negative charge ("<< calibStrip.
charge <<
"). Skipping these RDOs");
131 hitNegativeCharge = true;
132 }
133 continue;
134 }
135
136 Trk::LocalDirection localDir;
137 const Trk::PlaneSurface& psurf = detEl->
surface(prdId);
141
144
146 ATH_MSG_DEBUG(
" MM detector surface direction phi "<< gdir.phi() <<
" global radius hit " << globalPos.perp()
147 << " phi pos " << globalPos.phi() << " global z "<< globalPos.z());
148
153 localPos.x() += calibStrip.
dx;
154
155 if (!merge) {
156
157 auto mpd = std::make_unique<MMPrepData>(prdId, hash,
158 std::move(localPos), std::move(rdoList), std::move(cov),
159 detEl,
162
163 prdColl->push_back(std::move(mpd));
164
165 } else {
167
168 continue;
169 }
170
171 MMPrepData mpd(prdId, hash, std::move(localPos), std::move(rdoList),
172 std::move(cov), detEl, calibStrip.
time, calibStrip.
charge,
174
175
176 mpd.setHashAndIndex(hash, 0);
178 MMprds.push_back(std::move(mpd));
179 }
180 }
181
182 if (merge) {
183 std::vector<std::unique_ptr<MMPrepData>>
clusters;
184
187
188 for (std::unique_ptr<MMPrepData>& prdN : clusters) {
189 prdN->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
190 prdColl->push_back(std::move(prdN));
191 }
192 }
193
194 if (xAODContainer) {
195
196 std::vector<const MMPrepData*> sortMe{prdColl->begin(), prdColl->end()};
197 std::ranges::sort(sortMe, IdentifierByDetElSorter{
m_idHelperSvc.get()});
220 }
221 }
222 }
223
224 ATH_CHECK(lock.addOrDelete(std::move(prdColl)));
225 ATH_MSG_DEBUG(
"PRD hash " << hash <<
" has been moved to container");
226
227 return StatusCode::SUCCESS;
228}
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
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
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 setReadoutElement(const MuonGMR4::MmReadoutElement *readoutEle)
set the pointer to the MmReadoutElement
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
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
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.