![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
23 std::atomic<bool> hitNegativeCharge{
false};
24 std::atomic<bool> invalidLocalPos{
false};
31 : base_class(
t,
n,
p) {}
37 ATH_CHECK(m_mmPrepDataContainerKey.initialize());
38 ATH_CHECK(m_rdoContainerKey.initialize());
42 m_prdContainerCacheKey.initialize(!m_prdContainerCacheKey.key().empty()));
43 ATH_CHECK(m_xAODKey.initialize(!m_xAODKey.empty()));
44 return StatusCode::SUCCESS;
50 const std::vector<IdentifierHash>& idsToDecode,
52 ATH_MSG_DEBUG(
" ***************** Start of process MM Collection");
56 if (rdoColl->
size() > 100)
62 if (!idsToDecode.empty() and
std::find(idsToDecode.begin(), idsToDecode.end(),
63 hash) == idsToDecode.end()) {
65 return StatusCode::SUCCESS;
72 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the MM PrepData container");
73 return StatusCode::SUCCESS;
82 ATH_MSG_DEBUG(
"In processCollection: collection already available in the MM PrepData container (via cache)");
83 return StatusCode::SUCCESS;
85 auto prdColl = std::make_unique<MMPrepDataCollection>(
hash);
90 int getId = id_helper.
get_id(
hash, moduleId, &context);
96 prdColl->setIdentifier(moduleId);
105 "Null pointer to the read MuonDetectorManager conditions object");
106 return StatusCode::FAILURE;
110 xprd.setIdentifier(prd.identify().get_compact());
114 xprd.setGasGap(id_helper.
gasGap(prd.identify()));
115 xprd.setChannelNumber(id_helper.
channel(prd.identify()));
116 xprd.setTime(prd.time());
117 xprd.setCharge(prd.charge());
118 xprd.setDriftDist(prd.driftDist());
119 xprd.setAngle(prd.angle());
120 xprd.setChiSqProb(prd.chisqProb());
121 xprd.setAuthor(prd.author());
122 xprd.setQuality(prd.quality());
123 xprd.setStripNumbers(prd.stripNumbers());
124 xprd.setStripTimes(prd.stripTimes());
125 xprd.setStripCharges(prd.stripCharges());
126 xprd.setStripDriftDist(prd.stripDriftDist());
127 xprd.setStripDriftErrors(prd.stripDriftErrors());
130 std::vector<MMPrepData> MMprds;
135 const Identifier rdoId = rdo->identify();
138 << rdoId.get_compact() <<
" ("
140 <<
") is no MicroMega Identifier, continuing");
146 std::vector<Identifier> rdoList;
147 Identifier parentID = id_helper.
parentID(rdoId);
155 rdoList.push_back(prdId);
167 invalidLocalPos =
true;
179 ATH_CHECK(m_calibTool->calibrateStrip(ctx, rdo, calibStrip));
180 if (calibStrip.
charge < 0) {
184 <<
" counts, corresponds to a negative charge ("
185 << calibStrip.
charge <<
"). Skipping these RDOs");
186 hitNegativeCharge =
true;
198 << psurf.
center().y() <<
" z "
200 ATH_MSG_DEBUG(
" localPos x " << localPos.x() <<
" localPos y "
201 << localPos.y() <<
" lpos recalculated 0 "
202 << lpos[0] <<
" lpos y " << lpos[1]);
206 << gdir.phi() <<
" global radius hit " << globalPos.perp()
207 <<
" phi pos " << globalPos.phi() <<
" global z "
214 localPos.x() += calibStrip.
dx;
218 std::unique_ptr<MMPrepData> mpd = std::make_unique<MMPrepData>(
219 prdId,
hash, std::move(localPos), std::move(rdoList), std::move(
cov),
223 if (!m_xAODKey.empty()) {
224 auto xprd = xAODContainer->
push_back(std::make_unique<xAOD::MMCluster>());
225 fillxAOD(*mpd, *xprd);
228 prdColl->push_back(std::move(mpd));
231 MMPrepData mpd(prdId,
hash, std::move(localPos), std::move(rdoList),
234 if (mpd.
charge() < m_singleStripChargeCut)
240 MMprds.push_back(std::move(mpd));
245 std::vector<std::unique_ptr<Muon::MMPrepData>>
clusters;
249 m_clusterBuilderTool->getClusters(ctx, std::move(MMprds),
clusters));
251 for (std::unique_ptr<Muon::MMPrepData>& prdN :
clusters) {
252 prdN->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
253 if (!m_xAODKey.empty()) {
254 auto xprd = xAODContainer->
push_back(std::make_unique<xAOD::MMCluster>());
255 fillxAOD(*prdN, *xprd);
257 prdColl->push_back(std::move(prdN));
266 return StatusCode::SUCCESS;
270 const EventContext& ctx)
const {
272 if (rdoContainerHandle.isValid()) {
274 return rdoContainerHandle.cptr();
284 const std::vector<IdentifierHash>& idsToDecode)
const {
292 it != rdoContainer->
end(); ++
it) {
294 const auto* rdoColl = *
it;
295 if (rdoColl->empty())
297 ATH_MSG_DEBUG(
"New RDO collection with " << rdoColl->size() <<
"MM Hits");
299 if (processCollection(ctx, mmPrepDataContainer, xAODContainer, idsToDecode, rdoColl).isFailure()) {
301 "processCsm returns a bad StatusCode - keep going for new data "
302 "collections in this event");
309 const std::vector<IdentifierHash>& idVect)
const {
312 ATH_MSG_DEBUG(
"Size of the RDO container to be decoded: " << idVect.size());
315 setupMM_PrepDataContainer(ctx);
317 if (!mmPrepDataContainer) {
318 return StatusCode::FAILURE;
321 if (!m_xAODKey.empty()) {
324 auto xAODPrepDataContainer = setupxAODPrepDataContainer(outputContainer);
326 processRDOContainer(ctx, mmPrepDataContainer, xAODPrepDataContainer, idVect);
328 return StatusCode::SUCCESS;
332 const EventContext&,
const std::vector<uint32_t>&)
const {
334 return StatusCode::FAILURE;
337 const EventContext& ctx)
const {
338 return setupMM_PrepDataContainer(ctx) ? StatusCode::SUCCESS
339 : StatusCode::FAILURE;
344 const EventContext& ctx)
const {
348 if (m_prdContainerCacheKey.key().empty()) {
351 handle.record(std::make_unique<Muon::MMPrepDataContainer>(
354 if (
status.isFailure() || !handle.isValid()) {
356 "Could not record container of MicroMega PrepData Container at "
357 << m_mmPrepDataContainerKey.key());
365 ATH_MSG_FATAL(
"Invalid UpdateHandle " << m_prdContainerCacheKey.key());
369 std::make_unique<Muon::MMPrepDataContainer>(
update.ptr()));
370 if (
status.isFailure() || !handle.isValid()) {
372 "Could not record container of MM PrepData Container using cache "
373 << m_prdContainerCacheKey.key() <<
" - "
374 << m_mmPrepDataContainerKey.key());
378 << m_prdContainerCacheKey.key());
387 if (!m_xAODKey.empty() &&
389 .
record(std::make_unique<xAOD::MMClusterContainer>(),
390 std::make_unique<xAOD::MMClusterAuxContainer>())
393 "Recorded xAOD container with key: " << outputContainer.
key());
394 return outputContainer.
ptr();
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,...
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...
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Ensure that the Athena extensions are properly loaded.
Class to represent MM measurements.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
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)
std::string find(const std::string &s)
return a remapped string
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
Eigen::Matrix< double, 2, 1 > Vector2D
bool OnlineAndPresentInAnotherView()
This method is to avoid calling an expensive operation in the offline case.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
This class provides conversion from CSC RDO data to CSC Digits.
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
int multilayer(const Identifier &id) const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
bool msgLvl(const MSG::Level lvl) const
Test the output level.
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
Temporary class to hold the MM RDO.
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
const_iterator end() const
return const_iterator for end of container
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
const_iterator begin() const
return const_iterator for first entry
const IdentifierHash & identifierHash() const
represents the three-dimensional global direction with respect to a planar surface frame.
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Ensure that the ATLAS eigen extensions are properly loaded.
virtual bool isMM(const Identifier &id) const =0
returns whether this is a MM Identifier or not
Identifier parentID(const Identifier &id) const
const Muon::IMuonIdHelperSvc * m_idHelperSvc
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Eigen::Matrix< double, 3, 1 > Vector3D
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
size_type module_hash_max() const
the maximum hash value
StatusCode addOrDelete(std::unique_ptr< T > ptr)
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,...
int channel(const Identifier &id) const override
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
int gasGap(const Identifier &id) const override
get the hashes
virtual std::string toString(const Identifier &id) const =0
print all fields to string
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
#define ATH_MSG_WARNING(x)
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
IdContext module_context() const
id for module
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Eigen::Matrix< float, N, N > MeasMatrix
void setAuthor(Author author)
int charge() const
Returns the AD.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.