CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
StandAloneMuonTrajectoryBuilder Class Reference

#include <StandAloneTrajectoryBuilder.h>

Inheritance diagram for StandAloneMuonTrajectoryBuilder:
MuonTrajectoryBuilder

Public Types

typedef std::pair< const DetLayer *, TrajectoryStateOnSurfaceDetLayerWithState
 
- Public Types inherited from MuonTrajectoryBuilder
typedef MuonCandidate::CandidateContainer CandidateContainer
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
typedef MuonCandidate::TrajectoryContainer TrajectoryContainer
 

Public Member Functions

StandAloneMuonFilterbwfilter () const
 actual filter More...
 
StandAloneMuonFilterfilter () const
 pre-filter More...
 
StandAloneMuonRefitterrefitter () const
 refitter of the hits container More...
 
void setEvent (const edm::Event &event) override
 Pass the Event to the algo at each event. More...
 
 StandAloneMuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &iC)
 Constructor with Parameter set and MuonServiceProxy. More...
 
TrajectoryContainer trajectories (const TrajectorySeed &) override
 return a container of the reconstructed trajectories compatible with a given seed More...
 
CandidateContainer trajectories (const TrackCand &) override
 dummy implementation, unused in this class More...
 
 ~StandAloneMuonTrajectoryBuilder () override
 Destructor. More...
 
- Public Member Functions inherited from MuonTrajectoryBuilder
 MuonTrajectoryBuilder ()
 constructor More...
 
virtual ~MuonTrajectoryBuilder ()
 destructor More...
 

Private Member Functions

DetLayerWithState propagateTheSeedTSOS (TrajectoryStateOnSurface &aTSOS, DetId &aDetId)
 

Private Attributes

bool doBackwardFilter
 
bool doRefit
 
bool doSeedRefit
 
std::unique_ptr< StandAloneMuonFiltertheBWFilter
 
std::string theBWSeedType
 
std::unique_ptr< StandAloneMuonFiltertheFilter
 
std::string theNavigationType
 
std::unique_ptr< StandAloneMuonRefittertheRefitter
 
recoMuon::SeedPosition theSeedPosition
 
std::string theSeedPropagatorName
 Propagator for the seed extrapolation. More...
 
std::unique_ptr< SeedTransformertheSeedTransformer
 
const MuonServiceProxytheService
 

Detailed Description

Definition at line 26 of file StandAloneTrajectoryBuilder.h.

Member Typedef Documentation

◆ DetLayerWithState

Definition at line 28 of file StandAloneTrajectoryBuilder.h.

Constructor & Destructor Documentation

◆ StandAloneMuonTrajectoryBuilder()

StandAloneMuonTrajectoryBuilder::StandAloneMuonTrajectoryBuilder ( const edm::ParameterSet par,
const MuonServiceProxy service,
edm::ConsumesCollector iC 
)

Constructor with Parameter set and MuonServiceProxy.

Definition at line 41 of file StandAloneTrajectoryBuilder.cc.

References edm::ParameterSet::addParameter(), doBackwardFilter, doRefit, doSeedRefit, Exception, edm::ParameterSet::getParameter(), recoMuon::in, LogTrace, metname, recoMuon::out, AlCaHLTBitMon_QueryRunRegistry::string, theBWFilter, theBWSeedType, theFilter, theNavigationType, theRefitter, theSeedPosition, theSeedPropagatorName, theSeedTransformer, and theService.

44  : theService(service) {
45  const std::string metname = "Muon|RecoMuon|StandAloneMuonTrajectoryBuilder";
46 
47  LogTrace(metname) << "constructor called" << endl;
48 
49  // The navigation type:
50  // "Direct","Standard"
51  theNavigationType = par.getParameter<string>("NavigationType");
52 
53  // The inward-outward fitter (starts from seed state)
54  ParameterSet filterPSet = par.getParameter<ParameterSet>("FilterParameters");
55  filterPSet.addParameter<string>("NavigationType", theNavigationType);
56  theFilter = std::make_unique<StandAloneMuonFilter>(filterPSet, theService, iC);
57 
58  // Fit direction
59  string seedPosition = par.getParameter<string>("SeedPosition");
60 
61  if (seedPosition == "in")
63  else if (seedPosition == "out")
65  else
66  throw cms::Exception("StandAloneMuonFilter constructor")
67  << "Wrong seed position chosen in StandAloneMuonFilter::StandAloneMuonFilter ParameterSet"
68  << "\n"
69  << "Possible choices are:"
70  << "\n"
71  << "SeedPosition = in or SeedPosition = out";
72 
73  // Propagator for the seed extrapolation
74  theSeedPropagatorName = par.getParameter<string>("SeedPropagator");
75 
76  // Disable/Enable the backward filter
77  doBackwardFilter = par.getParameter<bool>("DoBackwardFilter");
78 
79  // Disable/Enable the refit of the trajectory
80  doRefit = par.getParameter<bool>("DoRefit");
81 
82  // Disable/Enable the refit of the trajectory seed
83  doSeedRefit = par.getParameter<bool>("DoSeedRefit");
84 
85  if (doBackwardFilter) {
86  // The outward-inward fitter (starts from theFilter outermost state)
87  ParameterSet bwFilterPSet = par.getParameter<ParameterSet>("BWFilterParameters");
88  // theBWFilter = new StandAloneMuonBackwardFilter(bwFilterPSet,theService); // FIXME
89  bwFilterPSet.addParameter<string>("NavigationType", theNavigationType);
90  theBWFilter = std::make_unique<StandAloneMuonFilter>(bwFilterPSet, theService, iC);
91 
92  theBWSeedType = bwFilterPSet.getParameter<string>("BWSeedType");
93  }
94 
95  if (doRefit) {
96  // The outward-inward fitter (starts from theBWFilter innermost state)
97  ParameterSet refitterPSet = par.getParameter<ParameterSet>("RefitterParameters");
98  theRefitter = std::make_unique<StandAloneMuonRefitter>(refitterPSet, iC, theService);
99  }
100 
101  // The seed transformer (used to refit the seed and get the seed transient state)
102  // ParameterSet seedTransformerPSet = par.getParameter<ParameterSet>("SeedTransformerParameters");
103  ParameterSet seedTransformerParameters = par.getParameter<ParameterSet>("SeedTransformerParameters");
104  theSeedTransformer = std::make_unique<SeedTransformer>(seedTransformerParameters, iC);
105 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::string metname
#define LogTrace(id)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
std::unique_ptr< StandAloneMuonFilter > theBWFilter
std::unique_ptr< StandAloneMuonFilter > theFilter
std::unique_ptr< StandAloneMuonRefitter > theRefitter
std::string theSeedPropagatorName
Propagator for the seed extrapolation.
std::unique_ptr< SeedTransformer > theSeedTransformer

◆ ~StandAloneMuonTrajectoryBuilder()

StandAloneMuonTrajectoryBuilder::~StandAloneMuonTrajectoryBuilder ( )
override

Destructor.

Definition at line 113 of file StandAloneTrajectoryBuilder.cc.

References LogTrace.

113  {
114  LogTrace("Muon|RecoMuon|StandAloneMuonTrajectoryBuilder")
115  << "StandAloneMuonTrajectoryBuilder destructor called" << endl;
116 }
#define LogTrace(id)

Member Function Documentation

◆ bwfilter()

StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::bwfilter ( ) const
inline

actual filter

Definition at line 48 of file StandAloneTrajectoryBuilder.h.

References theBWFilter.

Referenced by trajectories().

48 { return theBWFilter.get(); }
std::unique_ptr< StandAloneMuonFilter > theBWFilter

◆ filter()

StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::filter ( ) const
inline

pre-filter

Definition at line 45 of file StandAloneTrajectoryBuilder.h.

References theFilter.

Referenced by trajectories().

45 { return theFilter.get(); }
std::unique_ptr< StandAloneMuonFilter > theFilter

◆ propagateTheSeedTSOS()

StandAloneMuonTrajectoryBuilder::DetLayerWithState StandAloneMuonTrajectoryBuilder::propagateTheSeedTSOS ( TrajectoryStateOnSurface aTSOS,
DetId aDetId 
)
private

Definition at line 383 of file StandAloneTrajectoryBuilder.cc.

References alongMomentum, DirectMuonNavigation::compatibleLayers(), debug, TrajectoryStateOnSurface::freeState(), recoMuon::in, TrajectoryStateOnSurface::isValid(), phase1PixelTopology::layer, LogTrace, metname, FreeTrajectoryState::momentum(), oppositeToMomentum, PV3DBase< T, PVType, FrameType >::perp(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, GeometricSearchDet::surface(), theNavigationType, theSeedPosition, theSeedPropagatorName, and theService.

Referenced by trajectories().

384  {
385  const std::string metname = "Muon|RecoMuon|StandAloneMuonTrajectoryBuilder";
387 
388  DetId seedDetId(aDetId);
389  // const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
390 
391  TrajectoryStateOnSurface initialState(aTSOS);
392 
393  LogTrace(metname) << "Seed's Pt: " << initialState.freeState()->momentum().perp() << endl;
394 
395  LogTrace(metname) << "Seed's id: " << endl;
396  LogTrace(metname) << debug.dumpMuonId(seedDetId);
397 
398  // Get the layer on which the seed relies
399  const DetLayer* initialLayer = theService->detLayerGeometry()->idToLayer(seedDetId);
400 
401  LogTrace(metname) << "Seed's detLayer: " << endl;
402  LogTrace(metname) << debug.dumpLayer(initialLayer);
403 
404  LogTrace(metname) << "TrajectoryStateOnSurface before propagation:" << endl;
405  LogTrace(metname) << debug.dumpTSOS(initialState);
406 
408 
409  // ask for compatible layers
410  vector<const DetLayer*> detLayers;
411 
412  if (theNavigationType == "Standard")
413  detLayers =
414  theService->muonNavigationSchool()->compatibleLayers(*initialLayer, *initialState.freeState(), detLayerOrder);
415  else if (theNavigationType == "Direct") {
416  DirectMuonNavigation navigation(&*theService->detLayerGeometry());
417  detLayers = navigation.compatibleLayers(*initialState.freeState(), detLayerOrder);
418  } else
419  edm::LogError(metname) << "No Properly Navigation Selected!!" << endl;
420 
421  LogTrace(metname) << "There are " << detLayers.size() << " compatible layers" << endl;
422 
423  DetLayerWithState result = DetLayerWithState(initialLayer, initialState);
424 
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());
429  LogTrace(metname) << debug.dumpLayer(*layer);
430  }
431 
432  const DetLayer* finalLayer = detLayers.back();
433 
435  LogTrace(metname) << "Most internal one:" << endl;
436  else
437  LogTrace(metname) << "Most external one:" << endl;
438 
439  LogTrace(metname) << debug.dumpLayer(finalLayer);
440 
441  const TrajectoryStateOnSurface propagatedState =
442  theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
443 
444  if (propagatedState.isValid()) {
445  result = DetLayerWithState(finalLayer, propagatedState);
446 
447  LogTrace(metname) << "Trajectory State on Surface after the extrapolation" << endl;
448  LogTrace(metname) << debug.dumpTSOS(propagatedState);
449  LogTrace(metname) << debug.dumpLayer(finalLayer);
450  } else
451  LogTrace(metname) << "Extrapolation failed. Keep the original seed state" << endl;
452  } else
453  LogTrace(metname) << "No compatible layers. Keep the original seed state" << endl;
454 
455  return result;
456 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
const std::string metname
PropagationDirection
Log< level::Error, false > LogError
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
std::string theSeedPropagatorName
Propagator for the seed extrapolation.
std::pair< const DetLayer *, TrajectoryStateOnSurface > DetLayerWithState

◆ refitter()

StandAloneMuonRefitter* StandAloneMuonTrajectoryBuilder::refitter ( ) const
inline

refitter of the hits container

Definition at line 51 of file StandAloneTrajectoryBuilder.h.

References theRefitter.

Referenced by trajectories().

51 { return theRefitter.get(); }
std::unique_ptr< StandAloneMuonRefitter > theRefitter

◆ setEvent()

void StandAloneMuonTrajectoryBuilder::setEvent ( const edm::Event event)
overridevirtual

Pass the Event to the algo at each event.

Implements MuonTrajectoryBuilder.

Definition at line 107 of file StandAloneTrajectoryBuilder.cc.

References doBackwardFilter, theBWFilter, and theFilter.

Referenced by ExhaustiveMuonTrajectoryBuilder::setEvent().

107  {
108  theFilter->setEvent(event);
109  if (doBackwardFilter)
110  theBWFilter->setEvent(event);
111 }
std::unique_ptr< StandAloneMuonFilter > theBWFilter
std::unique_ptr< StandAloneMuonFilter > theFilter
Definition: event.py:1

◆ trajectories() [1/2]

MuonTrajectoryBuilder::TrajectoryContainer StandAloneMuonTrajectoryBuilder::trajectories ( const TrajectorySeed )
overridevirtual

return a container of the reconstructed trajectories compatible with a given seed

Implements MuonTrajectoryBuilder.

Definition at line 129 of file StandAloneTrajectoryBuilder.cc.

References alongMomentum, bwfilter(), StandAloneMuonFilter::createDefaultTrajectory(), debug, doBackwardFilter, doRefit, doSeedRefit, Trajectory::empty(), filter(), Trajectory::foundHits(), TrajectoryStateOnSurface::freeState(), StandAloneMuonFilter::getCSCChamberUsed(), StandAloneMuonFilter::getCSCCompatibleChambers(), StandAloneMuonFilter::getDTChamberUsed(), StandAloneMuonFilter::getDTCompatibleChambers(), StandAloneMuonFilter::getGEMChamberUsed(), StandAloneMuonFilter::getGEMCompatibleChambers(), StandAloneMuonFilter::getME0ChamberUsed(), StandAloneMuonFilter::getME0CompatibleChambers(), StandAloneMuonFilter::getRPCChamberUsed(), StandAloneMuonFilter::getRPCCompatibleChambers(), StandAloneMuonFilter::getTotalCompatibleChambers(), recoMuon::in, StandAloneMuonFilter::lastCompatibleTSOS(), Trajectory::lastMeasurement(), StandAloneMuonFilter::lastUpdatedTSOS(), LogTrace, metname, FreeTrajectoryState::momentum(), oppositeToMomentum, trajectoryStateTransform::persistentState(), propagateTheSeedTSOS(), TrajectoryMeasurement::recHit(), StandAloneMuonRefitter::refit(), StandAloneMuonFilter::refit(), refitter(), fileCollector::seed, AlCaHLTBitMon_QueryRunRegistry::string, theBWSeedType, theSeedPosition, theSeedTransformer, and theService.

Referenced by ExhaustiveMuonTrajectoryBuilder::trajectories().

129  {
130  Resetter fwReset(filter());
131  Resetter bwReset(bwfilter());
132 
133  const std::string metname = "Muon|RecoMuon|StandAloneMuonTrajectoryBuilder";
135 
136  // Set the services for the seed transformer
137  theSeedTransformer->setServices(theService->eventSetup());
138 
139  // the trajectory container. In principle starting from one seed we can
140  // obtain more than one trajectory. TODO: this feature is not yet implemented!
141  TrajectoryContainer trajectoryContainer;
142 
144  Trajectory trajectoryFW(seed, fwDirection);
145 
146  TrajectoryStateOnSurface lastTSOS;
147  DetId lastDetId;
148 
149  vector<Trajectory> seedTrajectories;
150 
151  if (doSeedRefit) {
152  seedTrajectories = theSeedTransformer->seedTransform(seed);
153  if (!seedTrajectories.empty()) {
154  TrajectoryMeasurement lastTM(seedTrajectories.front().lastMeasurement());
155  lastTSOS = lastTM.updatedState();
156  lastDetId = lastTM.recHit()->geographicalId();
157  }
158  }
159 
160  if (!doSeedRefit || seedTrajectories.empty()) {
161  lastTSOS = theSeedTransformer->seedTransientState(seed);
162  lastDetId = seed.startingState().detId();
163  }
164 
165  LogTrace(metname) << "Trajectory State on Surface before the extrapolation" << endl;
166  LogTrace(metname) << debug.dumpTSOS(lastTSOS);
167 
168  // Segment layer
169  LogTrace(metname) << "The RecSegment relies on: " << endl;
170  LogTrace(metname) << debug.dumpMuonId(lastDetId);
171 
172  DetLayerWithState inputFromSeed = propagateTheSeedTSOS(lastTSOS, lastDetId);
173 
174  // refine the FTS given by the seed
175 
176  // the trajectory is filled in the refitter::refit
177  filter()->refit(inputFromSeed.second, inputFromSeed.first, trajectoryFW);
178 
179  // "0th order" check...
180  if (trajectoryFW.empty()) {
181  LogTrace(metname) << "Forward trajectory EMPTY! No trajectory will be loaded!" << endl;
182  return trajectoryContainer;
183  }
184 
185  // Get the last TSOS
186  // TrajectoryStateOnSurface tsosAfterRefit = filter()->lastUpdatedTSOS(); // this is the last UPDATED TSOS
187  TrajectoryStateOnSurface tsosAfterRefit = filter()->lastCompatibleTSOS(); // this is the last COMPATIBLE TSOS
188 
189  LogTrace(metname) << "StandAloneMuonTrajectoryBuilder filter output " << endl;
190  LogTrace(metname) << debug.dumpTSOS(tsosAfterRefit);
191 
192  /*
193  // -- 1st attempt
194  if( filter()->isCompatibilitySatisfied() ) {
195  if( filter()->layers().size() ) // OR if( filter()->goodState() ) ??? Maybe when only RPC hits are used...
196  LogTrace(metname) << debug.dumpLayer( filter()->lastDetLayer() );
197  else {
198  LogTrace(metname) << "Compatibility satisfied, but all RecHits are invalid! A trajectory with only invalid hits will be loaded!" << endl;
199  trajectoryContainer.push_back(new Trajectory(trajectoryFW));
200  return trajectoryContainer;
201  }
202  }
203  else {
204  LogTrace(metname) << "Compatibility NOT satisfied after Forward filter! No trajectory will be loaded!" << endl;
205  LogTrace(metname) << "Total chambers: " << filter()->getTotalCompatibleChambers() << "; DT: "
206  << filter()->getDTCompatibleChambers() << "; CSC: " << filter()->getCSCCompatibleChambers() << endl;
207  return trajectoryContainer;
208  }
209  // -- end 1st attempt
210  */
211 
212  // -- 2nd attempt
213  if (filter()->goodState()) {
214  LogTrace(metname) << debug.dumpLayer(filter()->lastDetLayer());
215  } else if (filter()->isCompatibilitySatisfied()) {
216  int foundValidRh = trajectoryFW.foundHits(); // number of valid hits
217  LogTrace(metname) << "Compatibility satisfied after Forward filter, but too few valid RecHits (" << foundValidRh
218  << ")." << endl
219  << "A trajectory with only invalid RecHits will be loaded!" << endl;
220  if (!foundValidRh) {
221  trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
222  return trajectoryContainer;
223  }
224  Trajectory defaultTraj(seed, fwDirection);
225  filter()->createDefaultTrajectory(trajectoryFW, defaultTraj);
226  trajectoryContainer.push_back(std::make_unique<Trajectory>(defaultTraj));
227  return trajectoryContainer;
228  } else {
229  LogTrace(metname) << "Compatibility NOT satisfied after Forward filter! No trajectory will be loaded!" << endl;
230  LogTrace(metname) << "Total compatible chambers: " << filter()->getTotalCompatibleChambers()
231  << "; DT: " << filter()->getDTCompatibleChambers()
232  << "; CSC: " << filter()->getCSCCompatibleChambers()
233  << "; RPC: " << filter()->getRPCCompatibleChambers()
234  << "; GEM: " << filter()->getGEMCompatibleChambers()
235  << "; ME0: " << filter()->getME0CompatibleChambers() << endl;
236  return trajectoryContainer;
237  }
238  // -- end 2nd attempt
239 
240  LogTrace(metname) << "Number of DT/CSC/RPC/GEM/ME0 chamber used (fw): " << filter()->getDTChamberUsed() << "/"
241  << filter()->getCSCChamberUsed() << "/" << filter()->getRPCChamberUsed() << "/"
242  << filter()->getGEMChamberUsed() << "/" << filter()->getME0ChamberUsed() << endl;
243  LogTrace(metname) << "Momentum: " << tsosAfterRefit.freeState()->momentum();
244 
245  if (!doBackwardFilter) {
246  LogTrace(metname) << "Only forward refit requested. No backward refit will be performed!" << endl;
247 
248  // ***** Refit of fwd step *****
249  // if (doRefit && !trajectoryFW.empty() && filter()->goodState()){ // CHECK!!! Can trajectoryFW really be empty at this point??? And goodState...?
250  if (doRefit) {
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());
256  } else
257  trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
258  } else
259  trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryFW));
260 
261  LogTrace(metname) << "Trajectory saved" << endl;
262  return trajectoryContainer;
263  }
264 
265  // ***** Backward filtering *****
266 
267  TrajectorySeed seedForBW;
268 
269  if (theBWSeedType == "noSeed") {
270  } else if (theBWSeedType == "fromFWFit") {
272  tsosAfterRefit, trajectoryFW.lastMeasurement().recHit()->geographicalId().rawId());
273 
274  edm::OwnVector<TrackingRecHit> recHitsContainer;
276  TrajectorySeed fwFit(seedTSOS, recHitsContainer, seedDirection);
277 
278  seedForBW = fwFit;
279  } else if (theBWSeedType == "fromGenerator") {
280  seedForBW = seed;
281  } else
282  LogWarning(metname) << "Wrong seed type for the backward filter!";
283 
285  Trajectory trajectoryBW(seedForBW, bwDirection);
286 
287  // FIXME! under check!
288  bwfilter()->refit(tsosAfterRefit, filter()->lastDetLayer(), trajectoryBW);
289 
290  // Get the last TSOS
291  TrajectoryStateOnSurface tsosAfterBWRefit = bwfilter()->lastUpdatedTSOS();
292 
293  LogTrace(metname) << "StandAloneMuonTrajectoryBuilder BW filter output " << endl;
294  LogTrace(metname) << debug.dumpTSOS(tsosAfterBWRefit);
295 
296  LogTrace(metname) << "Number of RecHits: " << trajectoryBW.foundHits() << "\n"
297  << "Number of DT/CSC/RPC/GEM/ME0 chamber used (bw): " << bwfilter()->getDTChamberUsed() << "/"
298  << bwfilter()->getCSCChamberUsed() << "/" << bwfilter()->getRPCChamberUsed() << "/"
299  << bwfilter()->getGEMChamberUsed() << "/" << bwfilter()->getME0ChamberUsed();
300 
301  // -- The trajectory is "good" if there are at least 2 chambers used in total and at
302  // least 1 is "tracking" (DT or CSC)
303  // -- The trajectory satisfies the "compatibility" requirements if there are at least
304  // 2 compatible chambers (not necessarily used!) in total and at
305  // least 1 is "tracking" (DT or CSC)
306  // 1st attempt
307  /*
308  if (bwfilter()->isCompatibilitySatisfied()) {
309 
310  if (doRefit && !trajectoryBW.empty() && bwfilter()->goodState()){
311  pair<bool,Trajectory> refitResult = refitter()->refit(trajectoryBW);
312  if (refitResult.first){
313  trajectoryContainer.push_back(new Trajectory(refitResult.second));
314  LogTrace(metname) << "StandAloneMuonTrajectoryBuilder Refit output " << endl;
315  LogTrace(metname) << debug.dumpTSOS(refitResult.second.lastMeasurement().updatedState());
316  }
317  else
318  trajectoryContainer.push_back(new Trajectory(trajectoryBW));
319  }
320  else
321  trajectoryContainer.push_back(new Trajectory(trajectoryBW));
322 
323  LogTrace(metname)<< "Trajectory saved" << endl;
324 
325  }
326  //if the trajectory is not saved, but at least two chamber are used in the
327  //forward filtering, try to build a new trajectory starting from the old
328  //trajectory w/o the latest measurement and a looser chi2 cut
329  else if ( filter()->getTotalChamberUsed() >= 2 ) {
330  LogTrace(metname)<< "Trajectory NOT saved. Second Attempt." << endl;
331  // FIXME:
332  // a better choice could be: identify the poorest one, exclude it, redo
333  // the fw and bw filtering. Or maybe redo only the bw without the excluded
334  // measure. As first step I will port the ORCA algo, then I will move to the
335  // above pattern.
336 
337  }
338 
339  else {
340  LogTrace(metname) << "Compatibility NOT satisfied after Backward filter!" << endl;
341  LogTrace(metname) << "The result of Forward filter will be loaded!" << endl;
342 
343  trajectoryContainer.push_back(new Trajectory(trajectoryFW));
344  }
345  */
346  // end 1st attempt
347 
348  // 2nd attempt
349  if (bwfilter()->goodState()) {
350  LogTrace(metname) << debug.dumpLayer(bwfilter()->lastDetLayer());
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;
357  } else {
358  LogTrace(metname) << "Compatibility NOT satisfied after Backward filter!" << endl
359  << "The Forward trajectory will be invalidated and then loaded!" << endl;
360  Trajectory defaultTraj(seed, fwDirection);
361  filter()->createDefaultTrajectory(trajectoryFW, defaultTraj);
362  trajectoryContainer.push_back(std::make_unique<Trajectory>(defaultTraj));
363  return trajectoryContainer;
364  }
365  // end 2nd attempt
366 
367  if (doRefit) {
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());
373  } else
374  trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
375  } else
376  trajectoryContainer.push_back(std::make_unique<Trajectory>(trajectoryBW));
377 
378  LogTrace(metname) << "Trajectory saved" << endl;
379 
380  return trajectoryContainer;
381 }
void createDefaultTrajectory(const Trajectory &, Trajectory &)
const std::string metname
int getGEMCompatibleChambers() const
int getME0CompatibleChambers() const
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
MuonCandidate::TrajectoryContainer TrajectoryContainer
StandAloneMuonFilter * bwfilter() const
actual filter
PropagationDirection
void refit(const TrajectoryStateOnSurface &initialState, const DetLayer *, Trajectory &trajectory)
Perform the inner-outward fitting.
#define LogTrace(id)
StandAloneMuonFilter * filter() const
pre-filter
TrajectoryStateOnSurface lastUpdatedTSOS() const
the Trajectory state on the last surface of the fitting
GlobalVector momentum() 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
int getDTCompatibleChambers() const
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
int getCSCCompatibleChambers() const
int getTotalCompatibleChambers() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
std::pair< const DetLayer *, TrajectoryStateOnSurface > DetLayerWithState
Log< level::Warning, false > LogWarning
std::unique_ptr< SeedTransformer > theSeedTransformer
DetLayerWithState propagateTheSeedTSOS(TrajectoryStateOnSurface &aTSOS, DetId &aDetId)

◆ trajectories() [2/2]

CandidateContainer StandAloneMuonTrajectoryBuilder::trajectories ( const TrackCand )
inlineoverridevirtual

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 42 of file StandAloneTrajectoryBuilder.h.

42 { return CandidateContainer(); }
MuonCandidate::CandidateContainer CandidateContainer

Member Data Documentation

◆ doBackwardFilter

bool StandAloneMuonTrajectoryBuilder::doBackwardFilter
private

◆ doRefit

bool StandAloneMuonTrajectoryBuilder::doRefit
private

Definition at line 78 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

◆ doSeedRefit

bool StandAloneMuonTrajectoryBuilder::doSeedRefit
private

Definition at line 79 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

◆ theBWFilter

std::unique_ptr<StandAloneMuonFilter> StandAloneMuonTrajectoryBuilder::theBWFilter
private

◆ theBWSeedType

std::string StandAloneMuonTrajectoryBuilder::theBWSeedType
private

Definition at line 80 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

◆ theFilter

std::unique_ptr<StandAloneMuonFilter> StandAloneMuonTrajectoryBuilder::theFilter
private

Definition at line 70 of file StandAloneTrajectoryBuilder.h.

Referenced by filter(), setEvent(), and StandAloneMuonTrajectoryBuilder().

◆ theNavigationType

std::string StandAloneMuonTrajectoryBuilder::theNavigationType
private

Navigation type "Direct","Standard"

Definition at line 63 of file StandAloneTrajectoryBuilder.h.

Referenced by propagateTheSeedTSOS(), and StandAloneMuonTrajectoryBuilder().

◆ theRefitter

std::unique_ptr<StandAloneMuonRefitter> StandAloneMuonTrajectoryBuilder::theRefitter
private

Definition at line 74 of file StandAloneTrajectoryBuilder.h.

Referenced by refitter(), and StandAloneMuonTrajectoryBuilder().

◆ theSeedPosition

recoMuon::SeedPosition StandAloneMuonTrajectoryBuilder::theSeedPosition
private

◆ theSeedPropagatorName

std::string StandAloneMuonTrajectoryBuilder::theSeedPropagatorName
private

Propagator for the seed extrapolation.

Definition at line 68 of file StandAloneTrajectoryBuilder.h.

Referenced by propagateTheSeedTSOS(), and StandAloneMuonTrajectoryBuilder().

◆ theSeedTransformer

std::unique_ptr<SeedTransformer> StandAloneMuonTrajectoryBuilder::theSeedTransformer
private

Definition at line 75 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

◆ theService

const MuonServiceProxy* StandAloneMuonTrajectoryBuilder::theService
private