CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
GlobalTrajectoryBuilderBase Class Referenceabstract

#include <GlobalTrajectoryBuilderBase.h>

Inheritance diagram for GlobalTrajectoryBuilderBase:
MuonTrajectoryBuilder GlobalMuonTrajectoryBuilder L3MuonTrajectoryBuilder

Classes

struct  ComparatorInOut
 

Public Types

typedef
MuonTransientTrackingRecHit::ConstMuonRecHitContainer 
ConstMuonRecHitContainer
 
typedef
MuonTransientTrackingRecHit::ConstMuonRecHitPointer 
ConstMuonRecHitPointer
 
typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer
 
typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 
typedef
MuonTransientTrackingRecHit::MuonRecHitContainer 
MuonRecHitContainer
 
typedef
MuonTransientTrackingRecHit::MuonRecHitPointer 
MuonRecHitPointer
 
typedef
TransientTrackingRecHit::RecHitContainer 
RecHitContainer
 
typedef
TransientTrackingRecHit::RecHitPointer 
RecHitPointer
 
typedef std::vector< TrajectoryTC
 
typedef TC::const_iterator TI
 
- Public Types inherited from MuonTrajectoryBuilder
typedef
MuonCandidate::CandidateContainer 
CandidateContainer
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
typedef
MuonCandidate::TrajectoryContainer 
TrajectoryContainer
 

Public Member Functions

 GlobalTrajectoryBuilderBase (const edm::ParameterSet &, const MuonServiceProxy *)
 constructor with Parameter Set and MuonServiceProxy More...
 
virtual void setEvent (const edm::Event &)
 pass the Event to the algo at each event More...
 
MuonTrajectoryBuilder::TrajectoryContainer trajectories (const TrajectorySeed &)
 dummy implementation, unused in this class More...
 
virtual ~GlobalTrajectoryBuilderBase ()
 destructor More...
 
- Public Member Functions inherited from MuonTrajectoryBuilder
 MuonTrajectoryBuilder ()
 constructor More...
 
virtual CandidateContainer trajectories (const TrackCand &)=0
 return a container reconstructed muons starting from a given track More...
 
virtual ~MuonTrajectoryBuilder ()
 destructor More...
 

Protected Types

enum  RefitDirection { inToOut, outToIn, undetermined }
 

Protected Member Functions

void addTraj (TrackCand &)
 if TrackCand has only a TrackRef, attempt to add Trajectory* More...
 
MuonTrajectoryBuilder::CandidateContainer build (const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
 build combined trajectory from sta Track and tracker RecHits More...
 
void checkMuonHits (const reco::Track &, ConstRecHitContainer &, ConstRecHitContainer &, std::vector< int > &) const
 check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit More...
 
RefitDirection checkRecHitsOrdering (const ConstRecHitContainer &) const
 This does nothing now. More...
 
std::vector< TrackCandchooseRegionalTrackerTracks (const TrackCand &, const std::vector< TrackCand > &)
 choose tracker tracks within region of interest More...
 
const TrajectorychooseTrajectory (const std::vector< Trajectory * > &, int) const
 choose final trajectory More...
 
RectangularEtaPhiTrackingRegion defineRegionOfInterest (const reco::TrackRef &) const
 define region of interest with tracker More...
 
void fixTEC (ConstRecHitContainer &all, double scl_x, double scl_y) const
 rescale errors of outermost TEC RecHit More...
 
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits (const reco::Track &) const
 get transient RecHits of a Track More...
 
virtual std::vector< TrackCandmakeTkCandCollection (const TrackCand &)=0
 make a TrackCand collection using tracker Track, Trajectory information More...
 
void printHits (const ConstRecHitContainer &) const
 print all RecHits of a trajectory More...
 
ConstRecHitContainer selectMuonHits (const Trajectory &, const std::vector< int > &) const
 select muon hits compatible with trajectory; check hits in chambers with showers More...
 
ConstRecHitContainer selectTrackerHits (const ConstRecHitContainer &) const
 select tracker hits; exclude some tracker hits in the global trajectory More...
 
const MuonServiceProxyservice () const
 
GlobalMuonTrackMatchertrackMatcher () const
 
double trackProbability (const Trajectory &) const
 calculate chi2 probability (-ln(P)) More...
 

Protected Attributes

std::string theCategory
 
float thePCut
 
float thePtCut
 

Private Attributes

unsigned long long theCacheId_TRH
 
const edm::EventtheEvent
 
GlobalMuonRefittertheGlbRefitter
 
MuonDetLayerMeasurementstheLayerMeasurements
 
int theMuonHitsOption
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
MuonTrackingRegionBuildertheRegionBuilder
 
bool theRPCInTheFit
 
const MuonServiceProxytheService
 
float theTECxScale
 
float theTECyScale
 
std::string theTrackerPropagatorName
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
GlobalMuonTrackMatchertheTrackMatcher
 
TrackTransformertheTrackTransformer
 
const TrackerTopologytTopo_
 

Detailed Description

Base class for GlobalMuonTrajectoryBuilder and L3MuonTrajectoryBuilder Provide common tools and interface to reconstruct muons starting from a muon track reconstructed in the standalone muon system (with DT, CSC and RPC information). It tries to reconstruct the corresponding track in the tracker and performs matching between the reconstructed tracks in the muon system and the tracker.

Date:
2013/01/06 19:16:51
Revision:
1.24
Author
N. Neumeister Purdue University
C. Liu Purdue University
A. Everett Purdue University

Definition at line 50 of file GlobalTrajectoryBuilderBase.h.

Member Typedef Documentation

Definition at line 62 of file GlobalTrajectoryBuilderBase.h.

Definition at line 60 of file GlobalTrajectoryBuilderBase.h.

Definition at line 55 of file GlobalTrajectoryBuilderBase.h.

Definition at line 57 of file GlobalTrajectoryBuilderBase.h.

Definition at line 61 of file GlobalTrajectoryBuilderBase.h.

Definition at line 59 of file GlobalTrajectoryBuilderBase.h.

Definition at line 54 of file GlobalTrajectoryBuilderBase.h.

Definition at line 56 of file GlobalTrajectoryBuilderBase.h.

Definition at line 64 of file GlobalTrajectoryBuilderBase.h.

typedef TC::const_iterator GlobalTrajectoryBuilderBase::TI

Definition at line 65 of file GlobalTrajectoryBuilderBase.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with Parameter Set and MuonServiceProxy

Definition at line 91 of file GlobalTrajectoryBuilderBase.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), GlobalMuonRefitter_cff::GlobalMuonRefitter, GlobalMuonTrackMatcher_cff::GlobalMuonTrackMatcher, theCacheId_TRH, theCategory, theGlbRefitter, theMuonHitsOption, theMuonRecHitBuilderName, thePCut, thePtCut, theRegionBuilder, theRPCInTheFit, theService, theTECxScale, theTECyScale, theTrackerPropagatorName, theTrackerRecHitBuilderName, theTrackMatcher, and theTrackTransformer.

92  :
94 
95  theCategory = par.getUntrackedParameter<string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalTrajectoryBuilderBase");
96 
97 
98  ParameterSet trackMatcherPSet = par.getParameter<ParameterSet>("GlobalMuonTrackMatcher");
99  theTrackMatcher = new GlobalMuonTrackMatcher(trackMatcherPSet,theService);
100 
101  theTrackerPropagatorName = par.getParameter<string>("TrackerPropagator");
102 
103  ParameterSet trackTransformerPSet = par.getParameter<ParameterSet>("TrackTransformer");
104  theTrackTransformer = new TrackTransformer(trackTransformerPSet);
105 
106  ParameterSet regionBuilderPSet = par.getParameter<ParameterSet>("MuonTrackingRegionBuilder");
107 
108  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet,theService);
109 
110  // TrackRefitter parameters
111  ParameterSet refitterParameters = par.getParameter<ParameterSet>("GlbRefitterParameters");
112  theGlbRefitter = new GlobalMuonRefitter(refitterParameters, theService);
113 
114  theMuonHitsOption = refitterParameters.getParameter<int>("MuonHitsOption");
115 
116  theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder");
117  theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder");
118 
119  theRPCInTheFit = par.getParameter<bool>("RefitRPCHits");
120 
121  theTECxScale = par.getParameter<double>("ScaleTECxFactor");
122  theTECyScale = par.getParameter<double>("ScaleTECyFactor");
123  thePtCut = par.getParameter<double>("PtCut");
124  thePCut = par.getParameter<double>("PCut");
125 
126  theCacheId_TRH = 0;
127 
128 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MuonDetLayerMeasurements * theLayerMeasurements
const MuonServiceProxy * service() const
GlobalMuonTrackMatcher * theTrackMatcher
MuonTrackingRegionBuilder * theRegionBuilder
GlobalTrajectoryBuilderBase::~GlobalTrajectoryBuilderBase ( )
virtual

destructor

Definition at line 134 of file GlobalTrajectoryBuilderBase.cc.

References theGlbRefitter, theRegionBuilder, theTrackMatcher, and theTrackTransformer.

134  {
135 
136  if (theTrackMatcher) delete theTrackMatcher;
139  if (theGlbRefitter) delete theGlbRefitter;
140 }
GlobalMuonTrackMatcher * theTrackMatcher
MuonTrackingRegionBuilder * theRegionBuilder

Member Function Documentation

void GlobalTrajectoryBuilderBase::addTraj ( TrackCand )
inlineprotected

if TrackCand has only a TrackRef, attempt to add Trajectory*

Definition at line 127 of file GlobalTrajectoryBuilderBase.h.

127 {}
MuonCandidate::CandidateContainer GlobalTrajectoryBuilderBase::build ( const TrackCand staCand,
MuonTrajectoryBuilder::CandidateContainer tkTrajs 
) const
protected

build combined trajectory from sta Track and tracker RecHits

Definition at line 176 of file GlobalTrajectoryBuilderBase.cc.

References checkRecHitsOrdering(), fixTEC(), getTransientRecHits(), LogDebug, LogTrace, MuonCandidate::muonTrack(), outToIn, mix_2012_Summer_inTimeOnly_cff::prob, GlobalMuonRefitter::refit(), selectTrackerHits(), Trajectory::setSeedRef(), theCategory, theGlbRefitter, theMuonHitsOption, thePCut, thePtCut, theService, theTECxScale, theTECyScale, theTrackTransformer, MuonCandidate::trackerTrack(), MuonCandidate::trackerTrajectory(), trackProbability(), MuonCandidate::trajectory(), TrackTransformer::transform(), and tTopo_.

Referenced by GlobalMuonTrajectoryBuilder::trajectories(), and L3MuonTrajectoryBuilder::trajectories().

177  {
178 
179  LogTrace(theCategory) << " Begin Build" << endl;
180 
181  // tracker trajectory should be built and refit before this point
182  if ( tkTrajs.empty() ) return CandidateContainer();
183 
184  // add muon hits and refit/smooth trajectories
185  CandidateContainer refittedResult;
186  ConstRecHitContainer muonRecHits = getTransientRecHits(*(staCand.second));
187 
188  // check order of muon measurements
189  if ( (muonRecHits.size() > 1) &&
190  ( muonRecHits.front()->globalPosition().mag() >
191  muonRecHits.back()->globalPosition().mag() ) ) {
192  LogTrace(theCategory)<< " reverse order: ";
193  }
194 
195  for ( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); it++ ) {
196 
197  // cut on tracks with low momenta
198  LogTrace(theCategory)<< " Track p and pT " << (*it)->trackerTrack()->p() << " " << (*it)->trackerTrack()->pt();
199  if( (*it)->trackerTrack()->p() < thePCut || (*it)->trackerTrack()->pt() < thePtCut ) continue;
200 
201  ConstRecHitContainer trackerRecHits;
202  if ((*it)->trackerTrack().isNonnull()) {
203  trackerRecHits = getTransientRecHits(*(*it)->trackerTrack());
204  } else {
205  LogDebug(theCategory)<<" NEED HITS FROM TRAJ";
206  //trackerRecHits = (*it)->trackerTrajectory()->recHits();
207  }
208 
209  // check for single TEC RecHits in trajectories in the overalp region
210  if ( fabs((*it)->trackerTrack()->eta()) > 0.95 && fabs((*it)->trackerTrack()->eta()) < 1.15 && (*it)->trackerTrack()->pt() < 60 ) {
211  if ( theTECxScale < 0 || theTECyScale < 0 )
212  trackerRecHits = selectTrackerHits(trackerRecHits);
213  else
214  fixTEC(trackerRecHits,theTECxScale,theTECyScale);
215  }
216 
217  RefitDirection recHitDir = checkRecHitsOrdering(trackerRecHits);
218  if ( recHitDir == outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
219 
220  reco::TransientTrack tTT((*it)->trackerTrack(),&*theService->magneticField(),theService->trackingGeometry());
221  TrajectoryStateOnSurface innerTsos = tTT.innermostMeasurementState();
222 
224  if((*it)->trackerTrack()->seedRef().isAvailable()) tmpSeed = (*it)->trackerTrack()->seedRef();
225 
226  if ( !innerTsos.isValid() ) {
227  LogTrace(theCategory) << " inner Trajectory State is invalid. ";
228  continue;
229  }
230 
231  innerTsos.rescaleError(100.);
232 
233  TC refitted0,refitted1;
234  MuonCandidate* finalTrajectory = 0;
235  Trajectory *tkTrajectory = 0;
236 
237  // tracker only track
238  if ( ! ((*it)->trackerTrajectory() && (*it)->trackerTrajectory()->isValid()) ) {
239  refitted0 = theTrackTransformer->transform((*it)->trackerTrack()) ;
240  if (!refitted0.empty()) tkTrajectory = new Trajectory(*(refitted0.begin()));
241  else LogWarning(theCategory)<< " Failed to load tracker track trajectory";
242  } else tkTrajectory = (*it)->trackerTrajectory();
243  if (tkTrajectory) tkTrajectory->setSeedRef(tmpSeed);
244 
245  // full track with all muon hits using theGlbRefitter
246  ConstRecHitContainer allRecHits = trackerRecHits;
247  allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
248  refitted1 = theGlbRefitter->refit( *(*it)->trackerTrack(), tTT, allRecHits,theMuonHitsOption, tTopo_);
249  LogTrace(theCategory)<<" This track-sta refitted to " << refitted1.size() << " trajectories";
250 
251  Trajectory *glbTrajectory1 = 0;
252  if (!refitted1.empty()) glbTrajectory1 = new Trajectory(*(refitted1.begin()));
253  else LogDebug(theCategory)<< " Failed to load global track trajectory 1";
254  if (glbTrajectory1) glbTrajectory1->setSeedRef(tmpSeed);
255 
256  finalTrajectory = 0;
257  if(glbTrajectory1 && tkTrajectory) finalTrajectory = new MuonCandidate(glbTrajectory1, (*it)->muonTrack(), (*it)->trackerTrack(),
258  tkTrajectory? new Trajectory(*tkTrajectory) : 0);
259 
260  if ( finalTrajectory )
261  refittedResult.push_back(finalTrajectory);
262 
263  if(tkTrajectory) delete tkTrajectory;
264  }
265 
266  // choose the best global fit for this Standalone Muon based on the track probability
267  CandidateContainer selectedResult;
268  MuonCandidate* tmpCand = 0;
269  if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
270  double minProb = 9999;
271 
272  for (CandidateContainer::const_iterator iter=refittedResult.begin(); iter != refittedResult.end(); iter++) {
273  double prob = trackProbability(*(*iter)->trajectory());
274  LogTrace(theCategory)<<" refitted-track-sta with pT " << (*iter)->trackerTrack()->pt() << " has probability " << prob;
275 
276  if (prob < minProb) {
277  minProb = prob;
278  tmpCand = (*iter);
279  }
280  }
281 
282  if ( tmpCand ) selectedResult.push_back(new MuonCandidate(new Trajectory(*(tmpCand->trajectory())), tmpCand->muonTrack(), tmpCand->trackerTrack(),
283  (tmpCand->trackerTrajectory())? new Trajectory( *(tmpCand->trackerTrajectory()) ):0 ) );
284 
285  for (CandidateContainer::const_iterator it = refittedResult.begin(); it != refittedResult.end(); ++it) {
286  if ( (*it)->trajectory() ) delete (*it)->trajectory();
287  if ( (*it)->trackerTrajectory() ) delete (*it)->trackerTrajectory();
288  if ( *it ) delete (*it);
289  }
290  refittedResult.clear();
291 
292  return selectedResult;
293 
294 }
#define LogDebug(id)
const reco::TrackRef muonTrack() const
return muon track
Definition: MuonCandidate.h:45
MuonCandidate::CandidateContainer CandidateContainer
ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer &) const
select tracker hits; exclude some tracker hits in the global trajectory
const reco::TrackRef trackerTrack() const
return tracker track
Definition: MuonCandidate.h:48
void fixTEC(ConstRecHitContainer &all, double scl_x, double scl_y) const
rescale errors of outermost TEC RecHit
double trackProbability(const Trajectory &) const
calculate chi2 probability (-ln(P))
Trajectory * trackerTrajectory() const
return tracker trajectory
Definition: MuonCandidate.h:51
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::Track &) const
get transient RecHits of a Track
#define LogTrace(id)
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:310
virtual std::vector< Trajectory > transform(const reco::Track &) const
Convert a reco::Track into Trajectory.
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
This does nothing now.
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Trajectory * trajectory() const
return trajectory
Definition: MuonCandidate.h:42
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
void GlobalTrajectoryBuilderBase::checkMuonHits ( const reco::Track ,
ConstRecHitContainer ,
ConstRecHitContainer ,
std::vector< int > &   
) const
protected

check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit

GlobalTrajectoryBuilderBase::RefitDirection GlobalTrajectoryBuilderBase::checkRecHitsOrdering ( const ConstRecHitContainer recHits) const
protected

This does nothing now.

check order of RechIts on a trajectory

Definition at line 406 of file GlobalTrajectoryBuilderBase.cc.

References inToOut, outToIn, theCategory, and undetermined.

Referenced by build().

406  {
407 
408  if ( !recHits.empty() ) {
409  ConstRecHitContainer::const_iterator frontHit = recHits.begin();
410  ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
411  while ( !(*frontHit)->isValid() && frontHit != backHit ) {frontHit++;}
412  while ( !(*backHit)->isValid() && backHit != frontHit ) {backHit--;}
413 
414  double rFirst = (*frontHit)->globalPosition().mag();
415  double rLast = (*backHit) ->globalPosition().mag();
416 
417  if ( rFirst < rLast ) return inToOut;
418  else if (rFirst > rLast) return outToIn;
419  else {
420  LogError(theCategory) << "Impossible to determine the rechits order" << endl;
421  return undetermined;
422  }
423  }
424  else {
425  LogError(theCategory) << "Impossible to determine the rechits order" << endl;
426  return undetermined;
427  }
428 }
vector< GlobalTrajectoryBuilderBase::TrackCand > GlobalTrajectoryBuilderBase::chooseRegionalTrackerTracks ( const TrackCand staCand,
const std::vector< TrackCand > &  tkTs 
)
protected

choose tracker tracks within region of interest

Definition at line 301 of file GlobalTrajectoryBuilderBase.cc.

References defineRegionOfInterest(), deltaR(), and query::result.

Referenced by GlobalMuonTrajectoryBuilder::makeTkCandCollection().

302  {
303 
304  // define eta-phi region
305  RectangularEtaPhiTrackingRegion regionOfInterest = defineRegionOfInterest(staCand.second);
306 
307  // get region's etaRange and phiMargin
308  //UNUSED: PixelRecoRange<float> etaRange = regionOfInterest.etaRange();
309  //UNUSED: TkTrackingRegionsMargin<float> phiMargin = regionOfInterest.phiMargin();
310 
311  vector<TrackCand> result;
312 
313  double deltaR_max = 1.0;
314 
315  for ( vector<TrackCand>::const_iterator is = tkTs.begin(); is != tkTs.end(); ++is ) {
316  // check if each trackCand is in region of interest
317 // bool inEtaRange = etaRange.inside(is->second->eta());
318 // bool inPhiRange = (fabs(Geom::Phi<float>(is->second->phi()) - Geom::Phi<float>(regionOfInterest.direction().phi())) < phiMargin.right() ) ? true : false ;
319 
320  double deltaR_tmp = deltaR(static_cast<double>(regionOfInterest.direction().eta()),
321  static_cast<double>(regionOfInterest.direction().phi()),
322  is->second->eta(), is->second->phi());
323 
324  // for each trackCand in region, add trajectory and add to result
325  //if ( inEtaRange && inPhiRange ) {
326  if (deltaR_tmp < deltaR_max) {
327  TrackCand tmpCand = TrackCand(*is);
328  result.push_back(tmpCand);
329  }
330  }
331 
332  return result;
333 
334 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
tuple result
Definition: query.py:137
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
const Trajectory* GlobalTrajectoryBuilderBase::chooseTrajectory ( const std::vector< Trajectory * > &  ,
int   
) const
protected

choose final trajectory

RectangularEtaPhiTrackingRegion GlobalTrajectoryBuilderBase::defineRegionOfInterest ( const reco::TrackRef staTrack) const
protected

define region of interest with tracker

Definition at line 341 of file GlobalTrajectoryBuilderBase.cc.

References MuonTrackingRegionBuilder::region(), and theRegionBuilder.

Referenced by chooseRegionalTrackerTracks().

341  {
342 
344 
345  TkTrackingRegionsMargin<float> etaMargin(fabs(region1->etaRange().min() - region1->etaRange().mean()),
346  fabs(region1->etaRange().max() - region1->etaRange().mean()));
347 
348  RectangularEtaPhiTrackingRegion region2(region1->direction(),
349  region1->origin(),
350  region1->ptMin(),
351  region1->originRBound(),
352  region1->originZBound(),
353  etaMargin,
354  region1->phiMargin());
355 
356  delete region1;
357  return region2;
358 
359 }
RectangularEtaPhiTrackingRegion * region(const reco::TrackRef &) const
define tracking region
MuonTrackingRegionBuilder * theRegionBuilder
void GlobalTrajectoryBuilderBase::fixTEC ( ConstRecHitContainer all,
double  scl_x,
double  scl_y 
) const
protected

rescale errors of outermost TEC RecHit

Definition at line 459 of file GlobalTrajectoryBuilderBase.cc.

References angle(), MuonTransientTrackingRecHit::build(), error, i, pos, LocalError::rotate(), StripTopology::strip(), StripTopology::stripAngle(), StripSubdetector::TEC, DetId::Tracker, LocalError::xx(), and LocalError::yy().

Referenced by build().

461  {
462 
463  int nTEC(0);
464  ConstRecHitContainer::iterator lone_tec;
465 
466  for ( ConstRecHitContainer::iterator i = all.begin(); i != all.end(); i++) {
467  if ( !(*i)->isValid() ) continue;
468 
469  if ( (*i)->det()->geographicalId().det() == DetId::Tracker &&
470  (*i)->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
471  lone_tec = i;
472  nTEC++;
473 
474  if ( (i+1) != all.end() && (*(i+1))->isValid() &&
475  (*(i+1))->det()->geographicalId().det() == DetId::Tracker &&
476  (*(i+1))->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
477  nTEC++;
478  break;
479  }
480  }
481 
482  if (nTEC > 1) break;
483  }
484 
485  int hitDet = (*lone_tec)->hit()->geographicalId().det();
486  int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
487  if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
488  hitDet == DetId::Tracker && hitSubDet == StripSubdetector::TEC) {
489 
490  // rescale the TEC rechit error matrix in its rotated frame
491  const SiStripRecHit2D* strip = dynamic_cast<const SiStripRecHit2D*>((*lone_tec)->hit());
492  const TSiStripRecHit2DLocalPos* Tstrip = dynamic_cast<const TSiStripRecHit2DLocalPos*>((*lone_tec).get());
493  if (strip && Tstrip->det() && Tstrip) {
494  LocalPoint pos = Tstrip->localPosition();
495  if ((*lone_tec)->detUnit()) {
496  const StripTopology* topology = dynamic_cast<const StripTopology*>(&(*lone_tec)->detUnit()->topology());
497  if (topology) {
498  // rescale the local error along/perp the strip by a factor
499  float angle = topology->stripAngle(topology->strip((*lone_tec)->hit()->localPosition()));
500  LocalError error = Tstrip->localPositionError();
501  LocalError rotError = error.rotate(angle);
502  LocalError scaledError(rotError.xx() * scl_x * scl_x, 0, rotError.yy() * scl_y * scl_y);
503  error = scaledError.rotate(-angle);
504  MuonTransientTrackingRecHit* mtt_rechit;
505  if (strip->cluster().isNonnull()) {
509  SiStripRecHit2D* st = new SiStripRecHit2D(pos,error,
510  (*lone_tec)->geographicalId().rawId(),
511  strip->cluster());
512  *lone_tec = mtt_rechit->build((*lone_tec)->det(),st);
513  }
514  else {
515  SiStripRecHit2D* st = new SiStripRecHit2D(pos,error,
516  (*lone_tec)->geographicalId().rawId(),
517  strip->cluster_regional());
518  *lone_tec = mtt_rechit->build((*lone_tec)->det(),st);
519  }
520  }
521  }
522  }
523  }
524 
525 }
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
virtual float stripAngle(float strip) const =0
virtual float strip(const LocalPoint &) const =0
float yy() const
Definition: LocalError.h:26
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:39
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh)
FIXME virtual ConstMuonRecHitContainer specificTransientHits() const;.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
TransientTrackingRecHit::ConstRecHitContainer GlobalTrajectoryBuilderBase::getTransientRecHits ( const reco::Track track) const
protected

get transient RecHits of a Track

Definition at line 532 of file GlobalTrajectoryBuilderBase.cc.

References DetId::det(), trajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), LogDebug, DetId::Muon, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), query::result, theCategory, theMuonRecHitBuilder, theRPCInTheFit, theService, theTrackerPropagatorName, theTrackerRecHitBuilder, and DetId::Tracker.

Referenced by build().

532  {
533 
535 
536 
537 
538  TrajectoryStateOnSurface currTsos = trajectoryStateTransform::innerStateOnSurface(track, *theService->trackingGeometry(), &*theService->magneticField());
539 
540  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) {
541  if((*hit)->isValid()) {
542  DetId recoid = (*hit)->geographicalId();
543  if ( recoid.det() == DetId::Tracker ) {
545  if (!ttrhit->hit()->hasPositionAndError()){
546  TrajectoryStateOnSurface predTsos = theService->propagator(theTrackerPropagatorName)->propagate(currTsos, theService->trackingGeometry()->idToDet(recoid)->surface());
547 
548  if ( !predTsos.isValid() ) {
549  edm::LogError("MissingTransientHit")
550  <<"Could not get a tsos on the hit surface. We will miss a tracking hit.";
551  continue;
552  }
553  currTsos = predTsos;
554  TransientTrackingRecHit::RecHitPointer preciseHit = ttrhit->clone(predTsos);
555  result.push_back(preciseHit);
556  }else{
557  result.push_back(ttrhit);
558  }
559  } else if ( recoid.det() == DetId::Muon ) {
560  if ( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit) {
561  LogDebug(theCategory) << "RPC Rec Hit discarded";
562  continue;
563  }
564  result.push_back(theMuonRecHitBuilder->build(&**hit));
565  }
566  }
567  }
568 
569  return result;
570 }
#define LogDebug(id)
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field)
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
tuple result
Definition: query.py:137
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:63
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:20
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:65
virtual std::vector<TrackCand> GlobalTrajectoryBuilderBase::makeTkCandCollection ( const TrackCand )
protectedpure virtual

make a TrackCand collection using tracker Track, Trajectory information

Implemented in L3MuonTrajectoryBuilder, and GlobalMuonTrajectoryBuilder.

void GlobalTrajectoryBuilderBase::printHits ( const ConstRecHitContainer hits) const
protected

print all RecHits of a trajectory

Definition at line 380 of file GlobalTrajectoryBuilderBase.cc.

References LogTrace, pos, mathSSE::sqrt(), theCategory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

380  {
381 
382  LogTrace(theCategory) << "Used RecHits: " << hits.size();
383  for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
384  if ( !(*ir)->isValid() ) {
385  LogTrace(theCategory) << "invalid RecHit";
386  continue;
387  }
388 
389  const GlobalPoint& pos = (*ir)->globalPosition();
390 
392  << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y())
393  << " z = " << pos.z()
394  << " dimension = " << (*ir)->dimension()
395  << " " << (*ir)->det()->geographicalId().det()
396  << " " << (*ir)->det()->subDetector();
397 
398  }
399 
400 }
T y() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
#define LogTrace(id)
T x() const
Definition: PV3DBase.h:62
ConstRecHitContainer GlobalTrajectoryBuilderBase::selectMuonHits ( const Trajectory ,
const std::vector< int > &   
) const
protected

select muon hits compatible with trajectory; check hits in chambers with showers

GlobalTrajectoryBuilderBase::ConstRecHitContainer GlobalTrajectoryBuilderBase::selectTrackerHits ( const ConstRecHitContainer all) const
protected

select tracker hits; exclude some tracker hits in the global trajectory

Definition at line 435 of file GlobalTrajectoryBuilderBase.cc.

References cond::ecalcond::all, i, StripSubdetector::TEC, and DetId::Tracker.

Referenced by build().

435  {
436 
437  int nTEC(0);
438 
440  for (ConstRecHitContainer::const_iterator i = all.begin(); i != all.end(); i++) {
441  if ( !(*i)->isValid() ) continue;
442  if ( (*i)->det()->geographicalId().det() == DetId::Tracker &&
443  (*i)->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
444  nTEC++;
445  } else {
446  hits.push_back((*i).get());
447  }
448  if ( nTEC > 1 ) return all;
449  }
450 
451  return hits;
452 
453 }
int i
Definition: DBlmapReader.cc:9
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
const MuonServiceProxy* GlobalTrajectoryBuilderBase::service ( ) const
inlineprotected

Definition at line 140 of file GlobalTrajectoryBuilderBase.h.

References theService.

140 { return theService; }
void GlobalTrajectoryBuilderBase::setEvent ( const edm::Event event)
virtual

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Reimplemented in L3MuonTrajectoryBuilder, and GlobalMuonTrajectoryBuilder.

Definition at line 146 of file GlobalTrajectoryBuilderBase.cc.

References event(), LogDebug, edm::ESHandle< class >::product(), MuonTrackingRegionBuilder::setEvent(), GlobalMuonRefitter::setEvent(), TrackTransformer::setServices(), GlobalMuonRefitter::setServices(), theCacheId_TRH, theCategory, theEvent, theGlbRefitter, theMuonRecHitBuilder, theMuonRecHitBuilderName, theRegionBuilder, theService, theTrackerRecHitBuilder, theTrackerRecHitBuilderName, theTrackTransformer, and tTopo_.

Referenced by GlobalMuonTrajectoryBuilder::setEvent(), and L3MuonTrajectoryBuilder::setEvent().

146  {
147 
148  theEvent = &event;
149 
151  theRegionBuilder->setEvent(event);
152 
153  theGlbRefitter->setEvent(event);
154  theGlbRefitter->setServices(theService->eventSetup());
155 
156  unsigned long long newCacheId_TRH = theService->eventSetup().get<TransientRecHitRecord>().cacheIdentifier();
157  if ( newCacheId_TRH != theCacheId_TRH ) {
158  LogDebug(theCategory) << "TransientRecHitRecord changed!";
159  theCacheId_TRH = newCacheId_TRH;
162  }
163 
164  //Retrieve tracker topology from geometry
166  theService->eventSetup().get<IdealGeometryRecord>().get(tTopoHand);
167  tTopo_=tTopoHand.product();
168 
169 }
#define LogDebug(id)
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
virtual void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
T const * product() const
Definition: ESHandle.h:62
MuonTrackingRegionBuilder * theRegionBuilder
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
GlobalMuonTrackMatcher* GlobalTrajectoryBuilderBase::trackMatcher ( ) const
inlineprotected
double GlobalTrajectoryBuilderBase::trackProbability ( const Trajectory track) const
protected

calculate chi2 probability (-ln(P))

Definition at line 366 of file GlobalTrajectoryBuilderBase.cc.

References Trajectory::chiSquared(), LnChiSquaredProbability(), and Trajectory::ndof().

Referenced by build().

366  {
367 
368  if ( track.ndof() > 0 && track.chiSquared() > 0 ) {
369  return -LnChiSquaredProbability(track.chiSquared(), track.ndof());
370  } else {
371  return 0.0;
372  }
373 
374 }
float LnChiSquaredProbability(double chiSquared, double nrDOF)
int ndof(bool bon=true) const
Definition: Trajectory.cc:74
double chiSquared() const
Definition: Trajectory.h:254
MuonTrajectoryBuilder::TrajectoryContainer GlobalTrajectoryBuilderBase::trajectories ( const TrajectorySeed )
inlinevirtual

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 76 of file GlobalTrajectoryBuilderBase.h.

MuonCandidate::TrajectoryContainer TrajectoryContainer

Member Data Documentation

unsigned long long GlobalTrajectoryBuilderBase::theCacheId_TRH
private

Definition at line 176 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theCategory
protected
const edm::Event* GlobalTrajectoryBuilderBase::theEvent
private

Definition at line 184 of file GlobalTrajectoryBuilderBase.h.

Referenced by setEvent().

GlobalMuonRefitter* GlobalTrajectoryBuilderBase::theGlbRefitter
private
MuonDetLayerMeasurements* GlobalTrajectoryBuilderBase::theLayerMeasurements
private

Definition at line 171 of file GlobalTrajectoryBuilderBase.h.

int GlobalTrajectoryBuilderBase::theMuonHitsOption
private

Definition at line 179 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

edm::ESHandle<TransientTrackingRecHitBuilder> GlobalTrajectoryBuilderBase::theMuonRecHitBuilder
private

Definition at line 190 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theMuonRecHitBuilderName
private

Definition at line 189 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

float GlobalTrajectoryBuilderBase::thePCut
protected

Definition at line 166 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

float GlobalTrajectoryBuilderBase::thePtCut
protected
MuonTrackingRegionBuilder* GlobalTrajectoryBuilderBase::theRegionBuilder
private
bool GlobalTrajectoryBuilderBase::theRPCInTheFit
private
const MuonServiceProxy* GlobalTrajectoryBuilderBase::theService
private
float GlobalTrajectoryBuilderBase::theTECxScale
private

Definition at line 180 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

float GlobalTrajectoryBuilderBase::theTECyScale
private

Definition at line 181 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

std::string GlobalTrajectoryBuilderBase::theTrackerPropagatorName
private
edm::ESHandle<TransientTrackingRecHitBuilder> GlobalTrajectoryBuilderBase::theTrackerRecHitBuilder
private

Definition at line 187 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theTrackerRecHitBuilderName
private

Definition at line 186 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

GlobalMuonTrackMatcher* GlobalTrajectoryBuilderBase::theTrackMatcher
private
TrackTransformer* GlobalTrajectoryBuilderBase::theTrackTransformer
private
const TrackerTopology* GlobalTrajectoryBuilderBase::tTopo_
private

Definition at line 192 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and setEvent().