ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MuonR4::SegmentFittingAlg Class Reference

Algorithm to handle segment fits
More...

#include <SegmentFittingAlg.h>

Inheritance diagram for MuonR4::SegmentFittingAlg:
Collaboration diagram for MuonR4::SegmentFittingAlg:

Public Types

using HitVec = SegmentFitResult::HitVec
 

Public Member Functions

 SegmentFittingAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~SegmentFittingAlg ()
 
virtual StatusCode initialize () override
 
virtual StatusCode execute (const EventContext &ctx) const override
 
virtual StatusCode finalize () override
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
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. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

using Parameters = SegmentFit::Parameters
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

template<class ContainerType >
StatusCode retrieveContainer (const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const
 Helper method to fetch data from StoreGate. More...
 
SegmentFitResult fitSegmentHits (const EventContext &ctx, const ActsGeometryContext &gctx, const Parameters &startPars, SegmentFitResult::HitVec &&calibHits) const
 Executes the segment fit with start parameters. More...
 
const xAOD::MuonSegmentgetTruthSegment (const EventContext &ctx, const std::unordered_set< const xAOD::MuonSimHit * > &matchedSeedHits) const
 
More...
 
std::vector< std::unique_ptr< Segment > > fitSegmentSeed (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed *seed) const
 
bool removeOutliers (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &fitResult) const
 Spot hits with large discrepancy from the estimated parameters and remove them from the list. More...
 
bool plugHoles (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &toRecover) const
 Recovery of missed hits. More...
 
void eraseWrongHits (const ActsGeometryContext &gctx, SegmentFitResult &candidate) const
 Removes all hits from the segment which are obvious outliers. More...
 
void resolveAmbiguities (const ActsGeometryContext &gctx, std::vector< std::unique_ptr< Segment >> &segmentCandidates) const
 
void visualizeFit (const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel, std::vector< std::unique_ptr< TObject >> primitives={}) const
 
void visualizeFitPhi (const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadHandleKey< SegmentSeedContainerm_seedKey {this, "ReadKey", "MuonHoughStationSegmentSeeds"}
 ReadHandle of the seeds. More...
 
SG::ReadHandleKey< xAOD::MuonSegmentContainerm_truthSegKey {this, "TruthSegKey", "TruthSegmentsR4"}
 ReadHandle for the truth segments (For validation purposes) More...
 
SG::WriteHandleKey< SegmentContainerm_outSegments {this, "MuonSegmentContainer", "R4MuonSegments"}
 
SG::ReadHandleKey< ActsGeometryContextm_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
ToolHandle< ISpacePointCalibratorm_calibTool {this, "Calibrator", "" }
 
Gaudi::Property< bool > m_useMinuit {this, "useMinuit", false}
 Toggle the fitter. More...
 
Gaudi::Property< bool > m_doT0Fit {this, "fitSegmentT0", true}
 
Gaudi::Property< bool > m_doBeamspotConstraint {this, "doBeamspotConstraint", false}
 Add beamline constraint. More...
 
Gaudi::Property< double > m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm}
 
Gaudi::Property< double > m_beamSpotL {this, "BeamSpotLength", 20. * Gaudi::Units::m}
 
Gaudi::Property< double > m_seedTanThetaReso {this, "ResoSeedTanTheta", 250. * Gaudi::Units::mrad}
 Two mdt seeds are the same if their defining parameters match wihin. More...
 
Gaudi::Property< double > m_seedY0Reso {this, "ResoSeedY0", 500.*Gaudi::Units::micrometer}
 
Gaudi::Property< double > m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. }
 
Gaudi::Property< double > m_outlierRemovalCut {this, "OutlierRemoval", 5.}
 Cut on the segment chi2 / nDoF to launch the outlier removal. More...
 
Gaudi::Property< double > m_recoveryPull {this, "RecoveryPull", 5.}
 
std::unique_ptr< TCanvas > m_allCan {}
 
Gaudi::Property< std::string > m_allCanName {this, "AllCanName", "AllSegmentFits"}
 
std::atomic< unsigned int > m_canvCounter ATLAS_THREAD_SAFE {0}
 
Gaudi::Property< unsigned int > m_nDrawCanvases {this, "MaxCanvases", 5000}
 Draw maximally 5000 segment fit visualizations. More...
 
const MuonGMR4::MuonDetectorManagerm_detMgr {nullptr}
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Algorithm to handle segment fits

This is currently a placeholder to test ideas!

Definition at line 42 of file SegmentFittingAlg.h.

Member Typedef Documentation

◆ HitVec

Definition at line 50 of file SegmentFittingAlg.h.

◆ Parameters

Definition at line 53 of file SegmentFittingAlg.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SegmentFittingAlg()

MuonR4::SegmentFittingAlg::SegmentFittingAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 93 of file SegmentFittingAlg.cxx.

93  :
94  AthReentrantAlgorithm(name, pSvcLocator) {}

◆ ~SegmentFittingAlg()

MuonR4::SegmentFittingAlg::~SegmentFittingAlg ( )
virtualdefault

Member Function Documentation

◆ cardinality()

unsigned int AthReentrantAlgorithm::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.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ eraseWrongHits()

void MuonR4::SegmentFittingAlg::eraseWrongHits ( const ActsGeometryContext gctx,
SegmentFitResult candidate 
) const
private

Removes all hits from the segment which are obvious outliers.

E.g. tubes which cannot be crossed by the segment.

Parameters
gctxGeometry context needed to calculate the nominal time of arrival, if the time fit is activated
candidateReference of the segment candidate to prune.

The segment has never crossed the tube

Definition at line 918 of file SegmentFittingAlg.cxx.

918  {
919  auto [segPos, segDir] = makeLine(candidate.segmentPars);
920  candidate.calibMeasurements.erase(std::remove_if(candidate.calibMeasurements.begin(), candidate.calibMeasurements.end(),
921  [&segPos, &segDir](const HitVec::value_type& hit){
922  if (hit->fitState() != CalibratedSpacePoint::State::Outlier) {
923  return false;
924  }
927  const double dist = Amg::lineDistance(segPos, segDir, hit->positionInChamber(), hit->directionInChamber());
928  const auto* dc = static_cast<const xAOD::MdtDriftCircle*>(hit->spacePoint()->primaryMeasurement());
929  return dist >= dc->readoutElement()->innerTubeRadius();
930  }
931  return true;
932  }), candidate.calibMeasurements.end());
933  const MuonGMR4::MuonChamber* chamber{nullptr};
934  for (const auto& hit : candidate.calibMeasurements) {
935  if (hit->type() != xAOD::UncalibMeasType::Other){
936  chamber = hit->spacePoint()->chamber();
937  break;
938  }
939  }
940  std::optional<double> timeOfFlight = candidate.timeFit ? std::make_optional<double>((chamber->localToGlobalTrans(gctx)*segPos).mag() * inv_c)
941  : std::nullopt;
942  auto [updatedMeasChi2, updateChi2] = SegmentFitHelpers::postFitChi2PerMas(candidate.segmentPars, timeOfFlight,
943  candidate.calibMeasurements, msgStream());
944  ATH_MSG_VERBOSE("The measurements before "<<candidate.chi2PerMeasurement<<", after: "<<updatedMeasChi2<<", chi2: "<<updateChi2);
945  candidate.chi2PerMeasurement = std::move(updatedMeasChi2);
946  }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode MuonR4::SegmentFittingAlg::execute ( const EventContext &  ctx) const
overridevirtual

Definition at line 113 of file SegmentFittingAlg.cxx.

113  {
114 
115  const ActsGeometryContext* gctx{nullptr};
117  const SegmentSeedContainer* segmentSeeds=nullptr;
118  ATH_CHECK(retrieveContainer(ctx, m_seedKey, segmentSeeds));
119 
121  ATH_CHECK(writeSegments.record(std::make_unique<SegmentContainer>()));
122  std::vector<std::unique_ptr<Segment>> allSegments{};
123  for (const SegmentSeed* seed : *segmentSeeds) {
124  std::vector<std::unique_ptr<Segment>> segments = fitSegmentSeed(ctx, *gctx, seed);
125  allSegments.insert(allSegments.end(), std::make_move_iterator(segments.begin()),
126  std::make_move_iterator(segments.end()));
127  }
128  resolveAmbiguities(*gctx, allSegments);
129  writeSegments->insert(writeSegments->end(),
130  std::make_move_iterator(allSegments.begin()),
131  std::make_move_iterator(allSegments.end()));
132  ATH_MSG_VERBOSE("Found in total "<<writeSegments->size()<<" segments. ");
133  return StatusCode::SUCCESS;
134  }

◆ 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 & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ finalize()

StatusCode MuonR4::SegmentFittingAlg::finalize ( )
overridevirtual

Definition at line 108 of file SegmentFittingAlg.cxx.

108  {
109  if (m_allCan) m_allCan->SaveAs( (m_allCanName +".pdf]").c_str());
110  return StatusCode::SUCCESS;
111  }

◆ fitSegmentHits()

SegmentFitResult MuonR4::SegmentFittingAlg::fitSegmentHits ( const EventContext &  ctx,
const ActsGeometryContext gctx,
const Parameters startPars,
SegmentFitResult::HitVec &&  calibHits 
) const
private

Executes the segment fit with start parameters.

The returned fit result indicates whether the fit was a success and all relevant output parameters

ctx: Event context needed to access the calibration constants of the hits

gctx: Geometry context needed to place the segment globally within ATLAS to calculate the nominal time of arrival

startPars: Segment parameters preestimated from the SegmentSeed (either hough pattern or two drift circle seed)

calibHits: Vector of strip & mdt hits to consider for the fit

Add beamspot if neccessary

placeholder for a very generous beam spot: 300mm in X,Y (tracking volume), 20000 along Z

Configure the minimizer

Assumption that the particle travels at the speed of light

Execute fit

Definition at line 182 of file SegmentFittingAlg.cxx.

185  {
186  SegmentFitResult data{};
187  if (calibHits.empty()) {
188  ATH_MSG_WARNING("No hits, no segment");
189  return data;
190  }
191 
194  unsigned int numPhi = std::accumulate(calibHits.begin(), calibHits.end(),0,
195  [](unsigned int n, const HitVec::value_type& hit){
196  return n + (hit->fitState() == CalibratedSpacePoint::State::Valid &&
197  hit->measuresPhi());
198  });
199  if (numPhi) {
200  const Amg::Transform3D globToLoc{calibHits[0]->spacePoint()->chamber()->globalToLocalTrans(gctx)};
201  Amg::Vector3D beamSpot{globToLoc.translation()};
202  AmgSymMatrix(3) covariance{AmgSymMatrix(3)::Identity()};
204  covariance(0,0) = std::pow(m_beamSpotR, 2);
205  covariance(1,1) = std::pow(m_beamSpotR, 2);
206  covariance(2,2) = std::pow(m_beamSpotL, 2);
207  AmgSymMatrix(3) jacobian = globToLoc.linear();
208  covariance = jacobian * covariance * jacobian.transpose();
209  AmgSymMatrix(2) beamSpotCov{covariance.block<2,2>(0,0)};
210  auto beamSpotSP = std::make_unique<CalibratedSpacePoint>(nullptr, std::move(beamSpot), Amg::Vector3D::Zero());
211  beamSpotSP->setCovariance<2>(std::move(beamSpotCov));
212  ATH_MSG_VERBOSE("Beam spot constraint "<<Amg::toString(beamSpotSP->positionInChamber())<<", "<<toString(beamSpotSP->covariance()));
213  calibHits.push_back(std::move(beamSpotSP));
214  }
215  }
216 
217  const Amg::Transform3D& locToGlob{calibHits[0]->spacePoint()->chamber()->localToGlobalTrans(gctx)};
218 
219  if (!m_useMinuit) {
220  MdtSegmentFitter::Config fitCfg{};
221  fitCfg.calibrator = m_calibTool.get();
222  fitCfg.doTimeFit = m_doT0Fit;
223 
224  MdtSegmentFitter fitter{name(), std::move(fitCfg)};
225  return fitter.fitSegment(ctx, std::move(calibHits), startPars, locToGlob);
226  }
227 
228  data.segmentPars = startPars;
229 
230  CalibSegmentChi2Minimizer c2f{name(), ctx, locToGlob, copy(calibHits), m_calibTool.get(), m_doT0Fit};
231  data.hasPhi = c2f.hasPhiMeas();
232  data.timeFit = c2f.doTimeFit();
233  data.nDoF = c2f.nDoF();
234  if (data.nDoF <= 0) {
235  ATH_MSG_DEBUG("Reject fit due to 0 degrees of freedom");
236  return data;
237  }
238  ROOT::Minuit2::Minuit2Minimizer minimizer((name() + std::to_string(ctx.eventID().event_number())).c_str());
240  minimizer.SetMaxFunctionCalls(100000);
241  minimizer.SetTolerance(0.0001);
242  minimizer.SetPrintLevel(-1);
243  minimizer.SetStrategy(1);
244 
245  minimizer.SetVariable(toInt(ParamDefs::y0), "y0", startPars[toInt(ParamDefs::y0)], 1.e-5);
246  minimizer.SetVariable(toInt(ParamDefs::theta), "theta", startPars[toInt(ParamDefs::theta)], 1.e-5);
247  minimizer.SetVariableLimits(toInt(ParamDefs::y0),
248  startPars[toInt(ParamDefs::y0)] - 60. *Gaudi::Units::cm,
249  startPars[toInt(ParamDefs::y0)] + 60. *Gaudi::Units::cm);
250  minimizer.SetVariableLimits(toInt(ParamDefs::theta),
251  startPars[toInt(ParamDefs::theta)] - 0.6,
252  startPars[toInt(ParamDefs::theta)] + 0.6);
253 
254  if (data.hasPhi) {
255  minimizer.SetVariable(toInt(ParamDefs::x0), "x0", startPars[toInt(ParamDefs::x0)], 1.e-5);
256  minimizer.SetVariable(toInt(ParamDefs::phi), "phi", startPars[toInt(ParamDefs::phi)], 1.e-5);
257  minimizer.SetVariableLimits(toInt(ParamDefs::x0),
258  startPars[toInt(ParamDefs::x0)] - 600,
259  startPars[toInt(ParamDefs::x0)] + 600);
260  minimizer.SetVariableLimits(toInt(ParamDefs::phi),
261  startPars[toInt(ParamDefs::phi)] - 0.6,
262  startPars[toInt(ParamDefs::phi)] + 0.6);
263  } else {
264  minimizer.SetFixedVariable(toInt(ParamDefs::x0), "x0", 0.);
265  minimizer.SetFixedVariable(toInt(ParamDefs::phi), "phi", 90.*Gaudi::Units::deg);
266  }
268  if (data.timeFit) {
269  minimizer.SetVariable(toInt(ParamDefs::time), "t0", startPars[toInt(ParamDefs::time)] , 1.e-5 );
270  minimizer.SetVariableLimits(toInt(ParamDefs::time),
271  startPars[toInt(ParamDefs::time)] - 12.5,
272  startPars[toInt(ParamDefs::time)] + 12.5);
273  } else{
274  minimizer.SetFixedVariable(toInt(ParamDefs::time), "t0", 0.);
275  }
276  minimizer.SetFunction(c2f);
278  if (!minimizer.Minimize() || !minimizer.Hesse()) {
279  data.calibMeasurements = std::move(calibHits);
280  } else {
281  const double* xs = minimizer.X();
282  const double* errs = minimizer.Errors();
283 
284  for (unsigned int p = 0; p < toInt(ParamDefs::nPars); ++p) {
285  data.segmentPars[p] = xs[p];
286  data.segmentParErrs(p,p) = errs[p];
287  }
288  std::optional<double> timeOfArrival{std::nullopt};
289  const auto [locPos, locDir] = data.makeLine();
290  if (data.timeFit) {
291  timeOfArrival = std::make_optional<double>((locToGlob*locPos).mag() * inv_c);
292  }
293  data.nIter = minimizer.NCalls();
294  data.calibMeasurements = c2f.release(xs);
295 
296  auto [chiPerMeas, finalChi2] = SegmentFitHelpers::postFitChi2PerMas(data.segmentPars, timeOfArrival,
297  data.calibMeasurements, msgStream());
298  data.chi2PerMeasurement = std::move(chiPerMeas);
299  data.chi2 = finalChi2;
300  data.converged = true;
301  }
302  return data;
303  }

◆ fitSegmentSeed()

std::vector< std::unique_ptr< Segment > > MuonR4::SegmentFittingAlg::fitSegmentSeed ( const EventContext &  ctx,
const ActsGeometryContext gctx,
const SegmentSeed seed 
) const
private

At very high inclanation angles, the muon may traverse 3 hits in the same layer (E.g. BEE)

Draw the pattern with all possible seeds

Draw the prefit

Definition at line 305 of file SegmentFittingAlg.cxx.

307  {
308 
309  const Amg::Transform3D& locToGlob{patternSeed->chamber()->localToGlobalTrans(gctx)};
310  std::vector<std::unique_ptr<Segment>> segments{};
311 
312  MdtSegmentSeedGenerator::Config genCfg{};
313  genCfg.hitPullCut = m_seedHitChi2;
314  genCfg.interceptReso = m_seedY0Reso;
315  genCfg.tanThetaReso = m_seedTanThetaReso;
316  genCfg.calibrator = m_calibTool.get();
318  genCfg.busyLayerLimit = 2 + 2*(patternSeed->parameters()[toInt(ParamDefs::theta)] > 50 * Gaudi::Units::deg);
320  if (m_canvCounter < m_nDrawCanvases) {
321  SegmentFitResult data{};
322  data.segmentPars = patternSeed->parameters();
323  const Amg::Vector3D seedPos{patternSeed->positionInChamber()};
324  const Amg::Vector3D seedDir{patternSeed->directionInChamber()};
325 
326  data.calibMeasurements = m_calibTool->calibrate(ctx, patternSeed->getHitsInMax(), seedPos, seedDir,
327  data.segmentPars[toInt(ParamDefs::time)]);
328 
329  for (const std::unique_ptr<CalibratedSpacePoint>& meas : data.calibMeasurements) {
330  data.chi2PerMeasurement.push_back(SegmentFitHelpers::chiSqTerm(seedPos, seedDir, 0., std::nullopt, *meas, msgStream()));
331  }
332  data.chi2 = std::accumulate(data.chi2PerMeasurement.begin(), data.chi2PerMeasurement.end(), 0.);
333  data.nDoF = 1;
334 
335  // /** Draw the full pattern seed */
336  std::vector<std::unique_ptr<TObject>> seedLines{};
337  MdtSegmentSeedGenerator drawMe{name(), patternSeed, genCfg};
338  while(auto s = drawMe.nextSeed(ctx)) {
339  seedLines.push_back(drawLine(s->parameters));
340  }
341  seedLines.push_back(drawLabel("possible seeds: "+std::to_string(drawMe.numGenerated()),0.15, 0.85, 14));
342  visualizeFit(ctx, data, patternSeed->parentBucket(), "pattern", std::move(seedLines));
343  }
344  MdtSegmentSeedGenerator seedGen{name(),patternSeed, std::move(genCfg)};
345 
346  while (auto seed = seedGen.nextSeed(ctx)) {
347 
348  SegmentFitResult data{};
349  data.segmentPars = seed->parameters;
350  data.calibMeasurements = std::move(seed->measurements);
351 
353  if (m_canvCounter < m_nDrawCanvases) {
354  const auto [seedPos, seedDir] = SegmentFit::makeLine(data.segmentPars);
355  for (const std::unique_ptr<CalibratedSpacePoint>& meas : data.calibMeasurements) {
356  data.chi2PerMeasurement.push_back(SegmentFitHelpers::chiSqTerm(seedPos, seedDir, 0., std::nullopt, *meas, msgStream()));
357  }
358  data.chi2 = std::accumulate(data.chi2PerMeasurement.begin(), data.chi2PerMeasurement.end(), 0.);
359 
360  std::vector<std::unique_ptr<TObject>> primitives{};
361  primitives.push_back(drawLine(seed->parameters));
362 
363  visualizeFit(ctx, data, patternSeed->parentBucket(),
364  std::format("Pre fit {:d}", seedGen.numGenerated()), std::move(primitives));
365  }
366  data = fitSegmentHits(ctx, gctx, seed->parameters, std::move(data.calibMeasurements));
367  data.nIter += seed->nIter;
368  if (data.converged) {
369  visualizeFit(ctx, data, patternSeed->parentBucket(),
370  std::format("Intermediate fit {:d}", seedGen.numGenerated()));
371  }
372  if (!removeOutliers(ctx, gctx, *patternSeed, data)) {
373  continue;
374  }
375  if (!plugHoles(ctx, gctx, *patternSeed, data)) {
376  continue;
377  }
378 
379  visualizeFit(ctx, data, patternSeed->parentBucket(),
380  std::format("Final fit {:d}", seedGen.numGenerated()));
381 
382  const auto [locPos, locDir] = data.makeLine();
383  Amg::Vector3D globPos = locToGlob * locPos;
384  Amg::Vector3D globDir = locToGlob.linear()* locDir;
385 
386 
387  auto finalSeg = std::make_unique<Segment>(std::move(globPos), std::move(globDir),
388  patternSeed,
389  std::move(data.calibMeasurements),
390  data.chi2,
391  data.nDoF);
392  finalSeg->setCallsToConverge(data.nIter);
393  finalSeg->setChi2PerMeasurement(std::move(data.chi2PerMeasurement));
394  finalSeg->setParUncertainties(std::move(data.segmentParErrs));
395  if (data.timeFit) {
396  finalSeg->setSegmentT0(data.segmentPars[toInt(ParamDefs::time)]);
397  }
398  segments.push_back(std::move(finalSeg));
399 
400  }
401  return segments;
402  }

◆ getTruthSegment()

const xAOD::MuonSegment * MuonR4::SegmentFittingAlg::getTruthSegment ( const EventContext &  ctx,
const std::unordered_set< const xAOD::MuonSimHit * > &  matchedSeedHits 
) const
private


Definition at line 151 of file SegmentFittingAlg.cxx.

152  {
153  const xAOD::MuonSegmentContainer* truthSegs{nullptr};
154  if (!retrieveContainer(ctx, m_truthSegKey, truthSegs).isSuccess()){
155  THROW_EXCEPTION("Failed to retrieve segment container "<<m_truthSegKey.fullKey());
156  }
157  const ActsGeometryContext* gctx{};
158  retrieveContainer(ctx,m_geoCtxKey, gctx).ignore();
159  if (!truthSegs){
160  return nullptr;
161  }
162  const xAOD::MuonSegment* bestSeg{nullptr};
163  unsigned int mostHits{0};
164  for (const xAOD::MuonSegment* segment : *truthSegs){
165  std::unordered_set<const xAOD::MuonSimHit*> truthHits{getTruthMatchedHits(*segment)};
166  ATH_MSG_VERBOSE("Compare associated hits "<<toString(truthPars(*segment))<<" "
168  const unsigned matchedHits = std::accumulate(truthHits.begin(), truthHits.end(),0 ,
169  [&truthRecoHits](unsigned int n, const xAOD::MuonSimHit* simHit){
170  return n + truthRecoHits.count(simHit);
171  });
172  if (matchedHits > mostHits) {
173  mostHits = matchedHits;
174  bestSeg = segment;
175  }
176  }
177 
178  return bestSeg;
179  }

◆ initialize()

StatusCode MuonR4::SegmentFittingAlg::initialize ( )
overridevirtual

Definition at line 96 of file SegmentFittingAlg.cxx.

96  {
98  ATH_CHECK(m_seedKey.initialize());
99  ATH_CHECK(m_outSegments.initialize());
100  ATH_CHECK(m_calibTool.retrieve());
101  ATH_CHECK(m_idHelperSvc.retrieve());
102  ATH_CHECK(m_truthSegKey.initialize(!m_truthSegKey.empty()));
104  m_allCan = std::make_unique<TCanvas>("all", "all", 800,600.);
105  m_allCan->SaveAs( (m_allCanName +".pdf[").c_str());
106  return StatusCode::SUCCESS;
107  }

◆ 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()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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.

◆ plugHoles()

bool MuonR4::SegmentFittingAlg::plugHoles ( const EventContext &  ctx,
const ActsGeometryContext gctx,
const SegmentSeed seed,
SegmentFitResult toRecover 
) const
private

Recovery of missed hits.

Hits in the space point bucket that are maximally <RecoveryPull> away from the fitted segment are put onto the segment candidate and the candidate is refitted. If the refitted candidate has a chi2/nDoF < <OutlierRemoval> the canidate is automatically choosen otherwise, its chi needs to be better.

Parameters
ctxEventContext needed for calibration of the hits
gctxGeometry context needed if the beamspot constaint will be packed onto the segment
seedSegment seed from the pattern recognition to access the underlying bucket
toRecoverFit result with parameters & hits to recover.

We've the first estimator of the segment fit

Setup a map to replace space points if they better suite

Hit is already used in the segment fit

Remove the beamspot constraint measurement

Nothing has been recovered. Just bail out

If the chi2 is less than 5, no outlier rejection is launched. So also accept any recovered segment below that threshold

Next check whether the recovery made measurements marked as outlier feasable for the hole recovery

Finally remove all hits from the calib measurements which are obvious outliers

Definition at line 798 of file SegmentFittingAlg.cxx.

801  {
803  ATH_MSG_VERBOSE("plugHoles() -- segment "<<toString(beforeRecov.segmentPars)
804  <<", chi2: "<<beforeRecov.chi2<<", nDoF: "<<beforeRecov.nDoF<<", "
805  <<beforeRecov.chi2 /std::max(beforeRecov.nDoF, 1) );
807  std::unordered_set<const SpacePoint*> usedSpacePoint{};
808  for (const HitVec::value_type& hit : beforeRecov.calibMeasurements) {
809  usedSpacePoint.insert(hit->spacePoint());
810  }
811 
812  HitVec candidateHits{};
813  SpacePointPerLayerSorter hitLayers{*seed.parentBucket()};
814  bool hasCandidate{false};
815  const auto [locPos, locDir] = beforeRecov.makeLine();
816  for (const std::vector<HoughHitType>& mdtLayer : hitLayers.mdtHits()) {
817  for (const SpacePoint* mdtHit: mdtLayer) {
819  if (usedSpacePoint.count(mdtHit)) {
820  continue;
821  }
822  const double dist = Amg::lineDistance(locPos, locDir, mdtHit->positionInChamber(), mdtHit->directionInChamber());
823  const auto* dc = static_cast<const xAOD::MdtDriftCircle*>(mdtHit->primaryMeasurement());
824  if (dist >= dc->readoutElement()->innerTubeRadius()) {
825  continue;
826  }
827  HitVec::value_type calibHit{m_calibTool->calibrate(ctx, mdtHit, locPos, locDir, beforeRecov.segmentPars[toInt(ParamDefs::time)])};
828  const double pull = std::sqrt(SegmentFitHelpers::chiSqTermMdt(locPos, locDir, *calibHit, msgStream()));
829  ATH_MSG_VERBOSE(__func__<<"() :"<<__LINE__<<" Candidate hit for recovery "<<m_idHelperSvc->toString(mdtHit->identify())<<", chi2: "<<pull);
830  if (pull <= m_recoveryPull) {
831  hasCandidate |= calibHit->fitState() == CalibratedSpacePoint::State::Valid;
832  candidateHits.push_back(std::move(calibHit));
833  } else {
834  calibHit->setFitState(CalibratedSpacePoint::State::Outlier);
835  candidateHits.push_back(std::move(calibHit));
836  }
837  }
838  }
839  if (!hasCandidate) {
840  ATH_MSG_VERBOSE("No space point candidates for recovery were found");
841  beforeRecov.calibMeasurements.insert(beforeRecov.calibMeasurements.end(),
842  std::make_move_iterator(candidateHits.begin()),
843  std::make_move_iterator(candidateHits.end()));
844  eraseWrongHits(gctx, beforeRecov);
845  return beforeRecov.nDoF > 0;
846  }
847 
848  HitVec copied = copy(beforeRecov.calibMeasurements), copiedCandidates = copy(candidateHits);
851  removeBeamSpot(copied);
852  }
853 
854  candidateHits.insert(candidateHits.end(), std::make_move_iterator(copied.begin()), std::make_move_iterator(copied.end()));
855 
856  SegmentFitResult recovered = fitSegmentHits(ctx, gctx, beforeRecov.segmentPars, std::move(candidateHits));
857  if (!recovered.converged) {
858  return false;
859  }
861  if (recovered.nDoF + recovered.timeFit <= beforeRecov.nDoF + beforeRecov.timeFit) {
862  for (HitVec::value_type& hit : copiedCandidates) {
863  hit->setFitState(CalibratedSpacePoint::State::Outlier);
864  beforeRecov.calibMeasurements.push_back(std::move(hit));
865  }
866  eraseWrongHits(gctx, beforeRecov);
867  return true;
868  }
869  ATH_MSG_VERBOSE("Chi2, nDOF before:"<<beforeRecov.chi2<<", "<<beforeRecov.nDoF<<" after recovery: "<<recovered.chi2<<", "<<recovered.nDoF);
870  double redChi2 = recovered.chi2 / std::max(recovered.nDoF,1);
872  if (redChi2 < m_outlierRemovalCut || (beforeRecov.nDoF == 0) || redChi2 < beforeRecov.chi2 / beforeRecov.nDoF) {
873  ATH_MSG_VERBOSE("Accept segment with recovered "<<(recovered.nDoF + recovered.timeFit) - (beforeRecov.nDoF + beforeRecov.timeFit)<<" hits.");
874  recovered.nIter += beforeRecov.nIter;
875  beforeRecov = std::move(recovered);
877  while (true) {
878  bool runAnotherTrial = false;
879  copied = copy(beforeRecov.calibMeasurements);
881  removeBeamSpot(copied);
882  }
883  for (unsigned int m = 0; m < beforeRecov.calibMeasurements.size(); ++m) {
884  if (beforeRecov.calibMeasurements[m]->fitState() == CalibratedSpacePoint::State::Outlier &&
885  std::sqrt(beforeRecov.chi2PerMeasurement[m]) < m_recoveryPull) {
886  copied[m]->setFitState(CalibratedSpacePoint::State::Valid);
887  runAnotherTrial = true;
888  }
889  }
890  if (!runAnotherTrial) {
891  break;
892  }
893  recovered = fitSegmentHits(ctx, gctx, beforeRecov.segmentPars, std::move(copied));
894  if (!recovered.converged) {
895  break;
896  }
897  if (recovered.nDoF + recovered.timeFit <= beforeRecov.nDoF + beforeRecov.timeFit) {
898  break;
899  }
900  redChi2 = recovered.chi2 / std::max(recovered.nDoF, 1);
901  if (redChi2 < m_outlierRemovalCut || redChi2 < beforeRecov.chi2 / beforeRecov.nDoF) {
902  recovered.nIter += beforeRecov.nIter;
903  beforeRecov = std::move(recovered);
904  } else {
905  break;
906  }
907  }
909  eraseWrongHits(gctx, beforeRecov);
910  } else{
911  for (HitVec::value_type& hit : copiedCandidates) {
912  hit->setFitState(CalibratedSpacePoint::State::Outlier);
913  beforeRecov.calibMeasurements.push_back(std::move(hit));
914  }
915  }
916  return true;
917  }

◆ removeOutliers()

bool MuonR4::SegmentFittingAlg::removeOutliers ( const EventContext &  ctx,
const ActsGeometryContext gctx,
const SegmentSeed seed,
SegmentFitResult fitResult 
) const
private

Spot hits with large discrepancy from the estimated parameters and remove them from the list.

Parameters
ctxEventContext needed for hit calibration
gctxGeometry context needed if the beamspot constaint will be packed onto the segment
fitResultData structure carrying the fit parameters & calibrated hits

If no degree of freedom is in the segment fit then try to plug the holes

Remove a priori the beamspot constaint as it never should pose any problem and another one will be added anyway in the next iteration

Next sort the measurements by chi2

Declare the hit with the largest chi2 as outlier.

Remove the last measurement as it has the largest discrepancy

Definition at line 404 of file SegmentFittingAlg.cxx.

407  {
408 
410  if (data.nDoF<=0 || data.calibMeasurements.empty()) {
411  ATH_MSG_VERBOSE("No degree of freedom available. What shall be removed?!");
412  return false;
413  }
414 
415  const auto [segPos, segDir] = data.makeLine();
416 
417  if (data.converged && data.chi2 / data.nDoF < m_outlierRemovalCut) {
418  ATH_MSG_VERBOSE("The segment "<<Amg::toString(segPos)<<" + "<<Amg::toString(segDir)
419  <<" is already of good quality "<<data.chi2 / std::max(data.nDoF, 1)
420  <<". Don't remove outliers");
421  return true;
422  }
425  if (m_doBeamspotConstraint && removeBeamSpot(data.calibMeasurements)) {
426  data.nDoF-=2;
427  data.nPhiMeas-=1;
428  }
429 
431  std::sort(data.calibMeasurements.begin(), data.calibMeasurements.end(),
432  [&, this](const HitVec::value_type& a, const HitVec::value_type& b){
433  return SegmentFitHelpers::chiSqTerm(segPos, segDir, data.segmentPars[toInt(ParamDefs::time)], std::nullopt, *a, msgStream()) <
434  SegmentFitHelpers::chiSqTerm(segPos, segDir, data.segmentPars[toInt(ParamDefs::time)], std::nullopt, *b, msgStream());
435  });
436 
438  data.calibMeasurements.back()->setFitState(CalibratedSpacePoint::State::Outlier);
439  data.nDoF -= data.calibMeasurements.back()->measuresEta();
440  data.nDoF -= data.calibMeasurements.back()->measuresPhi();
441  if (m_doT0Fit && data.calibMeasurements.back()->measuresTime() &&
442  data.calibMeasurements.back()->type() != xAOD::UncalibMeasType::MdtDriftCircleType) {
443  --data.nDoF;
444  }
446  std::vector<HoughHitType> uncalib{};
447  for (const HitVec::value_type& calib : data.calibMeasurements) {
448  uncalib.push_back(calib->spacePoint());
449  }
450  SegmentFitResult newAttempt = fitSegmentHits(ctx, gctx, data.segmentPars, std::move(data.calibMeasurements));
451  if (newAttempt.converged) {
452  newAttempt.nIter+=data.nIter;
453  data = std::move(newAttempt);
454  visualizeFit(ctx, data, seed.parentBucket(), "bad fit recovery");
455  } else {
456  data.calibMeasurements = std::move(newAttempt.calibMeasurements);
457  }
458  return removeOutliers(ctx, gctx, seed, data);
459  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ resolveAmbiguities()

void MuonR4::SegmentFittingAlg::resolveAmbiguities ( const ActsGeometryContext gctx,
std::vector< std::unique_ptr< Segment >> &  segmentCandidates 
) const
private

Definition at line 947 of file SegmentFittingAlg.cxx.

948  {
949  using SegmentVec = std::vector<std::unique_ptr<Segment>>;
950  ATH_MSG_VERBOSE("Resolve ambiguities amongst "<<segmentCandidates.size()<<" segment candidates. ");
951  std::unordered_map<const MuonGMR4::MuonChamber*, SegmentVec> candidatesPerChamber{};
952 
953  for (std::unique_ptr<Segment>& sortMe : segmentCandidates) {
954  const MuonGMR4::MuonChamber* chamb = sortMe->chamber();
955  candidatesPerChamber[chamb].push_back(std::move(sortMe));
956  }
957  SegmentAmbiSolver ambiSolver{name()};
958  segmentCandidates.clear();
959  for (auto& [chamber, resolveMe] : candidatesPerChamber) {
960  SegmentVec resolvedSegments = ambiSolver.resolveAmbiguity(gctx, std::move(resolveMe));
961  segmentCandidates.insert(segmentCandidates.end(),
962  std::make_move_iterator(resolvedSegments.begin()),
963  std::make_move_iterator(resolvedSegments.end()));
964  }
965  }

◆ retrieveContainer()

template<class ContainerType >
StatusCode MuonR4::SegmentFittingAlg::retrieveContainer ( const EventContext &  ctx,
const SG::ReadHandleKey< ContainerType > &  key,
const ContainerType *&  contToPush 
) const
private

Helper method to fetch data from StoreGate.

If the key is empty, a nullptr is assigned to the container ptr Failure is returned in cases, of non-empty keys and failed retrieval

Definition at line 137 of file SegmentFittingAlg.cxx.

139  {
140  contToPush = nullptr;
141  if (key.empty()) {
142  ATH_MSG_VERBOSE("No key has been parsed for object "<< typeid(ContainerType).name());
143  return StatusCode::SUCCESS;
144  }
145  SG::ReadHandle<ContainerType> readHandle{key, ctx};
146  ATH_CHECK(readHandle.isPresent());
147  contToPush = readHandle.cptr();
148  return StatusCode::SUCCESS;
149  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::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 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::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 InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ 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.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ visualizeFit()

void MuonR4::SegmentFittingAlg::visualizeFit ( const EventContext &  ctx,
const SegmentFitResult fitResult,
const SpacePointBucket bucket,
const std::string &  extraLabel,
std::vector< std::unique_ptr< TObject >>  primitives = {} 
) const
private

Definition at line 591 of file SegmentFittingAlg.cxx.

595  {
596 
597 
598  static std::mutex mutex{};
599  if(m_canvCounter >= m_nDrawCanvases) return;
600  std::lock_guard guard{mutex};
601  if(m_canvCounter >= m_nDrawCanvases) return;
602 
603 
604 
605  std::unordered_set<const SpacePoint*> usedSpacePoint{}, outliers{};
606  for (const HitVec::value_type& hit : fitResult.calibMeasurements) {
607  usedSpacePoint.insert(hit->spacePoint());
608  if (hit->fitState() != CalibratedSpacePoint::State::Valid) {
609  outliers.insert(hit->spacePoint());
610  }
611  }
612  const xAOD::MuonSegment* truthMatched{getTruthSegment(ctx, getTruthMatchedHits(*bucket))};
613  std::unordered_set<const xAOD::MuonSimHit*> truthSpHits{};
614  if (truthMatched) {
615  truthSpHits = getTruthMatchedHits(*truthMatched);
616  }
617  const auto [locPos, locDir] = fitResult.makeLine();
618 
619  ATH_MSG_VERBOSE("visualizeFit() -- segment "<<Amg::toString(locPos)<<", "<<Amg::toString(locDir)
620  <<", counter: "<<m_canvCounter<<", chi2: "<<fitResult.chi2<<", nDoF: "<<fitResult.nDoF<<", "
621  <<fitResult.chi2 /std::max(fitResult.nDoF, 1));
622 
625  Identifier refId{};
626  unsigned updated{0};
627  for (const SpacePointBucket::value_type& spInBucket : *bucket) {
628 
629  if (usedSpacePoint.count(spInBucket.get())) {
630  refId = m_idHelperSvc->chamberId(spInBucket->identify());
631  }
632  const Amg::Vector3D& hitPos{spInBucket->positionInChamber()};
633  if (refId == m_idHelperSvc->chamberId(spInBucket->identify())) {
634  yMin = std::min(yMin, hitPos.y());
635  yMax = std::max(yMax, hitPos.y());
636  zMax = std::max(zMax, hitPos.z());
637  zMin = std::min(zMin, hitPos.z());
638  ++updated;
639  }
640  switch (spInBucket->type()) {
642  auto circle = std::make_unique<TEllipse>(hitPos.y(), hitPos.z(), spInBucket->driftRadius());
643  if (truthSpHits.count(getTruthMatchedHit(*spInBucket->primaryMeasurement()))){
644  circle->SetFillColor(kOrange +1);
645  circle->SetLineColor(kOrange +1);
646  } else {
647  circle->SetFillColor(kBlue);
648  circle->SetLineColor(kBlue);
649  }
650 
651  circle->SetFillStyle(0);
652  circle->SetFillColorAlpha(circle->GetFillColor(), 0.8);
653  if (outliers.count(spInBucket.get())) {
654  circle->SetFillStyle(3344);
655  } else if (usedSpacePoint.count(spInBucket.get())) {
656  circle->SetFillStyle(1001);
657  }
658  primitives.insert(primitives.begin(), std::move(circle));
659  const auto* prd = static_cast<const xAOD::MdtDriftCircle*>(spInBucket->primaryMeasurement());
660  circle = std::make_unique<TEllipse>(hitPos.y(), hitPos.z(), prd->readoutElement()->innerTubeRadius());
661  circle->SetLineStyle(2);
662  circle->SetLineColor(kBlack);
663  primitives.insert(primitives.begin(), std::move(circle));
664  break;
666  const auto* prd = static_cast<const xAOD::RpcMeasurement*>(spInBucket->primaryMeasurement());
667  const double boxY = 0.5*std::sqrt(12)*spInBucket->uncertainty().y();
668  const double boxZ = 0.5*prd->readoutElement()->gasGapPitch();
669  auto stripBox = std::make_unique<TBox>(hitPos.y() - boxY, hitPos.z() - boxZ,
670  hitPos.y() + boxY, hitPos.z() + boxZ);
671  stripBox->SetFillColor(kGreen +2);
672  stripBox->SetLineColor(kGreen +2);
673  stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
674  stripBox->SetFillStyle(0);
675  if (outliers.count(spInBucket.get())) {
676  stripBox->SetFillStyle(3344);
677  } else if (usedSpacePoint.count(spInBucket.get())) {
678  stripBox->SetFillStyle(1001);
679  }
680  primitives.insert(primitives.begin(), std::move(stripBox));
681  break;
683  const auto* prd = static_cast<const xAOD::TgcStrip*>(spInBucket->primaryMeasurement());
684  const double boxY = 0.5*std::sqrt(12)*spInBucket->uncertainty().y();
685  const double boxZ = 0.5*prd->readoutElement()->gasGapPitch();
686  auto stripBox = std::make_unique<TBox>(hitPos.y() - boxY, hitPos.z() - boxZ,
687  hitPos.y() + boxY, hitPos.z() + boxZ);
688  stripBox->SetFillColor(kCyan +2);
689  stripBox->SetLineColor(kCyan +2);
690  stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
691  stripBox->SetFillStyle(0);
692  if (outliers.count(spInBucket.get())) {
693  stripBox->SetFillStyle(3344);
694  } else if (usedSpacePoint.count(spInBucket.get())) {
695  stripBox->SetFillStyle(1001);
696  }
697  primitives.insert(primitives.begin(), std::move(stripBox));
698  break;
699  } default:
700  continue;
701  }
702  }
703  if (updated < 2) {
704  --m_canvCounter;
705  return;
706  }
707  visualizeFitPhi(ctx, fitResult, bucket, extraLabel);
708 
709  auto myCanvas = std::make_unique<TCanvas>("can","can",800,600);
710  myCanvas->cd();
711 
712  double width = (yMax - yMin)*1.3;
713  double height = (zMax - zMin)*1.3;
714  if (height > width) width = height;
715  else height = width;
716 
717  const double midPointY = 0.5 * (yMax + yMin);
718  const double midPointZ = 0.5 * (zMax + zMin);
719  const double y0 = midPointY - 0.5 * width;
720  const double z0 = midPointZ - 0.5 * height;
721  const double y1 = midPointY + 0.5 * width;
722  const double z1 = midPointZ + 0.5 * height;
723  auto frame = myCanvas->DrawFrame(y0,z0,y1,z1);
724  frame->GetXaxis()->SetTitle("y [mm]");
725  frame->GetYaxis()->SetTitle("z [mm]");
726 
727  primitives.push_back(drawLine(fitResult.segmentPars, z0, z1, kRed));
728  if (truthMatched){
729  primitives.push_back(drawLine(truthPars(*truthMatched), z0, z1, kOrange + 1));
730  ATH_MSG_VERBOSE("Truth matched segment with parameters "<<toString(truthPars(*truthMatched)));
731  }
732 
733  {
734  std::stringstream legendLabel{};
735  legendLabel<<"Event: "<<ctx.eventID().event_number()<<", chamber : "<<m_idHelperSvc->toStringChamber(bucket->at(0)->identify())
736  <<" #chi^{2} /nDoF: "<<std::format("{:.2f}", fitResult.chi2/std::max(1, fitResult.nDoF))
737  <<", nDoF: "<<fitResult.nDoF;
738  if (!extraLabel.empty()) {
739  legendLabel<<" ("<<extraLabel<<")";
740  }
741  primitives.push_back(drawLabel(legendLabel.str(), 0.1, 0.96));
742  }
743  primitives.push_back(drawLabel(makeLabel(fitResult.segmentPars),0.25,0.91));
744 
745 
746  double legX{0.15};
747  double legY{0.8};
748  for (size_t ihit = 0; ihit < fitResult.calibMeasurements.size(); ++ihit) {
749  const HitVec::value_type& hit{fitResult.calibMeasurements[ihit]};
750  if (hit->type() == xAOD::UncalibMeasType::MdtDriftCircleType) {
751  std::stringstream legendstream{};
752  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
753  legendstream<<"ML: "<<idHelper.multilayer(hit->spacePoint()->identify());
754  legendstream<<", TL: "<<idHelper.tubeLayer(hit->spacePoint()->identify());
755  legendstream<<", T: "<<idHelper.tube(hit->spacePoint()->identify());
756  legendstream<<", #chi^{2}: "<<std::format("{:.2f}", fitResult.chi2PerMeasurement[ihit]);
757  legendstream<<", "<<(SegmentFitHelpers::driftSign(locPos, locDir, hit->spacePoint(), msgStream()) == -1 ? "L" : "R");
758  primitives.push_back(drawLabel(legendstream.str(), legX, legY, 14));
759  } else if (hit->type() == xAOD::UncalibMeasType::RpcStripType) {
760  std::stringstream legendstream{};
761  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
762  legendstream<<" DR: "<<idHelper.doubletR(hit->spacePoint()->identify());
763  legendstream<<" DZ: "<<idHelper.doubletZ(hit->spacePoint()->identify());
764  legendstream<<", GAP: "<<idHelper.gasGap(hit->spacePoint()->identify());
765  legendstream<<", #eta/#phi: "<<(hit->measuresEta() ? "si" : "nay")
766  << "/"<<(hit->measuresPhi() ? "si" : "nay");
767  legendstream<<", #chi^{2}: "<<std::format("{:.2f}",fitResult.chi2PerMeasurement[ihit]);
768  primitives.push_back(drawLabel(legendstream.str(), legX, legY, 14));
769  } else if (hit->type() == xAOD::UncalibMeasType::TgcStripType){
770  std::stringstream legendstream{};
771  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
772  legendstream<<"ST: "<<m_idHelperSvc ->stationNameString(hit->spacePoint()->identify());
773  legendstream<<", GAP: "<<idHelper.gasGap(hit->spacePoint()->identify());
774  legendstream<<", #eta/#phi: "<<(hit->measuresEta() ? "si" : "nay")
775  << "/"<<(hit->measuresPhi() ? "si" : "nay");
776  legendstream<<", #chi^{2}: "<<std::format("{:.2f}", fitResult.chi2PerMeasurement[ihit]);
777  primitives.push_back(drawLabel(legendstream.str(), legX, legY, 14));
778  } else {
779  continue;
780  }
781  legY-=0.05;
782  }
783  for (auto& drawMe: primitives) {
784  drawMe->Draw();
785  }
786  std::stringstream canvasName;
787  canvasName<<"SegmenFitDisplays_"<<ctx.eventID().event_number()<<"_"<<(m_canvCounter++)<<"E_"
788  <<m_idHelperSvc->stationNameString(refId)
789  <<std::abs(m_idHelperSvc->stationEta(refId))
790  <<(m_idHelperSvc->stationEta(refId) >0 ? "A" : "C")
791  <<m_idHelperSvc->stationPhi(refId);
792  if (!extraLabel.empty()) canvasName<<"_"<<removeNonAlphaNum(extraLabel);
793  canvasName<<".pdf";
794  myCanvas->SaveAs(canvasName.str().c_str());
795  myCanvas->SaveAs((m_allCanName+".pdf").c_str());
796  }

◆ visualizeFitPhi()

void MuonR4::SegmentFittingAlg::visualizeFitPhi ( const EventContext &  ctx,
const SegmentFitResult fitResult,
const SpacePointBucket bucket,
const std::string &  extraLabel 
) const
private

Definition at line 460 of file SegmentFittingAlg.cxx.

463  {
464 
465  std::vector<std::unique_ptr<TObject>> primitives{};
466 
467  std::unordered_set<const SpacePoint*> usedSpacePoint{}, outliers{};
468  for (const HitVec::value_type& hit : fitResult.calibMeasurements) {
469  usedSpacePoint.insert(hit->spacePoint());
470  if (hit->fitState() != CalibratedSpacePoint::State::Valid) {
471  outliers.insert(hit->spacePoint());
472  }
473  }
474  const xAOD::MuonSegment* truthMatched{getTruthSegment(ctx, getTruthMatchedHits(*bucket))};
475 
478 
479  Identifier refId{};
480  unsigned int updated{0};
481  for (const SpacePointBucket::value_type& spInBucket : *bucket) {
482  if (!spInBucket->measuresPhi()) {
483  continue;
484  }
485  if (usedSpacePoint.count(spInBucket.get())) {
486  refId = m_idHelperSvc->chamberId(spInBucket->identify());
487  }
488  const Amg::Vector3D& hitPos{spInBucket->positionInChamber()};
489  if (refId == m_idHelperSvc->chamberId(spInBucket->identify())) {
490  xMin = std::min(xMin, hitPos.x());
491  xMax = std::max(xMax, hitPos.x());
492  zMax = std::max(zMax, hitPos.z());
493  zMin = std::min(zMin, hitPos.z());
494  ++updated;
495  }
496  switch (spInBucket->type()) {
498  const auto* prd = static_cast<const xAOD::RpcMeasurement*>(spInBucket->primaryMeasurement());
499  const double boxX = 0.5*std::sqrt(12)*spInBucket->uncertainty().x();
500  const double boxZ = 0.5*prd->readoutElement()->gasGapPitch();
501  auto stripBox = std::make_unique<TBox>(hitPos.x() - boxX, hitPos.z() - boxZ,
502  hitPos.x() + boxX, hitPos.z() + boxZ);
503  stripBox->SetFillColor(kGreen +2);
504  stripBox->SetLineColor(kGreen +2);
505  stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
506  stripBox->SetFillStyle(0);
507  if (outliers.count(spInBucket.get())) {
508  stripBox->SetFillStyle(3344);
509  }else if (usedSpacePoint.count(spInBucket.get())) {
510  stripBox->SetFillStyle(1001);
511  }
512  primitives.insert(primitives.begin(), std::move(stripBox));
513  break;
515  const auto* prd = static_cast<const xAOD::TgcStrip*>(spInBucket->primaryMeasurement());
516  const double boxX = 0.5*std::sqrt(12)*spInBucket->uncertainty().x();
517  const double boxZ = 0.5*prd->readoutElement()->gasGapPitch();
518  auto stripBox = std::make_unique<TBox>(hitPos.x() - boxX, hitPos.z() - boxZ,
519  hitPos.x() + boxX, hitPos.z() + boxZ);
520  stripBox->SetFillColor(kCyan +2);
521  stripBox->SetLineColor(kCyan +2);
522  stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
523  stripBox->SetFillStyle(0);
524  if (outliers.count(spInBucket.get())) {
525  stripBox->SetFillStyle(3344);
526  } else if (usedSpacePoint.count(spInBucket.get())) {
527  stripBox->SetFillStyle(1001);
528  }
529  primitives.insert(primitives.begin(), std::move(stripBox));
530  break;
531  } default:
532  continue;
533  }
534  }
535  if (updated < 2) {
536  return;
537  }
538 
539  auto myCanvas = std::make_unique<TCanvas>("can","can",800,600);
540  myCanvas->cd();
541 
542  double width = std::max(10. *Gaudi::Units::cm ,(xMax - xMin)*1.3);
543  double height = std::max(10. *Gaudi::Units::cm ,(zMax - zMin)*1.3);
544  if (height > width) width = height;
545  else height = width;
546 
547  const double midPointX = 0.5 * (xMax + xMin);
548  const double midPointZ = 0.5 * (zMax + zMin);
549  const double x0 = midPointX - 0.5 * width;
550  const double z0 = midPointZ - 0.5 * height;
551  const double x1 = midPointX + 0.5 * width;
552  const double z1 = midPointZ + 0.5 * height;
553  auto frame = myCanvas->DrawFrame(x0,z0,x1,z1);
554  frame->GetXaxis()->SetTitle("x [mm]");
555  frame->GetYaxis()->SetTitle("z [mm]");
556 
557  primitives.push_back(drawLine(fitResult.segmentPars, z0, z1, kRed, toInt(AxisDefs::phi)));
558 
559  if (truthMatched){
560  primitives.push_back(drawLine(truthPars(*truthMatched), z0, z1, kOrange + 1, toInt(AxisDefs::phi)));
561  ATH_MSG_VERBOSE("Truth matched segment with parameters "<<toString(truthPars(*truthMatched)));
562  }
563 
564  {
565  std::stringstream legendLabel{};
566  legendLabel<<"Event: "<<ctx.eventID().event_number()<<", chamber : "<<m_idHelperSvc->toStringChamber(bucket->at(0)->identify())
567  <<" #chi^{2} /nDoF: "<<std::format("{:.2f}", fitResult.chi2/std::max(1, fitResult.nDoF))
568  <<", nDoF: "<<fitResult.nDoF;
569  if (!extraLabel.empty()) {
570  legendLabel<<" ("<<extraLabel<<")";
571  }
572  primitives.push_back(drawLabel(legendLabel.str(), 0.1, 0.96));
573  }
574  primitives.push_back(drawLabel(makeLabel(fitResult.segmentPars),0.25,0.91));
575 
576  for (auto& drawMe: primitives) {
577  drawMe->Draw();
578  }
579  std::stringstream canvasName;
580  canvasName<<"SegmenFitDisplays_"<<ctx.eventID().event_number()<<"_"<<(m_canvCounter)<<"P_"
581  <<m_idHelperSvc->stationNameString(refId)
582  <<std::abs(m_idHelperSvc->stationEta(refId))
583  <<(m_idHelperSvc->stationEta(refId) >0 ? "A" : "C")
584  <<m_idHelperSvc->stationPhi(refId);
585  if (!extraLabel.empty()) canvasName<<"_"<<removeNonAlphaNum(extraLabel);
586  canvasName<<".pdf";
587  myCanvas->SaveAs(canvasName.str().c_str());
588  myCanvas->SaveAs((m_allCanName+".pdf").c_str());
589 
590  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic<unsigned int> m_canvCounter MuonR4::SegmentFittingAlg::ATLAS_THREAD_SAFE {0}
mutableprivate

Definition at line 158 of file SegmentFittingAlg.h.

◆ m_allCan

std::unique_ptr<TCanvas> MuonR4::SegmentFittingAlg::m_allCan {}
private

Definition at line 156 of file SegmentFittingAlg.h.

◆ m_allCanName

Gaudi::Property<std::string> MuonR4::SegmentFittingAlg::m_allCanName {this, "AllCanName", "AllSegmentFits"}
private

Definition at line 157 of file SegmentFittingAlg.h.

◆ m_beamSpotL

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotL {this, "BeamSpotLength", 20. * Gaudi::Units::m}
private

Definition at line 144 of file SegmentFittingAlg.h.

◆ m_beamSpotR

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm}
private

Definition at line 143 of file SegmentFittingAlg.h.

◆ m_calibTool

ToolHandle<ISpacePointCalibrator> MuonR4::SegmentFittingAlg::m_calibTool {this, "Calibrator", "" }
private

Definition at line 135 of file SegmentFittingAlg.h.

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonR4::SegmentFittingAlg::m_detMgr {nullptr}
private

Definition at line 162 of file SegmentFittingAlg.h.

◆ 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_doBeamspotConstraint

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doBeamspotConstraint {this, "doBeamspotConstraint", false}
private

Add beamline constraint.

Definition at line 142 of file SegmentFittingAlg.h.

◆ m_doT0Fit

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doT0Fit {this, "fitSegmentT0", true}
private

Definition at line 140 of file SegmentFittingAlg.h.

◆ 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 AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

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

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_geoCtxKey

SG::ReadHandleKey<ActsGeometryContext> MuonR4::SegmentFittingAlg::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
private

Definition at line 130 of file SegmentFittingAlg.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::SegmentFittingAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 132 of file SegmentFittingAlg.h.

◆ m_nDrawCanvases

Gaudi::Property<unsigned int> MuonR4::SegmentFittingAlg::m_nDrawCanvases {this, "MaxCanvases", 5000}
private

Draw maximally 5000 segment fit visualizations.

Definition at line 160 of file SegmentFittingAlg.h.

◆ m_outlierRemovalCut

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_outlierRemovalCut {this, "OutlierRemoval", 5.}
private

Cut on the segment chi2 / nDoF to launch the outlier removal.

Definition at line 152 of file SegmentFittingAlg.h.

◆ m_outSegments

SG::WriteHandleKey<SegmentContainer> MuonR4::SegmentFittingAlg::m_outSegments {this, "MuonSegmentContainer", "R4MuonSegments"}
private

Definition at line 127 of file SegmentFittingAlg.h.

◆ m_recoveryPull

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_recoveryPull {this, "RecoveryPull", 5.}
private

Definition at line 153 of file SegmentFittingAlg.h.

◆ m_seedHitChi2

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. }
private

Definition at line 150 of file SegmentFittingAlg.h.

◆ m_seedKey

SG::ReadHandleKey<SegmentSeedContainer> MuonR4::SegmentFittingAlg::m_seedKey {this, "ReadKey", "MuonHoughStationSegmentSeeds"}
private

ReadHandle of the seeds.

Definition at line 122 of file SegmentFittingAlg.h.

◆ m_seedTanThetaReso

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedTanThetaReso {this, "ResoSeedTanTheta", 250. * Gaudi::Units::mrad}
private

Two mdt seeds are the same if their defining parameters match wihin.

Definition at line 148 of file SegmentFittingAlg.h.

◆ m_seedY0Reso

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedY0Reso {this, "ResoSeedY0", 500.*Gaudi::Units::micrometer}
private

Definition at line 149 of file SegmentFittingAlg.h.

◆ m_truthSegKey

SG::ReadHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentFittingAlg::m_truthSegKey {this, "TruthSegKey", "TruthSegmentsR4"}
private

ReadHandle for the truth segments (For validation purposes)

Definition at line 124 of file SegmentFittingAlg.h.

◆ m_useMinuit

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_useMinuit {this, "useMinuit", false}
private

Toggle the fitter.

Definition at line 138 of file SegmentFittingAlg.h.

◆ 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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonR4::inv_c
constexpr double inv_c
Definition: SegmentFittingAlg.cxx:42
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
xAOD::MuonSimHit_v1
Definition: MuonSimHit_v1.h:18
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
MuonR4::SegmentFittingAlg::m_outlierRemovalCut
Gaudi::Property< double > m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
Definition: SegmentFittingAlg.h:152
MuonR4::SegmentFittingAlg::m_outSegments
SG::WriteHandleKey< SegmentContainer > m_outSegments
Definition: SegmentFittingAlg.h:127
xAOD::RpcMeasurement_v1
RpcMeasurement_v1: Class storing the geneic.
Definition: RpcMeasurement_v1.h:21
xAOD::RpcMeasurement_v1::readoutElement
const MuonGMR4::RpcReadoutElement * readoutElement() const
Retrieve the associated RpcReadoutElement.
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
vtune_athena.format
format
Definition: vtune_athena.py:14
MuonR4::SegmentFittingAlg::m_recoveryPull
Gaudi::Property< double > m_recoveryPull
Definition: SegmentFittingAlg.h:153
MuonR4::SegmentFittingAlg::m_beamSpotL
Gaudi::Property< double > m_beamSpotL
Definition: SegmentFittingAlg.h:144
MuonR4::SegmentFitHelpers::postFitChi2PerMas
std::pair< std::vector< double >, double > postFitChi2PerMas(const SegmentFit::Parameters &segPars, std::optional< double > arrivalTime, std::vector< std::unique_ptr< CalibratedSpacePoint >> &hits, MsgStream &msg)
Calculates the chi2 per measurement and the chi2 itself after the fit is finished.
Definition: SegmentFitHelperFunctions.cxx:251
MuonR4::getTruthMatchedHits
std::unordered_set< const xAOD::MuonSimHit * > getTruthMatchedHits(const xAOD::MuonSegment &segment)
: Returns all truth hits matched to a xAOD::MuonSegment
Definition: MuonSimHitHelpers.cxx:24
MuonR4::removeNonAlphaNum
std::string removeNonAlphaNum(std::string str)
Definition: SegmentFittingAlg.cxx:82
MuonR4::SegmentFittingAlg::m_seedY0Reso
Gaudi::Property< double > m_seedY0Reso
Definition: SegmentFittingAlg.h:149
MuonR4::SegmentFittingAlg::eraseWrongHits
void eraseWrongHits(const ActsGeometryContext &gctx, SegmentFitResult &candidate) const
Removes all hits from the segment which are obvious outliers.
Definition: SegmentFittingAlg.cxx:918
MuonR4::SegmentFittingAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: SegmentFittingAlg.h:162
TgcIdHelper
Definition: TgcIdHelper.h:50
calibdata.chamber
chamber
Definition: calibdata.py:32
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
MuonR4::SegmentFittingAlg::fitSegmentHits
SegmentFitResult fitSegmentHits(const EventContext &ctx, const ActsGeometryContext &gctx, const Parameters &startPars, SegmentFitResult::HitVec &&calibHits) const
Executes the segment fit with start parameters.
Definition: SegmentFittingAlg.cxx:182
xAOD::TgcStrip_v1
Definition: TgcStrip_v1.h:19
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
MuonR4::SegmentFittingAlg::m_useMinuit
Gaudi::Property< bool > m_useMinuit
Toggle the fitter.
Definition: SegmentFittingAlg.h:138
MuonR4::SegmentFittingAlg::m_beamSpotR
Gaudi::Property< double > m_beamSpotR
Definition: SegmentFittingAlg.h:143
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
deg
#define deg
Definition: SbPolyhedron.cxx:17
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
MuonR4::SegmentFittingAlg::HitVec
SegmentFitResult::HitVec HitVec
Definition: SegmentFittingAlg.h:50
MuonR4::SegmentFittingAlg::m_doT0Fit
Gaudi::Property< bool > m_doT0Fit
Definition: SegmentFittingAlg.h:140
MuonR4::CalibratedSpacePoint::State::Outlier
@ Outlier
MuonR4::drawLabel
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, unsigned int fontSize=18)
Definition: SegmentFittingAlg.cxx:59
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonGMR4::MuonChamber
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonChamber.h:42
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
MuonR4::SegmentFittingAlg::resolveAmbiguities
void resolveAmbiguities(const ActsGeometryContext &gctx, std::vector< std::unique_ptr< Segment >> &segmentCandidates) const
Definition: SegmentFittingAlg.cxx:947
MuonR4::SegmentFit::makeLine
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
Definition: SegmentFitterEventData.cxx:22
MuonR4::toString
std::string toString(const CalibratedSpacePoint::Covariance_t &mat)
Returns the matrix in string.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:74
RpcIdHelper
Definition: RpcIdHelper.h:51
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuonR4::SegmentFit::ParamDefs::phi
@ phi
MuonR4::SegmentFittingAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: SegmentFittingAlg.h:132
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
SpacePoint
Definition: Trigger/TrigAccel/TrigCudaFitter/src/SpacePoint.h:7
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
MuonR4::SegmentFittingAlg::m_calibTool
ToolHandle< ISpacePointCalibrator > m_calibTool
Definition: SegmentFittingAlg.h:135
MuonR4::SegmentFit::AxisDefs::phi
@ phi
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonR4::copy
MuonR4::SegmentFitResult::HitVec copy(const MuonR4::SegmentFitResult::HitVec &hits)
Definition: SegmentFittingAlg.cxx:67
MuonR4::drawLine
std::unique_ptr< TLine > drawLine(const MuonR4::SegmentFit::Parameters &pars, const double z1=300.*Gaudi::Units::mm, const double z2=-300.*Gaudi::Units::mm, const int color=kViolet, unsigned int coord=toInt(AxisDefs::eta))
Definition: SegmentFittingAlg.cxx:44
MuonR4::SegmentFittingAlg::fitSegmentSeed
std::vector< std::unique_ptr< Segment > > fitSegmentSeed(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed *seed) const
Definition: SegmentFittingAlg.cxx:305
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
MuonR4::SegmentFittingAlg::m_truthSegKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegKey
ReadHandle for the truth segments (For validation purposes)
Definition: SegmentFittingAlg.h:124
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonR4::SegmentFittingAlg::plugHoles
bool plugHoles(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &toRecover) const
Recovery of missed hits.
Definition: SegmentFittingAlg.cxx:798
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
MuonR4::SegmentFittingAlg::m_seedHitChi2
Gaudi::Property< double > m_seedHitChi2
Definition: SegmentFittingAlg.h:150
MuonR4::SegmentFittingAlg::removeOutliers
bool removeOutliers(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &fitResult) const
Spot hits with large discrepancy from the estimated parameters and remove them from the list.
Definition: SegmentFittingAlg.cxx:404
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
dumpNswErrorDb.linear
def linear
Definition: dumpNswErrorDb.py:23
MdtIdHelper
Definition: MdtIdHelper.h:61
MuonR4::truthPars
Parameters truthPars(const xAOD::MuonSegment &truthSeg)
Definition: SegmentFittingAlg.cxx:86
xAOD::Other
@ Other
python.StandardJetMods.pull
pull
Definition: StandardJetMods.py:282
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonGMR4::TgcReadoutElement::gasGapPitch
double gasGapPitch() const
Returns the thickness of the gasGap.
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
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
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
MuonR4::removeBeamSpot
bool removeBeamSpot(MuonR4::SegmentFitResult::HitVec &hits)
Definition: SegmentFittingAlg.cxx:74
MuonR4::SegmentFit::ParamDefs::x0
@ x0
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::TgcStrip_v1::readoutElement
const MuonGMR4::TgcReadoutElement * readoutElement() const
Retrieve the associated TgcReadoutElement.
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
MuonR4::SegmentFittingAlg::getTruthSegment
const xAOD::MuonSegment * getTruthSegment(const EventContext &ctx, const std::unordered_set< const xAOD::MuonSimHit * > &matchedSeedHits) const
Definition: SegmentFittingAlg.cxx:151
MuonR4::SegmentFit::ParamDefs::time
@ time
min
#define min(a, b)
Definition: cfImp.cxx:40
MuonR4::CalibratedSpacePoint::State::Valid
@ Valid
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
MuonR4::SegmentFit::ParamDefs::y0
@ y0
MuonR4::SegmentFittingAlg::m_doBeamspotConstraint
Gaudi::Property< bool > m_doBeamspotConstraint
Add beamline constraint.
Definition: SegmentFittingAlg.h:142
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonR4::SegmentFittingAlg::m_seedKey
SG::ReadHandleKey< SegmentSeedContainer > m_seedKey
ReadHandle of the seeds.
Definition: SegmentFittingAlg.h:122
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MuonR4::SegmentFit::toInt
constexpr int toInt(const ParamDefs p)
Definition: MuonHoughDefs.h:42
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
MuonR4::SegmentFitHelpers::driftSign
int driftSign(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &uncalibHit, MsgStream &msg)
Calculates whether a segement line travereses the tube measurement on the left (-1) or right (1) side...
Definition: SegmentFitHelperFunctions.cxx:222
MuonR4::SegmentFittingAlg::m_allCanName
Gaudi::Property< std::string > m_allCanName
Definition: SegmentFittingAlg.h:157
MuonR4::SegmentSeedContainer
DataVector< SegmentSeed > SegmentSeedContainer
Definition: MuonPatternContainer.h:15
MuonR4::SegmentFittingAlg::retrieveContainer
StatusCode retrieveContainer(const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const
Helper method to fetch data from StoreGate.
Definition: SegmentFittingAlg.cxx:137
Amg::lineDistance
double lineDistance(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the shortest distance between two lines posA: offset point of line A dirA: orientation of ...
Definition: GeoPrimitivesHelpers.h:303
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.copyTCTOutput.locDir
locDir
Definition: copyTCTOutput.py:113
PlotSFuncertainty.calib
calib
Definition: PlotSFuncertainty.py:110
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
MuonR4::SegmentVec
SegmentAmbiSolver::SegmentVec SegmentVec
Definition: SegmentAmbiSolver.cxx:9
MuonR4::SegmentFittingAlg::m_allCan
std::unique_ptr< TCanvas > m_allCan
Definition: SegmentFittingAlg.h:156
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonR4::SegmentFittingAlg::m_seedTanThetaReso
Gaudi::Property< double > m_seedTanThetaReso
Two mdt seeds are the same if their defining parameters match wihin.
Definition: SegmentFittingAlg.h:148
MuonR4::SegmentFitHelpers::chiSqTerm
double chiSqTerm(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated measurement.
Definition: SegmentFitHelperFunctions.cxx:27
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
MuonR4::SegmentFit::makeLabel
std::string makeLabel(const Parameters &pars)
Definition: SegmentFitterEventData.cxx:28
MuonR4::getTruthMatchedHit
const xAOD::MuonSimHit * getTruthMatchedHit(const xAOD::UncalibratedMeasurement &prdHit)
Returns the MuonSimHit, if there's any, matched to the uncalibrated muon measurement.
Definition: MuonSimHitHelpers.cxx:13
python.BuildSignatureFlags.beamSpot
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
Definition: BuildSignatureFlags.py:432
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
MuonR4::SegmentFittingAlg::visualizeFit
void visualizeFit(const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel, std::vector< std::unique_ptr< TObject >> primitives={}) const
Definition: SegmentFittingAlg.cxx:591
MuonR4::SegmentFittingAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SegmentFittingAlg.h:130
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
MuonR4::SegmentFittingAlg::m_nDrawCanvases
Gaudi::Property< unsigned int > m_nDrawCanvases
Draw maximally 5000 segment fit visualizations.
Definition: SegmentFittingAlg.h:160
MuonR4::AmgSymMatrix
const AmgSymMatrix(2) &SpacePoint
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:147
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
MuonR4::SegmentFittingAlg::visualizeFitPhi
void visualizeFitPhi(const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel) const
Definition: SegmentFittingAlg.cxx:460
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
MuonR4::SegmentFitHelpers::chiSqTermMdt
double chiSqTermMdt(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated Mdt measurement.
Definition: SegmentFitHelperFunctions.cxx:49
MuonR4::SegmentFit::ParamDefs::theta
@ theta
fitman.k
k
Definition: fitman.py:528
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
ServiceHandle< ICondSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
MuonGMR4::RpcReadoutElement::gasGapPitch
double gasGapPitch() const
Returns the thickness of a RPC gasgap.
Identifier
Definition: IdentifierFieldParser.cxx:14