21 std::atomic<bool> hitNegativeCharge{
false};
39 return StatusCode::SUCCESS;
45 const std::vector<IdentifierHash>& idsToDecode,
47 ATH_MSG_DEBUG(
" ***************** Start of process MM Collection");
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;
63 if (mmPrepDataContainer->
indexFindPtr(hash) !=
nullptr) {
65 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the MM PrepData container");
66 return StatusCode::SUCCESS;
74 ATH_MSG_DEBUG(
"In processCollection: collection already available in the MM PrepData container (via cache)");
75 return StatusCode::SUCCESS;
77 auto prdColl = std::make_unique<MMPrepDataCollection>(hash);
82 if (id_helper.
get_id(hash, moduleId, &context) != 0) {
83 ATH_MSG_ERROR(
"Could not convert the hash Id: " << hash <<
" to identifier");
86 prdColl->setIdentifier(moduleId);
92 std::vector<MMPrepData> MMprds;
101 int channel = rdo->channel();
102 std::vector<Identifier> rdoList;
104 ATH_MSG_DEBUG(
" channel RDO " << channel <<
" channel from rdoID " << id_helper.
channel(rdoId));
105 rdoList.push_back(prdId);
113 if (msgLvl(MSG::DEBUG)) {
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;
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());
153 localPos.x() += calibStrip.
dx;
157 auto mpd = std::make_unique<MMPrepData>(prdId, hash,
158 std::move(localPos), std::move(rdoList), std::move(cov),
163 prdColl->push_back(std::move(mpd));
171 MMPrepData mpd(prdId, hash, std::move(localPos), std::move(rdoList),
172 std::move(cov), detEl, calibStrip.
time, calibStrip.
charge,
178 MMprds.push_back(std::move(mpd));
183 std::vector<std::unique_ptr<MMPrepData>> clusters;
188 for (std::unique_ptr<MMPrepData>& prdN : clusters) {
189 prdN->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
190 prdColl->push_back(std::move(prdN));
196 std::vector<const MMPrepData*> sortMe{prdColl->begin(), prdColl->end()};
225 ATH_MSG_DEBUG(
"PRD hash " << hash <<
" has been moved to container");
227 return StatusCode::SUCCESS;
233 if (rdoContainerHandle.isValid()) {
235 return rdoContainerHandle.cptr();
245 const std::vector<IdentifierHash>& idsToDecode)
const {
254 if (rdoColl->empty()){
257 ATH_MSG_DEBUG(
"New RDO collection with " << rdoColl->size() <<
"MM Hits");
259 if (
processCollection(ctx, mmPrepDataContainer, xAODContainer, idsToDecode, rdoColl).isFailure()) {
261 "processCsm returns a bad StatusCode - keep going for new data "
262 "collections in this event");
269 const std::vector<IdentifierHash>& idVect)
const {
272 ATH_MSG_DEBUG(
"Size of the RDO container to be decoded: " << idVect.size());
276 if (!mmPrepDataContainer) {
277 return StatusCode::FAILURE;
284 ATH_CHECK(outputContainer.
record(std::make_unique<xAOD::MMClusterContainer>(),
285 std::make_unique<xAOD::MMClusterAuxContainer>()));
286 xAODContainer = outputContainer.
ptr();
291 return StatusCode::SUCCESS;
295 const std::vector<uint32_t>&)
const {
297 return StatusCode::FAILURE;
302 ATH_CHECK(writeHandle.
record(std::make_unique<xAOD::MMClusterContainer>(),
303 std::make_unique<xAOD::MMClusterAuxContainer>()));
307 : StatusCode::FAILURE;
317 handle.
record(std::make_unique<MMPrepDataContainer>(
320 if (status.isFailure() || !handle.
isValid()) {
322 "Could not record container of MicroMega PrepData Container at "
329 if (!update.isValid()) {
333 StatusCode status = handle.
record(std::make_unique<MMPrepDataContainer>(update.ptr()));
334 if (status.isFailure() || !handle.
isValid()) {
336 "Could not record container of MM PrepData Container using cache "
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
bool OnlineAndPresentInAnotherView()
This method is to avoid calling an expensive operation in the offline case.
StatusCode addOrDelete(std::unique_ptr< T > ptr)
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,...
This is a "hash" representation of an Identifier.
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
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
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
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
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
Class to represent MM measurements.
void setAuthor(Author author)
const IdentifierHash & identifierHash() const
Temporary class to hold the MM RDO.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
pointer_type ptr()
Dereference the pointer.
represents the three-dimensional global direction with respect to a planar surface frame.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
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.
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
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
Ensure that the Athena extensions are properly loaded.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Ensure that the ATLAS eigen extensions are properly loaded.
MMClusterContainer_v1 MMClusterContainer
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.