ATLAS Offline Software
Loading...
Searching...
No Matches
MuonGMR4::MuonChamberToolTest Class Reference

#include <MuonChamberToolTest.h>

Inheritance diagram for MuonGMR4::MuonChamberToolTest:
Collaboration diagram for MuonGMR4::MuonChamberToolTest:

Public Member Functions

 ~MuonChamberToolTest ()=default
StatusCode execute (const EventContext &ctx) const override
StatusCode initialize () override
bool isReEntrant () const override final
template<class EnevelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const TgcReadoutElement &tgc, const EnevelopeType &chamber, const Acts::Volume &detVol) const
template<class EnevelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const MmReadoutElement &mm, const EnevelopeType &chamber, const Acts::Volume &detVol) const
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::vector< Amg::Vector3DcornerPoints (const ActsTrk::GeometryContext &gctx, const Acts::Volume &volume) const
 Returns the edge points from a trapezoidal / cuboid /diamond volume.
std::array< Amg::Vector3D, 8 > cornerPoints (const ActsTrk::GeometryContext &gctx, const Acts::StrawSurface &surface) const
std::array< Amg::Vector3D, 4 > cornerPoints (const ActsTrk::GeometryContext &gctx, const Acts::PlaneSurface &surface) const
void saveEnvelope (const ActsTrk::GeometryContext &gctx, const std::string &envName, const Acts::Volume &envelopeVol, const std::vector< const MuonGMR4::MuonReadoutElement * > &assocRE, const std::vector< std::shared_ptr< Acts::Volume > > &subVolumes={}) const
StatusCode checkChambers (const ActsTrk::GeometryContext &gctx) const
 Check whether the chamber envelopes are consistent.
StatusCode checkEnvelopes (const ActsTrk::GeometryContext &gctx) const
 Check envelopes.
StatusCode checkTrackingGeometry (const ActsTrk::GeometryContext &gctx, std::shared_ptr< const Acts::TrackingGeometry > &trackingGeometry) const
 Check tracking geometry volumes.
template<class EnvelopeType>
StatusCode allReadoutInEnvelope (const ActsTrk::GeometryContext &ctx, const EnvelopeType &envelope) const
 Checks whether the readout elements of an enevelope are completely embedded into the envelope.
template<class EnvelopeType>
StatusCode pointInside (const ActsTrk::GeometryContext &gctx, const EnvelopeType &envelope, const Acts::Volume &boundVol, const Amg::Vector3D &point, const std::string &descr, const Identifier &channelId) const
 Checks whether the point is inside of an envelope object, i.e.
StatusCode pointInside (const ActsTrk::GeometryContext &gctx, const Acts::TrackingVolume &volume, const Amg::Vector3D &point, const std::string &descr, const Identifier &chamberId) const
 Checks whether the point is inside a tracking volume.
bool hasOverlap (const ActsTrk::GeometryContext &gctx, const std::vector< Amg::Vector3D > &chamberEdges, const Acts::Volume &volume) const
 Checks whether the edge points from a trapezoid/cuboid/diamond form a volume overlapping with the given volume.
template<class EnvelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const MdtReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
 Checks whether all channels of a given readout element are fully covered by the envelope.
template<class EnvelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const RpcReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
template<class EnvelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const TgcReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
template<class EnvelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const sTgcReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
template<class EnvelopeType>
StatusCode testReadoutEle (const ActsTrk::GeometryContext &gctx, const MmReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
SG::ReadHandleKey< ActsTrk::GeometryContextm_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
ServiceHandle< ActsTrk::ITrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc","ActsTrackingGeometrySvc"}
Gaudi::Property< unsigned > m_overlapSamples {this, "overlapSamples", 50}
 Number of points to scan along the lines between two volume corners to check whether they belong to an another volume.
Gaudi::Property< std::string > m_overlapChambObj {this, "chamberOverlapFile", "OverlapingChambers.obj"}
 Name of the chamber output obj file.
Gaudi::Property< bool > m_ignoreOverlapCh {this, "ignoreChamberOverlap", true}
 The overlap of chamber volumes does not lead to a failure.
Gaudi::Property< bool > m_ignoreOutsideSurf {this, "ignoreOutsideSurface", true}
 The exceeding surfaces does not lead to a failure.
Gaudi::Property< bool > m_dumpObjs {this, "dumpVolumes" , false}
 Dump the chambers & sectors as separate obj files.
const MuonDetectorManagerm_detMgr {nullptr}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 30 of file MuonChamberToolTest.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~MuonChamberToolTest()

MuonGMR4::MuonChamberToolTest::~MuonChamberToolTest ( )
default

Member Function Documentation

◆ allReadoutInEnvelope()

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::allReadoutInEnvelope ( const ActsTrk::GeometryContext & ctx,
const EnvelopeType & envelope ) const
private

Checks whether the readout elements of an enevelope are completely embedded into the envelope.

Definition at line 127 of file MuonChamberToolTest.cxx.

128 {
129 std::shared_ptr<Acts::Volume> boundVol = envelope.boundingVolume(gctx);
130 const Chamber::ReadoutSet reEles = envelope.readoutEles();
131 for(const MuonReadoutElement* readOut : reEles) {
132 if constexpr (std::is_same_v<EnvelopeType, SpectrometerSector>) {
133 if (readOut->msSector() != &envelope) {
134 ATH_MSG_FATAL("Mismatch in the sector association "<<m_idHelperSvc->toStringDetEl(readOut->identify())
135 <<std::endl<<(*readOut->msSector())<<std::endl<<envelope);
136 return StatusCode::FAILURE;
137 }
138 } else if constexpr (std::is_same_v<EnvelopeType, Chamber>) {
139 if (readOut->chamber() != &envelope) {
140 ATH_MSG_FATAL("Mismatch in the chamber association "<<m_idHelperSvc->toStringDetEl(readOut->identify())
141 <<std::endl<<(*readOut->chamber())<<std::endl<<envelope);
142 return StatusCode::FAILURE;
143 }
144 }
145 switch (readOut->detectorType()) {
147 const auto* detEle = static_cast<const TgcReadoutElement*>(readOut);
148 ATH_CHECK(testReadoutEle(gctx, *detEle, envelope, *boundVol));
149 break;
151 const auto* detEle = static_cast<const MdtReadoutElement*>(readOut);
152 ATH_CHECK(testReadoutEle(gctx, *detEle, envelope, *boundVol));
153 break;
155 const auto* detEle = static_cast<const RpcReadoutElement*>(readOut);
156 ATH_CHECK(testReadoutEle(gctx, *detEle, envelope, *boundVol));
157 break;
159 const auto* detEle = static_cast<const MmReadoutElement*>(readOut);
160 ATH_CHECK(testReadoutEle(gctx, *detEle, envelope, *boundVol));
161 break;
163 const auto* detEle = static_cast<const sTgcReadoutElement*>(readOut);
164 ATH_CHECK(testReadoutEle(gctx, *detEle, envelope, *boundVol));
165 break;
166 } default: {
167 ATH_MSG_FATAL("Who came up with putting "<<ActsTrk::to_string(readOut->detectorType())
168 <<" into the MS");
169 return StatusCode::FAILURE;
170 }
171 }
172 }
173 ATH_MSG_DEBUG("All "<<reEles.size()<<" readout elements are embedded in "<<envelope);
174 return StatusCode::SUCCESS;
175 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
std::vector< const MuonReadoutElement * > ReadoutSet
Define the list of read out elements of the chamber.
Definition Chamber.h:31
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode testReadoutEle(const ActsTrk::GeometryContext &gctx, const MdtReadoutElement &readOutEle, const EnvelopeType &envelope, const Acts::Volume &boundVol) const
Checks whether all channels of a given readout element are fully covered by the envelope.
std::string to_string(const DetectorType &type)
@ Mm
Maybe not needed in the migration.
@ Tgc
Resitive Plate Chambers.
@ sTgc
Micromegas (NSW)
@ Rpc
Monitored Drift Tubes.
@ Mdt
MuonSpectrometer.

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ checkChambers()

StatusCode MuonGMR4::MuonChamberToolTest::checkChambers ( const ActsTrk::GeometryContext & gctx) const
private

Check whether the chamber envelopes are consistent.

Check the overlap with other chambers

Definition at line 341 of file MuonChamberToolTest.cxx.

341 {
342
343 std::vector<const MuonReadoutElement*> allRE = m_detMgr->getAllReadoutElements();
345 const ChamberSet chambers = m_detMgr->getAllChambers();
346 ATH_MSG_INFO("Fetched "<<chambers.size()<<" chambers.");
347 std::vector<const Chamber*> chamberVec{chambers.begin(), chambers.end()};
348
349 const auto missChamb = std::ranges::find_if(allRE, [&chamberVec](const MuonGMR4::MuonReadoutElement* re){
350 return std::ranges::find(chamberVec, re->chamber()) == chamberVec.end();
351 });
352 if (missChamb != allRE.end()) {
353 ATH_MSG_FATAL("The chamber "<<(*(*missChamb)->chamber())<<" is not in the chamber set");
354 return StatusCode::FAILURE;
355 }
356
357 // Retrieve bounds here rather than inside the loop below,
358 // so we only need to do it O(N) rather than O(N^2) times.
359 std::vector<std::shared_ptr<Acts::Volume> > chamberBoundsVec;
360 chamberBoundsVec.reserve (chamberVec.size());
361 for (const Chamber* ch : chamberVec)
362 chamberBoundsVec.push_back (ch->boundingVolume(gctx));
363
364 std::set<const Chamber*> overlapChambers{};
365 std::stringstream overlapstream{};
366 for (std::size_t chIdx = 0; chIdx< chamberVec.size(); ++chIdx) {
367 const Chamber& chamber{*chamberVec[chIdx]};
368 const Acts::Volume& chamberBounds = *chamberBoundsVec[chIdx];
369 if (m_dumpObjs) {
370 saveEnvelope(gctx, std::format("Chamber_{:}{:}{:}{:}{:}",
371 ActsTrk::to_string(chamber.detectorType()),
372 chName(chamber.chamberIndex()),
373 Acts::abs(chamber.stationEta()),
374 chamber.stationEta() > 0 ? 'A' : 'C',
375 chamber.stationPhi()),
376 chamberBounds, chamber.readoutEles());
377 }
378 ATH_CHECK(allReadoutInEnvelope(gctx, chamber));
379 const std::vector<Amg::Vector3D> chambCorners = cornerPoints(gctx, chamberBounds);
381 std::vector<const Chamber*> overlaps{};
382 for (std::size_t chIdx1 = 0; chIdx1<chamberVec.size(); ++chIdx1) {
383 if (chIdx == chIdx1) {
384 continue;
385 }
386 const Chamber* overlapTest{chamberVec[chIdx1]};
387 if (hasOverlap(gctx, chambCorners, *chamberBoundsVec[chIdx1])) {
388 overlaps.push_back(overlapTest);
389 }
390 }
391 if (overlaps.empty()) {
392 continue;
393 }
394 overlapstream<<"The chamber "<<chamber<<" overlaps with "<<std::endl;
395 for (const Chamber* itOverlaps : overlaps) {
396 overlapstream<<" *** "<<(*itOverlaps)<<std::endl;
397 }
398 overlapstream<<std::endl<<std::endl;
399 overlapChambers.insert(overlaps.begin(), overlaps.end());
400 overlapChambers.insert(chamberVec[chIdx]);
401 }
402 if (!overlapChambers.empty()) {
403 Acts::ObjVisualization3D visualHelper{};
404 for (const Chamber* hasOverlap: overlapChambers) {
405 Acts::GeometryView3D::drawVolume(visualHelper, *hasOverlap->boundingVolume(gctx), gctx.context());
406 visualHelper.write(m_overlapChambObj.value());
407 }
408 if (m_ignoreOverlapCh) {
409 ATH_MSG_WARNING(overlapstream.str());
410 } else {
411 ATH_MSG_FATAL(overlapstream.str());
412 }
413 }
414 return overlapChambers.empty() || m_ignoreOverlapCh ? StatusCode::SUCCESS : StatusCode::FAILURE;
415 }
const boost::regex re(r_e)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
Acts::GeometryContext context() const
const MuonDetectorManager * m_detMgr
Gaudi::Property< bool > m_ignoreOverlapCh
The overlap of chamber volumes does not lead to a failure.
void saveEnvelope(const ActsTrk::GeometryContext &gctx, const std::string &envName, const Acts::Volume &envelopeVol, const std::vector< const MuonGMR4::MuonReadoutElement * > &assocRE, const std::vector< std::shared_ptr< Acts::Volume > > &subVolumes={}) const
Gaudi::Property< bool > m_dumpObjs
Dump the chambers & sectors as separate obj files.
Gaudi::Property< std::string > m_overlapChambObj
Name of the chamber output obj file.
StatusCode allReadoutInEnvelope(const ActsTrk::GeometryContext &ctx, const EnvelopeType &envelope) const
Checks whether the readout elements of an enevelope are completely embedded into the envelope.
std::vector< Amg::Vector3D > cornerPoints(const ActsTrk::GeometryContext &gctx, const Acts::Volume &volume) const
Returns the edge points from a trapezoidal / cuboid /diamond volume.
bool hasOverlap(const ActsTrk::GeometryContext &gctx, const std::vector< Amg::Vector3D > &chamberEdges, const Acts::Volume &volume) const
Checks whether the edge points from a trapezoid/cuboid/diamond form a volume overlapping with the giv...
SpectrometerSector::ChamberSet ChamberSet
const std::string & chName(ChIndex index)
convert ChIndex into a string
Chamber
Define chamber types and locations.

◆ checkEnvelopes()

StatusCode MuonGMR4::MuonChamberToolTest::checkEnvelopes ( const ActsTrk::GeometryContext & gctx) const
private

Check envelopes.

Definition at line 417 of file MuonChamberToolTest.cxx.

417 {
418
419 std::vector<const MuonReadoutElement*> allREs = m_detMgr->getAllReadoutElements();
420 for (const MuonReadoutElement* re : allREs) {
421 if (!re->msSector()) {
422 ATH_MSG_FATAL("The readout element "<<m_idHelperSvc->toStringDetEl(re->identify())<<" does not have any sector associated ");
423 return StatusCode::FAILURE;
424 }
425 const SpectrometerSector* sectorFromDet = m_detMgr->getSectorEnvelope(re->chamberIndex(),
426 m_idHelperSvc->sector(re->identify()),
427 re->stationEta());
428 if (sectorFromDet != re->msSector()) {
429 ATH_MSG_FATAL("The sector attached to "<<m_idHelperSvc->toStringDetEl(re->identify())
430 <<", chIdx: "<<chName(re->chamberIndex())<<", sector: "<<m_idHelperSvc->sector(re->identify())
431 <<" is not the one attached to the readout geometry \n"<<(*re->msSector())<<"\n"<<(*sectorFromDet));
432 return StatusCode::FAILURE;
433 }
434 }
435 using SectorSet = MuonDetectorManager::MuonSectorSet;
436 const SectorSet sectors = m_detMgr->getAllSectors();
437 ATH_MSG_INFO("Fetched "<<sectors.size()<<" sectors. ");
438 for (const SpectrometerSector* sector : sectors) {
439 if (m_dumpObjs) {
440 saveEnvelope(gctx, std::format("Sector_{:}{:}{:}",
441 chName(sector->chamberIndex()),
442 sector->side() >0? 'A' :'C',
443 sector->stationPhi() ),
444 *sector->boundingVolume(gctx), sector->readoutEles(),
445 chamberVolumes(gctx, *sector));
446 }
447 ATH_CHECK(allReadoutInEnvelope(gctx, *sector));
448 const std::shared_ptr<Acts::Volume> secVolume = sector->boundingVolume(gctx);
449 for (const SpectrometerSector::ChamberPtr& chamber : sector->chambers()){
450 const std::vector<Amg::Vector3D> edges = cornerPoints(gctx, *chamber->boundingVolume(gctx));
451 unsigned int edgeCount{0};
452 for (const Amg::Vector3D& edge : edges) {
453 ATH_CHECK(pointInside(gctx, *sector, *secVolume, edge, std::format("Edge {:}", ++edgeCount),
454 chamber->readoutEles().front()->identify()));
455 }
456 }
457 }
458 return StatusCode::SUCCESS;
459 }
StatusCode pointInside(const ActsTrk::GeometryContext &gctx, const EnvelopeType &envelope, const Acts::Volume &boundVol, const Amg::Vector3D &point, const std::string &descr, const Identifier &channelId) const
Checks whether the point is inside of an envelope object, i.e.
GeoModel::TransientConstSharedPtr< Chamber > ChamberPtr
Eigen::Matrix< double, 3, 1 > Vector3D

◆ checkTrackingGeometry()

StatusCode MuonGMR4::MuonChamberToolTest::checkTrackingGeometry ( const ActsTrk::GeometryContext & gctx,
std::shared_ptr< const Acts::TrackingGeometry > & trackingGeometry ) const
private

Check tracking geometry volumes.

Definition at line 461 of file MuonChamberToolTest.cxx.

462 {
463
464 //visit the volumes and check the overlaps with the other volumes in the tracking geometry
465 // also check overlaps between volumes and surfaces (e.g surfaces where the passive material is mapped)
466 std::vector<const Acts::TrackingVolume*> volumeVec{};
467 std::vector<const Acts::TrackingVolume*> overlapVolumes{};
468 std::vector<const Acts::Surface*> surfacesVec{};
469 //keep onyl the chamber volumes - not the cylinders
470 trackingGeometry->visitVolumes([&](const Acts::TrackingVolume* vol){
471 //for the cylinder type volumes , fetch the inner surfaces only (e.g passive material surfaces)
472 if(vol->volumeBounds().type() == Acts::VolumeBounds::BoundsType::eCylinder){
473 std::ranges::for_each(vol->surfaces(), [&](const auto& surf){
474 surfacesVec.push_back(&surf);
475 });
476 return;
477 }
478 //dump the tracking volumes into obj
479 if(m_dumpObjs){
480 Acts::ObjVisualization3D visualHelper{};
481 for(const auto& surf : vol->surfaces()){
482 Acts::GeometryView3D::drawSurface(visualHelper, surf, gctx.context());
483 }
484 std::string volName = vol->volumeName();
485 Acts::GeometryView3D::drawVolume(visualHelper, *vol, gctx.context());
486 ATH_MSG_DEBUG("Save new tracking volume 'MsTrackingVol_"<<volName<<".obj'");
487 visualHelper.write(std::format("MsTrackingVol_{:}.obj", volName));
488
489 }
490 volumeVec.push_back(vol);
491
492 });
493
494 ATH_MSG_VERBOSE("Fetched "<< surfacesVec.size()<< "surfaces");
495
496
497 for(std::size_t vIdx = 0; vIdx < volumeVec.size(); vIdx++){
498 const Acts::TrackingVolume* testVol{volumeVec[vIdx]};
499 std::vector<const Acts::TrackingVolume*> overlaps{};
500 const std::vector<Amg::Vector3D> edges = cornerPoints(gctx, *testVol);
501 const auto childrenVol = testVol->volumes();
502 const auto innerSurfaces = testVol->surfaces();
503
504 for(const auto& surface : innerSurfaces){
505 //only plane or straw surfaces expected
506 std::vector<Amg::Vector3D> surfEdges = {};
507 if(const auto* strawSurf = dynamic_cast<const Acts::StrawSurface*>(&surface)){
508 ATH_MSG_VERBOSE("Checking straw surface "<<surface.geometryId()
509 <<" in volume "<<testVol->volumeName());
510
511 auto edges = cornerPoints(gctx, *strawSurf);
512 surfEdges = {edges.begin(), edges.end()};
513 }else if(const auto* planeSurf = dynamic_cast<const Acts::PlaneSurface*>(&surface)){
514 ATH_MSG_VERBOSE("Checking plane surface "<<surface.geometryId()
515 <<" in volume "<<testVol->volumeName());
516
517 auto edges = cornerPoints(gctx, *planeSurf);
518 surfEdges = {edges.begin(), edges.end()};
519 } else{
520 ATH_MSG_FATAL("The surface "<< surface.geometryId()
521 <<" is neither a straw nor a plane surface");
522 return StatusCode::FAILURE;
523 }
524
525
526 for(const auto& edge : surfEdges){
527 if(!(testVol->inside(gctx.context(), edge,0.01))){
528 ATH_MSG_FATAL("The surface " << surface.geometryId() <<" at vertex point " <<Amg::toString(edge)
529 <<" is outside the parent volume" << testVol->volumeName());
530 return m_ignoreOutsideSurf ? StatusCode::SUCCESS : StatusCode::FAILURE;
531
532 }
533 }
534 }
535
536 //check if this test volume overlaps with the other volumes in the tracking geometry
537 for(std::size_t vIdx1 = 0 ; vIdx1 < volumeVec.size(); vIdx1++){
538 bool isChild = std::ranges::find_if(childrenVol,
539 [&](const Acts::TrackingVolume& tv){ return &tv == volumeVec[vIdx1]; }
540 ) != childrenVol.end();
541
542 bool isMother = (testVol->motherVolume() == volumeVec[vIdx1]);
543
544 if(vIdx1 == vIdx || isMother){
545 continue;
546 }
547 //check if the child volume is entirely enclosed by the mother volume
548 if(isChild){
549 std::vector<Amg::Vector3D> childEdges = cornerPoints(gctx,*volumeVec[vIdx1]);
550 for(const auto& edge : childEdges){
551 if(!(testVol->inside(gctx.context(), edge, 0.01))){
552 ATH_MSG_FATAL("The children volume's " << volumeVec[vIdx1]->volumeName()
553 <<" vertex point " <<Amg::toString(edge)
554 <<" is outside the parent volume" << testVol->volumeName());
555 return StatusCode::FAILURE;
556 }
557 }
558 continue;
559
560 }
561 if(hasOverlap(gctx, edges, *volumeVec[vIdx1])){
562 overlaps.push_back(volumeVec[vIdx1]);
563 }
564 }
565
566 //check if the tracking volume overlaps with surfaces of the tracking geometry (e.g cylinders of the barrel where material is mapped)
567 auto [min,max] = std::ranges::minmax_element(edges, [&](const auto& cornerA, const auto& cornerB){
568 return cornerA.perp() < cornerB.perp();
569 });
570 double rmin{min->perp()};
571 double rmax{max->perp()};
572 bool hasoverlap{false};
573 for(const auto& surf : surfacesVec){
574 double radius{0.};
575 double halfZ{0.};
576 ATH_MSG_VERBOSE("Checking surface "<<surf->name()<< " , "<<surf->geometryId());
577 if(const auto* cylSurf = dynamic_cast<const Acts::CylinderSurface*>(surf)){
578 using BoundEnum = Acts::CylinderBounds::BoundValues;
579 const auto& bounds = static_cast<const Acts::CylinderBounds&>(cylSurf->bounds());
580 const auto& center = cylSurf->center(gctx.context());
581 radius = bounds.get(BoundEnum::eR);
582 halfZ = bounds.get(BoundEnum:: eHalfLengthZ);
583 //check for overlap in R in case the surface and the volume have overlapping Z position
584 if(center.z() + halfZ > min->z()){
585 hasoverlap = (radius > rmin && radius < rmax);
586 }
587 }else if(const auto* discSurf = dynamic_cast<const Acts::DiscSurface*>(surf)){
588 using BoundEnum = Acts::RadialBounds::BoundValues;
589 const auto& bounds = static_cast<const Acts::RadialBounds&>(discSurf->bounds());
590 const auto& center = discSurf->center(gctx.context());
591 radius = bounds.get(BoundEnum::eMaxR);
592 //these are endcap passive discsc - witht the endcap chambers check if there is overlap in Z
593 // with the barrel check if there is overlap in R and Z
594 if(center.z() > min->z() && center.z() < max->z()){
595 hasoverlap = (radius > rmin && radius < rmax);
596 }
597
598 }else{
599 ATH_MSG_FATAL("The surface "<< surf->geometryId()<<", "<< surf->name()
600 <<" is not a cylinder surface or disc - i dont expect any other type at the moment");
601 return StatusCode::FAILURE;
602 }
603
604 if(hasoverlap){
605 ATH_MSG_FATAL("The volume " << testVol->volumeName() << "overlaps with the surface "<< surf->name() << "with geo id" << surf->geometryId());
606 }
607
608 }
609
610 if(overlaps.empty()){
611 ATH_MSG_DEBUG("No overlaps detected for the volume "<<testVol->volumeName());
612 continue;
613 }else{
614 overlapVolumes.push_back(testVol);
615 ATH_MSG_ALWAYS("The volume " << testVol->volumeName() << " overlaps with: ");
616 for(const auto& overlap: overlaps){
617 ATH_MSG_ALWAYS(" Volume: " << overlap->volumeName());
618 }
619 }
620 }
621 if(overlapVolumes.empty()){
622 ATH_MSG_ALWAYS("No overlaps detected in the tracking geometry!!");
623 }
624 return overlapVolumes.empty() || m_ignoreOverlapCh ? StatusCode::SUCCESS : StatusCode::FAILURE;
625 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_ALWAYS(x)
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
Gaudi::Property< bool > m_ignoreOutsideSurf
The exceeding surfaces does not lead to a failure.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
double halfZ(const Acts::VolumeBounds &bounds)
Returns the half-Z length for the parsed volume bounds (Trapezoid/ Cuboid)
bool isChild(const xAOD::TruthParticle *p, const xAOD::TruthParticle *c)

◆ cornerPoints() [1/3]

std::array< Amg::Vector3D, 4 > MuonGMR4::MuonChamberToolTest::cornerPoints ( const ActsTrk::GeometryContext & gctx,
const Acts::PlaneSurface & surface ) const
private

Account for the stereo angle of the micromega geometry

Definition at line 254 of file MuonChamberToolTest.cxx.

254 {
255 std::array<Amg::Vector3D, 4> edges{make_array<Amg::Vector3D,4>(Amg::Vector3D::Zero())};
256 if(surface.bounds().type() == Acts::SurfaceBounds::BoundsType::eRectangle) { //RPC surfaces are rectangles
257 const Acts::RectangleBounds& bounds = static_cast<const Acts::RectangleBounds&>(surface.bounds());
258 using BoundEnum = Acts::RectangleBounds::BoundValues;
259
260 unsigned int edgeIdx{0};
261 for(const double signX : {-1., 1.}) {
262 for (const double signY : { -1., 1.}) {
263 const Amg::Vector3D edge{signX < 0 ? bounds.get(BoundEnum::eMinX) : bounds.get(BoundEnum::eMaxX),
264 signY < 0 ? bounds.get(BoundEnum::eMinY) : bounds.get(BoundEnum::eMaxY), 0.};
265 edges[edgeIdx] = surface.localToGlobalTransform(gctx.context()) * edge;
266 ++edgeIdx;
267 }
268 }
269 return edges;
270 } else if(surface.bounds().type() == Acts::SurfaceBounds::BoundsType::eTrapezoid) {
271 using BoundEnum = Acts::TrapezoidBounds::BoundValues;
272 const auto& bounds = static_cast<const Acts::TrapezoidBounds&>(surface.bounds());
273 unsigned int edgeIdx{0};
274
275 ATH_MSG_VERBOSE("Fetch volume bounds "<<Amg::toString(surface.localToGlobalTransform(gctx.context())));
276 for (const double signX : {-1., 1.}) {
277 for (const double signY : { -1., 1.}) {
278 const Amg::Vector3D edge{Amg::getRotateZ3D(-1.*bounds.get(BoundEnum::eRotationAngle)) *
279 Amg::Vector3D(signX*bounds.get(signY < 0 ? BoundEnum::eHalfLengthXnegY : BoundEnum::eHalfLengthXposY),
280 signY*bounds.get(BoundEnum::eHalfLengthY), 0.)};
281
282 edges[edgeIdx] = surface.localToGlobalTransform(gctx.context()) * edge;
283 ++edgeIdx;
284 }
285 }
286
287 return edges;
288 } else {
289 ATH_MSG_FATAL("The surface bounds are neither a rectangle nor a trapezoid, this is not supported yet");
290 return edges;
291 }
292 }
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
Definition ArrayHelper.h:10
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis

◆ cornerPoints() [2/3]

std::array< Amg::Vector3D, 8 > MuonGMR4::MuonChamberToolTest::cornerPoints ( const ActsTrk::GeometryContext & gctx,
const Acts::StrawSurface & surface ) const
private

Definition at line 233 of file MuonChamberToolTest.cxx.

233 {
234 std::array<Amg::Vector3D, 8> edges{make_array<Amg::Vector3D,8>(Amg::Vector3D::Zero())};
235 using BoundEnum = Acts::LineBounds::BoundValues;
236 const auto& bounds = static_cast<const Acts::LineBounds&>(surface.bounds());
237 unsigned int edgeIdx{0};
238
239 ATH_MSG_VERBOSE("Fetch volume bounds "<<Amg::toString(surface.localToGlobalTransform(gctx.context())));
240 for (const double signX : {-1., 1.}) {
241 for (const double signY : { -1., 1.}) {
242 for (const double signZ: {-1., 1.}) {
243 const Amg::Vector3D edge{signX*bounds.get(BoundEnum::eR),
244 signY*bounds.get(BoundEnum::eR),
245 signZ*bounds.get(BoundEnum::eHalfLengthZ)};
246 edges[edgeIdx] = surface.localToGlobalTransform(gctx.context()) * edge;
247 ++edgeIdx;
248 }
249 }
250 }
251 return edges;
252 }

◆ cornerPoints() [3/3]

std::vector< Amg::Vector3D > MuonGMR4::MuonChamberToolTest::cornerPoints ( const ActsTrk::GeometryContext & gctx,
const Acts::Volume & volume ) const
private

Returns the edge points from a trapezoidal / cuboid /diamond volume.

Definition at line 177 of file MuonChamberToolTest.cxx.

177 {
178
179 const auto& bounds = volume.volumeBounds();
180 unsigned int edgeIdx{0};
181 //diamond volume bounds case - there are 12 edges
182 if(bounds.type() == Acts::VolumeBounds::BoundsType::eDiamond){
183 const auto& diamondBounds = static_cast<const Acts::DiamondVolumeBounds&>(bounds);
184 using BoundEnum = Acts::DiamondVolumeBounds::BoundValues;
185 std::vector<Amg::Vector3D> edges(12, Amg::Vector3D::Zero());
186 double xCord{0};
187 double yCord{0};
188 for(double signX : {-1.,1.}){
189 for(double signY : {-1., 0., 1.}){
190 for(double signZ : {-1.,1.}){
191 if(signY == 0){
192 xCord = diamondBounds.get(BoundEnum::eHalfLengthX2);
193 }else if(signY < 0){
194 xCord = diamondBounds.get(BoundEnum::eHalfLengthX1);
195 yCord = diamondBounds.get(BoundEnum::eLengthY1);
196
197 }else{
198 xCord = diamondBounds.get(BoundEnum::eHalfLengthX3);
199 yCord = diamondBounds.get(BoundEnum::eLengthY2);
200
201 }
202
203 const Amg::Vector3D edge{signX*xCord,
204 signY*yCord,
205 signZ*diamondBounds.get(BoundEnum::eHalfLengthZ)};
206 edges[edgeIdx] = volume.localToGlobalTransform(gctx.context())*edge;
207 edgeIdx++;
208 }
209 }
210 }
211
212 return edges;
213 }
214
215 //trapezoid or rectangular bounds case
216 std::vector<Amg::Vector3D> edges(8, Amg::Vector3D::Zero());
217 ATH_MSG_VERBOSE("Fetch volume bounds "<<Amg::toString(volume.localToGlobalTransform(gctx.context())));
218 for (const double signX : {-1., 1.}) {
219 for (const double signY : { -1., 1.}) {
220 for (const double signZ: {-1., 1.}) {
221 const Amg::Vector3D edge{signX* (signY>0 ? MuonGMR4::halfXhighY(bounds) : MuonGMR4::halfXlowY(bounds)),
222 signY*MuonGMR4::halfY(bounds),
223 signZ*MuonGMR4::halfZ(bounds)};
224 edges[edgeIdx] = volume.localToGlobalTransform(gctx.context()) * edge;
225 ATH_MSG_VERBOSE("Local edge "<<Amg::toString(edge)<<", global edge: "<<Amg::toString(edges[edgeIdx]));
226 ++edgeIdx;
227 }
228 }
229 }
230 return edges;
231 }
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid)
double halfXhighY(const Acts::VolumeBounds &bounds)
Returns the half-Y length @ posiive Y for the parsed volume bounds (Trapezoid/ Cuboid)
double halfXlowY(const Acts::VolumeBounds &bounds)
Returns the half-X length @ negative Y for the parsed volume bounds (Trapezoid/ Cuboid)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonGMR4::MuonChamberToolTest::execute ( const EventContext & ctx) const
override

Check that all chambers covered by their sector envelopes

Definition at line 647 of file MuonChamberToolTest.cxx.

647 {
648 const ActsTrk::GeometryContext* gctx{nullptr};
649 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
650 std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry = m_trackingGeometrySvc->trackingGeometry();
652 ATH_CHECK(checkChambers(*gctx));
654 ATH_CHECK(checkTrackingGeometry(*gctx, trackingGeometry));
655
656 return StatusCode::SUCCESS;
657 }
StatusCode checkEnvelopes(const ActsTrk::GeometryContext &gctx) const
Check envelopes.
StatusCode checkChambers(const ActsTrk::GeometryContext &gctx) const
Check whether the chamber envelopes are consistent.
StatusCode checkTrackingGeometry(const ActsTrk::GeometryContext &gctx, std::shared_ptr< const Acts::TrackingGeometry > &trackingGeometry) const
Check tracking geometry volumes.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ hasOverlap()

bool MuonGMR4::MuonChamberToolTest::hasOverlap ( const ActsTrk::GeometryContext & gctx,
const std::vector< Amg::Vector3D > & chamberEdges,
const Acts::Volume & volume ) const
private

Checks whether the edge points from a trapezoid/cuboid/diamond form a volume overlapping with the given volume.

Parameters
gctxGeometry context carrying all alignment & global transformations
chamberEdgesEdge points of the volume that might overlap
volumeSecond volume used for the overlap checking

First check that there's at least a chance that the edges might overlap with the center

The bound values contain the half length's if the minDist is within reach Then continue the check

Definition at line 303 of file MuonChamberToolTest.cxx.

305 {
306
308 const Amg::Vector3D center{volume.center(gctx.context())};
309 double minDist = 1._km;
310 for (const Amg::Vector3D& edge : chamberEdges) {
311 minDist = std::min(minDist, (edge - center).mag());
312 }
315 if (std::ranges::none_of(volume.volumeBounds().values(),
316 [minDist](const double bound){
317 return minDist < 2.5*bound;
318 })) {
319 return false;
320 }
321 const double stepLength = 1. / m_overlapSamples;
322
323 const Acts::VolumeBounds& volBounds = volume.volumeBounds();
324 const Acts::Transform3& transform = volume.globalToLocalTransform(gctx.context());
325 for (unsigned edge1 = 1; edge1 < chamberEdges.size(); ++edge1) {
326 for (unsigned edge2 = 0; edge2 < edge1; ++edge2) {
327 for (unsigned step = 0 ; step <= m_overlapSamples; ++step) {
328 const double section = stepLength * step;
329 const Amg::Vector3D testPoint = section* chamberEdges[edge1] + (1. -section) *chamberEdges[edge2];
330 // Using acts::Volume::inside is horribly slow in dbg builds.
331 // Using the bounds method directly is much faster.
332 //if (volume.inside (gctx.context(), testPoint)) {
333 if (volBounds.inside (transform * testPoint)) {
334 return true;
335 }
336 }
337 }
338 }
339 return false;
340 }
Scalar mag() const
mag method
void section(const std::string &sec)
Gaudi::Property< unsigned > m_overlapSamples
Number of points to scan along the lines between two volume corners to check whether they belong to a...
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.

◆ initialize()

StatusCode MuonGMR4::MuonChamberToolTest::initialize ( )
override

Definition at line 55 of file MuonChamberToolTest.cxx.

55 {
56 ATH_CHECK(m_idHelperSvc.retrieve());
57 ATH_CHECK(m_geoCtxKey.initialize());
59 ATH_CHECK(detStore()->retrieve(m_detMgr));
60 return StatusCode::SUCCESS;
61 }
const ServiceHandle< StoreGateSvc > & detStore() const

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ isReEntrant()

bool MuonGMR4::MuonChamberToolTest::isReEntrant ( ) const
inlinefinaloverride

Definition at line 38 of file MuonChamberToolTest.h.

38{return false;}

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ pointInside() [1/2]

StatusCode MuonGMR4::MuonChamberToolTest::pointInside ( const ActsTrk::GeometryContext & gctx,
const Acts::TrackingVolume & volume,
const Amg::Vector3D & point,
const std::string & descr,
const Identifier & chamberId ) const
private

Checks whether the point is inside a tracking volume.

Parameters
gctxGeometry context carrying the aligned local -> global transfors
volumeReference to the tracking volume to check
pointPoint that needs to be inside the volume
descrDescription of the point
chamberIdIdentifier for more information if the point is outside

Definition at line 108 of file MuonChamberToolTest.cxx.

112 {
113 if (volume.inside(gctx.context(), point, tolerance)) {
114 return StatusCode::SUCCESS;
115 }
116 const std::vector<Amg::Vector3D> volumeCorners = cornerPoints(gctx, volume);
117 ATH_MSG_FATAL("In channel "<<m_idHelperSvc->toString(chamberId) <<", the point "
118 << descr <<" "<<Amg::toString(volume.globalToLocalTransform(gctx.context())* point)
119 <<" is not part of the chamber volume. The corners of the volume are:");
120 for(const auto& corner : volumeCorners) {
121 ATH_MSG_FATAL(" "<<Amg::toString(volume.globalToLocalTransform(gctx.context())*corner));
122 }
123 return StatusCode::FAILURE;
124 }
constexpr double tolerance

◆ pointInside() [2/2]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::pointInside ( const ActsTrk::GeometryContext & gctx,
const EnvelopeType & envelope,
const Acts::Volume & boundVol,
const Amg::Vector3D & point,
const std::string & descr,
const Identifier & channelId ) const
private

Checks whether the point is inside of an envelope object, i.e.

the spectrometer sector or the chamber

Parameters
gctxGeometry context carrying the aligned local -> global transfors
envelopeReference to the envelope to check
boundVolReference to the bounding volume representing the envelope
pointPoint that needs to be inside the volume
descrDescription of the point
channelIdIdentifier for more information if the point is outside

Why does the strip design give a different result than the Acts bounds?

Definition at line 71 of file MuonChamberToolTest.cxx.

76 {
77
78 // Explicitly inline Volume::inside here so that it gets
79 // flattened in debug builds. Gives a significant speedup.
80 //if (boundVol.inside(gctx.context(), point, tolerance)) {
81 const Amg::Vector3D locPos{boundVol.globalToLocalTransform(gctx.context()) * point};
82 if (boundVol.volumeBounds().inside(locPos,tolerance)) {
83 ATH_MSG_VERBOSE("In channel "<<m_idHelperSvc->toString(channelId)
84 <<", point "<<descr <<" is inside of the chamber "<<std::endl<<chamb<<std::endl
85 <<"Local position:" <<Amg::toString(boundVol.globalToLocalTransform(gctx.context()) * point));
86 return StatusCode::SUCCESS;
87 }
88
89 StripDesign planeTrapezoid{};
90 planeTrapezoid.defineTrapezoid(chamb.halfXShort(), chamb.halfXLong(), chamb.halfY());
91 planeTrapezoid.setLevel(MSG::VERBOSE);
93 static const Eigen::Rotation2D axisSwap{90. *Gaudi::Units::deg};
94 if (std::abs(locPos.z()) - chamb.halfZ() < -tolerance &&
95 planeTrapezoid.insideTrapezoid(axisSwap*locPos.block<2,1>(0,0))) {
96 return StatusCode::SUCCESS;
97 }
98 planeTrapezoid.defineStripLayout(locPos.y() * Amg::Vector2D::UnitX(), 1, 1, 1);
99 ATH_MSG_FATAL("In channel "<<m_idHelperSvc->toString(channelId) <<", the point "
100 << descr <<" "<<Amg::toString(point)<<" is not part of the chamber volume."
101 <<std::endl<<std::endl<<chamb<<std::endl<<"Local position "<<Amg::toString(locPos)
102 <<", "<<planeTrapezoid
103 <<", box left edge: "<<Amg::toString(planeTrapezoid.leftEdge(1).value_or(Amg::Vector2D::Zero()))
104 <<", box right edge "<<Amg::toString(planeTrapezoid.rightEdge(1).value_or(Amg::Vector2D::Zero())));
105 return StatusCode::FAILURE;
106 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ saveEnvelope()

void MuonGMR4::MuonChamberToolTest::saveEnvelope ( const ActsTrk::GeometryContext & gctx,
const std::string & envName,
const Acts::Volume & envelopeVol,
const std::vector< const MuonGMR4::MuonReadoutElement * > & assocRE,
const std::vector< std::shared_ptr< Acts::Volume > > & subVolumes = {} ) const
private

Definition at line 627 of file MuonChamberToolTest.cxx.

631 {
632 Acts::ObjVisualization3D visualHelper{};
633 std::ranges::for_each(assocRE, [&visualHelper, &gctx](const MuonReadoutElement* re){
634 std::ranges::for_each(re->getSurfaces(),[&visualHelper, &gctx](const std::shared_ptr<Acts::Surface>& surface){
635 Acts::GeometryView3D::drawSurface(visualHelper, *surface, gctx.context());
636 });
637 });
638 std::ranges::for_each(subVols, [&visualHelper, &gctx](const std::shared_ptr<Acts::Volume>& subVol ){
639 Acts::GeometryView3D::drawVolume(visualHelper,*subVol, gctx.context(), Amg::Transform3D::Identity(),
640 Acts::s_viewPassive);
641 });
642 Acts::GeometryView3D::drawVolume(visualHelper, envelopeVol, gctx.context());
643 ATH_MSG_DEBUG("Save new envelope 'MsTrackTest_"<<envName<<".obj'");
644 visualHelper.write(std::format("MsTrackTest_{:}.obj", envName));
645 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_ERROR(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ testReadoutEle() [1/7]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const MdtReadoutElement & readOutEle,
const EnvelopeType & envelope,
const Acts::Volume & boundVol ) const
private

Checks whether all channels of a given readout element are fully covered by the envelope.

Parameters
gctxGeometry context carrying all alignment & global transformations
readOutEleReadout element to test
envelopeReference to the envelope to check
boundVolBounding volume representing the envelope

Definition at line 659 of file MuonChamberToolTest.cxx.

662 {
663 ATH_MSG_VERBOSE("Test whether "<<m_idHelperSvc->toStringDetEl(mdtMl.identify())<<std::endl<<mdtMl.getParameters());
664
665 for (unsigned int layer = 1; layer <= mdtMl.numLayers(); ++layer) {
666 for (unsigned int tube = 1; tube <= mdtMl.numTubesInLay(); ++tube) {
667 const IdentifierHash idHash = mdtMl.measurementHash(layer, tube);
668 if (!mdtMl.isValid(idHash)){
669 continue;
670 }
671 const Amg::Transform3D& locToGlob{mdtMl.localToGlobalTransform(gctx, idHash)};
672 const Identifier measId{mdtMl.measurementId(idHash)};
673
674 ATH_CHECK(pointInside(gctx, chamber, detVol, mdtMl.globalTubePos(gctx, idHash), "tube center", measId));
675
676 ATH_CHECK(pointInside(gctx, chamber, detVol, mdtMl.readOutPos(gctx, idHash), "tube readout", measId));
677 ATH_CHECK(pointInside(gctx, chamber, detVol, mdtMl.highVoltPos(gctx, idHash), "tube HV", measId));
678
679 ATH_CHECK(pointInside(gctx, chamber, detVol, locToGlob*(-mdtMl.innerTubeRadius() * Amg::Vector3D::UnitX()),
680 "bottom of the tube box", measId));
681 ATH_CHECK(pointInside(gctx, chamber, detVol, locToGlob*(mdtMl.innerTubeRadius() * Amg::Vector3D::UnitX()),
682 "sealing of the tube box", measId));
683
684 ATH_CHECK(pointInside(gctx, chamber, detVol, locToGlob*(-mdtMl.innerTubeRadius() * Amg::Vector3D::UnitY()),
685 "wall to the previous tube", measId));
686 ATH_CHECK(pointInside(gctx, chamber, detVol, locToGlob*(-mdtMl.innerTubeRadius() * Amg::Vector3D::UnitY()),
687 "wall to the next tube", measId));
688 }
689 }
690 return StatusCode::SUCCESS;
691 }
Eigen::Affine3d Transform3D
@ layer
Definition HitInfo.h:79

◆ testReadoutEle() [2/7]

template<class EnevelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const MmReadoutElement & mm,
const EnevelopeType & chamber,
const Acts::Volume & detVol ) const

Definition at line 736 of file MuonChamberToolTest.cxx.

739 {
740
741 const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
742 for(unsigned int gasGap = 1; gasGap <= mm.nGasGaps(); ++gasGap){
743 IdentifierHash gasGapHash = MmReadoutElement::createHash(gasGap,0);
744 unsigned int firstStrip = mm.firstStrip(gasGapHash);
745 for(unsigned int strip = firstStrip; strip <= mm.numStrips(gasGapHash); ++strip){
746 const Identifier stripId = idHelper.channelID(mm.identify(), mm.multilayer(), gasGap, strip);
747 ATH_CHECK(pointInside(gctx, chamber, detVol, mm.stripPosition(gctx, stripId), "center", stripId));
748 ATH_CHECK(pointInside(gctx, chamber, detVol, mm.leftStripEdge(gctx, mm.measurementHash(stripId)), "left edge", stripId));
749 ATH_CHECK(pointInside(gctx, chamber, detVol, mm.rightStripEdge(gctx, mm.measurementHash(stripId)), "right edge", stripId));
750 }
751 }
752
753 return StatusCode::SUCCESS;
754 }
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
static IdentifierHash createHash(const int gasGap, const int strip)

◆ testReadoutEle() [3/7]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const MmReadoutElement & readOutEle,
const EnvelopeType & envelope,
const Acts::Volume & boundVol ) const
private

◆ testReadoutEle() [4/7]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const RpcReadoutElement & readOutEle,
const EnvelopeType & envelope,
const Acts::Volume & boundVol ) const
private

Definition at line 693 of file MuonChamberToolTest.cxx.

696 {
697
698 ATH_MSG_VERBOSE("Test whether "<<m_idHelperSvc->toStringDetEl(rpc.identify())<<std::endl<<rpc.getParameters());
699
700 const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
701 for (unsigned int gasGap = 1 ; gasGap <= rpc.nGasGaps(); ++gasGap) {
702 for (int doubletPhi = rpc.doubletPhi(); doubletPhi <= rpc.doubletPhiMax(); ++doubletPhi){
703 for (bool measPhi : {false, true}) {
704 const int nStrips = measPhi ? rpc.nPhiStrips() : rpc.nEtaStrips();
705 for (int strip = 1; strip <= nStrips; ++strip) {
706 const Identifier stripId = idHelper.channelID(rpc.identify(),rpc.doubletZ(),
707 doubletPhi, gasGap, measPhi, strip);
708 ATH_CHECK(pointInside(gctx, chamber, detVol, rpc.stripPosition(gctx, stripId), "center", stripId));
709 ATH_CHECK(pointInside(gctx, chamber, detVol, rpc.leftStripEdge(gctx, stripId), "right edge", stripId));
710 ATH_CHECK(pointInside(gctx, chamber, detVol, rpc.rightStripEdge(gctx, stripId), "left edge", stripId));
711 }
712 }
713 }
714 }
715 return StatusCode::SUCCESS;
716 }
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)

◆ testReadoutEle() [5/7]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const sTgcReadoutElement & readOutEle,
const EnvelopeType & envelope,
const Acts::Volume & boundVol ) const
private

Definition at line 756 of file MuonChamberToolTest.cxx.

759 {
760
761 const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
762 for(unsigned int gasGap = 1; gasGap <= stgc.numLayers(); ++gasGap){
763
764 for(unsigned int nch = 1; nch <= stgc.nChTypes(); ++nch){
765 IdentifierHash gasGapHash = sTgcReadoutElement::createHash(gasGap, nch, 0, 0);
766 const unsigned int nStrips = stgc.numChannels(gasGapHash);
768
769 for(unsigned int strip = 1; strip <= nStrips; ++strip){
770 const Identifier stripId = idHelper.channelID(stgc.identify(), stgc.multilayer(), gasGap, nch, strip);
771 const IdentifierHash stripHash = stgc.measurementHash(stripId);
772 ATH_CHECK(pointInside(gctx, chamber, detVol, stgc.globalChannelPosition(gctx, stripHash), "channel position", stripId));
773
775 ATH_CHECK(pointInside(gctx, chamber, detVol, stgc.rightStripEdge(gctx, stripHash), "channel position", stripId));
776 ATH_CHECK(pointInside(gctx, chamber, detVol, stgc.leftStripEdge(gctx, stripHash), "channel position", stripId));
777 }
778 }
779 }
780 }
781 return StatusCode::SUCCESS;
782
783 }
ReadoutChannelType
ReadoutChannelType to distinguish the available readout channels Pad - pad readout channel Strip - et...
static IdentifierHash createHash(const unsigned gasGap, const unsigned channelType, const unsigned channel, const unsigned wireInGrp=0)
Create a measurement hash from the Identifier fields.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const

◆ testReadoutEle() [6/7]

template<class EnvelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const TgcReadoutElement & readOutEle,
const EnvelopeType & envelope,
const Acts::Volume & boundVol ) const
private

◆ testReadoutEle() [7/7]

template<class EnevelopeType>
StatusCode MuonGMR4::MuonChamberToolTest::testReadoutEle ( const ActsTrk::GeometryContext & gctx,
const TgcReadoutElement & tgc,
const EnevelopeType & chamber,
const Acts::Volume & detVol ) const

Definition at line 718 of file MuonChamberToolTest.cxx.

721 {
722 for (unsigned int gasGap = 1; gasGap <= tgc.nGasGaps(); ++gasGap){
723 for (bool isStrip : {false}) {
724 const IdentifierHash layHash = tgc.constructHash(0, gasGap, isStrip);
725 const unsigned int nChannel = tgc.numChannels(layHash);
726 for (unsigned int channel = 1; channel <= nChannel ; ++channel) {
727 const IdentifierHash measHash = tgc.constructHash(channel, gasGap, isStrip);
728 ATH_CHECK(pointInside(gctx, chamber, detVol, tgc.channelPosition(gctx, measHash),
729 "center", tgc.measurementId(measHash)));
730 }
731 }
732 }
733 return StatusCode::SUCCESS;
734 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detMgr

const MuonDetectorManager* MuonGMR4::MuonChamberToolTest::m_detMgr {nullptr}
private

Definition at line 147 of file MuonChamberToolTest.h.

147{nullptr};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dumpObjs

Gaudi::Property<bool> MuonGMR4::MuonChamberToolTest::m_dumpObjs {this, "dumpVolumes" , false}
private

Dump the chambers & sectors as separate obj files.

Definition at line 146 of file MuonChamberToolTest.h.

146{this, "dumpVolumes" , false};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_geoCtxKey

SG::ReadHandleKey<ActsTrk::GeometryContext> MuonGMR4::MuonChamberToolTest::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
private

Definition at line 133 of file MuonChamberToolTest.h.

133{this, "AlignmentKey", "ActsAlignment", "cond handle key"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonGMR4::MuonChamberToolTest::m_idHelperSvc
private
Initial value:
{this, "IdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 130 of file MuonChamberToolTest.h.

130 {this, "IdHelperSvc",
131 "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_ignoreOutsideSurf

Gaudi::Property<bool> MuonGMR4::MuonChamberToolTest::m_ignoreOutsideSurf {this, "ignoreOutsideSurface", true}
private

The exceeding surfaces does not lead to a failure.

In fact, the tubes are exceeded in BIS78 (TODO)

Definition at line 144 of file MuonChamberToolTest.h.

144{this, "ignoreOutsideSurface", true};

◆ m_ignoreOverlapCh

Gaudi::Property<bool> MuonGMR4::MuonChamberToolTest::m_ignoreOverlapCh {this, "ignoreChamberOverlap", true}
private

The overlap of chamber volumes does not lead to a failure.

In fact, the overlap between the T4 & BIS78 chambers is found to be unavoidable without boolean shapes in the tracking geometry

Definition at line 142 of file MuonChamberToolTest.h.

142{this, "ignoreChamberOverlap", true};

◆ m_overlapChambObj

Gaudi::Property<std::string> MuonGMR4::MuonChamberToolTest::m_overlapChambObj {this, "chamberOverlapFile", "OverlapingChambers.obj"}
private

Name of the chamber output obj file.

Definition at line 139 of file MuonChamberToolTest.h.

139{this, "chamberOverlapFile", "OverlapingChambers.obj"};

◆ m_overlapSamples

Gaudi::Property<unsigned> MuonGMR4::MuonChamberToolTest::m_overlapSamples {this, "overlapSamples", 50}
private

Number of points to scan along the lines between two volume corners to check whether they belong to an another volume.

Definition at line 137 of file MuonChamberToolTest.h.

137{this, "overlapSamples", 50};

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> MuonGMR4::MuonChamberToolTest::m_trackingGeometrySvc {this, "TrackingGeometrySvc","ActsTrackingGeometrySvc"}
private

Definition at line 135 of file MuonChamberToolTest.h.

135{this, "TrackingGeometrySvc","ActsTrackingGeometrySvc"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: