|
ATLAS Offline Software
|
Go to the documentation of this file.
22 std::atomic<bool> hitNegativeCharge{
false};
26 MmRdoToPrepDataToolMT::MmRdoToPrepDataToolMT(
const std::string&
t,
29 : base_class(
t,
n,
p) {}
41 return StatusCode::SUCCESS;
47 const std::vector<IdentifierHash>& idsToDecode,
49 ATH_MSG_DEBUG(
" ***************** Start of process MM Collection");
57 if (!idsToDecode.empty() and
std::find(idsToDecode.begin(), idsToDecode.end(),
58 hash) == idsToDecode.end()) {
60 return StatusCode::SUCCESS;
67 ATH_MSG_DEBUG(
"In processCollection: collection already contained in the MM PrepData container");
68 return StatusCode::SUCCESS;
76 ATH_MSG_DEBUG(
"In processCollection: collection already available in the MM PrepData container (via cache)");
77 return StatusCode::SUCCESS;
79 auto prdColl = std::make_unique<MMPrepDataCollection>(
hash);
84 if (id_helper.
get_id(
hash, moduleId, &context) != 0) {
88 prdColl->setIdentifier(moduleId);
93 if (!MuonDetMgr.isValid()) {
94 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
95 return StatusCode::FAILURE;
98 std::vector<MMPrepData> MMprds;
107 std::vector<Identifier> rdoList;
110 rdoList.push_back(prdId);
132 if (calibStrip.
charge < 0) {
133 if (!hitNegativeCharge || msgLvl(
MSG::DEBUG)) {
134 ATH_MSG_WARNING(
"One MM RDO or more, such as one with pdo = "<< rdo->charge()
135 <<
" counts, corresponds to a negative charge ("<< calibStrip.
charge <<
"). Skipping these RDOs");
136 hitNegativeCharge =
true;
151 ATH_MSG_DEBUG(
" MM detector surface direction phi "<< gdir.phi() <<
" global radius hit " << globalPos.perp()
152 <<
" phi pos " << globalPos.phi() <<
" global z "<< globalPos.z());
158 localPos.x() += calibStrip.
dx;
162 auto mpd = std::make_unique<MMPrepData>(prdId,
hash,
163 std::move(localPos), std::move(rdoList), std::move(
cov),
168 prdColl->push_back(std::move(mpd));
174 MMPrepData mpd(prdId,
hash, std::move(localPos), std::move(rdoList),
181 MMprds.push_back(std::move(mpd));
186 std::vector<std::unique_ptr<MMPrepData>>
clusters;
191 for (std::unique_ptr<MMPrepData>& prdN :
clusters) {
192 prdN->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
193 prdColl->push_back(std::move(prdN));
199 std::vector<const MMPrepData*> sortMe{prdColl->begin(), prdColl->end()};
203 cluster->setIdentifier(prd->identify().get_compact());
204 cluster->setMeasurement(
m_idHelperSvc->detElementHash(prd->identify()),
207 cluster->setGasGap(id_helper.
gasGap(prd->identify()));
208 cluster->setChannelNumber(id_helper.
channel(prd->identify()));
209 cluster->setTime(prd->time());
210 cluster->setCharge(prd->charge());
211 cluster->setDriftDist(prd->driftDist());
212 cluster->setAngle(prd->angle());
213 cluster->setChiSqProb(prd->chisqProb());
214 cluster->setAuthor(prd->author());
215 cluster->setQuality(prd->quality());
216 cluster->setStripNumbers(prd->stripNumbers());
217 cluster->setStripTimes(prd->stripTimes());
218 cluster->setStripCharges(prd->stripCharges());
219 cluster->setStripDriftDist(prd->stripDriftDist());
220 cluster->setStripDriftErrors(prd->stripDriftErrors());
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;
282 ATH_CHECK(outputContainer.recordNonConst(std::make_unique<xAOD::MMClusterContainer>(),
283 std::make_unique<xAOD::MMClusterAuxContainer>()));
284 xAODContainer = outputContainer.ptr();
289 return StatusCode::SUCCESS;
293 const std::vector<uint32_t>&)
const {
295 return StatusCode::FAILURE;
300 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::MMClusterContainer>(),
301 std::make_unique<xAOD::MMClusterAuxContainer>()));
305 : StatusCode::FAILURE;
315 handle.record(std::make_unique<MMPrepDataContainer>(
318 if (
status.isFailure() || !handle.isValid()) {
320 "Could not record container of MicroMega PrepData Container at "
332 if (
status.isFailure() || !handle.isValid()) {
334 "Could not record container of MM PrepData Container using cache "
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 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())
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
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.
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
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.
Ensure that the ATLAS eigen extensions are properly loaded.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
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
int gasGap(const Identifier &id) const override
get the hashes
#define ATH_MSG_WARNING(x)
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)
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.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
size_type size() const noexcept
Returns the number of elements in the collection.