CMS 3D CMS Logo

ExhaustiveMuonTrajectoryBuilder.cc
Go to the documentation of this file.
5 
6 
8  const MuonServiceProxy* proxy,
10  : theTrajBuilder(pset, proxy,iC),
11  theSeeder(),
12  theService(proxy)
13 {
14 }
15 
16 
18 
19 
22 {
23  LocalTrajectoryParameters localTrajectoryParameters(seed.startingState().parameters());
24  LocalVector p(localTrajectoryParameters.momentum());
25  int rawId = seed.startingState().detId();
26  DetId detId(rawId);
27  bool isBarrel = (detId.subdetId() == 1);
28  // homemade local-to-global
29  double pt = (isBarrel) ? -p.z() : p.perp();
30  pt *= localTrajectoryParameters.charge();
31  float err00 = seed.startingState().error(0);
32  // float p_err = sqr(sptmean/(ptmean*ptmean));
33  // mat[0][0]= p_err;
34  float sigmapt = sqrt(err00)*pt*pt;
35  TrajectorySeed::range range = seed.recHits();
37  // Make a new seed based on each segment, using the original pt and sigmapt
38  for(TrajectorySeed::const_iterator recHitItr = range.first;
39  recHitItr != range.second; ++recHitItr)
40  {
41  const GeomDet * geomDet = theService->trackingGeometry()->idToDet((*recHitItr).geographicalId());
43  = MuonTransientTrackingRecHit::specificBuild(geomDet,&*recHitItr);
44  TrajectorySeed tmpSeed(theSeeder.createSeed(pt, sigmapt, muonRecHit));
46  result.insert(result.end(), trajectories.begin(), trajectories.end());
47  }
48  return result;
49 }
50 
51 
54 {
55  return CandidateContainer();
56 }
57 
58 
59 
61 {
62  theTrajBuilder.setEvent(event);
63 }
64 
65 
67 {
68  // choose the one with the most hits, and the smallest chi-squared
69  int best_nhits = 0;
70  unsigned best = 0;
71  unsigned ntraj = trajectories.size();
72  for(unsigned i = 0; i < ntraj; ++i)
73  {
74  int nhits = trajectories[i]->foundHits();
75  if(nhits > best_nhits)
76  {
77  best_nhits = nhits;
78  best = i;
79  }
80  else if(nhits == best_nhits && trajectories[i]->chiSquared() < trajectories[best]->chiSquared())
81  {
82  best = i;
83  }
84  }
86  for(unsigned i = 0; i < ntraj; ++i)
87  {
88  if(i == best) {
89  result.push_back(trajectories[best]);
90  } else {
91  delete trajectories[i];
92  }
93  }
94  trajectories.swap(result);
95 }
96 
MuonCandidate::CandidateContainer CandidateContainer
std::pair< const Trajectory *, reco::TrackRef > TrackCand
virtual void setEvent(const edm::Event &event)
pass the Event to the algo at each event
StandAloneMuonTrajectoryBuilder theTrajBuilder
MuonCandidate::TrajectoryContainer TrajectoryContainer
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
recHitContainer::const_iterator const_iterator
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< const_iterator, const_iterator > range
unsigned int detId() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
range recHits() const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
void clean(TrajectoryContainer &trajectories) const
TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
const GeomDet * idToDet(DetId) const override
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
virtual TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
ExhaustiveMuonTrajectoryBuilder(const edm::ParameterSet &pset, const MuonServiceProxy *, edm::ConsumesCollector &)
const LocalTrajectoryParameters & parameters() const
Definition: event.py:1