CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
*, TrajectoryStateOnSurface
DetLayerWithState
 
- Public Types inherited from MuonTrajectoryBuilder
typedef
MuonCandidate::CandidateContainer 
CandidateContainer
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
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...
 
virtual void setEvent (const edm::Event &event)
 Pass the Event to the algo at each event. More...
 
 StandAloneMuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *)
 Constructor with Parameter set and MuonServiceProxy. More...
 
TrajectoryContainer trajectories (const TrajectorySeed &)
 return a container of the reconstructed trajectories compatible with a given seed More...
 
virtual CandidateContainer trajectories (const TrackCand &)
 dummy implementation, unused in this class More...
 
virtual ~StandAloneMuonTrajectoryBuilder ()
 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
 
StandAloneMuonFiltertheBWFilter
 
std::string theBWSeedType
 
StandAloneMuonFiltertheFilter
 
std::string theNavigationType
 
StandAloneMuonRefittertheRefitter
 
recoMuon::SeedPosition theSeedPosition
 
std::string theSeedPropagatorName
 Propagator for the seed extrapolation. More...
 
SeedTransformertheSeedTransformer
 
const MuonServiceProxytheService
 

Detailed Description

Definition at line 26 of file StandAloneTrajectoryBuilder.h.

Member Typedef Documentation

Definition at line 29 of file StandAloneTrajectoryBuilder.h.

Constructor & Destructor Documentation

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

Constructor with Parameter set and MuonServiceProxy.

Definition at line 41 of file StandAloneTrajectoryBuilder.cc.

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

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

Destructor.

Definition at line 109 of file StandAloneTrajectoryBuilder.cc.

References doBackwardFilter, doRefit, LogTrace, theBWFilter, theFilter, theRefitter, and theSeedTransformer.

109  {
110 
111  LogTrace("Muon|RecoMuon|StandAloneMuonTrajectoryBuilder")
112  << "StandAloneMuonTrajectoryBuilder destructor called" << endl;
113 
114  if(theFilter) delete theFilter;
116  if(doRefit && theRefitter) delete theRefitter;
118 }
#define LogTrace(id)

Member Function Documentation

StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::bwfilter ( ) const
inline

actual filter

Definition at line 49 of file StandAloneTrajectoryBuilder.h.

References theBWFilter.

Referenced by trajectories().

49 {return theBWFilter;}
StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::filter ( ) const
inline

pre-filter

Definition at line 46 of file StandAloneTrajectoryBuilder.h.

References theFilter.

Referenced by trajectories().

46 {return theFilter;}
StandAloneMuonTrajectoryBuilder::DetLayerWithState StandAloneMuonTrajectoryBuilder::propagateTheSeedTSOS ( TrajectoryStateOnSurface aTSOS,
DetId aDetId 
)
private

Definition at line 405 of file StandAloneTrajectoryBuilder.cc.

References alongMomentum, DirectMuonNavigation::compatibleLayers(), DetLayer::compatibleLayers(), debug, MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), MuonPatternRecoDumper::dumpTSOS(), TrajectoryStateOnSurface::freeState(), recoMuon::in, TrajectoryStateOnSurface::isValid(), LogTrace, metname, FreeTrajectoryState::momentum(), oppositeToMomentum, PV3DBase< T, PVType, FrameType >::perp(), query::result, GeometricSearchDet::surface(), theNavigationType, theSeedPosition, theSeedPropagatorName, and theService.

Referenced by trajectories().

405  {
406 
407  const std::string metname = "Muon|RecoMuon|StandAloneMuonTrajectoryBuilder";
409 
410  DetId seedDetId(aDetId);
411  // const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
412 
413  TrajectoryStateOnSurface initialState(aTSOS);
414 
415  LogTrace(metname)<<"Seed's Pt: "<<initialState.freeState()->momentum().perp()<<endl;
416 
417  LogTrace(metname)<< "Seed's id: "<< endl ;
418  LogTrace(metname) << debug.dumpMuonId(seedDetId);
419 
420  // Get the layer on which the seed relies
421  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
422 
423  LogTrace(metname)<< "Seed's detLayer: "<< endl ;
424  LogTrace(metname) << debug.dumpLayer(initialLayer);
425 
426  LogTrace(metname)<< "TrajectoryStateOnSurface before propagation:" << endl;
427  LogTrace(metname) << debug.dumpTSOS(initialState);
428 
429 
431 
432  // ask for compatible layers
433  vector<const DetLayer*> detLayers;
434 
435  if(theNavigationType == "Standard")
436  detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder);
437  else if (theNavigationType == "Direct"){
438  DirectMuonNavigation navigation( &*theService->detLayerGeometry() );
439  detLayers = navigation.compatibleLayers( *initialState.freeState(),detLayerOrder);
440  }
441  else
442  edm::LogError(metname) << "No Properly Navigation Selected!!"<<endl;
443 
444 
445  LogTrace(metname) << "There are "<< detLayers.size() <<" compatible layers"<<endl;
446 
447  DetLayerWithState result = DetLayerWithState(initialLayer,initialState);
448 
449  if(detLayers.size()){
450 
451  LogTrace(metname) << "Compatible layers:"<<endl;
452  for( vector<const DetLayer*>::const_iterator layer = detLayers.begin();
453  layer != detLayers.end(); layer++){
454  LogTrace(metname) << debug.dumpMuonId((*layer)->basicComponents().front()->geographicalId());
455  LogTrace(metname) << debug.dumpLayer(*layer);
456  }
457 
458  const DetLayer* finalLayer = detLayers.back();
459 
460  if(theSeedPosition == recoMuon::in) LogTrace(metname) << "Most internal one:"<<endl;
461  else LogTrace(metname) << "Most external one:"<<endl;
462 
463  LogTrace(metname) << debug.dumpLayer(finalLayer);
464 
465  const TrajectoryStateOnSurface propagatedState =
466  theService->propagator(theSeedPropagatorName)->propagate(initialState,
467  finalLayer->surface());
468 
469  if(propagatedState.isValid()){
470  result = DetLayerWithState(finalLayer,propagatedState);
471 
472  LogTrace(metname) << "Trajectory State on Surface after the extrapolation"<<endl;
473  LogTrace(metname) << debug.dumpTSOS(propagatedState);
474  LogTrace(metname) << debug.dumpLayer(finalLayer);
475  }
476  else
477  LogTrace(metname)<< "Extrapolation failed. Keep the original seed state" <<endl;
478  }
479  else
480  LogTrace(metname)<< "No compatible layers. Keep the original seed state" <<endl;
481 
482  return result;
483 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::string dumpLayer(const DetLayer *layer) const
const std::string metname
PropagationDirection
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
tuple result
Definition: query.py:137
#define LogTrace(id)
std::pair< const DetLayer *, TrajectoryStateOnSurface > DetLayerWithState
Definition: DetId.h:20
std::vector< const DetLayer * > compatibleLayers(NavigationDirection direction) const
Definition: DetLayer.cc:60
std::string theSeedPropagatorName
Propagator for the seed extrapolation.
#define debug
Definition: MEtoEDMFormat.h:34
StandAloneMuonRefitter* StandAloneMuonTrajectoryBuilder::refitter ( ) const
inline

refitter of the hits container

Definition at line 52 of file StandAloneTrajectoryBuilder.h.

References theRefitter.

Referenced by trajectories().

52 {return theRefitter;}
void StandAloneMuonTrajectoryBuilder::setEvent ( const edm::Event event)
virtual

Pass the Event to the algo at each event.

Implements MuonTrajectoryBuilder.

Definition at line 104 of file StandAloneTrajectoryBuilder.cc.

References doBackwardFilter, StandAloneMuonFilter::setEvent(), theBWFilter, and theFilter.

Referenced by ExhaustiveMuonTrajectoryBuilder::setEvent().

104  {
105  theFilter->setEvent(event);
107 }
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
MuonTrajectoryBuilder::TrajectoryContainer StandAloneMuonTrajectoryBuilder::trajectories ( const TrajectorySeed )
virtual

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

Implements MuonTrajectoryBuilder.

Definition at line 130 of file StandAloneTrajectoryBuilder.cc.

References alongMomentum, bwfilter(), StandAloneMuonFilter::createDefaultTrajectory(), debug, PTrajectoryStateOnDet::detId(), doBackwardFilter, doRefit, doSeedRefit, MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), MuonPatternRecoDumper::dumpTSOS(), Trajectory::empty(), filter(), Trajectory::foundHits(), TrajectoryStateOnSurface::freeState(), StandAloneMuonFilter::getCSCChamberUsed(), StandAloneMuonFilter::getCSCCompatibleChambers(), StandAloneMuonFilter::getDTChamberUsed(), StandAloneMuonFilter::getDTCompatibleChambers(), 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(), SeedTransformer::seedTransform(), SeedTransformer::seedTransientState(), SeedTransformer::setServices(), TrajectorySeed::startingState(), theBWSeedType, theSeedPosition, theSeedTransformer, and theService.

Referenced by ExhaustiveMuonTrajectoryBuilder::trajectories().

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

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 43 of file StandAloneTrajectoryBuilder.h.

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

Member Data Documentation

bool StandAloneMuonTrajectoryBuilder::doBackwardFilter
private
bool StandAloneMuonTrajectoryBuilder::doRefit
private
bool StandAloneMuonTrajectoryBuilder::doSeedRefit
private

Definition at line 83 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::theBWFilter
private
std::string StandAloneMuonTrajectoryBuilder::theBWSeedType
private

Definition at line 84 of file StandAloneTrajectoryBuilder.h.

Referenced by StandAloneMuonTrajectoryBuilder(), and trajectories().

StandAloneMuonFilter* StandAloneMuonTrajectoryBuilder::theFilter
private
std::string StandAloneMuonTrajectoryBuilder::theNavigationType
private

Navigation type "Direct","Standard"

Definition at line 67 of file StandAloneTrajectoryBuilder.h.

Referenced by propagateTheSeedTSOS(), and StandAloneMuonTrajectoryBuilder().

StandAloneMuonRefitter* StandAloneMuonTrajectoryBuilder::theRefitter
private
recoMuon::SeedPosition StandAloneMuonTrajectoryBuilder::theSeedPosition
private
std::string StandAloneMuonTrajectoryBuilder::theSeedPropagatorName
private

Propagator for the seed extrapolation.

Definition at line 72 of file StandAloneTrajectoryBuilder.h.

Referenced by propagateTheSeedTSOS(), and StandAloneMuonTrajectoryBuilder().

SeedTransformer* StandAloneMuonTrajectoryBuilder::theSeedTransformer
private
const MuonServiceProxy* StandAloneMuonTrajectoryBuilder::theService
private