![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include <CLHEP/Random/RandGaussZiggurat.h>
17 #include <GaudiKernel/SystemOfUnits.h>
20 ISvcLocator* pSvcLocator):
29 return StatusCode::SUCCESS;
32 std::stringstream statstr{};
34 for (
unsigned int g = 0;
g < m_allHits.size(); ++
g) {
35 allHits += m_allHits[
g];
36 statstr<<
" *** Layer "<<(
g+1)<<
" "<<(100.* m_acceptedHits[
g] /
std::max(1
u*m_allHits[
g], 1
u))
37 <<
"% of "<<m_allHits[
g]<<std::endl;
39 if(!allHits)
return StatusCode::SUCCESS;
40 ATH_MSG_INFO(
"Tried to convert "<<allHits<<
" hits. Successes rate per layer "<<std::endl<<statstr.str());
41 return StatusCode::SUCCESS;
47 if (!simHitContainer.isPresent()){
49 return StatusCode::FAILURE;
53 if (!errorCalibDB.isValid()) {
55 return StatusCode::FAILURE;
59 ATH_CHECK(prdContainer.record(std::make_unique<xAOD::MMClusterContainer>(),
60 std::make_unique<xAOD::MMClusterAuxContainer>()));
68 if(std::abs(simHit->pdgId())!=13)
continue;
70 const unsigned int hitGapInNsw = (id_helper.multilayer(hitId) -1) * 4 + id_helper.gasGap(hitId) -1;
71 ++m_allHits[hitGapInNsw];
78 const Amg::Vector3D lHitPos{xAOD::toEigen(simHit->localPosition())};
80 int channelNumber = design.stripNumber(lHitPos.block<2,1>(0,0));
82 if (!design.insideTrapezoid(lHitPos.block<2,1>(0,0))) {
84 <<
" is outside bounds "<<std::endl<<design<<
" rejecting it");
88 const Identifier clusId = id_helper.channelID(hitId,
89 id_helper.multilayer(hitId),
90 id_helper.gasGap(hitId),
97 ++m_acceptedHits[hitGapInNsw];
99 prdContainer->push_back(prd);
102 prd->
setGasGap(id_helper.gasGap(clusId));
106 errorCalibInput.
stripId = clusId;
107 errorCalibInput.locTheta =
M_PI- simHit->localDirection().theta();
108 errorCalibInput.clusterAuthor=66;
109 double uncert = errorCalibDB->clusterUncertainty(errorCalibInput);
112 double newLocalX = CLHEP::RandGaussZiggurat::shoot(rndEngine, lHitPos.x(), uncert);
118 return StatusCode::SUCCESS;
128 rngWrapper->
setSeed(rngName, ctx);
def retrieve(aClass, aKey=None)
StatusCode finalize() override final
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
CLHEP::HepRandomEngine * getRandomEngine(const EventContext &ctx) const
ServiceHandle< IAthRNGSvc > m_rndmSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
#define ATH_MSG_VERBOSE(x)
SG::ReadCondHandleKey< NswErrorCalibData > m_uncertCalibKey
@ u
Enums for curvilinear frames.
SG::ReadHandleKey< xAOD::MuonSimHitContainer > m_readKey
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
An algorithm that can be simultaneously executed in multiple threads.
void setGasGap(uint8_t gap)
Handle class for recording to StoreGate.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::WriteHandleKey< xAOD::MMClusterContainer > m_writeKey
const MuonGMR4::MuonDetectorManager * m_DetMgr
Access to the new readout geometry.
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
const StripLayer & stripLayer(const Identifier &measId) const
StatusCode initialize() override final
MMCluster_v1 MMCluster
Defined the version of the MMCluster.
A wrapper class for event-slot-local random engines.
xAODSimHitToMmMeasCnvAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
Gaudi::Property< std::string > m_streamName
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
const StripDesign & design() const
Returns the underlying strip design.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
value_type get_compact(void) const
Get the compact id.
StatusCode execute(const EventContext &ctx) const override final
#define ATH_MSG_WARNING(x)
Eigen::Matrix< float, N, N > MeasMatrix
Handle class for reading from StoreGate.
void setChannelNumber(uint16_t strip)