4#ifndef MUON_MOOTRACKFITTER_H
5#define MUON_MOOTRACKFITTER_H
61 typedef std::vector<const Trk::MeasurementBase*>
MeasVec;
65 typedef std::vector<const Trk::PrepRawData*>
PrepVec;
70 typedef std::map<MuonStationIndex::StIndex, SmallLargeChambers>
SLStationMap;
72 typedef std::vector<std::pair<const Trk::TrackParameters*, const Trk::Layer*> >
MaterialLayers;
78 MooTrackFitter(
const std::string&,
const std::string&,
const IInterface*);
91 static const InterfaceID IID_MooTrackFitter(
"Muon::MooTrackFitter", 1, 0);
92 return IID_MooTrackFitter;
102 const PrepVec& externalPhiHits)
const;
105 std::unique_ptr<Trk::Track>
refit(
const EventContext& ctx,
const MuPatTrack& trkCan)
const;
108 std::unique_ptr<Trk::Track>
refit(
const EventContext& ctx,
const Trk::Track& track)
const;
126 std::pair<std::unique_ptr<Trk::Track>, std::unique_ptr<Trk::Track> >
splitTrack(
const EventContext& ctx,
const Trk::Track& track)
const;
130 const std::vector<const Trk::TrackStateOnSurface*>& tsos)
const;
160 std::vector<std::unique_ptr<const Trk::MeasurementBase>>
garbage{};
178 for (; it != it_end; ++it) {
179 if (it->second.first) ++
nSmall;
180 if (it->second.second) ++
nLarge;
181 if (it->second.first && it->second.second) ++
nOverlaps;
261 "Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"};
262 ToolHandle<Trk::ITrackFitter>
m_trackFitter{
this,
"Fitter",
"Trk::GlobalChi2Fitter/MCTBFitter"};
263 PublicToolHandle<MuPatHitTool>
m_hitHandler{
this,
"HitTool",
"Muon::MuPatHitTool/MuPatHitTool"};
265 this,
"SegmentMomentum",
"MuonSegmentMomentum/MuonSegmentMomentum"};
267 Gaudi::Property<Trk::RunOutlierRemoval>
m_runOutlier{
this,
"RunOutlier",
false,
"Switch whether to run outlier logics or not"};
268 Gaudi::Property<int>
m_matEffects{
this,
"MatEffects", 2,
"type of material interaction in extrapolation"};
274 this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
275 "Handle to the service providing the IMuonEDMHelperSvc interface"};
276 PublicToolHandle<MuonEDMPrinterTool>
m_printer{
this,
"MuonPrinterTool",
277 "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
279 this,
"TrackToSegmentTool",
280 "Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"};
283 "MuonPhiHitSelector/MuonPhiHitSelector"};
284 ToolHandle<IMuonTrackCleaner>
m_cleaner{
this,
"TrackCleaner",
"Muon::MuonTrackCleaner/MuonTrackCleaner"};
286 this,
"SegmentInOverlapTool",
"Muon::MuonSegmentInOverlapResolvingTool/MuonSegmentInOverlapResolvingTool"};
288 this,
"TrackSummaryTool",
"Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool"};
290 Gaudi::Property<bool>
m_slFit{
this,
"SLFit",
true,
"Perform sl fit"};
291 Gaudi::Property<bool>
m_slProp{
this,
"SLProp",
false,
"Enable straight line propagation"};
292 Gaudi::Property<bool>
m_seedWithSegmentTheta{
this,
"SeedWithSegmentTheta",
true,
"Seed with theta connecting first + last eta hit"};
293 Gaudi::Property<bool>
m_seedWithAvePhi{
this,
"SeedWithAvePhi",
true,
"Seed with average phi of all phi hits"};
294 Gaudi::Property<bool>
m_seedPhiWithEtaHits{
this,
"SeedPhiWithEtaHits",
false,
"Seed phi from positions first last eta hit"};
295 Gaudi::Property<bool>
m_usePreciseHits{
this,
"UsePreciseHits",
false,
"Use actual measurement error"};
296 Gaudi::Property<bool>
m_usePrefit{
this,
"UsePrefit",
true,
"Use prefit"};
297 Gaudi::Property<bool>
m_allowFirstFit{
this,
"AllowFirstFitResult",
false,
"Return the result of the prefit is final fit fails"};
299 "Momentum cut-off. Seeds below the threshold will not be fitted"};
300 Gaudi::Property<bool>
m_cosmics{
this,
"Cosmics",
false,
"Special treatment for cosmics"};
301 Gaudi::Property<bool>
m_cleanPhiHits{
this,
"CleanPhiHits",
true,
"Special flag to switch off phi hit cleaning"};
302 Gaudi::Property<unsigned int>
m_phiHitsMax{
this,
"MaxPatternPhiHits", 40,
303 "If more than maximum number of phi hits on pattern, no hits will be added"};
304 Gaudi::Property<bool>
m_seedAtStartOfTrack{
this,
"SeedAtStartOfTrack",
true,
"Provide seed parameters at the start of the track"};
306 "use precise hits in first station to stabalise the fit"};
309 "cut on the maximum difference in phi between measurements on the track"};
311 "minimum chi2/ndof for a track to be passed to cleaner"};
312 Gaudi::Property<double>
m_chi2Cut{
this,
"ReducedChi2Cut", 100.,
"minimum chi2/ndof for a track to be accepted"};
std::atomic_uint m_nfailedTubeFit
std::map< MuonStationIndex::StIndex, SmallLargeChambers > SLStationMap
double phiSeeding(const EventContext &ctx, FitterData &fitterData) const
calculate phi used to for seeding the fit
static double qOverPFromEntry(const MuPatCandidateBase &entry)
get q/p from entry
std::pair< int, int > SmallLargeChambers
Gaudi::Property< double > m_chi2Cut
bool validMomentum(const Trk::TrackParameters &pars) const
check whether mometum of start parameter is ok
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
PrepVec::const_iterator PrepCit
Gaudi::Property< unsigned int > m_phiHitsMax
std::shared_ptr< const MuonSegment > segmentFromEntry(const EventContext &ctx, const MuPatCandidateBase &entry) const
get segment from entry
bool cleanPhiHits(const EventContext &ctx, double momentum, FitterData &phiHits, const PrepVec &patternPhiHits) const
clean phi hits, returns true if anything happened during the cleaning
Gaudi::Property< Trk::RunOutlierRemoval > m_runOutlier
std::atomic_uint m_nsuccess
std::atomic_uint m_nfailedFakePrecise
ToolHandle< Trk::ITrackFitter > m_trackFitter
fitter
Gaudi::Property< bool > m_cleanPhiHits
ToolHandle< IMuonSegmentMomentumEstimator > m_momentumEstimator
tool to estimate track momentum
bool corruptEntry(const MuPatCandidateBase &entry) const
sanity check for entries
static const InterfaceID & interfaceID()
access to tool interface
Gaudi::Property< bool > m_seedWithSegmentTheta
ToolHandle< IMuonHitSelector > m_phiHitSelector
tool to clean phi hits
Trk::MagneticFieldProperties m_magFieldProperties
magnetic field properties
double qOverPFromEntries(const EventContext &ctx, const MuPatCandidateBase &firstEntry, const MuPatCandidateBase &secondEntry) const
get q/p using angle + position of the two entries
Gaudi::Property< bool > m_seedPhiWithEtaHits
std::pair< std::unique_ptr< Trk::Track >, std::unique_ptr< Trk::Track > > splitTrack(const EventContext &ctx, const Trk::Track &track) const
split given track if it crosses the calorimeter volume, code assumes that the track was already extra...
ToolHandle< IMuonSegmentInOverlapResolvingTool > m_overlapResolver
Gaudi::Property< bool > m_allowFirstFit
void createStartParameters(const EventContext &ctx, FitterData &inputData) const
create a perigee parameter give the input data
StatusCode finalize()
finialize method, method taken from bass-class AlgTool
~MooTrackFitter()=default
destructor
std::atomic_uint m_nfailedFakeInitial
std::unique_ptr< Trk::Track > fitWithRefit(const EventContext &ctx, const Trk::Perigee &startPars, MeasVec &hits) const
fit track, refit if needed
std::unique_ptr< Trk::MeasurementBase > createFakePhiForMeasurement(const Trk::MeasurementBase &measurement, const Amg::Vector3D *overlapPos, const Amg::Vector3D *phiPos, double error) const
create fake phi hit on the surface of the give measurement
Trk::ParticleHypothesis m_ParticleHypothesis
nomen est omen
Trk::TrackInfo::TrackPatternRecoInfo m_patRecInfo
Gaudi::Property< int > m_matEffects
std::unique_ptr< Trk::Track > fitSplitTrack(const EventContext &ctx, const Trk::TrackParameters &startPars, const std::vector< const Trk::TrackStateOnSurface * > &tsos) const
construct a track from a list of TSOS and a start parameters
Gaudi::Property< bool > m_usePreciseHits
Gaudi::Property< bool > m_seedWithAvePhi
double thetaSeeding(const MuPatCandidateBase &entry, MeasVec &etaHits) const
calculate theta used for seeding the fit
std::unique_ptr< Trk::Track > fit(const EventContext &ctx, const MuPatCandidateBase &firstEntry, const MuPatCandidateBase &secondEntry, const PrepVec &externalPhiHits) const
fit the hits of two MuPatCandidateBase
std::unique_ptr< Trk::Perigee > createPerigee(const EventContext &ctx, const Trk::TrackParameters &firstPars, const Trk::MeasurementBase &firstMeas) const
create perigee parameter to initialize fit
bool getMinMaxPhi(FitterData &fitterData) const
calculate the minimum and maximum phi value a track could have to pass all eta channels
std::atomic_uint m_nfailedExtractCleaning
Gaudi::Property< bool > m_slFit
Gaudi::Property< bool > m_cosmics
std::atomic_uint m_nlowMomentum
std::vector< const Trk::MeasurementBase * > MeasVec
Gaudi::Property< double > m_pThreshold
ToolHandle< IMuonTrackToSegmentTool > m_trackToSegmentTool
helper tool to convert tracks into segments
std::atomic_uint m_nfailedParsInital
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
multi purpose helper tool
std::vector< std::pair< const Trk::TrackParameters *, const Trk::Layer * > > MaterialLayers
std::pair< double, double > getElementHalfLengths(const Identifier &id, const Trk::TrkDetElementBase *ele) const
void cleanSegment(const MuonSegment &seg, std::set< Identifier > &removedIdentifiers) const
std::atomic_uint m_nfailedExtractPrecise
Gaudi::Property< bool > m_seedAtStartOfTrack
Gaudi::Property< bool > m_slProp
static double restrictedMomentum(double momentum)
impose upper and lower bound on momentum
MeasVec::const_iterator MeasCit
Gaudi::Property< bool > m_usePrefit
std::atomic_uint m_nfailedExtractInital
PublicToolHandle< MuPatHitTool > m_hitHandler
hit handler
Gaudi::Property< double > m_openingAngleCut
ToolHandle< IMuonTrackCleaner > m_cleaner
bool addFakePhiHits(const EventContext &ctx, FitterData &fitterData, const Trk::TrackParameters &referenceParameter) const
check fitterData, add fake phi hits if needed.
unsigned int hasPhiConstrain(FitterData &inputData) const
check whether data has sufficient phi constraints
Gaudi::Property< bool > m_preciseFirstStation
void cleanEntry(const MuPatCandidateBase &entry, std::set< Identifier > &removedIdentifiers) const
Gaudi::Property< double > m_preCleanChi2Cut
bool extractData(const MuPatCandidateBase &entry1, const MuPatCandidateBase &entry2, FitterData &fitterData) const
extract all information needed for the fit from the track
bool getMaterial(const Trk::TrackParameters &pars, FitterData &fitterData) const
get material
StatusCode initialize()
initialize method, method taken from bass-class AlgTool
std::atomic_uint m_nfailedMinMaxPhi
std::unique_ptr< Trk::Track > refit(const EventContext &ctx, const MuPatTrack &trkCan) const
refit a MuPatTrack
std::atomic_uint m_nfailedFitPrecise
std::atomic_uint m_noPerigee
std::vector< const Trk::PrepRawData * > PrepVec
void removeSegmentOutliers(FitterData &fitterData) const
MooTrackFitter(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
std::unique_ptr< Trk::Track > cleanAndEvaluateTrack(const EventContext &ctx, Trk::Track &track, const std::set< Identifier > &excludedChambers) const
clean and evaluate the track,
PublicToolHandle< MuonEDMPrinterTool > m_printer
tool to print out EDM objects
ToolHandle< Trk::IPropagator > m_propagator
propagator
ToolHandle< Trk::ITrackSummaryHelperTool > m_trackSummaryTool
track candidate entry object.
This is the common class for 3D segments used in the muon spectrometer.
Base Class for a Detector Layer in the Tracking realm.
magnetic field properties to steer the behavior of the extrapolation
This class is the pure abstract base class for all fittable tracking measurements.
This is the base class for all tracking detector elements with read-out relevant information.
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::vector< MuPatHitPtr > MuPatHitList
NSWSeed::MeasVec MeasVec
Stereo seeds can be formed using hits from 4 independent layers by solving the following system of eq...
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ FullField
Field is set to be realistic, but within a given Volume.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters
std::set< MuonStationIndex::StIndex > stations
MaterialLayers materialLayers
SLStationMap smallLargeChambersPerStation
const MuPatCandidateBase * firstEntry
int numberOfLargeChambers()
std::unique_ptr< Trk::Perigee > startPars
MeasVec firstLastMeasurements
std::set< Identifier > mdtIdsFirst
const MuPatCandidateBase * secondEntry
std::vector< std::unique_ptr< const Trk::MeasurementBase > > garbage
std::set< Identifier > mdtIdsSecond
int numberOfSmallChambers()
unsigned int nLargeChambers
unsigned int nSmallChambers