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 &)
 
void setEvent (const edm::Event &event) override
 pass the Event to the algo at each event More...
 
TrajectoryContainer trajectories (const TrajectorySeed &) override
 return a container of the reconstructed trajectories compatible with a given seed More...
 
CandidateContainer trajectories (const TrackCand &) override
 return a container reconstructed muons starting from a given track More...
 
 ~ExhaustiveMuonTrajectoryBuilder () override
 
- 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::ExhaustiveMuonTrajectoryBuilder ( const edm::ParameterSet pset,
const MuonServiceProxy proxy,
edm::ConsumesCollector iC 
)

◆ ~ExhaustiveMuonTrajectoryBuilder()

ExhaustiveMuonTrajectoryBuilder::~ExhaustiveMuonTrajectoryBuilder ( )
override

Definition at line 11 of file ExhaustiveMuonTrajectoryBuilder.cc.

11 {}

Member Function Documentation

◆ clean()

void ExhaustiveMuonTrajectoryBuilder::clean ( TrajectoryContainer trajectories) const
private

Definition at line 45 of file ExhaustiveMuonTrajectoryBuilder.cc.

References mps_fire::i, eostools::move(), nhits, mps_fire::result, and trajectories().

45  {
46  // choose the one with the most hits, and the smallest chi-squared
47  if (trajectories.empty()) {
48  return;
49  }
50  int best_nhits = 0;
51  unsigned best = 0;
52  unsigned ntraj = trajectories.size();
53  for (unsigned i = 0; i < ntraj; ++i) {
54  int nhits = trajectories[i]->foundHits();
55  if (nhits > best_nhits) {
56  best_nhits = nhits;
57  best = i;
58  } else if (nhits == best_nhits && trajectories[i]->chiSquared() < trajectories[best]->chiSquared()) {
59  best = i;
60  }
61  }
63  result.reserve(1);
64  result.emplace_back(std::move(trajectories[best]));
65  trajectories.swap(result);
66 }
MuonCandidate::TrajectoryContainer TrajectoryContainer
TrajectoryContainer trajectories(const TrajectorySeed &) override
return a container of the reconstructed trajectories compatible with a given seed ...
def move(src, dest)
Definition: eostools.py:511

◆ setEvent()

void ExhaustiveMuonTrajectoryBuilder::setEvent ( const edm::Event event)
overridevirtual

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Definition at line 43 of file ExhaustiveMuonTrajectoryBuilder.cc.

References StandAloneMuonTrajectoryBuilder::setEvent(), and theTrajBuilder.

StandAloneMuonTrajectoryBuilder theTrajBuilder
void setEvent(const edm::Event &event) override
Pass the Event to the algo at each event.
Definition: event.py:1

◆ trajectories() [1/2]

MuonTrajectoryBuilder::TrajectoryContainer ExhaustiveMuonTrajectoryBuilder::trajectories ( const TrajectorySeed seed)
overridevirtual

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

Implements MuonTrajectoryBuilder.

Definition at line 13 of file ExhaustiveMuonTrajectoryBuilder.cc.

References MuonSeedFromRecHits::createSeed(), hcalRecHitTable_cff::detId, GlobalTrackingGeometry::idToDet(), PixelPluginsPhase0_cfi::isBarrel, AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, nano_mu_digi_cff::rawId, rpcPointValidation_cfi::recHit, mps_fire::result, fileCollector::seed, MuonTransientTrackingRecHit::specificBuild(), mathSSE::sqrt(), theSeeder, theService, theTrajBuilder, MuonServiceProxy::trackingGeometry(), and StandAloneMuonTrajectoryBuilder::trajectories().

Referenced by clean().

13  {
14  LocalTrajectoryParameters localTrajectoryParameters(seed.startingState().parameters());
15  LocalVector p(localTrajectoryParameters.momentum());
16  int rawId = seed.startingState().detId();
17  DetId detId(rawId);
18  bool isBarrel = (detId.subdetId() == 1);
19  // homemade local-to-global
20  double pt = (isBarrel) ? -p.z() : p.perp();
21  pt *= localTrajectoryParameters.charge();
22  float err00 = seed.startingState().error(0);
23  // float p_err = sqr(sptmean/(ptmean*ptmean));
24  // mat[0][0]= p_err;
25  float sigmapt = sqrt(err00) * pt * pt;
27  // Make a new seed based on each segment, using the original pt and sigmapt
28  for (auto const& recHit : seed.recHits()) {
29  const GeomDet* geomDet = theService->trackingGeometry()->idToDet(recHit.geographicalId());
30  auto muonRecHit = MuonTransientTrackingRecHit::specificBuild(geomDet, &recHit);
31  TrajectorySeed tmpSeed(theSeeder.createSeed(pt, sigmapt, muonRecHit));
33  result.insert(
34  result.end(), std::make_move_iterator(trajectories.begin()), std::make_move_iterator(trajectories.end()));
35  }
36  return result;
37 }
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
StandAloneMuonTrajectoryBuilder theTrajBuilder
MuonCandidate::TrajectoryContainer TrajectoryContainer
const GeomDet * idToDet(DetId) const override
TrajectoryContainer trajectories(const TrajectorySeed &) override
return a container of the reconstructed trajectories compatible with a given seed ...
T sqrt(T t)
Definition: SSEVec.h:19
TrajectoryContainer trajectories(const TrajectorySeed &) override
return a container of the reconstructed trajectories compatible with a given seed ...
Definition: DetId.h:17
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)

◆ trajectories() [2/2]

MuonTrajectoryBuilder::CandidateContainer ExhaustiveMuonTrajectoryBuilder::trajectories ( const TrackCand )
overridevirtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 39 of file ExhaustiveMuonTrajectoryBuilder.cc.

39  {
40  return CandidateContainer();
41 }
MuonCandidate::CandidateContainer CandidateContainer

Member Data Documentation

◆ theSeeder

MuonSeedFromRecHits ExhaustiveMuonTrajectoryBuilder::theSeeder
private

Definition at line 35 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

◆ theService

const MuonServiceProxy* ExhaustiveMuonTrajectoryBuilder::theService
private

Definition at line 36 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

◆ theTrajBuilder

StandAloneMuonTrajectoryBuilder ExhaustiveMuonTrajectoryBuilder::theTrajBuilder
private

Definition at line 34 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by setEvent(), and trajectories().