ATLAS Offline Software
RpcDigitToRpcMeasCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include <StoreGate/ReadHandle.h>
8 
12 
13 namespace MuonR4 {
14  RpcDigitToRpcMeasCnvAlg::RpcDigitToRpcMeasCnvAlg(const std::string& name, ISvcLocator* pSvcLocator):
15  AthReentrantAlgorithm{name, pSvcLocator}{}
16 
19  ATH_CHECK(m_stripKey.initialize());
21  ATH_CHECK(m_idHelperSvc.retrieve());
23  m_stIdx_BIL = m_idHelperSvc->rpcIdHelper().stationNameIndex("BIL");
24  return StatusCode::SUCCESS;
25  }
26  StatusCode RpcDigitToRpcMeasCnvAlg::execute(const EventContext& ctx) const {
28  ATH_CHECK(readHandle.isPresent());
29 
31  ATH_CHECK(prdContainer.record(std::make_unique<xAOD::RpcStripContainer>(),
32  std::make_unique<xAOD::RpcStripAuxContainer>()));
33 
35  if (m_writeBIClust) {
37  ATH_CHECK(prdContainerBI.record(std::make_unique<xAOD::RpcStrip2DContainer>(),
38  std::make_unique<xAOD::RpcStrip2DAuxContainer>()));
39  }
40  for (const RpcDigitCollection* coll : *readHandle) {
41  for (const RpcDigit* digit : *coll) {
42  if (!m_writeBIClust || m_idHelperSvc->stationName(digit->identify()) != m_stIdx_BIL) {
43  convert(*digit, *prdContainer);
44  } else {
45  convert(*digit, *prdContainerBI);
46  }
47  }
48  }
49  return StatusCode::SUCCESS;
50  }
51 
53  xAOD::RpcStripContainer& strips) const {
54 
55  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
56  xAOD::RpcStrip* strip = strips.push_back(std::make_unique<xAOD::RpcStrip>());
57 
58  const MuonGMR4::RpcReadoutElement* readoutEle = m_detMgr->getRpcReadoutElement(digit.identify());
59  strip->setReadoutElement(readoutEle);
60 
61  strip->setDoubletPhi(idHelper.doubletPhi(digit.identify()));
62  strip->setGasGap(idHelper.gasGap(digit.identify()));
63  strip->setMeasuresPhi(idHelper.measuresPhi(digit.identify()));
64  strip->setStripNumber(idHelper.channel(digit.identify()));
65 
66  const MuonGMR4::StripDesign& design{readoutEle->sensorLayout(strip->measurementHash()).design()};
68  lPos[0] = (*design.center(strip->stripNumber())).x();
70  lCov[0] = design.stripPitch() / std::sqrt(12);
71  strip->setMeasurement(readoutEle->identHash(), std::move(lPos), std::move(lCov));
72  strip->setIdentifier(digit.identify().get_compact());
73  strip->setTime(digit.time());
74  /* TODO define time uncertainties */
75  }
76 
78  xAOD::RpcStrip2DContainer& strips) const {
79 
80  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
81  xAOD::RpcStrip2D* strip = strips.push_back(std::make_unique<xAOD::RpcStrip2D>());
82 
83  const MuonGMR4::RpcReadoutElement* readoutEle = m_detMgr->getRpcReadoutElement(digit.identify());
84  strip->setReadoutElement(readoutEle);
85 
86  strip->setDoubletPhi(idHelper.doubletPhi(digit.identify()));
87  strip->setGasGap(idHelper.gasGap(digit.identify()));
88  strip->setStripNumber(idHelper.channel(digit.identify()));
89  }
90 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonR4::RpcDigitToRpcMeasCnvAlg::m_digitKey
SG::ReadHandleKey< RpcDigitContainer > m_digitKey
Definition: RpcDigitToRpcMeasCnvAlg.h:43
RpcStrip2DAuxContainer.h
MuonR4::RpcDigitToRpcMeasCnvAlg::m_stripBIKey
SG::WriteHandleKey< xAOD::RpcStrip2DContainer > m_stripBIKey
Definition: RpcDigitToRpcMeasCnvAlg.h:48
MuonGMR4::StripDesign
Definition: StripDesign.h:30
RpcDigit
Definition: RpcDigit.h:16
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
RpcDigitCollection
Definition: RpcDigitCollection.h:17
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
xAOD::RpcStrip_v1
Definition: RpcStrip_v1.h:11
x
#define x
MuonGMR4::RpcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:18
RpcIdHelper
Definition: RpcIdHelper.h:51
MuonR4::RpcDigitToRpcMeasCnvAlg::RpcDigitToRpcMeasCnvAlg
RpcDigitToRpcMeasCnvAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: RpcDigitToRpcMeasCnvAlg.cxx:14
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MuonR4::RpcDigitToRpcMeasCnvAlg::m_stripKey
SG::WriteHandleKey< xAOD::RpcStripContainer > m_stripKey
Definition: RpcDigitToRpcMeasCnvAlg.h:46
WriteHandle.h
Handle class for recording to StoreGate.
MuonR4::RpcDigitToRpcMeasCnvAlg::convert
void convert(const RpcDigit &digit, xAOD::RpcStripContainer &strips) const
Definition: RpcDigitToRpcMeasCnvAlg.cxx:52
xAOD::RpcStrip2D_v1
Definition: RpcStrip2D_v1.h:11
MuonR4::RpcDigitToRpcMeasCnvAlg::initialize
StatusCode initialize() override final
Definition: RpcDigitToRpcMeasCnvAlg.cxx:17
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::RpcDigitToRpcMeasCnvAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: RpcDigitToRpcMeasCnvAlg.h:54
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonR4::RpcDigitToRpcMeasCnvAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: RpcDigitToRpcMeasCnvAlg.h:52
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
MuonGMR4::MuonReadoutElement::identHash
IdentifierHash identHash() const
Returns the Identifier has of the Element that is Identical to the detElHash from the id_helper class...
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
RpcDigitToRpcMeasCnvAlg.h
MuonR4::RpcDigitToRpcMeasCnvAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: RpcDigitToRpcMeasCnvAlg.cxx:26
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonGMR4::RpcReadoutElement::sensorLayout
const StripLayer & sensorLayout(const IdentifierHash &measHash) const
Access to the StripLayer associated to a given measurement Hash.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
MuonGMR4::StripLayer::design
const StripDesign & design() const
Returns the underlying strip design.
RpcReadoutElement.h
MuonR4
The CsvMuonSimHitDumper reads a Simulation Hit container for muons and dumps information to csv files...
Definition: MuonSpacePoint.h:11
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
MuonR4::RpcDigitToRpcMeasCnvAlg::m_writeBIClust
Gaudi::Property< bool > m_writeBIClust
Definition: RpcDigitToRpcMeasCnvAlg.h:50
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:54
ReadHandle.h
Handle class for reading from StoreGate.
RpcStripAuxContainer.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MuonR4::RpcDigitToRpcMeasCnvAlg::m_stIdx_BIL
int m_stIdx_BIL
BIL station index.
Definition: RpcDigitToRpcMeasCnvAlg.h:56