47 LogTrace(metname) <<
"constructor called" << endl;
59 string seedPosition = par.
getParameter<
string>(
"SeedPosition");
65 <<
"Wrong seed position chosen in StandAloneMuonFilter::StandAloneMuonFilter ParameterSet" 67 <<
"Possible choices are:" 69 <<
"SeedPosition = in or SeedPosition = out";
113 LogTrace(
"Muon|RecoMuon|StandAloneMuonTrajectoryBuilder")
114 <<
"StandAloneMuonTrajectoryBuilder destructor called" << endl;
127 ~Resetter() {
if(mf) mf->
reset();}
133 Resetter fwReset(
filter());
152 vector<Trajectory> seedTrajectories;
156 if(!seedTrajectories.empty()) {
158 lastTSOS = lastTM.updatedState();
159 lastDetId = lastTM.recHit()->geographicalId();
168 LogTrace(metname) <<
"Trajectory State on Surface before the extrapolation"<<endl;
172 LogTrace(metname) <<
"The RecSegment relies on: "<<endl;
180 filter()->
refit(inputFromSeed.second,inputFromSeed.first,trajectoryFW);
183 if( trajectoryFW.
empty() ) {
184 LogTrace(metname) <<
"Forward trajectory EMPTY! No trajectory will be loaded!" << endl;
185 return trajectoryContainer;
192 LogTrace(metname) <<
"StandAloneMuonTrajectoryBuilder filter output " << endl;
217 if(
filter()->goodState() ) {
220 else if(
filter()->isCompatibilitySatisfied() ) {
221 int foundValidRh = trajectoryFW.
foundHits();
222 LogTrace(metname) <<
"Compatibility satisfied after Forward filter, but too few valid RecHits (" 223 << foundValidRh <<
")." << endl
224 <<
"A trajectory with only invalid RecHits will be loaded!" << endl;
226 trajectoryContainer.push_back(
new Trajectory(trajectoryFW));
227 return trajectoryContainer;
231 trajectoryContainer.push_back(
new Trajectory(defaultTraj));
232 return trajectoryContainer;
235 LogTrace(metname) <<
"Compatibility NOT satisfied after Forward filter! No trajectory will be loaded!" << endl;
241 return trajectoryContainer;
245 LogTrace(metname) <<
"Number of DT/CSC/RPC/GEM/ME0 chamber used (fw): " 255 LogTrace(metname) <<
"Only forward refit requested. No backward refit will be performed!"<<endl;
260 pair<bool,Trajectory> refitResult =
refitter()->
refit(trajectoryFW);
261 if(refitResult.first) {
262 trajectoryContainer.push_back(
new Trajectory(refitResult.second));
263 LogTrace(metname) <<
"StandAloneMuonTrajectoryBuilder refit output " << endl ;
264 LogTrace(metname) << debug.
dumpTSOS(refitResult.second.lastMeasurement().updatedState());
267 trajectoryContainer.push_back(
new Trajectory(trajectoryFW));
270 trajectoryContainer.push_back(
new Trajectory(trajectoryFW));
272 LogTrace(metname) <<
"Trajectory saved" << endl;
273 return trajectoryContainer;
299 LogWarning(metname) <<
"Wrong seed type for the backward filter!";
302 Trajectory trajectoryBW(seedForBW,bwDirection);
310 LogTrace(metname) <<
"StandAloneMuonTrajectoryBuilder BW filter output " << endl ;
314 <<
"Number of RecHits: " << trajectoryBW.
foundHits() <<
"\n" 315 <<
"Number of DT/CSC/RPC/GEM/ME0 chamber used (bw): " 373 else if(
bwfilter()->isCompatibilitySatisfied() ) {
374 LogTrace(metname) <<
"Compatibility satisfied after Backward filter, but too few valid RecHits (" 375 << trajectoryBW.
foundHits() <<
")." << endl
376 <<
"The (good) result of FW filter will be loaded!" << endl;
377 trajectoryContainer.push_back(
new Trajectory(trajectoryFW));
378 return trajectoryContainer;
381 LogTrace(metname) <<
"Compatibility NOT satisfied after Backward filter!" << endl
382 <<
"The Forward trajectory will be invalidated and then loaded!" << endl;
385 trajectoryContainer.push_back(
new Trajectory(defaultTraj));
386 return trajectoryContainer;
391 pair<bool,Trajectory> refitResult =
refitter()->
refit(trajectoryBW);
392 if(refitResult.first) {
393 trajectoryContainer.push_back(
new Trajectory(refitResult.second));
394 LogTrace(metname) <<
"StandAloneMuonTrajectoryBuilder Refit output " << endl;
395 LogTrace(metname) << debug.
dumpTSOS(refitResult.second.lastMeasurement().updatedState());
398 trajectoryContainer.push_back(
new Trajectory(trajectoryBW));
401 trajectoryContainer.push_back(
new Trajectory(trajectoryBW));
403 LogTrace(metname) <<
"Trajectory saved" << endl;
405 return trajectoryContainer;
415 DetId seedDetId(aDetId);
422 LogTrace(metname)<<
"Seed's id: "<< endl ;
426 const DetLayer *initialLayer =
theService->detLayerGeometry()->idToLayer( seedDetId );
428 LogTrace(metname)<<
"Seed's detLayer: "<< endl ;
431 LogTrace(metname)<<
"TrajectoryStateOnSurface before propagation:" << endl;
438 vector<const DetLayer*> detLayers;
441 detLayers =
theService->muonNavigationSchool()->compatibleLayers(*initialLayer, *initialState.
freeState(),detLayerOrder);
447 edm::LogError(metname) <<
"No Properly Navigation Selected!!"<<endl;
450 LogTrace(metname) <<
"There are "<< detLayers.size() <<
" compatible layers"<<endl;
454 if(!detLayers.empty()){
456 LogTrace(metname) <<
"Compatible layers:"<<endl;
457 for( vector<const DetLayer*>::const_iterator layer = detLayers.begin();
458 layer != detLayers.end(); layer++){
459 LogTrace(metname) << debug.
dumpMuonId((*layer)->basicComponents().front()->geographicalId());
463 const DetLayer* finalLayer = detLayers.back();
466 else LogTrace(metname) <<
"Most external one:"<<endl;
477 LogTrace(metname) <<
"Trajectory State on Surface after the extrapolation"<<endl;
482 LogTrace(metname)<<
"Extrapolation failed. Keep the original seed state" <<endl;
485 LogTrace(metname)<<
"No compatible layers. Keep the original seed state" <<endl;
bool empty() const
True if trajectory has no measurements.
T getParameter(std::string const &) const
ConstRecHitPointer const & recHit() const
SeedTransformer * theSeedTransformer
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
StandAloneMuonFilter * theFilter
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
void refit(const TrajectoryStateOnSurface &initialState, const DetLayer *, Trajectory &trajectory)
Perform the inner-outward fitting.
int getDTChamberUsed() const
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
StandAloneMuonFilter * theBWFilter
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
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
unsigned int detId() const
RefitResult refit(const Trajectory &)
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
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 ...
std::pair< const DetLayer *, TrajectoryStateOnSurface > DetLayerWithState
PTrajectoryStateOnDet const & startingState() const
int getGEMChamberUsed() const
int getGEMCompatibleChambers() const
int getCSCChamberUsed() const
int getME0CompatibleChambers() const
StandAloneMuonFilter * filter() const
pre-filter
const MuonServiceProxy * theService
int getTotalCompatibleChambers() const
std::string theSeedPropagatorName
Propagator for the seed extrapolation.
void setEvent(const edm::Event &event) override
Pass the Event to the algo at each event.
StandAloneMuonRefitter * theRefitter
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)