59 string seedPosition = par.
getParameter<
string>(
"SeedPosition");
61 if (seedPosition ==
"in")
63 else if (seedPosition ==
"out")
67 <<
"Wrong seed position chosen in StandAloneMuonFilter::StandAloneMuonFilter ParameterSet" 69 <<
"Possible choices are:" 71 <<
"SeedPosition = in or SeedPosition = out";
92 theBWSeedType = bwFilterPSet.getParameter<
string>(
"BWSeedType");
104 theSeedTransformer = std::make_unique<SeedTransformer>(seedTransformerParameters, iC);
114 LogTrace(
"Muon|RecoMuon|StandAloneMuonTrajectoryBuilder")
115 <<
"StandAloneMuonTrajectoryBuilder destructor called" << endl;
130 Resetter fwReset(
filter());
149 vector<Trajectory> seedTrajectories;
153 if (!seedTrajectories.empty()) {
155 lastTSOS = lastTM.updatedState();
156 lastDetId = lastTM.recHit()->geographicalId();
162 lastDetId =
seed.startingState().detId();
165 LogTrace(
metname) <<
"Trajectory State on Surface before the extrapolation" << endl;
177 filter()->
refit(inputFromSeed.second, inputFromSeed.first, trajectoryFW);
180 if (trajectoryFW.
empty()) {
181 LogTrace(
metname) <<
"Forward trajectory EMPTY! No trajectory will be loaded!" << endl;
182 return trajectoryContainer;
189 LogTrace(
metname) <<
"StandAloneMuonTrajectoryBuilder filter output " << endl;
213 if (
filter()->goodState()) {
215 }
else if (
filter()->isCompatibilitySatisfied()) {
216 int foundValidRh = trajectoryFW.
foundHits();
217 LogTrace(
metname) <<
"Compatibility satisfied after Forward filter, but too few valid RecHits (" << foundValidRh
219 <<
"A trajectory with only invalid RecHits will be loaded!" << endl;
221 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
222 return trajectoryContainer;
226 trajectoryContainer.push_back(std::make_unique<Trajectory>(defaultTraj));
227 return trajectoryContainer;
229 LogTrace(
metname) <<
"Compatibility NOT satisfied after Forward filter! No trajectory will be loaded!" << endl;
236 return trajectoryContainer;
246 LogTrace(
metname) <<
"Only forward refit requested. No backward refit will be performed!" << endl;
251 pair<bool, Trajectory> refitResult =
refitter()->
refit(trajectoryFW);
252 if (refitResult.first) {
253 trajectoryContainer.push_back(std::make_unique<Trajectory>(refitResult.second));
254 LogTrace(
metname) <<
"StandAloneMuonTrajectoryBuilder refit output " << endl;
257 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
259 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
262 return trajectoryContainer;
285 Trajectory trajectoryBW(seedForBW, bwDirection);
293 LogTrace(
metname) <<
"StandAloneMuonTrajectoryBuilder BW filter output " << endl;
351 }
else if (
bwfilter()->isCompatibilitySatisfied()) {
352 LogTrace(
metname) <<
"Compatibility satisfied after Backward filter, but too few valid RecHits (" 353 << trajectoryBW.
foundHits() <<
")." << endl
354 <<
"The (good) result of FW filter will be loaded!" << endl;
355 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
356 return trajectoryContainer;
358 LogTrace(
metname) <<
"Compatibility NOT satisfied after Backward filter!" << endl
359 <<
"The Forward trajectory will be invalidated and then loaded!" << endl;
362 trajectoryContainer.push_back(std::make_unique<Trajectory>(defaultTraj));
363 return trajectoryContainer;
368 pair<bool, Trajectory> refitResult =
refitter()->
refit(trajectoryBW);
369 if (refitResult.first) {
370 trajectoryContainer.push_back(std::make_unique<Trajectory>(refitResult.second));
371 LogTrace(
metname) <<
"StandAloneMuonTrajectoryBuilder Refit output " << endl;
374 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
376 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
380 return trajectoryContainer;
388 DetId seedDetId(aDetId);
404 LogTrace(
metname) <<
"TrajectoryStateOnSurface before propagation:" << endl;
410 vector<const DetLayer*> detLayers;
414 theService->muonNavigationSchool()->compatibleLayers(*initialLayer, *initialState.
freeState(), detLayerOrder);
421 LogTrace(
metname) <<
"There are " << detLayers.size() <<
" compatible layers" << endl;
425 if (!detLayers.empty()) {
427 for (vector<const DetLayer*>::const_iterator
layer = detLayers.begin();
layer != detLayers.end();
layer++) {
432 const DetLayer* finalLayer = detLayers.back();
444 if (propagatedState.
isValid()) {
447 LogTrace(
metname) <<
"Trajectory State on Surface after the extrapolation" << endl;
451 LogTrace(
metname) <<
"Extrapolation failed. Keep the original seed state" << endl;
453 LogTrace(
metname) <<
"No compatible layers. Keep the original seed state" << endl;
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
T getParameter(std::string const &) const
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
void createDefaultTrajectory(const Trajectory &, Trajectory &)
recoMuon::SeedPosition theSeedPosition
StandAloneMuonTrajectoryBuilder(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &iC)
Constructor with Parameter set and MuonServiceProxy.
const std::string metname
int getGEMCompatibleChambers() const
int getME0CompatibleChambers() const
MuonCandidate::TrajectoryContainer TrajectoryContainer
std::string theBWSeedType
StandAloneMuonFilter * bwfilter() const
actual filter
Log< level::Error, false > LogError
void refit(const TrajectoryStateOnSurface &initialState, const DetLayer *, Trajectory &trajectory)
Perform the inner-outward fitting.
TrajectoryMeasurement const & lastMeasurement() const
constexpr std::array< uint8_t, layerIndexSize > layer
StandAloneMuonFilter * filter() const
pre-filter
TrajectoryStateOnSurface lastUpdatedTSOS() const
the Trajectory state on the last surface of the fitting
void addParameter(std::string const &name, T const &value)
GlobalVector momentum() const
int getGEMChamberUsed() const
RefitResult refit(const Trajectory &)
int getRPCCompatibleChambers() const
StandAloneMuonRefitter * refitter() const
refitter of the hits container
TrajectoryStateOnSurface lastCompatibleTSOS() const
the Trajectory state on the last compatible surface
std::string theNavigationType
~StandAloneMuonTrajectoryBuilder() override
Destructor.
TrajectoryContainer trajectories(const TrajectorySeed &) override
return a container of the reconstructed trajectories compatible with a given seed ...
int getDTCompatibleChambers() const
int getCSCChamberUsed() const
int getRPCChamberUsed() const
int getCSCCompatibleChambers() const
int getME0ChamberUsed() const
bool empty() const
True if trajectory has no measurements.
int getTotalCompatibleChambers() const
std::unique_ptr< StandAloneMuonFilter > theBWFilter
const MuonServiceProxy * theService
std::unique_ptr< StandAloneMuonFilter > theFilter
FreeTrajectoryState const * freeState(bool withErrors=true) const
std::unique_ptr< StandAloneMuonRefitter > theRefitter
std::string theSeedPropagatorName
Propagator for the seed extrapolation.
std::pair< const DetLayer *, TrajectoryStateOnSurface > DetLayerWithState
void setEvent(const edm::Event &event) override
Pass the Event to the algo at each event.
Log< level::Warning, false > LogWarning
std::unique_ptr< SeedTransformer > theSeedTransformer
int getDTChamberUsed() const
DetLayerWithState propagateTheSeedTSOS(TrajectoryStateOnSurface &aTSOS, DetId &aDetId)
ConstRecHitPointer const & recHit() const