CMS 3D CMS Logo

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::TrackRefTrackCand
 
typedef MuonCandidate::TrajectoryContainer TrajectoryContainer
 

Public Member Functions

 GlobalTrajectoryBuilderBase (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
 constructor with Parameter Set and MuonServiceProxy More...
 
void setEvent (const edm::Event &) override
 pass the Event to the algo at each event More...
 
MuonTrajectoryBuilder::TrajectoryContainer trajectories (const TrajectorySeed &) override
 dummy implementation, unused in this class More...
 
 ~GlobalTrajectoryBuilderBase () override
 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< TransientTrackingRecHitBuildertheMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
bool theRefitFlag
 
MuonTrackingRegionBuildertheRegionBuilder
 
bool theRPCInTheFit
 
const MuonServiceProxytheService
 
float theTECxScale
 
float theTECyScale
 
const TrackerTopologytheTopo
 
std::string theTrackerPropagatorName
 
edm::ESHandle< TransientTrackingRecHitBuildertheTrackerRecHitBuilder
 
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 51 of file GlobalTrajectoryBuilderBase.h.

Definition at line 49 of file GlobalTrajectoryBuilderBase.h.

Definition at line 45 of file GlobalTrajectoryBuilderBase.h.

Definition at line 47 of file GlobalTrajectoryBuilderBase.h.

Definition at line 50 of file GlobalTrajectoryBuilderBase.h.

Definition at line 48 of file GlobalTrajectoryBuilderBase.h.

Definition at line 44 of file GlobalTrajectoryBuilderBase.h.

Definition at line 46 of file GlobalTrajectoryBuilderBase.h.

Definition at line 52 of file GlobalTrajectoryBuilderBase.h.

typedef TC::const_iterator GlobalTrajectoryBuilderBase::TI

Definition at line 53 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, HLT_2018_cff::GlobalMuonTrackMatcher, HLT_2018_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_2018_cff::TrackTransformer.

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

destructor

Definition at line 122 of file GlobalTrajectoryBuilderBase.cc.

References theGlbRefitter, theRegionBuilder, theTrackMatcher, and theTrackTransformer.

122  {
123  if (theTrackMatcher)
124  delete theTrackMatcher;
125  if (theRegionBuilder)
126  delete theRegionBuilder;
128  delete theTrackTransformer;
129  if (theGlbRefitter)
130  delete theGlbRefitter;
131 }
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 106 of file GlobalTrajectoryBuilderBase.h.

References checkRecHitsOrdering(), and getTransientRecHits().

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

build combined trajectory from sta Track and tracker RecHits

Definition at line 162 of file GlobalTrajectoryBuilderBase.cc.

References funct::abs(), checkRecHitsOrdering(), fixTEC(), getTransientRecHits(), LogDebug, LogTrace, MuonServiceProxy::magneticField(), SiStripPI::max, conversionTrackMerger_cfi::minProb, MuonCandidate::muonTrack(), outToIn, TtFullHadEvtBuilder_cfi::prob, GlobalMuonRefitter::refit(), groupFilesInBlocks::reverse, 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().

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

References inToOut, outToIn, theCategory, and undetermined.

Referenced by addTraj(), and build().

418  {
419  if (!recHits.empty()) {
420  ConstRecHitContainer::const_iterator frontHit = recHits.begin();
421  ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
422  while (!(*frontHit)->isValid() && frontHit != backHit) {
423  frontHit++;
424  }
425  while (!(*backHit)->isValid() && backHit != frontHit) {
426  backHit--;
427  }
428 
429  double rFirst = (*frontHit)->globalPosition().mag();
430  double rLast = (*backHit)->globalPosition().mag();
431 
432  if (rFirst < rLast)
433  return inToOut;
434  else if (rFirst > rLast)
435  return outToIn;
436  else {
437  edm::LogError(theCategory) << "Impossible to determine the rechits order" << std::endl;
438  return undetermined;
439  }
440  } else {
441  edm::LogError(theCategory) << "Impossible to determine the rechits order" << std::endl;
442  return undetermined;
443  }
444 }
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 333 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by GlobalMuonTrajectoryBuilder::makeTkCandCollection().

334  {
335  // define eta-phi region
336  RectangularEtaPhiTrackingRegion regionOfInterest = defineRegionOfInterest(staCand.second);
337 
338  // get region's etaRange and phiMargin
339  //UNUSED: PixelRecoRange<float> etaRange = regionOfInterest.etaRange();
340  //UNUSED: TkTrackingRegionsMargin<float> phiMargin = regionOfInterest.phiMargin();
341 
342  std::vector<TrackCand> result;
343 
344  double deltaR_max = 1.0;
345 
346  for (auto&& is : tkTs) {
347  double deltaR_tmp = deltaR(static_cast<double>(regionOfInterest.direction().eta()),
348  static_cast<double>(regionOfInterest.direction().phi()),
349  is.second->eta(),
350  is.second->phi());
351 
352  // for each trackCand in region, add trajectory and add to result
353  //if ( inEtaRange && inPhiRange ) {
354  if (deltaR_tmp < deltaR_max) {
355  TrackCand tmpCand = TrackCand(is);
356  result.push_back(tmpCand);
357  }
358  }
359 
360  return result;
361 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalVector const & direction() const
the direction around which region is constructed
RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef &) const
define region of interest with tracker
T eta() const
Definition: PV3DBase.h:73
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 366 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by chooseRegionalTrackerTracks().

367  {
368  std::unique_ptr<RectangularEtaPhiTrackingRegion> region1 = theRegionBuilder->region(staTrack);
369 
370  TkTrackingRegionsMargin<float> etaMargin(std::abs(region1->etaRange().min() - region1->etaRange().mean()),
371  std::abs(region1->etaRange().max() - region1->etaRange().mean()));
372 
373  RectangularEtaPhiTrackingRegion region2(region1->direction(),
374  region1->origin(),
375  region1->ptMin(),
376  region1->originRBound(),
377  region1->originZBound(),
378  etaMargin,
379  region1->phiMargin());
380 
381  return region2;
382 }
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 473 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by build().

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

References TransientTrackingRecHitBuilder::build(), watchdog::const, DetId::det(), h, GlobalTrackingGeometry::idToDet(), trajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), LogDebug, MuonServiceProxy::magneticField(), DetId::Muon, edm::ESHandle< T >::product(), Propagator::propagate(), MuonServiceProxy::propagator(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), mps_fire::result, GeomDet::surface(), theCategory, theMuonRecHitBuilder, theRPCInTheFit, theService, theTrackerPropagatorName, theTrackerRecHitBuilder, DetId::Tracker, and MuonServiceProxy::trackingGeometry().

Referenced by addTraj(), and build().

531  {
533 
536 
537  auto tkbuilder = static_cast<TkTransientTrackingRecHitBuilder const*>(theTrackerRecHitBuilder.product());
538  auto hitCloner = tkbuilder->cloner();
539  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) {
540  if ((*hit)->isValid()) {
541  DetId recoid = (*hit)->geographicalId();
542  if (recoid.det() == DetId::Tracker) {
543  if (!(*hit)->hasPositionAndError()) {
544  TrajectoryStateOnSurface predTsos =
546  ->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  auto h = (**hit).cloneForFit(*tkbuilder->geometry()->idToDet((**hit).geographicalId()));
555  result.emplace_back(hitCloner.makeShared(h, predTsos));
556  } else {
557  result.push_back((*hit)->cloneSH());
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)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:17
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
const GeomDet * idToDet(DetId) const override
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
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 398 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().

Referenced by ntuplePrintersDiff.TrackingParticlePrinter::__call__(), ntuplePrintersDiff.SeedPrinter::diff(), ntuplePrintersDiff.TrackPrinter::diff(), ntuplePrintersDiff.TrackingParticlePrinter::diff(), ntuplePrintersDiff.SeedPrinter::printSeed(), and ntuplePrintersDiff.TrackPrinter::printTrack().

398  {
399  LogTrace(theCategory) << "Used RecHits: " << hits.size();
400  for (auto&& ir : hits) {
401  if (!ir->isValid()) {
402  LogTrace(theCategory) << "invalid RecHit";
403  continue;
404  }
405 
406  const GlobalPoint& pos = ir->globalPosition();
407 
408  LogTrace(theCategory) << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y()) << " z = " << pos.z()
409  << " dimension = " << ir->dimension() << " " << ir->det()->geographicalId().det() << " "
410  << ir->det()->subDetector();
411  }
412 }
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
#define LogTrace(id)
T x() const
Definition: PV3DBase.h:59
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 449 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by build().

450  {
451  int nTEC(0);
452 
454  for (auto&& i : all) {
455  if (!i->isValid())
456  continue;
457  if (i->det()->geographicalId().det() == DetId::Tracker &&
458  i->det()->geographicalId().subdetId() == StripSubdetector::TEC) {
459  nTEC++;
460  } else {
461  hits.push_back(i);
462  }
463  if (nTEC > 1)
464  return all;
465  }
466 
467  return hits;
468 }
static constexpr auto TEC
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
const MuonServiceProxy* GlobalTrajectoryBuilderBase::service ( ) const
inlineprotected

Definition at line 118 of file GlobalTrajectoryBuilderBase.h.

References theService.

118 { return theService; }
void GlobalTrajectoryBuilderBase::setEvent ( const edm::Event event)
overridevirtual

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Reimplemented in L3MuonTrajectoryBuilder.

Definition at line 136 of file GlobalTrajectoryBuilderBase.cc.

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

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

136  {
137  theEvent = &event;
138 
140  theRegionBuilder->setEvent(event);
141 
142  theGlbRefitter->setEvent(event);
144 
145  unsigned long long newCacheId_TRH = theService->eventSetup().get<TransientRecHitRecord>().cacheIdentifier();
146  if (newCacheId_TRH != theCacheId_TRH) {
147  LogDebug(theCategory) << "TransientRecHitRecord changed!";
148  theCacheId_TRH = newCacheId_TRH;
151  }
152 
153  //Retrieve tracker topology from geometry
155  theService->eventSetup().get<TrackerTopologyRcd>().get(tTopoHand);
156  theTopo = tTopoHand.product();
157 }
#define LogDebug(id)
const edm::EventSetup & eventSetup() const
get the whole EventSetup
void setServices(const edm::EventSetup &) override
set the services needed by the TrackTransformer
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
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 get() const
Definition: EventSetup.h:73
MuonTrackingRegionBuilder * theRegionBuilder
T const * product() const
Definition: ESHandle.h:86
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 387 of file GlobalTrajectoryBuilderBase.cc.

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

Referenced by build().

387  {
388  if (track.ndof() > 0 && track.chiSquared() > 0) {
389  return -LnChiSquaredProbability(track.chiSquared(), track.ndof());
390  } else {
391  return 0.0;
392  }
393 }
float LnChiSquaredProbability(double chiSquared, double nrDOF)
int ndof(bool bon=true) const
Definition: Trajectory.cc:97
float chiSquared() const
Definition: Trajectory.h:241
MuonTrajectoryBuilder::TrajectoryContainer GlobalTrajectoryBuilderBase::trajectories ( const TrajectorySeed )
inlineoverridevirtual

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 62 of file GlobalTrajectoryBuilderBase.h.

References setEvent().

62  {
64  }
MuonCandidate::TrajectoryContainer TrajectoryContainer

Member Data Documentation

unsigned long long GlobalTrajectoryBuilderBase::theCacheId_TRH
private

Definition at line 154 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

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

Definition at line 161 of file GlobalTrajectoryBuilderBase.h.

Referenced by setEvent().

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

Definition at line 149 of file GlobalTrajectoryBuilderBase.h.

int GlobalTrajectoryBuilderBase::theMuonHitsOption
private

Definition at line 157 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

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

Definition at line 165 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theMuonRecHitBuilderName
private

Definition at line 164 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

float GlobalTrajectoryBuilderBase::thePCut
protected

Definition at line 145 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

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

Definition at line 156 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 158 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

float GlobalTrajectoryBuilderBase::theTECyScale
private

Definition at line 159 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and GlobalTrajectoryBuilderBase().

const TrackerTopology* GlobalTrajectoryBuilderBase::theTopo
private

Definition at line 166 of file GlobalTrajectoryBuilderBase.h.

Referenced by build(), and setEvent().

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

Definition at line 163 of file GlobalTrajectoryBuilderBase.h.

Referenced by getTransientRecHits(), and setEvent().

std::string GlobalTrajectoryBuilderBase::theTrackerRecHitBuilderName
private

Definition at line 162 of file GlobalTrajectoryBuilderBase.h.

Referenced by GlobalTrajectoryBuilderBase(), and setEvent().

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