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 *, edm::ConsumesCollector &)
 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
 
bool theRefitFlag
 
MuonTrackingRegionBuildertheRegionBuilder
 
bool theRPCInTheFit
 
const MuonServiceProxytheService
 
float theTECxScale
 
float theTECyScale
 
const TrackerTopologytheTopo
 
std::string theTrackerPropagatorName
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
GlobalMuonTrackMatchertheTrackMatcher
 
TrackTransformertheTrackTransformer
 

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.

Author
N. Neumeister Purdue University
C. Liu Purdue University
A. Everett Purdue University

Definition at line 42 of file GlobalTrajectoryBuilderBase.h.

Member Typedef Documentation

Definition at line 53 of file GlobalTrajectoryBuilderBase.h.

Definition at line 51 of file GlobalTrajectoryBuilderBase.h.

Definition at line 47 of file GlobalTrajectoryBuilderBase.h.

Definition at line 49 of file GlobalTrajectoryBuilderBase.h.

Definition at line 52 of file GlobalTrajectoryBuilderBase.h.

Definition at line 50 of file GlobalTrajectoryBuilderBase.h.

Definition at line 46 of file GlobalTrajectoryBuilderBase.h.

Definition at line 48 of file GlobalTrajectoryBuilderBase.h.

Definition at line 54 of file GlobalTrajectoryBuilderBase.h.

typedef TC::const_iterator GlobalTrajectoryBuilderBase::TI

Definition at line 55 of file GlobalTrajectoryBuilderBase.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with Parameter Set and MuonServiceProxy

Class: GlobalTrajectoryBuilderBase

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.

Author
N. Neumeister Purdue University
C. Liu Purdue University
A. Everett Purdue University

Definition at line 76 of file GlobalTrajectoryBuilderBase.cc.

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

78  :
80 
81  theCategory = par.getUntrackedParameter<std::string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalTrajectoryBuilderBase");
82 
83 
84  edm::ParameterSet trackMatcherPSet = par.getParameter<edm::ParameterSet>("GlobalMuonTrackMatcher");
85  theTrackMatcher = new GlobalMuonTrackMatcher(trackMatcherPSet,theService);
86 
87  theTrackerPropagatorName = par.getParameter<std::string>("TrackerPropagator");
88 
89  edm::ParameterSet trackTransformerPSet = par.getParameter<edm::ParameterSet>("TrackTransformer");
90  theTrackTransformer = new TrackTransformer(trackTransformerPSet);
91 
92  edm::ParameterSet regionBuilderPSet = par.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
93 
94  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet,iC);
95 
96  // TrackRefitter parameters
97  edm::ParameterSet refitterParameters = par.getParameter<edm::ParameterSet>("GlbRefitterParameters");
98  theGlbRefitter = new GlobalMuonRefitter(refitterParameters, theService, iC);
99 
100  theMuonHitsOption = refitterParameters.getParameter<int>("MuonHitsOption");
101  theRefitFlag = refitterParameters.getParameter<bool>("RefitFlag");
102 
103  theTrackerRecHitBuilderName = par.getParameter<std::string>("TrackerRecHitBuilder");
104  theMuonRecHitBuilderName = par.getParameter<std::string>("MuonRecHitBuilder");
105 
106  theRPCInTheFit = par.getParameter<bool>("RefitRPCHits");
107 
108  theTECxScale = par.getParameter<double>("ScaleTECxFactor");
109  theTECyScale = par.getParameter<double>("ScaleTECyFactor");
110  thePtCut = par.getParameter<double>("PtCut");
111  thePCut = par.getParameter<double>("PCut");
112 
113  theCacheId_TRH = 0;
114 
115 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MuonDetLayerMeasurements * theLayerMeasurements
tuple MuonTrackingRegionBuilder
GlobalMuonTrackMatcher * theTrackMatcher
MuonTrackingRegionBuilder * theRegionBuilder
tuple TrackTransformer
GlobalTrajectoryBuilderBase::~GlobalTrajectoryBuilderBase ( )
virtual

destructor

Definition at line 121 of file GlobalTrajectoryBuilderBase.cc.

References theGlbRefitter, theRegionBuilder, theTrackMatcher, and theTrackTransformer.

121  {
122 
123  if (theTrackMatcher) delete theTrackMatcher;
126  if (theGlbRefitter) delete theGlbRefitter;
127 }
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 115 of file GlobalTrajectoryBuilderBase.h.

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

build combined trajectory from sta Track and tracker RecHits

Definition at line 163 of file GlobalTrajectoryBuilderBase.cc.

References funct::abs(), checkRecHitsOrdering(), fixTEC(), getTransientRecHits(), LogDebug, LogTrace, MuonServiceProxy::magneticField(), bookConverter::max, MuonCandidate::muonTrack(), outToIn, GlobalMuonRefitter::refit(), selectTrackerHits(), Trajectory::setSeedRef(), theCategory, theGlbRefitter, theMuonHitsOption, thePCut, thePtCut, theRefitFlag, theService, theTECxScale, theTECyScale, theTopo, theTrackTransformer, MuonCandidate::trackerTrack(), MuonCandidate::trackerTrajectory(), MuonServiceProxy::trackingGeometry(), trackProbability(), MuonCandidate::trajectory(), and TrackTransformer::transform().

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

164  {
165 
166  LogTrace(theCategory) << " Begin Build" << std::endl;
167 
168  // tracker trajectory should be built and refit before this point
169  if ( tkTrajs.empty() ) return CandidateContainer();
170 
171  // add muon hits and refit/smooth trajectories
172  CandidateContainer refittedResult;
173  ConstRecHitContainer muonRecHits = getTransientRecHits(*(staCand.second));
174 
175  // check order of muon measurements
176  if ( (muonRecHits.size() > 1) &&
177  ( muonRecHits.front()->globalPosition().mag() >
178  muonRecHits.back()->globalPosition().mag() ) ) {
179  LogTrace(theCategory)<< " reverse order: ";
180  }
181 
182  for (auto&& it: tkTrajs){
183  // cut on tracks with low momenta
184  LogTrace(theCategory)<< " Track p and pT " << it->trackerTrack()->p() << " " << it->trackerTrack()->pt();
185  if( it->trackerTrack()->p() < thePCut || it->trackerTrack()->pt() < thePtCut ) continue;
186 
187  // If true we will run theGlbRefitter->refit from all hits
188  if (theRefitFlag){
189  ConstRecHitContainer trackerRecHits;
190  if (it->trackerTrack().isNonnull()) {
191  trackerRecHits = getTransientRecHits(*it->trackerTrack());
192  } else {
193  LogDebug(theCategory)<<" NEED HITS FROM TRAJ";
194  }
195 
196  // ToDo: Do we need the following ?:
197  // check for single TEC RecHits in trajectories in the overalp region
198  if ( std::abs(it->trackerTrack()->eta()) > 0.95 && std::abs(it->trackerTrack()->eta()) < 1.15 && it->trackerTrack()->pt() < 60 ) {
199  if ( theTECxScale < 0 || theTECyScale < 0 )
200  trackerRecHits = selectTrackerHits(trackerRecHits);
201  else
202  fixTEC(trackerRecHits,theTECxScale,theTECyScale);
203  }
204 
205  RefitDirection recHitDir = checkRecHitsOrdering(trackerRecHits);
206  if ( recHitDir == outToIn ) reverse(trackerRecHits.begin(),trackerRecHits.end());
207 
209  TrajectoryStateOnSurface innerTsos = tTT.innermostMeasurementState();
210 
212  if(it->trackerTrack()->seedRef().isAvailable()) tmpSeed = it->trackerTrack()->seedRef();
213 
214  if ( !innerTsos.isValid() ) {
215  LogTrace(theCategory) << " inner Trajectory State is invalid. ";
216  continue;
217  }
218 
219  innerTsos.rescaleError(100.);
220 
221  TC refitted0,refitted1;
222  MuonCandidate* finalTrajectory = 0;
223  Trajectory *tkTrajectory = 0;
224 
225  // tracker only track
226  if ( ! (it->trackerTrajectory() && it->trackerTrajectory()->isValid()) ) {
227  refitted0 = theTrackTransformer->transform(it->trackerTrack()) ;
228  if (!refitted0.empty()) tkTrajectory = new Trajectory(*(refitted0.begin()));
229  else edm::LogWarning(theCategory)<< " Failed to load tracker track trajectory";
230  } else tkTrajectory = it->trackerTrajectory();
231  if (tkTrajectory) tkTrajectory->setSeedRef(tmpSeed);
232 
233  // full track with all muon hits using theGlbRefitter
234  ConstRecHitContainer allRecHits = trackerRecHits;
235  allRecHits.insert(allRecHits.end(), muonRecHits.begin(),muonRecHits.end());
236  refitted1 = theGlbRefitter->refit( *it->trackerTrack(), tTT, allRecHits,theMuonHitsOption, theTopo);
237  LogTrace(theCategory)<<" This track-sta refitted to " << refitted1.size() << " trajectories";
238 
239  Trajectory *glbTrajectory1 = 0;
240  if (!refitted1.empty()) glbTrajectory1 = new Trajectory(*(refitted1.begin()));
241  else LogDebug(theCategory)<< " Failed to load global track trajectory 1";
242  if (glbTrajectory1) glbTrajectory1->setSeedRef(tmpSeed);
243 
244  finalTrajectory = 0;
245  if(glbTrajectory1 && tkTrajectory) finalTrajectory = new MuonCandidate(glbTrajectory1, it->muonTrack(), it->trackerTrack(),
246  tkTrajectory? new Trajectory(*tkTrajectory) : 0);
247 
248  if ( finalTrajectory ) refittedResult.push_back(finalTrajectory);
249  if(tkTrajectory) delete tkTrajectory;
250  }
251  else{
252  MuonCandidate* finalTrajectory = 0;
254  if(it->trackerTrack()->seedRef().isAvailable()) tmpSeed = it->trackerTrack()->seedRef();
255 
256  TC refitted0;
257  Trajectory *tkTrajectory = 0;
258  if ( ! (it->trackerTrajectory() && it->trackerTrajectory()->isValid()) ) {
259  refitted0 = theTrackTransformer->transform(it->trackerTrack());
260  if (!refitted0.empty()){
261  tkTrajectory = new Trajectory(*(refitted0.begin()));
262  }
263  else edm::LogWarning(theCategory)<< " Failed to load tracker track trajectory";
264  }
265  else tkTrajectory = it->trackerTrajectory();
266  if (tkTrajectory) tkTrajectory->setSeedRef(tmpSeed);
267  // Creating MuonCandidate using only the tracker trajectory:
268  finalTrajectory = new MuonCandidate(new Trajectory(*tkTrajectory), it->muonTrack(), it->trackerTrack(),new Trajectory(*tkTrajectory));
269  if (finalTrajectory) refittedResult.push_back(finalTrajectory);
270  if(tkTrajectory) delete tkTrajectory;
271  }
272  }
273 
274  // choose the best global fit for this Standalone Muon based on the track probability
275  CandidateContainer selectedResult;
276  MuonCandidate* tmpCand = 0;
277  if ( refittedResult.size() > 0 ) tmpCand = *(refittedResult.begin());
278  double minProb = std::numeric_limits<double>::max();
279 
280  for (auto&& iter: refittedResult){
281  double prob = trackProbability(*iter->trajectory());
282  LogTrace(theCategory)<<" refitted-track-sta with pT " << iter->trackerTrack()->pt() << " has probability " << prob;
283 
284  if (prob < minProb) {
285  minProb = prob;
286  tmpCand = iter;
287  }
288  }
289 
290  if ( tmpCand ) selectedResult.push_back(new MuonCandidate(new Trajectory(*(tmpCand->trajectory())), tmpCand->muonTrack(), tmpCand->trackerTrack(),
291  (tmpCand->trackerTrajectory())? new Trajectory( *(tmpCand->trackerTrajectory()) ):0 ) );
292 
293  for (auto&& it: refittedResult){
294  if ( it->trajectory() ) delete it->trajectory();
295  if ( it->trackerTrajectory() ) delete it->trackerTrajectory();
296  if ( it ) delete it;
297  }
298  refittedResult.clear();
299 
300  return selectedResult;
301 
302 }
#define LogDebug(id)
const reco::TrackRef muonTrack() const
return muon track
Definition: MuonCandidate.h:43
MuonCandidate::CandidateContainer CandidateContainer
ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer &) const
select tracker hits; exclude some tracker hits in the global trajectory
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
const reco::TrackRef trackerTrack() const
return tracker track
Definition: MuonCandidate.h:46
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:49
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::Track &) const
get transient RecHits of a Track
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:363
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
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:40
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 409 of file GlobalTrajectoryBuilderBase.cc.

References inToOut, outToIn, theCategory, and undetermined.

Referenced by build().

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

choose tracker tracks within region of interest

Definition at line 309 of file GlobalTrajectoryBuilderBase.cc.

References defineRegionOfInterest(), deltaR(), TrackingRegion::direction(), PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::phi(), and mps_fire::result.

Referenced by GlobalMuonTrajectoryBuilder::makeTkCandCollection().

310  {
311 
312  // define eta-phi region
313  RectangularEtaPhiTrackingRegion regionOfInterest = defineRegionOfInterest(staCand.second);
314 
315  // get region's etaRange and phiMargin
316  //UNUSED: PixelRecoRange<float> etaRange = regionOfInterest.etaRange();
317  //UNUSED: TkTrackingRegionsMargin<float> phiMargin = regionOfInterest.phiMargin();
318 
319  std::vector<TrackCand> result;
320 
321  double deltaR_max = 1.0;
322 
323  for (auto&& is: tkTs){
324  double deltaR_tmp = deltaR(static_cast<double>(regionOfInterest.direction().eta()),
325  static_cast<double>(regionOfInterest.direction().phi()),
326  is.second->eta(), is.second->phi());
327 
328  // for each trackCand in region, add trajectory and add to result
329  //if ( inEtaRange && inPhiRange ) {
330  if (deltaR_tmp < deltaR_max) {
331  TrackCand tmpCand = TrackCand(is);
332  result.push_back(tmpCand);
333  }
334  }
335 
336  return result;
337 
338 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
tuple result
Definition: mps_fire.py:95
GlobalVector const & direction() const
the direction around which region is constructed
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
T eta() const
Definition: PV3DBase.h:76
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 345 of file GlobalTrajectoryBuilderBase.cc.

References funct::abs(), MuonTrackingRegionBuilder::region(), and theRegionBuilder.

Referenced by chooseRegionalTrackerTracks().

345  {
346 
347  std::unique_ptr<RectangularEtaPhiTrackingRegion> region1 = theRegionBuilder->region(staTrack);
348 
349  TkTrackingRegionsMargin<float> etaMargin(std::abs(region1->etaRange().min() - region1->etaRange().mean()),
350  std::abs(region1->etaRange().max() - region1->etaRange().mean()));
351 
352  RectangularEtaPhiTrackingRegion region2(region1->direction(),
353  region1->origin(),
354  region1->ptMin(),
355  region1->originRBound(),
356  region1->originZBound(),
357  etaMargin,
358  region1->phiMargin());
359 
360  return region2;
361 
362 }
std::unique_ptr< RectangularEtaPhiTrackingRegion > region(const reco::TrackRef &) const
Define tracking region.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MuonTrackingRegionBuilder * theRegionBuilder
void GlobalTrajectoryBuilderBase::fixTEC ( ConstRecHitContainer all,
double  scl_x,
double  scl_y 
) const
protected

rescale errors of outermost TEC RecHit

 freeze this hit, make sure it will not be recomputed during fitting

/ the implemetantion below works with cloning / to get a RecHitPointer to SiStripRecHit2D, the only method that works is / RecHitPointer MuonTransientTrackingRecHit::build(const GeomDet*,const TrackingRecHit*)

Definition at line 462 of file GlobalTrajectoryBuilderBase.cc.

References angle(), MuonTransientTrackingRecHit::build(), SiStripRecHit2D::cluster(), TrackingRecHit::det(), relativeConstraints::error, i, BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), LocalError::rotate(), StripTopology::strip(), StripTopology::stripAngle(), StripSubdetector::TEC, ecaldqm::topology(), DetId::Tracker, LocalError::xx(), and LocalError::yy().

Referenced by build().

464  {
465 
466  int nTEC(0);
467  ConstRecHitContainer::iterator lone_tec;
468 
469  for ( ConstRecHitContainer::iterator i = all.begin(); i != all.end(); i++) {
470  if ( !(*i)->isValid() ) continue;
471 
472  if ( (*i)->det()->geographicalId().det() == DetId::Tracker &&
473  (*i)->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
474  lone_tec = i;
475  nTEC++;
476 
477  if ( (i+1) != all.end() && (*(i+1))->isValid() &&
478  (*(i+1))->det()->geographicalId().det() == DetId::Tracker &&
479  (*(i+1))->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
480  nTEC++;
481  break;
482  }
483  }
484 
485  if (nTEC > 1) break;
486  }
487 
488  int hitDet = (*lone_tec)->hit()->geographicalId().det();
489  int hitSubDet = (*lone_tec)->hit()->geographicalId().subdetId();
490  if ( nTEC == 1 && (*lone_tec)->hit()->isValid() &&
491  hitDet == DetId::Tracker && hitSubDet == StripSubdetector::TEC) {
492 
493  // rescale the TEC rechit error matrix in its rotated frame
494  const SiStripRecHit2D* strip = dynamic_cast<const SiStripRecHit2D*>((*lone_tec)->hit());
495  if (strip && strip->det() ) {
496  LocalPoint pos = strip->localPosition();
497  if ((*lone_tec)->detUnit()) {
498  const StripTopology* topology = dynamic_cast<const StripTopology*>(&(*lone_tec)->detUnit()->topology());
499  if (topology) {
500  // rescale the local error along/perp the strip by a factor
501  float angle = topology->stripAngle(topology->strip((*lone_tec)->hit()->localPosition()));
503  LocalError rotError = error.rotate(angle);
504  LocalError scaledError(rotError.xx() * scl_x * scl_x, 0, rotError.yy() * scl_y * scl_y);
505  error = scaledError.rotate(-angle);
510  SiStripRecHit2D* st = new SiStripRecHit2D(pos,error,
511  *strip->det(),
512  strip->cluster());
513  *lone_tec = MuonTransientTrackingRecHit::build((*lone_tec)->det(),st);
514 
515  }
516  }
517  }
518  }
519 
520 }
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
virtual float stripAngle(float strip) const =0
CaloTopology const * topology(0)
virtual float strip(const LocalPoint &) const =0
float yy() const
Definition: LocalError.h:26
const GeomDet * det() const
ClusterRef cluster() const
virtual LocalError localPositionError() const final
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;.
virtual LocalPoint localPosition() const final
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 528 of file GlobalTrajectoryBuilderBase.cc.

References TkTransientTrackingRecHitBuilder::cloner(), DetId::det(), h, trajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), LogDebug, MuonServiceProxy::magneticField(), DetId::Muon, edm::ESHandle< class >::product(), MuonServiceProxy::propagator(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), mps_fire::result, theCategory, theMuonRecHitBuilder, theRPCInTheFit, theService, theTrackerPropagatorName, theTrackerRecHitBuilder, DetId::Tracker, and MuonServiceProxy::trackingGeometry().

Referenced by build().

528  {
529 
531 
532 
533 
535 
536  auto tkbuilder = static_cast<TkTransientTrackingRecHitBuilder const *>(theTrackerRecHitBuilder.product());
537  auto hitCloner = tkbuilder->cloner();
538  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) {
539  if((*hit)->isValid()) {
540  DetId recoid = (*hit)->geographicalId();
541  if ( recoid.det() == DetId::Tracker ) {
542  if (!(*hit)->hasPositionAndError()){
543  TrajectoryStateOnSurface predTsos = theService->propagator(theTrackerPropagatorName)->propagate(currTsos, theService->trackingGeometry()->idToDet(recoid)->surface());
544 
545  if ( !predTsos.isValid() ) {
546  edm::LogError("MissingTransientHit")
547  <<"Could not get a tsos on the hit surface. We will miss a tracking hit.";
548  continue;
549  }
550  currTsos = predTsos;
551  auto h = (**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) );
552  result.emplace_back(hitCloner.makeShared(h,predTsos));
553  }else{
554  result.push_back((*hit)->cloneSH());
555  }
556  } else if ( recoid.det() == DetId::Muon ) {
557  if ( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit) {
558  LogDebug(theCategory) << "RPC Rec Hit discarded";
559  continue;
560  }
561  result.push_back(theMuonRecHitBuilder->build(&**hit));
562  }
563  }
564  }
565 
566  return result;
567 }
#define LogDebug(id)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
tuple result
Definition: mps_fire.py:95
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:18
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
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 383 of file GlobalTrajectoryBuilderBase.cc.

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

383  {
384 
385  LogTrace(theCategory) << "Used RecHits: " << hits.size();
386  for (auto&& ir: hits){
387  if ( !ir->isValid() ) {
388  LogTrace(theCategory) << "invalid RecHit";
389  continue;
390  }
391 
392  const GlobalPoint& pos = ir->globalPosition();
393 
395  << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y())
396  << " z = " << pos.z()
397  << " dimension = " << ir->dimension()
398  << " " << ir->det()->geographicalId().det()
399  << " " << ir->det()->subDetector();
400 
401  }
402 
403 }
T y() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:18
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 438 of file GlobalTrajectoryBuilderBase.cc.

References Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), i, StripSubdetector::TEC, and DetId::Tracker.

Referenced by build().

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

Definition at line 128 of file GlobalTrajectoryBuilderBase.h.

References theService.

128 { 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 133 of file GlobalTrajectoryBuilderBase.cc.

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

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

133  {
134 
135  theEvent = &event;
136 
138  theRegionBuilder->setEvent(event);
139 
140  theGlbRefitter->setEvent(event);
142 
143  unsigned long long newCacheId_TRH = theService->eventSetup().get<TransientRecHitRecord>().cacheIdentifier();
144  if ( newCacheId_TRH != theCacheId_TRH ) {
145  LogDebug(theCategory) << "TransientRecHitRecord changed!";
146  theCacheId_TRH = newCacheId_TRH;
149  }
150 
151  //Retrieve tracker topology from geometry
153  theService->eventSetup().get<TrackerTopologyRcd>().get(tTopoHand);
154  theTopo=tTopoHand.product();
155 
156 }
#define LogDebug(id)
const edm::EventSetup & eventSetup() const
get the whole EventSetup
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
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
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 369 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by build().

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

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 64 of file GlobalTrajectoryBuilderBase.h.

MuonCandidate::TrajectoryContainer TrajectoryContainer

Member Data Documentation

unsigned long long GlobalTrajectoryBuilderBase::theCacheId_TRH
private

Definition at line 162 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

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

Definition at line 169 of file GlobalTrajectoryBuilderBase.h.

Referenced by setEvent().

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

Definition at line 157 of file GlobalTrajectoryBuilderBase.h.

int GlobalTrajectoryBuilderBase::theMuonHitsOption
private

Definition at line 165 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

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

Definition at line 173 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theMuonRecHitBuilderName
private

Definition at line 172 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

float GlobalTrajectoryBuilderBase::thePCut
protected

Definition at line 152 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

float GlobalTrajectoryBuilderBase::thePtCut
protected
bool GlobalTrajectoryBuilderBase::theRefitFlag
private

Definition at line 164 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

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

Definition at line 166 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

float GlobalTrajectoryBuilderBase::theTECyScale
private

Definition at line 167 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

const TrackerTopology* GlobalTrajectoryBuilderBase::theTopo
private

Definition at line 174 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and setEvent().

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

Definition at line 171 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theTrackerRecHitBuilderName
private

Definition at line 170 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

GlobalMuonTrackMatcher* GlobalTrajectoryBuilderBase::theTrackMatcher
private
TrackTransformer* GlobalTrajectoryBuilderBase::theTrackTransformer
private