44 : theService(service) {
47 LogTrace(metname) <<
"constructor called" << endl;
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";
85 if (doBackwardFilter) {
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();
165 LogTrace(metname) <<
"Trajectory State on Surface before the extrapolation" << endl;
169 LogTrace(metname) <<
"The RecSegment relies on: " << 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;
255 LogTrace(metname) << debug.
dumpTSOS(refitResult.second.lastMeasurement().updatedState());
257 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
259 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
261 LogTrace(metname) <<
"Trajectory saved" << endl;
262 return trajectoryContainer;
282 LogWarning(metname) <<
"Wrong seed type for the backward filter!";
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;
372 LogTrace(metname) << debug.
dumpTSOS(refitResult.second.lastMeasurement().updatedState());
374 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
376 trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
378 LogTrace(metname) <<
"Trajectory saved" << endl;
380 return trajectoryContainer;
388 DetId seedDetId(aDetId);
395 LogTrace(metname) <<
"Seed's id: " << endl;
401 LogTrace(metname) <<
"Seed's detLayer: " << endl;
404 LogTrace(metname) <<
"TrajectoryStateOnSurface before propagation:" << endl;
410 vector<const DetLayer*> detLayers;
414 theService->muonNavigationSchool()->compatibleLayers(*initialLayer, *initialState.
freeState(), detLayerOrder);
419 edm::LogError(metname) <<
"No Properly Navigation Selected!!" << endl;
421 LogTrace(metname) <<
"There are " << detLayers.size() <<
" compatible layers" << endl;
425 if (!detLayers.empty()) {
426 LogTrace(metname) <<
"Compatible layers:" << endl;
427 for (vector<const DetLayer*>::const_iterator
layer = detLayers.begin();
layer != detLayers.end();
layer++) {
428 LogTrace(metname) << debug.
dumpMuonId((*layer)->basicComponents().front()->geographicalId());
432 const DetLayer* finalLayer = detLayers.back();
435 LogTrace(metname) <<
"Most internal one:" << endl;
437 LogTrace(metname) <<
"Most external one:" << endl;
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;
bool empty() const
True if trajectory has no measurements.
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
ConstRecHitPointer const & recHit() const
void createDefaultTrajectory(const Trajectory &, Trajectory &)
std::string dumpLayer(const DetLayer *layer) const
recoMuon::SeedPosition theSeedPosition
StandAloneMuonTrajectoryBuilder(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &iC)
Constructor with Parameter set and MuonServiceProxy.
const std::string metname
int getRPCChamberUsed() const
MuonCandidate::TrajectoryContainer TrajectoryContainer
std::string theBWSeedType
int getRPCCompatibleChambers() const
TrajectoryStateOnSurface lastUpdatedTSOS() const
the Trajectory state on the last surface of the fitting
Log< level::Error, false > LogError
void refit(const TrajectoryStateOnSurface &initialState, const DetLayer *, Trajectory &trajectory)
Perform the inner-outward fitting.
int getDTChamberUsed() const
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
std::string dumpMuonId(const DetId &id) const
std::string dumpTSOS(const TrajectoryStateOnSurface &tsos) const
int getCSCCompatibleChambers() const
int getDTCompatibleChambers() const
TrajectoryMeasurement const & lastMeasurement() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
void addParameter(std::string const &name, T const &value)
StandAloneMuonFilter * bwfilter() const
actual filter
unsigned int detId() const
RefitResult refit(const Trajectory &)
GlobalVector momentum() const
std::string theNavigationType
~StandAloneMuonTrajectoryBuilder() override
Destructor.
TrajectoryContainer trajectories(const TrajectorySeed &) override
return a container of the reconstructed trajectories compatible with a given seed ...
PTrajectoryStateOnDet const & startingState() const
int getGEMChamberUsed() const
T getParameter(std::string const &) const
int getGEMCompatibleChambers() const
int getCSCChamberUsed() const
int getME0CompatibleChambers() const
std::unique_ptr< StandAloneMuonFilter > theBWFilter
StandAloneMuonFilter * filter() const
pre-filter
const MuonServiceProxy * theService
int getTotalCompatibleChambers() const
std::unique_ptr< StandAloneMuonFilter > theFilter
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 getME0ChamberUsed() const
StandAloneMuonRefitter * refitter() const
refitter of the hits container
TrajectoryStateOnSurface lastCompatibleTSOS() const
the Trajectory state on the last compatible surface
DetLayerWithState propagateTheSeedTSOS(TrajectoryStateOnSurface &aTSOS, DetId &aDetId)