CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ExhaustiveMuonTrajectoryBuilder Class Reference

#include <ExhaustiveMuonTrajectoryBuilder.h>

Inheritance diagram for ExhaustiveMuonTrajectoryBuilder:
MuonTrajectoryBuilder

Public Member Functions

 ExhaustiveMuonTrajectoryBuilder (const edm::ParameterSet &pset, const MuonServiceProxy *, edm::ConsumesCollector &)
 
virtual void setEvent (const edm::Event &event)
 pass the Event to the algo at each event More...
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &)
 return a container of the reconstructed trajectories compatible with a given seed More...
 
virtual CandidateContainer trajectories (const TrackCand &)
 return a container reconstructed muons starting from a given track More...
 
virtual ~ExhaustiveMuonTrajectoryBuilder ()
 
- Public Member Functions inherited from MuonTrajectoryBuilder
 MuonTrajectoryBuilder ()
 constructor More...
 
virtual ~MuonTrajectoryBuilder ()
 destructor More...
 

Private Member Functions

void clean (TrajectoryContainer &trajectories) const
 

Private Attributes

MuonSeedFromRecHits theSeeder
 
const MuonServiceProxytheService
 
StandAloneMuonTrajectoryBuilder theTrajBuilder
 

Additional Inherited Members

- Public Types inherited from MuonTrajectoryBuilder
typedef MuonCandidate::CandidateContainer CandidateContainer
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
typedef MuonCandidate::TrajectoryContainer TrajectoryContainer
 

Detailed Description

Instead of letting the SeedGenerator code choose a segment to start from, this TrajectoryBuilder makes a seed wfor each segment, and chooses the Trajectory with the most hits and the lowest chi-squared

Definition at line 17 of file ExhaustiveMuonTrajectoryBuilder.h.

Constructor & Destructor Documentation

ExhaustiveMuonTrajectoryBuilder::ExhaustiveMuonTrajectoryBuilder ( const edm::ParameterSet pset,
const MuonServiceProxy proxy,
edm::ConsumesCollector iC 
)

Definition at line 7 of file ExhaustiveMuonTrajectoryBuilder.cc.

10  : theTrajBuilder(pset, proxy,iC),
11  theSeeder(),
12  theService(proxy)
13 {
14 }
StandAloneMuonTrajectoryBuilder theTrajBuilder
ExhaustiveMuonTrajectoryBuilder::~ExhaustiveMuonTrajectoryBuilder ( )
virtual

Definition at line 17 of file ExhaustiveMuonTrajectoryBuilder.cc.

17 {}

Member Function Documentation

void ExhaustiveMuonTrajectoryBuilder::clean ( TrajectoryContainer trajectories) const
private

Definition at line 66 of file ExhaustiveMuonTrajectoryBuilder.cc.

References mps_fire::i, nhits, and mps_fire::result.

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 }
MuonCandidate::TrajectoryContainer TrajectoryContainer
virtual TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
void ExhaustiveMuonTrajectoryBuilder::setEvent ( const edm::Event event)
virtual

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Definition at line 60 of file ExhaustiveMuonTrajectoryBuilder.cc.

References StandAloneMuonTrajectoryBuilder::setEvent(), and theTrajBuilder.

61 {
62  theTrajBuilder.setEvent(event);
63 }
StandAloneMuonTrajectoryBuilder theTrajBuilder
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
MuonTrajectoryBuilder::TrajectoryContainer ExhaustiveMuonTrajectoryBuilder::trajectories ( const TrajectorySeed seed)
virtual

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

Implements MuonTrajectoryBuilder.

Definition at line 21 of file ExhaustiveMuonTrajectoryBuilder.cc.

References MuonSeedFromRecHits::createSeed(), PTrajectoryStateOnDet::detId(), PTrajectoryStateOnDet::error(), GlobalTrackingGeometry::idToDet(), gedGsfElectrons_cfi::isBarrel, AlCaHLTBitMon_ParallelJobs::p, PTrajectoryStateOnDet::parameters(), EnergyCorrector::pt, TrajectorySeed::recHits(), mps_fire::result, MuonTransientTrackingRecHit::specificBuild(), mathSSE::sqrt(), TrajectorySeed::startingState(), DetId::subdetId(), theSeeder, theService, theTrajBuilder, MuonServiceProxy::trackingGeometry(), and StandAloneMuonTrajectoryBuilder::trajectories().

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 }
StandAloneMuonTrajectoryBuilder theTrajBuilder
MuonCandidate::TrajectoryContainer TrajectoryContainer
virtual const GeomDet * idToDet(DetId) const
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
recHitContainer::const_iterator const_iterator
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< const_iterator, const_iterator > range
unsigned int detId() const
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
range recHits() const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
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
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 ...
const LocalTrajectoryParameters & parameters() const
MuonTrajectoryBuilder::CandidateContainer ExhaustiveMuonTrajectoryBuilder::trajectories ( const TrackCand )
virtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 53 of file ExhaustiveMuonTrajectoryBuilder.cc.

54 {
55  return CandidateContainer();
56 }
MuonCandidate::CandidateContainer CandidateContainer

Member Data Documentation

MuonSeedFromRecHits ExhaustiveMuonTrajectoryBuilder::theSeeder
private

Definition at line 37 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

const MuonServiceProxy* ExhaustiveMuonTrajectoryBuilder::theService
private

Definition at line 38 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

StandAloneMuonTrajectoryBuilder ExhaustiveMuonTrajectoryBuilder::theTrajBuilder
private

Definition at line 36 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by setEvent(), and trajectories().