ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MuonR4::MdtSegmentSeedGenerator Class Reference

Helper class to generate valid seeds for the segment fit. More...

#include <MdtSegmentSeedGenerator.h>

Inheritance diagram for MuonR4::MdtSegmentSeedGenerator:
Collaboration diagram for MuonR4::MdtSegmentSeedGenerator:

Classes

struct  Config
 Configuration switches of the module
More...
 
struct  DriftCircleSeed
 Helper struct from a generated Mdt seed. More...
 
struct  SeedFitAuxilliaries
 Auxillary struct to calculate fit constants. More...
 
struct  SeedFitAuxWithT0
 
struct  SeedSolution
 Cache of all solutions seen thus far. More...
 

Public Types

using HitVec = SpacePointPerLayerSplitter::HitVec
 

Public Member Functions

 MdtSegmentSeedGenerator (const std::string &name, const SegmentSeed *segmentSeed, const Config &configuration)
 Standard constructor taking the segmentSeed to start with and then few configuration tunes. More...
 
 ~MdtSegmentSeedGenerator ()
 
std::optional< DriftCircleSeednextSeed (const EventContext &ctx)
 returns the next seed in the row More...
 
unsigned int numGenerated () const
 Returns how many seeds have been generated. More...
 
const Configconfig () const
 Returns the current seed configuration. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Types

using SignComboType = std::array< int, 2 >
 Sign combinations to draw the 4 lines tangent to 2 drift circles The first two are indicating whether the tangent is left/right to the first/second circle. More...
 

Private Member Functions

std::optional< DriftCircleSeedbuildSeed (const EventContext &ctx, const HoughHitType &topHit, const HoughHitType &bottomHit, const SignComboType &signs)
 Tries to build the seed from the two hits. More...
 
SeedFitAuxilliaries estimateAuxillaries (const DriftCircleSeed &seed) const
 Helper function to estimate the auxillary variables that remain constant during the fit. More...
 
SeedFitAuxWithT0 estimateAuxillaries (const EventContext &ctx, const DriftCircleSeed &seed) const
 Helper function to estimate the auxillary variables that remain constants during the fit with t0. More...
 
void fitDriftCircles (DriftCircleSeed &seed) const
 Refine the seed by performing a fast Mdt segment fit. More...
 
void fitDriftCirclesWithT0 (const EventContext &ctx, DriftCircleSeed &seed) const
 Refine the seed by performing a fast Mdt segment fit with t0 constraint. More...
 
void moveToNextCandidate ()
 Prepares the generator to generate the seed from the next pair of drift circles. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

Config m_cfg {}
 
const SegmentSeedm_segmentSeed {nullptr}
 
SpacePointPerLayerSplitter m_hitLayers {m_segmentSeed->getHitsInMax()}
 
std::size_t m_upperLayer {0}
 Considered layer to pick the top drift circle from. More...
 
std::size_t m_lowerLayer {0}
 Considered layer to pick the bottom drift circle from. More...
 
std::size_t m_lowerHitIndex {0}
 Explicit hit to pick in the selected bottom layer. More...
 
std::size_t m_upperHitIndex {0}
 Explicit hit to pick in the selected top layer. More...
 
std::size_t m_signComboIndex {0}
 Index of the left-right ambiguity between the circles. More...
 
std::vector< SeedSolutionm_seenSolutions {}
 Vector caching equivalent solutions to avoid double seeding. More...
 
unsigned int m_nGenSeeds {0}
 Counter on how many seeds have been generated. More...
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Static Private Attributes

constexpr static std::array< SignComboType, 4 > s_signCombos
 

Detailed Description

Helper class to generate valid seeds for the segment fit.

The generator first returns a seed directly made from the patten recogntion. Afterwards it builds seeds by lying tangent lines to a pair of drift circles. The pairing starts from the innermost & outermost layers with tubes. A valid seed must have at least 4 associated hits which are within a chi2 of 5. If two seeds within the parameter resolution are generated, then the latter one is skipped.

Definition at line 24 of file MdtSegmentSeedGenerator.h.

Member Typedef Documentation

◆ HitVec

Definition at line 26 of file MdtSegmentSeedGenerator.h.

◆ SignComboType

using MuonR4::MdtSegmentSeedGenerator::SignComboType = std::array<int, 2>
private

Sign combinations to draw the 4 lines tangent to 2 drift circles The first two are indicating whether the tangent is left/right to the first/second circle.

The last sign is picking the sign of the solution arising from the final quadratic equation.

Definition at line 101 of file MdtSegmentSeedGenerator.h.

Constructor & Destructor Documentation

◆ MdtSegmentSeedGenerator()

MuonR4::MdtSegmentSeedGenerator::MdtSegmentSeedGenerator ( const std::string &  name,
const SegmentSeed segmentSeed,
const Config configuration 
)

Standard constructor taking the segmentSeed to start with and then few configuration tunes.

Parameters
nameName of the Seed generator's logger
segmentSeedSeed from which the seeds for the fit are built
configurationPassed configuration settings of the generator

Check whether the first layer is too busy

Check whether the lower layer is too busy

Definition at line 48 of file MdtSegmentSeedGenerator.cxx.

50  :
52  m_cfg{configuration},
53  m_segmentSeed{segmentSeed} {
54 
55  if (m_hitLayers.mdtHits().empty()) return;
56 
57  if (std::ranges::find_if(m_hitLayers.mdtHits(), [this](const HitVec& vec){
58  return vec.size() > m_cfg.busyLayerLimit;
59  }) != m_hitLayers.mdtHits().end()) {
60  m_cfg.startWithPattern = false;
61  }
62  // Set the start for the upper layer
63  m_upperLayer = m_hitLayers.mdtHits().size()-1;
64 
67  ++m_lowerLayer;
68  }
71  --m_upperLayer;
72  }
73 
74  if (msgLvl(MSG::VERBOSE)) {
75  std::stringstream sstr{};
76  for (const auto [layCount, layer] : Acts::enumerate(m_hitLayers.mdtHits())) {
77  sstr<<"Mdt-hits in layer "<<layCount<<": "<<layer.size()<<std::endl;
78  for (const HoughHitType& hit : layer) {
79  sstr<<" **** "<<hit->msSector()->idHelperSvc()->toString(hit->identify())<<" "
80  <<Amg::toString(hit->positionInChamber())<<", driftRadius: "<<hit->driftRadius()<<std::endl;
81  }
82  }
83  for (const auto [layCount, layer] : Acts::enumerate(m_hitLayers.stripHits())) {
84  sstr<<"Hits in layer "<<layCount<<": "<<layer.size()<<std::endl;
85  for (const HoughHitType& hit : layer) {
86  sstr<<" **** "<<hit->msSector()->idHelperSvc()->toString(hit->identify())<<" "
87  <<Amg::toString(hit->positionInChamber())<<", driftRadius: "<<hit->driftRadius()<<std::endl;
88  }
89  }
90  ATH_MSG_VERBOSE("SeedGenerator - sorting of hits done. Mdt layers: "<<m_hitLayers.mdtHits().size()
91  <<", strip layers: "<<m_hitLayers.stripHits().size()<<std::endl<<sstr.str()<<std::endl<<std::endl);
92  }
93  }

◆ ~MdtSegmentSeedGenerator()

MuonR4::MdtSegmentSeedGenerator::~MdtSegmentSeedGenerator ( )
default

Member Function Documentation

◆ buildSeed()

std::optional< MdtSegmentSeedGenerator::DriftCircleSeed > MuonR4::MdtSegmentSeedGenerator::buildSeed ( const EventContext &  ctx,
const HoughHitType topHit,
const HoughHitType bottomHit,
const SignComboType signs 
)
private

Tries to build the seed from the two hits.

Fails if the solution is invalid or if the seed has already been built before

Parameters
topHitHit candidate from the upper layer
bottomHitHit candidate from the lower layer
signObject encoding whether the tangent is left / right

All other sign combinations will also get stuck -> force the measurement selector to get another combo

Create a new line position & direction which also takes the potential phi estimates into account

Recalculate the seed with the calibrated parameters

Check that the is within the predefined window

d/dx asin(x) = 1 / sqrt(1- x*x)

Collect all hits close to the seed line

what ever comes after is not matching onto the segment

Reject seeds with too litle Mdt hit association

Last check wheather another seed with the same left-right combination hasn't already been found

All seed hits are of the same size

Including the places where no seed hit was assigned. Both solutions match in terms of left-right solutions. It's very likely that they're converging to the same segment.

Seed candidate is

Add the solution to the list. That we don't iterate twice over it

If we found a long Mdt seed, then ensure that all subsequent seeds have at least the same amount of Mdt hits.

Associate strip hits

Add all hits with a pull better than the threshold

Definition at line 179 of file MdtSegmentSeedGenerator.cxx.

182  {
183 
184  const auto* bottomPrd = static_cast<const xAOD::MdtDriftCircle*>(bottomHit->primaryMeasurement());
185  const auto* topPrd = static_cast<const xAOD::MdtDriftCircle*>(topHit->primaryMeasurement());
186 
187  const Muon::IMuonIdHelperSvc* idHelperSvc{topHit->msSector()->idHelperSvc()};
192  return std::nullopt;
193  }
194  const auto&[signTop, signBot] = signs;
195  double R = signBot *bottomHit->driftRadius() - signTop * topHit->driftRadius();
196  const Amg::Vector3D& bottomPos{bottomHit->positionInChamber()};
197  const Amg::Vector3D& topPos{topHit->positionInChamber()};
198 
199  const Amg::Vector3D D = topPos - bottomPos;
200  const double thetaTubes = std::atan2(D.y(), D.z());
201  const double distTubes = std::hypot(D.y(), D.z());
202  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Bottom tube "<<idHelperSvc->toString(bottomHit->identify())<<" "<<Amg::toString(bottomPos)
203  <<", driftRadius: "<<bottomHit->driftRadius()<<" - top tube "<<idHelperSvc->toString(topHit->identify())
204  <<" "<<Amg::toString(topPos)<<", driftRadius: "<<topHit->driftRadius()
205  <<", tube distance: "<<Amg::toString(D));
206 
207  DriftCircleSeed candidateSeed{};
208  candidateSeed.parameters = m_segmentSeed->parameters();
209  candidateSeed.parentBucket = m_segmentSeed->parentBucket();
210  double theta{thetaTubes - std::asin(std::clamp(R / distTubes, -1., 1.))};
211  Amg::Vector3D seedDir = Amg::dirFromAngles(90.*Gaudi::Units::deg, theta);
212  double Y0 = bottomPos.y()*seedDir.z() - bottomPos.z()*seedDir.y() + signBot*bottomHit->driftRadius();
213  double combDriftUncert{std::sqrt(bottomPrd->driftRadiusCov() + topPrd->driftRadiusCov())};
214  std::unique_ptr<CalibratedSpacePoint> calibBottom{}, calibTop{};
216  candidateSeed.parameters[toInt(ParamDefs::theta)] = theta;
217  candidateSeed.parameters[toInt(ParamDefs::y0)] = Y0 / seedDir.z();
220  const auto [linePos, lineDir] = makeLine(candidateSeed.parameters);
221  calibBottom = m_cfg.calibrator->calibrate(ctx, bottomHit, linePos, lineDir,
222  candidateSeed.parameters[toInt(ParamDefs::time)]);
223  calibTop = m_cfg.calibrator->calibrate(ctx, topHit, linePos, lineDir,
224  candidateSeed.parameters[toInt(ParamDefs::time)]);
225  R = signBot * calibBottom->driftRadius() - signTop * calibTop->driftRadius();
227  theta = thetaTubes - std::asin(std::clamp(R / distTubes, -1., 1.));
228  seedDir = Amg::dirFromAngles(90.*Gaudi::Units::deg, theta);
229  Y0 = bottomPos.y()*seedDir.z() - bottomPos.z()*seedDir.y() + signBot*bottomHit->driftRadius();
230  combDriftUncert = std::sqrt(driftCov(*calibBottom) + driftCov(*calibTop));
231  }
232 
233  candidateSeed.parameters[toInt(ParamDefs::theta)] = theta;
234  candidateSeed.parameters[toInt(ParamDefs::y0)] = Y0 / seedDir.z();
236  if (!passRangeCut(m_cfg.thetaRange, theta) ||
237  !passRangeCut(m_cfg.interceptRange, candidateSeed.parameters[toInt(ParamDefs::y0)])) {
238  return std::nullopt;
239  }
240 
241  const Amg::Vector3D seedPos = Y0 / seedDir.z() * Amg::Vector3D::UnitY();
242 
243  assert(std::abs(topPos.y()*seedDir.z() - topPos.z() * seedDir.y() + signTop*topHit->driftRadius() - Y0) < std::numeric_limits<float>::epsilon() );
244  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Candidate seed theta: "<<theta<<", tanTheta: "<<(seedDir.y() / seedDir.z())<<", y0: "<<Y0/seedDir.z());
245 
246  SeedSolution solCandidate{};
247  solCandidate.Y0 = seedPos[toInt(ParamDefs::y0)];
248  solCandidate.theta = theta;
250  const double denomSquare = 1. - std::pow(R / distTubes, 2);
251  if (denomSquare < std::numeric_limits<double>::epsilon()){
252  ATH_MSG_VERBOSE("Invalid seed, rejecting");
253  return std::nullopt;
254  }
255  solCandidate.dTheta = combDriftUncert / std::sqrt(denomSquare) / distTubes;
256  solCandidate.dY0 = std::hypot(-bottomPos.y()*seedDir.y() + bottomPos.z()*seedDir.z(), 1.) * solCandidate.dTheta;
257  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Test new "<<solCandidate<<". "<<m_seenSolutions.size());
258 
259 
260  if (std::ranges::find_if(m_seenSolutions,
261  [&solCandidate, this] (const SeedSolution& seen) {
262  const double deltaY = std::abs(seen.Y0 - solCandidate.Y0);
263  const double limitY = std::hypot(seen.dY0, solCandidate.dY0);
264  const double dTheta = std::abs(seen.theta - solCandidate.theta);
265  const double limitTh = std::hypot(seen.dTheta, solCandidate.dTheta);
266  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": "<<seen
267  <<std::format(" delta Y: {:.2f} {:} {:.2f}", deltaY, deltaY < limitY ? '<' : '>', limitY)
268  <<std::format(" delta theta: {:.2f} {:} {:.2f}", dTheta, dTheta < limitTh ? '<' : '>', limitTh) );
269  return deltaY < limitY && dTheta < limitTh;;
270  }) != m_seenSolutions.end()){
271  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Reject due to similarity");
272  return std::nullopt;
273  }
275  for (const auto [layerNr, hitsInLayer] : Acts::enumerate(m_hitLayers.mdtHits())) {
276  ATH_MSG_VERBOSE( __func__<<"() "<<__LINE__<<": "<<hitsInLayer.size()<<" hits in layer "<<(layerNr +1));
277  bool hadGoodHit{false};
278  for (const HoughHitType testMe : hitsInLayer){
279  const double distance = std::abs(Amg::signedDistance(seedPos, seedDir, testMe->positionInChamber(),
280  testMe->directionInChamber()));
281  const auto* re = static_cast<const xAOD::MdtDriftCircle*>(testMe->primaryMeasurement())->readoutElement();
282 
283  const double pull = std::sqrt(SegmentFitHelpers::chiSqTermMdt(seedPos, seedDir, *testMe, msg()));
284  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Test hit "<<idHelperSvc->toString(testMe->identify())
285  <<" "<<Amg::toString(testMe->positionInChamber())<<", pull: "<<pull<<", distance: "<<distance);
286  if (pull < m_cfg.hitPullCut && distance < re->tubeRadius()) {
287  hadGoodHit = true;
288  solCandidate.seedHits.emplace_back(testMe);
289  candidateSeed.nMdt += (dcStatus(*testMe) == Muon::MdtDriftCircleStatus::MdtStatusDriftTime);
290  }
291  else if (hadGoodHit) {
292  break;
293  }
294  }
295  }
297  const unsigned hitCut = std::max(1.*m_cfg.nMdtHitCut, m_cfg.nMdtLayHitCut * m_hitLayers.mdtHits().size());
298 
299  if (1.*candidateSeed.nMdt < hitCut) {
300  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Too few hits associated "<<candidateSeed.nMdt<<", expect: "<<hitCut<<" hits.");
301  return std::nullopt;
302  }
303  /* Calculate the left-right signs of the used hits */
304  if (m_cfg.overlapCorridor) {
305  solCandidate.solutionSigns = driftSigns(seedPos, seedDir, solCandidate.seedHits, msg());
306  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Circle solutions for seed "
307  <<idHelperSvc->toStringChamber(bottomHit->identify())<<" - "<<solCandidate);
309  for (unsigned int a = m_cfg.startWithPattern; a< m_seenSolutions.size() ;++a) {
310  const SeedSolution& accepted = m_seenSolutions[a];
311  unsigned int nOverlap{0};
312  std::vector<int> corridor = driftSigns(seedPos, seedDir, accepted.seedHits, msg());
313  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Test seed against accepted "<<accepted<<", updated signs: "<<corridor);
315  for (unsigned int l = 0; l < accepted.seedHits.size(); ++l){
316  nOverlap += corridor[l] == accepted.solutionSigns[l];
317  }
320  if (nOverlap == corridor.size() && accepted.seedHits.size() >= solCandidate.seedHits.size()) {
321  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Same set of hits collected within the same corridor");
322  return std::nullopt;
323  }
324  }
325  }
327  for (const HoughHitType& hit : solCandidate.seedHits){
328  //calibBottom is nullptr after it has been moved, so...
329  //cppcheck-suppress accessMoved
330  if (hit == bottomHit && calibBottom) {
331  candidateSeed.measurements.emplace_back(std::move(calibBottom));
332  }
333  //calibTop is nullptr after it has been moved, so...
334  //cppcheck-suppress accessMoved
335  else if (hit == topHit && calibTop) {
336  candidateSeed.measurements.emplace_back(std::move(calibTop));
337  } else {
338  candidateSeed.measurements.emplace_back(m_cfg.calibrator->calibrate(ctx, hit, seedPos, seedDir, 0.));
339  }
340  }
342  m_seenSolutions.emplace_back(std::move(solCandidate));
345  if (m_cfg.tightenHitCut) {
346  m_cfg.nMdtHitCut = std::max(m_cfg.nMdtHitCut, candidateSeed.nMdt);
347  }
348  ++m_nGenSeeds;
349  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": In event "<<ctx.eventID().event_number()<<" found new seed solution "<<toString(candidateSeed.parameters));
350  if (m_cfg.fastSeedFit) {
351  if (!m_cfg.fastSegFitWithT0) {
352  fitDriftCircles(candidateSeed);
353  } else {
354  fitDriftCirclesWithT0(ctx, candidateSeed);
355  }
356  }
357 
358  // Combine the seed with the phi estimate
359  {
360  const Amg::Vector3D parDir = dirFromTangents(m_segmentSeed->tanPhi(), std::tan(theta));
361  candidateSeed.parameters[toInt(ParamDefs::theta)] = parDir.theta();
362  candidateSeed.parameters[toInt(ParamDefs::phi)] = parDir.phi();
363  }
364 
366  {
367  const auto [seedPos, seedDir] = makeLine(candidateSeed.parameters);
368  for (const std::vector<HoughHitType>& hitsInLayer : m_hitLayers.stripHits()) {
369  HoughHitType bestHit{nullptr};
370  double bestPull{m_cfg.hitPullCut};
371  for (const HoughHitType testMe : hitsInLayer){
372  const double pull = std::sqrt(SegmentFitHelpers::chiSqTermStrip(seedPos, seedDir, *testMe, msg()))
373  / testMe->dimension();
374  ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<": Test hit "<<idHelperSvc->toString(testMe->identify())
375  <<" "<<Amg::toString(testMe->positionInChamber())<<", pull: "<<pull);
377  if (pull <= bestPull) {
378  bestHit = testMe;
379  bestPull = pull;
380  }
381  }
382  if (!bestHit) {
383  continue;
384  }
385  candidateSeed.measurements.push_back(m_cfg.calibrator->calibrate(ctx,bestHit, seedPos, seedDir, 0));
386  }
387  }
388  return candidateSeed;
389  }

◆ config()

const MdtSegmentSeedGenerator::Config & MuonR4::MdtSegmentSeedGenerator::config ( ) const

Returns the current seed configuration.

Definition at line 44 of file MdtSegmentSeedGenerator.cxx.

44  {
45  return m_cfg;
46  }

◆ estimateAuxillaries() [1/2]

MdtSegmentSeedGenerator::SeedFitAuxilliaries MuonR4::MdtSegmentSeedGenerator::estimateAuxillaries ( const DriftCircleSeed seed) const
inlineprivate

Helper function to estimate the auxillary variables that remain constant during the fit.

Parameters
seedReference to the seed to calculate the variables from

Seed direction vector

y0Prime = y0 * cos(theta)

Calculate the centre of gravity

Calculate the fit constants

Definition at line 391 of file MdtSegmentSeedGenerator.cxx.

391  {
392 
393  SeedFitAuxilliaries aux{};
396  seed.parameters[toInt(ParamDefs::theta)]);
398  const double y0 = seed.parameters[toInt(ParamDefs::y0)] * seedDir.z();
399 
400  aux.invCovs.reserve(seed.measurements.size());
401  aux.driftSigns.reserve(seed.measurements.size());
402  double norm{0.};
404  for (const std::unique_ptr<CalibratedSpacePoint>& hit : seed.measurements) {
405  const double invCov = 1./ driftCov(*hit);
406  const Amg::Vector3D& pos{hit->positionInChamber()};
407  const int sign = y0 - pos.y() * seedDir.z() + pos.z()* seedDir.y() > 0 ? 1 : -1;
408 
409  aux.centerOfGrav+= invCov * pos;
410  aux.invCovs.push_back(invCov);
411  aux.driftSigns.push_back(sign);
412 
413  norm += invCov;
414  }
416  aux.covNorm = 1./ norm;
417  aux.centerOfGrav *= aux.covNorm;
419  for (const auto [covIdx, hit] : Acts::enumerate(seed.measurements)) {
420  const double& invCov = aux.invCovs[covIdx];
421  const int& sign = aux.driftSigns[covIdx];
422  const Amg::Vector3D pos = hit->positionInChamber() - aux.centerOfGrav;
423  const double signedCov = invCov * sign;
424  aux.T_zzyy += invCov * (std::pow(pos.z(), 2) - std::pow(pos.y(), 2));
425  aux.T_yz += invCov * pos.y()*pos.z();
426  aux.T_rz += signedCov * pos.z() * hit->driftRadius();
427  aux.T_ry += signedCov * pos.y() * hit->driftRadius();
428  aux.fitY0 += signedCov * aux.covNorm * hit->driftRadius();
429  }
430  ATH_MSG_VERBOSE("Estimated T_zzyy: "<<aux.T_zzyy<<", T_yz: "<<aux.T_yz<<", T_rz: "<<aux.T_rz
431  <<", T_ry: "<<aux.T_ry<<", centre "<<Amg::toString(aux.centerOfGrav)<<", y0: "<<aux.fitY0
432  <<", norm: "<<aux.covNorm<<"/"<<norm);
433  return aux;
434  }

◆ estimateAuxillaries() [2/2]

MdtSegmentSeedGenerator::SeedFitAuxWithT0 MuonR4::MdtSegmentSeedGenerator::estimateAuxillaries ( const EventContext &  ctx,
const DriftCircleSeed seed 
) const
inlineprivate

Helper function to estimate the auxillary variables that remain constants during the fit with t0.

Parameters
ctxEventContext to recalibrate the hits
seedReference to the seed to calculate the variables from

Definition at line 484 of file MdtSegmentSeedGenerator.cxx.

485  {
486  SeedFitAuxWithT0 aux{estimateAuxillaries(seed)};
487  for (const auto [idx, hit] : Acts::enumerate(seed.measurements)){
488  const double signedCov = aux.driftSigns[idx] * aux.invCovs[idx];
489  const double weight = aux.covNorm * signedCov;
490  const double velocity = m_cfg.calibrator->driftVelocity(ctx, *hit);
491  const double acceleration = m_cfg.calibrator->driftAcceleration(ctx, *hit);
492  const Amg::Vector3D pos = hit->positionInChamber() - aux.centerOfGrav;
493  aux.fitY0Prime+= weight * velocity;
494  aux.fitY0TwoPrime+= weight * acceleration;
495 
496  aux.T_vz += signedCov * pos.z()*velocity;
497  aux.T_vy += signedCov * pos.y()*velocity;
498  aux.T_az += signedCov * pos.z()*acceleration;
499  aux.T_ay += signedCov * pos.y()*acceleration;
500 
501  aux.R_vr += signedCov * hit->driftRadius() * velocity;
502  aux.R_va += signedCov * hit->driftRadius() * acceleration;
503  aux.R_vv += signedCov * velocity * velocity;
504  }
505  ATH_MSG_VERBOSE("Estimated T_vz: "<<aux.T_vz<<", T_vy: "<<aux.T_vy
506  <<", T_az: "<<aux.T_az<<", T_ay: "<<aux.T_ay<<" --- R_vr: "<<aux.R_vr
507  <<", R_va: "<<aux.R_va<<", R_vv: "<<aux.R_vv<<" -- Y0^{'}: "<<aux.fitY0Prime
508  <<", Y0^{''}: "<<aux.fitY0TwoPrime);
509  return aux;
510  }

◆ fitDriftCircles()

void MuonR4::MdtSegmentSeedGenerator::fitDriftCircles ( DriftCircleSeed seed) const
private

Refine the seed by performing a fast Mdt segment fit.

Parameters
seedSeed built from the tangent adjacent to the two seed circles

Now it's time to use the guestimate

Definition at line 435 of file MdtSegmentSeedGenerator.cxx.

435  {
436 
437  const SeedFitAuxilliaries auxVars = estimateAuxillaries(inSeed);
438 
439  double theta = inSeed.parameters[toInt(ParamDefs::theta)];
441  const double thetaGuess = std::atan2( 2.*(auxVars.T_yz - auxVars.T_rz), auxVars.T_zzyy) / 2.;
442 
443  ATH_MSG_VERBOSE("Start fast fit seed: "<<theta<<", guess: "<<thetaGuess
444  <<", y0: "<<inSeed.parameters[toInt(ParamDefs::y0)]
445  <<", fitY0: "<<auxVars.fitY0<<", centre: "<<Amg::toString(auxVars.centerOfGrav));
447  theta = thetaGuess;
448  CxxUtils::sincos thetaCS{theta};
449  bool converged{false};
450  while (!converged && inSeed.nIter++ <= m_cfg.nMaxIter) {
451  const CxxUtils::sincos twoTheta{2.*theta};
452  const double thetaPrime = 0.5*auxVars.T_zzyy *twoTheta.sn - auxVars.T_yz * twoTheta.cs
453  - auxVars.T_rz * thetaCS.cs - auxVars.T_ry * thetaCS.sn;
454  if (std::abs(thetaPrime) < m_cfg.precCutOff){
455  converged = true;
456  break;
457  }
458 
459  const double thetaTwoPrime = auxVars.T_zzyy * twoTheta.cs + 2.* auxVars.T_yz * twoTheta.sn
460  + auxVars.T_rz * thetaCS.sn - auxVars.T_ry * thetaCS.cs;
461  const double update = thetaPrime / thetaTwoPrime;
462  ATH_MSG_VERBOSE("Fit iteration #"<<inSeed.nIter<<" -- theta: "<<theta<<", thetaPrime: "<<thetaPrime
463  <<", thetaTwoPrime: "<<thetaTwoPrime<<" -- "<<std::format("{:.8f}", update)
464  <<" --> next theta "<<(theta - thetaPrime / thetaTwoPrime));
465 
466  if (std::abs(update) < m_cfg.precCutOff) {
467  converged = true;
468  break;
469  }
470  theta -= update;
471  thetaCS = CxxUtils::sincos{theta};
472  }
473  if (!converged) {
474  return;
475  }
476  double fitY0 = (auxVars.centerOfGrav.y() *thetaCS.cs - auxVars.centerOfGrav.z() * thetaCS.sn + auxVars.fitY0) / thetaCS.cs;
477  ATH_MSG_VERBOSE("Drift circle fit converged within "<<inSeed.nIter<<" iterations giving "<<toString(inSeed.parameters)<<", chi2: "<<inSeed.chi2
478  <<" - theta: "<<theta / Gaudi::Units::deg<<", y0: "<<fitY0);
479  inSeed.parameters[toInt(ParamDefs::theta)] = theta;
480  inSeed.parameters[toInt(ParamDefs::y0)] = fitY0;
481  }

◆ fitDriftCirclesWithT0()

void MuonR4::MdtSegmentSeedGenerator::fitDriftCirclesWithT0 ( const EventContext &  ctx,
DriftCircleSeed seed 
) const
private

Refine the seed by performing a fast Mdt segment fit with t0 constraint.

Parameters
ctxEventContext to recalibrate the hits
seedSeed built from the tangent adjacent to the two seed circles

d^{2}chi^{2} / d^{2}theta

Definition at line 512 of file MdtSegmentSeedGenerator.cxx.

512  {
514  SeedFitAuxWithT0 auxVars{estimateAuxillaries(ctx, inSeed)};
515 
516 
517  bool converged{false};
518  AmgSymMatrix(2) cov{AmgSymMatrix(2)::Zero()};
519  AmgVector(2) grad{AmgVector(2)::Zero()};
520  AmgVector(2) pars{inSeed.parameters[toInt(ParamDefs::theta)],
521  inSeed.parameters[toInt(ParamDefs::time)]};
522 
523 
524  while (!converged && inSeed.nIter++ <= m_cfg.nMaxIter) {
525 
526  const CxxUtils::sincos thetaCS{pars[0]};
527  const CxxUtils::sincos twoTheta{2.*pars[0]};
529  cov(0,0) = auxVars.T_zzyy * twoTheta.cs + 2.* auxVars.T_yz * twoTheta.sn
530  + auxVars.T_rz * thetaCS.sn - auxVars.T_ry * thetaCS.cs;
531 
532  // cov(1,0) = cov(0,1) = auxVars.T_vz * thetaCS.cs + auxVars.T_vy * thetaCS.sn;
533  cov(1,1) = - auxVars.fitY0Prime *auxVars.fitY0Prime - auxVars.fitY0Prime * auxVars.fitY0TwoPrime
534  - auxVars.T_az * thetaCS.sn - auxVars.T_ay * thetaCS.cs + auxVars.R_vv + auxVars.R_va;
535 
536  grad[0] =0.5*auxVars.T_zzyy *twoTheta.sn - auxVars.T_yz * twoTheta.cs
537  - auxVars.T_rz * thetaCS.cs - auxVars.T_ry * thetaCS.sn;
538  grad[1] = auxVars.fitY0 * auxVars.fitY0Prime - auxVars.R_vr + auxVars.T_vz * thetaCS.sn - auxVars.T_vy * thetaCS.cs;
539 
540 
541  const AmgVector(2) update = cov.inverse()* grad;
542  ATH_MSG_VERBOSE("Iteration: "<<inSeed.nIter<<", theta: "<<pars[0] / Gaudi::Units::deg<<", time: "<<
543  pars[1]<<" gradient: ("<<(grad[0])<<", "<<grad[1]<<"), covariance:"
544  <<std::endl<<Amg::toString(cov)<<std::endl<<" update: ("<<update[0] / Gaudi::Units::deg
545  <<", "<<update[1]<<").");
546  pars -= update;
547  }
548 
549  }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ moveToNextCandidate()

void MuonR4::MdtSegmentSeedGenerator::moveToNextCandidate ( )
inlineprivate

Prepares the generator to generate the seed from the next pair of drift circles.

Vary the left-right solutions

Move to the next hit in the lower layer

Move to the next hit in the upper layer

All combinations of hits & lines in both layers are processed Switch to the next lowerLayer. But skip the busy ones according to the configuration

Abort the loop if we parsed the multi-layer boundary

Definition at line 98 of file MdtSegmentSeedGenerator.cxx.

98  {
99  const HitVec& lower = m_hitLayers.mdtHits()[m_lowerLayer];
102  if (++m_signComboIndex < s_signCombos.size()) {
103  return;
104  }
105  m_signComboIndex = 0;
106 
108  if (++m_lowerHitIndex < lower.size()) {
109  return;
110  }
111  m_lowerHitIndex=0;
113  if (++m_upperHitIndex < upper.size()) {
114  return;
115  }
116  m_upperHitIndex = 0;
120  }
121 
122  if (m_lowerLayer < m_upperLayer) {
123  return;
124  }
128  return;
129  }
130  m_lowerLayer = 0;
132 
133  }
134  }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ nextSeed()

std::optional< MdtSegmentSeedGenerator::DriftCircleSeed > MuonR4::MdtSegmentSeedGenerator::nextSeed ( const EventContext &  ctx)

returns the next seed in the row

Increment for the next candidate

If a candidate is built return it. Otherwise continue the process

Definition at line 136 of file MdtSegmentSeedGenerator.cxx.

136  {
137  std::optional<DriftCircleSeed> found = std::nullopt;
139  ++m_nGenSeeds;
140  found = std::make_optional<DriftCircleSeed>();
141  found->parameters = m_segmentSeed->parameters();
142  found->measurements = m_cfg.calibrator->calibrate(ctx,
146  found->parentBucket = m_segmentSeed->parentBucket();
147  found->nMdt = std::ranges::count_if(m_segmentSeed->getHitsInMax(),
148  [](const SpacePoint* hit){
149  return hit->type() == xAOD::UncalibMeasType::MdtDriftCircleType;
150  });
151  SeedSolution patternSeed{};
152  patternSeed.seedHits.resize(2*m_hitLayers.mdtHits().size());
153  patternSeed.solutionSigns.resize(2*m_hitLayers.mdtHits().size());
154  patternSeed.Y0 = m_segmentSeed->interceptY();
155  patternSeed.theta = m_segmentSeed->tanTheta();
156  m_seenSolutions.push_back(std::move(patternSeed));
157  return found;
158  }
159 
160  while (m_lowerLayer < m_upperLayer) {
161  const HitVec& lower = m_hitLayers.mdtHits().at(m_lowerLayer);
163  ATH_MSG_VERBOSE("Layers with hits: "<<m_hitLayers.mdtHits().size()
164  <<" -- next bottom hit: "<<m_lowerLayer<<", hit: "<<m_lowerHitIndex
165  <<" ("<<lower.size()<<"), top hit " <<m_upperLayer<<", "<<m_upperHitIndex
166  <<" ("<<upper.size()<<") - ambiguity "<<s_signCombos[m_signComboIndex]);
167 
172  if (found) {
173  return found;
174  }
175  }
176  return std::nullopt;
177  }

◆ numGenerated()

unsigned int MuonR4::MdtSegmentSeedGenerator::numGenerated ( ) const

Returns how many seeds have been generated.

Definition at line 95 of file MdtSegmentSeedGenerator.cxx.

95  {
96  return m_nGenSeeds;
97  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_cfg

Config MuonR4::MdtSegmentSeedGenerator::m_cfg {}
private

Definition at line 204 of file MdtSegmentSeedGenerator.h.

◆ m_hitLayers

SpacePointPerLayerSplitter MuonR4::MdtSegmentSeedGenerator::m_hitLayers {m_segmentSeed->getHitsInMax()}
private

Definition at line 208 of file MdtSegmentSeedGenerator.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lowerHitIndex

std::size_t MuonR4::MdtSegmentSeedGenerator::m_lowerHitIndex {0}
private

Explicit hit to pick in the selected bottom layer.

Definition at line 215 of file MdtSegmentSeedGenerator.h.

◆ m_lowerLayer

std::size_t MuonR4::MdtSegmentSeedGenerator::m_lowerLayer {0}
private

Considered layer to pick the bottom drift circle from.

Definition at line 213 of file MdtSegmentSeedGenerator.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nGenSeeds

unsigned int MuonR4::MdtSegmentSeedGenerator::m_nGenSeeds {0}
private

Counter on how many seeds have been generated.

Definition at line 223 of file MdtSegmentSeedGenerator.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_seenSolutions

std::vector<SeedSolution> MuonR4::MdtSegmentSeedGenerator::m_seenSolutions {}
private

Vector caching equivalent solutions to avoid double seeding.

Definition at line 221 of file MdtSegmentSeedGenerator.h.

◆ m_segmentSeed

const SegmentSeed* MuonR4::MdtSegmentSeedGenerator::m_segmentSeed {nullptr}
private

Definition at line 207 of file MdtSegmentSeedGenerator.h.

◆ m_signComboIndex

std::size_t MuonR4::MdtSegmentSeedGenerator::m_signComboIndex {0}
private

Index of the left-right ambiguity between the circles.

Definition at line 219 of file MdtSegmentSeedGenerator.h.

◆ m_upperHitIndex

std::size_t MuonR4::MdtSegmentSeedGenerator::m_upperHitIndex {0}
private

Explicit hit to pick in the selected top layer.

Definition at line 217 of file MdtSegmentSeedGenerator.h.

◆ m_upperLayer

std::size_t MuonR4::MdtSegmentSeedGenerator::m_upperLayer {0}
private

Considered layer to pick the top drift circle from.

Definition at line 211 of file MdtSegmentSeedGenerator.h.

◆ s_signCombos

constexpr static std::array<SignComboType,4> MuonR4::MdtSegmentSeedGenerator::s_signCombos
staticconstexprprivate
Initial value:
{
std::array{ 1, 1}, std::array{ 1,-1},
std::array{-1,-1}, std::array{-1, 1},
}

Definition at line 102 of file MdtSegmentSeedGenerator.h.


The documentation for this class was generated from the following files:
MuonR4::MdtSegmentSeedGenerator::m_upperHitIndex
std::size_t m_upperHitIndex
Explicit hit to pick in the selected top layer.
Definition: MdtSegmentSeedGenerator.h:217
MuonR4::SegmentFitHelpers::driftSigns
std::vector< int > driftSigns(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const std::vector< const SpacePoint * > &uncalibHits, MsgStream &msg)
Calculates whether a segment line travereses the tube measurements on the left (-1) or right (1) side...
Definition: SegmentFitHelperFunctions.cxx:217
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonR4::SegmentSeed::parentBucket
const SpacePointBucket * parentBucket() const
Returns the bucket out of which the seed was formed.
Definition: SegmentSeed.cxx:38
MuonR4::MdtSegmentSeedGenerator::Config::overlapCorridor
bool overlapCorridor
Check whether a new seed candidate shares the same left-right solution with already accepted ones Rej...
Definition: MdtSegmentSeedGenerator.h:50
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
MuonR4::SpacePointPerLayerSplitter::stripHits
const HitLayVec & stripHits() const
Returns the sorted strip hits.
Definition: SpacePointPerLayerSplitter.h:33
MuonR4::MdtSegmentSeedGenerator::numGenerated
unsigned int numGenerated() const
Returns how many seeds have been generated.
Definition: MdtSegmentSeedGenerator.cxx:95
MuonR4::MdtSegmentSeedGenerator::Config::nMdtHitCut
unsigned int nMdtHitCut
How many drift circle hits needs the seed to contain in order to be valid.
Definition: MdtSegmentSeedGenerator.h:41
vtune_athena.format
format
Definition: vtune_athena.py:14
MuonR4::MdtSegmentSeedGenerator::Config::busyLayerLimit
unsigned int busyLayerLimit
How many drift circles may be on a layer to be used for seeding.
Definition: MdtSegmentSeedGenerator.h:39
makeComparison.deltaY
int deltaY
Definition: makeComparison.py:44
MuonR4::dcStatus
Muon::MdtDriftCircleStatus dcStatus(const SpacePoint &dc)
Definition: MdtSegmentSeedGenerator.cxx:30
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonR4::SegmentSeed::tanPhi
double tanPhi() const
Returns the angle from the phi extension.
Definition: SegmentSeed.cxx:31
MuonR4::driftCov
double driftCov(const CalibratedSpacePoint &dcHit)
Definition: MdtSegmentSeedGenerator.cxx:22
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:200
MuonR4::SegmentSeed::positionInChamber
Amg::Vector3D positionInChamber() const
Returns the position of the seed in the sector frame.
Definition: SegmentSeed.cxx:41
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonR4::MdtSegmentSeedGenerator::HitVec
SpacePointPerLayerSplitter::HitVec HitVec
Definition: MdtSegmentSeedGenerator.h:26
MuonR4::MdtSegmentSeedGenerator::estimateAuxillaries
SeedFitAuxilliaries estimateAuxillaries(const DriftCircleSeed &seed) const
Helper function to estimate the auxillary variables that remain constant during the fit.
Definition: MdtSegmentSeedGenerator.cxx:391
MuonR4::MdtSegmentSeedGenerator::Config::fastSeedFit
bool fastSeedFit
Toggle whether the seed is rapidly refitted.
Definition: MdtSegmentSeedGenerator.h:56
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
upper
int upper(int c)
Definition: LArBadChannelParser.cxx:49
MuonR4::MdtSegmentSeedGenerator::m_nGenSeeds
unsigned int m_nGenSeeds
Counter on how many seeds have been generated.
Definition: MdtSegmentSeedGenerator.h:223
MuonR4::MdtSegmentSeedGenerator::Config::nMdtLayHitCut
double nMdtLayHitCut
Hit cut based on the fraction of collected tube layers.
Definition: MdtSegmentSeedGenerator.h:44
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
MuonR4::ISpacePointCalibrator::calibrate
virtual CalibSpacePointPtr calibrate(const EventContext &ctx, const SpacePoint *spacePoint, const Amg::Vector3D &seedPosInChamb, const Amg::Vector3D &seedDirInChamb, const double timeDelay) const =0
Calibrates a single space point.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonR4::ISpacePointCalibrator::driftVelocity
virtual double driftVelocity(const EventContext &ctx, const CalibratedSpacePoint &spacePoint) const =0
Returns the drift velocity for a given drift-circle space point.
MuonR4::MdtSegmentSeedGenerator::Config::recalibSeedCircles
bool recalibSeedCircles
Recalibrate the seed drift circles from the initial estimate
Definition: MdtSegmentSeedGenerator.h:52
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:26
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
MuonR4::HoughHitType
HoughMaximum::HitType HoughHitType
Definition: MuonHoughDefs.h:18
MuonR4::toString
std::string toString(const CalibratedSpacePoint::Covariance_t &mat)
Returns the matrix in string.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:75
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonR4::SegmentFit::ParamDefs::phi
@ phi
MuonR4::MdtSegmentSeedGenerator::Config::startWithPattern
bool startWithPattern
Try at the first time the pattern seed as candidate.
Definition: MdtSegmentSeedGenerator.h:37
SpacePoint
Definition: Trigger/TrigAccel/TrigCudaFitter/src/SpacePoint.h:7
MuonR4::MdtSegmentSeedGenerator::m_lowerHitIndex
std::size_t m_lowerHitIndex
Explicit hit to pick in the selected bottom layer.
Definition: MdtSegmentSeedGenerator.h:215
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:190
MuonR4::SegmentFit::dirFromTangents
Amg::Vector3D dirFromTangents(const double tanPhi, const double tanTheta)
Constructs a direction vector from tanPhi & tanTheta.
Definition: SegmentFitterEventData.cxx:23
MuonR4::MdtSegmentSeedGenerator::s_signCombos
constexpr static std::array< SignComboType, 4 > s_signCombos
Definition: MdtSegmentSeedGenerator.h:102
MuonR4::MdtSegmentSeedGenerator::Config::fastSegFitWithT0
bool fastSegFitWithT0
Toggle whether an initial t0 fit shall be executed.
Definition: MdtSegmentSeedGenerator.h:58
MuonR4::SegmentFitHelpers::chiSqTermStrip
double chiSqTermStrip(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated strip measurement.
Definition: SegmentFitHelperFunctions.cxx:82
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
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
MuonR4::ISpacePointCalibrator::driftAcceleration
virtual double driftAcceleration(const EventContext &ctx, const CalibratedSpacePoint &spacePoint) const =0
Returns the drift acceleration for a given drift-circle space point.
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
MuonR4::SegmentSeed::tanTheta
double tanTheta() const
Returns the angular coordinate of the eta transform.
Definition: SegmentSeed.cxx:32
MuonR4::SpacePointPerLayerSplitter::firstLayerFrom2ndMl
unsigned int firstLayerFrom2ndMl() const
Returns the layer index with hits from the second multilayer
Definition: SpacePointPerLayerSplitter.h:41
MuonR4::MdtSegmentSeedGenerator::m_cfg
Config m_cfg
Definition: MdtSegmentSeedGenerator.h:204
MuonR4::SegmentFitHelpers::chiSqTermMdt
double chiSqTermMdt(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated Mdt measurement.
Definition: SegmentFitHelperFunctions.cxx:52
MuonR4::MdtSegmentSeedGenerator::Config::thetaRange
std::array< double, 2 > thetaRange
Cut on the theta angle.
Definition: MdtSegmentSeedGenerator.h:31
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
MuonR4::MdtSegmentSeedGenerator::buildSeed
std::optional< DriftCircleSeed > buildSeed(const EventContext &ctx, const HoughHitType &topHit, const HoughHitType &bottomHit, const SignComboType &signs)
Tries to build the seed from the two hits.
Definition: MdtSegmentSeedGenerator.cxx:179
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonR4::MdtSegmentSeedGenerator::m_upperLayer
std::size_t m_upperLayer
Considered layer to pick the top drift circle from.
Definition: MdtSegmentSeedGenerator.h:211
MuonR4::SegmentSeed::interceptY
double interceptY() const
Returns the intercept coordinate of the eta transform.
Definition: SegmentSeed.cxx:34
MuonR4::SegmentSeed::getHitsInMax
const std::vector< HitType > & getHitsInMax() const
Returns the list of assigned hits.
Definition: SegmentSeed.cxx:37
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
python.StandardJetMods.pull
pull
Definition: StandardJetMods.py:304
MuonR4::MdtSegmentSeedGenerator::m_hitLayers
SpacePointPerLayerSplitter m_hitLayers
Definition: MdtSegmentSeedGenerator.h:208
MuonR4::MdtSegmentSeedGenerator::SeedFitAuxilliaries::driftSigns
std::vector< int > driftSigns
Vector of drfit signs.
Definition: MdtSegmentSeedGenerator.h:144
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
MuonR4::MdtSegmentSeedGenerator::Config::hitPullCut
double hitPullCut
Upper cut on the hit chi2 w.r.t.
Definition: MdtSegmentSeedGenerator.h:35
jobOption.theta
theta
Definition: jobOption.ParticleGun_fwd_sequence.py:13
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MuonR4::MdtSegmentSeedGenerator::fitDriftCirclesWithT0
void fitDriftCirclesWithT0(const EventContext &ctx, DriftCircleSeed &seed) const
Refine the seed by performing a fast Mdt segment fit with t0 constraint.
Definition: MdtSegmentSeedGenerator.cxx:512
MuonR4::SegmentFit::ParamDefs::time
@ time
lumiFormat.array
array
Definition: lumiFormat.py:91
Athena::Units
Definition: Units.h:45
MuonR4::SegmentFit::ParamDefs::y0
@ y0
MuonR4::sign
constexpr double sign(const double x)
Returns the sign of a number.
Definition: MatrixUtils.h:11
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
MuonR4::passRangeCut
constexpr bool passRangeCut(const std::array< double, 2 > &cutRange, const double value)
Definition: MdtSegmentSeedGenerator.cxx:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MuonR4::SegmentFit::toInt
constexpr int toInt(const ParamDefs p)
Definition: MuonHoughDefs.h:42
MuonR4::SpacePointPerLayerSplitter::mdtHits
const HitLayVec & mdtHits() const
Returns the sorted Mdt hits.
Definition: SpacePointPerLayerSplitter.h:25
checkTriggerxAOD.found
found
Definition: checkTriggerxAOD.py:328
MuonR4::MdtSegmentSeedGenerator::moveToNextCandidate
void moveToNextCandidate()
Prepares the generator to generate the seed from the next pair of drift circles.
Definition: MdtSegmentSeedGenerator.cxx:98
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
Amg::dirFromAngles
Amg::Vector3D dirFromAngles(const double phi, const double theta)
Constructs a direction vector from the azimuthal & polar angles.
Definition: GeoPrimitivesHelpers.h:299
MuonR4::MdtSegmentSeedGenerator::Config::nMaxIter
unsigned int nMaxIter
Maximum number of iterations in the fast segment fit.
Definition: MdtSegmentSeedGenerator.h:60
a
TList * a
Definition: liststreamerinfos.cxx:10
MuonR4::MdtSegmentSeedGenerator::m_segmentSeed
const SegmentSeed * m_segmentSeed
Definition: MdtSegmentSeedGenerator.h:207
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
MuonR4::MdtSegmentSeedGenerator::Config::tightenHitCut
bool tightenHitCut
Once a seed with even more than initially required hits is found, reject all following seeds with les...
Definition: MdtSegmentSeedGenerator.h:47
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
re
const boost::regex re(r_e)
Muon::nsw::STGTPSegments::MergedSegmentProperty::dTheta
@ dTheta
MuonR4::MdtSegmentSeedGenerator::m_seenSolutions
std::vector< SeedSolution > m_seenSolutions
Vector caching equivalent solutions to avoid double seeding.
Definition: MdtSegmentSeedGenerator.h:221
MuonR4::MdtSegmentSeedGenerator::Config::interceptRange
std::array< double, 2 > interceptRange
Cut on the intercept range.
Definition: MdtSegmentSeedGenerator.h:33
MuonR4::SegmentSeed::parameters
const Parameters & parameters() const
Returns the parameter array.
Definition: SegmentSeed.cxx:35
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:39
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
MuonR4::MdtSegmentSeedGenerator::fitDriftCircles
void fitDriftCircles(DriftCircleSeed &seed) const
Refine the seed by performing a fast Mdt segment fit.
Definition: MdtSegmentSeedGenerator.cxx:435
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273
MuonR4::MdtSegmentSeedGenerator::m_signComboIndex
std::size_t m_signComboIndex
Index of the left-right ambiguity between the circles.
Definition: MdtSegmentSeedGenerator.h:219
Amg::signedDistance
double signedDistance(const Amg::Vector3D &posA, const Amg::Vector3D &dirA, const Amg::Vector3D &posB, const Amg::Vector3D &dirB)
Calculates the signed distance between two lines in 3D space.
Definition: GeoPrimitivesHelpers.h:329
MuonR4::MdtSegmentSeedGenerator::Config::precCutOff
double precCutOff
Precision cut off in the fast segment fit.
Definition: MdtSegmentSeedGenerator.h:62
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
MuonR4::SegmentSeed::directionInChamber
Amg::Vector3D directionInChamber() const
Returns the direction of the seed in the sector frame.
Definition: SegmentSeed.cxx:42
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
MuonR4::MdtSegmentSeedGenerator::Config::calibrator
const ISpacePointCalibrator * calibrator
Pointer to the space point calibrator.
Definition: MdtSegmentSeedGenerator.h:54
MuonR4::AmgSymMatrix
const AmgSymMatrix(2) &SpacePoint
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:90
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67
MuonR4::MdtSegmentSeedGenerator::m_lowerLayer
std::size_t m_lowerLayer
Considered layer to pick the bottom drift circle from.
Definition: MdtSegmentSeedGenerator.h:213
MuonR4::SegmentFit::ParamDefs::theta
@ theta
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148