CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ExhaustiveMuonTrajectoryBuilder Class Reference

#include <ExhaustiveMuonTrajectoryBuilder.h>

Inheritance diagram for ExhaustiveMuonTrajectoryBuilder:
MuonTrajectoryBuilder

List of all members.

Public Member Functions

 ExhaustiveMuonTrajectoryBuilder (const edm::ParameterSet &pset, const MuonServiceProxy *)
virtual void setEvent (const edm::Event &event)
 pass the Event to the algo at each event
virtual CandidateContainer trajectories (const TrackCand &)
 return a container reconstructed muons starting from a given track
virtual TrajectoryContainer trajectories (const TrajectorySeed &)
 return a container of the reconstructed trajectories compatible with a given seed
virtual ~ExhaustiveMuonTrajectoryBuilder ()

Private Member Functions

void clean (TrajectoryContainer &trajectories) const

Private Attributes

MuonSeedFromRecHits theSeeder
const MuonServiceProxytheService
StandAloneMuonTrajectoryBuilder theTrajBuilder

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 15 of file ExhaustiveMuonTrajectoryBuilder.h.


Constructor & Destructor Documentation

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

Definition at line 7 of file ExhaustiveMuonTrajectoryBuilder.cc.

: theTrajBuilder(pset, proxy),
  theSeeder(),
  theService(proxy)
{
}
ExhaustiveMuonTrajectoryBuilder::~ExhaustiveMuonTrajectoryBuilder ( ) [virtual]

Definition at line 16 of file ExhaustiveMuonTrajectoryBuilder.cc.

{}

Member Function Documentation

void ExhaustiveMuonTrajectoryBuilder::clean ( TrajectoryContainer trajectories) const [private]

Definition at line 67 of file ExhaustiveMuonTrajectoryBuilder.cc.

References i, and query::result.

Referenced by trajectories().

{
  // choose the one with the most hits, and the smallest chi-squared
  int best_nhits = 0;
  unsigned best = 0;
  unsigned ntraj = trajectories.size();
  for(unsigned i = 0; i < ntraj; ++i)
  {
    int nhits = trajectories[i]->foundHits();
    if(nhits > best_nhits)
    {
      best_nhits = nhits;
      best = i;
    }
    else if(nhits == best_nhits && trajectories[i]->chiSquared() < trajectories[best]->chiSquared())
    {
      best = i;
    }
  }
  TrajectoryContainer result;
  for(unsigned i = 0; i < ntraj; ++i)
  {
    if(i == best) {
      result.push_back(trajectories[best]);
    } else {
       delete trajectories[i];
    }
  }
  trajectories.swap(result);
}
void ExhaustiveMuonTrajectoryBuilder::setEvent ( const edm::Event event) [virtual]

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Definition at line 61 of file ExhaustiveMuonTrajectoryBuilder.cc.

References StandAloneMuonTrajectoryBuilder::setEvent(), and theTrajBuilder.

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 20 of file ExhaustiveMuonTrajectoryBuilder.cc.

References clean(), MuonSeedFromRecHits::createSeed(), PTrajectoryStateOnDet::detId(), PTrajectoryStateOnDet::errorMatrix(), L1TEmulatorMonitor_cff::p, PTrajectoryStateOnDet::parameters(), ExpressReco_HICollisions_FallBack::pt, TrajectorySeed::recHits(), query::result, MuonTransientTrackingRecHit::specificBuild(), mathSSE::sqrt(), TrajectorySeed::startingState(), DetId::subdetId(), theSeeder, theService, theTrajBuilder, MuonServiceProxy::trackingGeometry(), and StandAloneMuonTrajectoryBuilder::trajectories().

{
  LocalTrajectoryParameters localTrajectoryParameters(seed.startingState().parameters());
  LocalVector p(localTrajectoryParameters.momentum());
  int rawId = seed.startingState().detId();
  DetId detId(rawId);
  bool isBarrel = (detId.subdetId() == 1);
  // homemade local-to-global
  double pt = (isBarrel) ? -p.z() : p.perp();
  pt *= localTrajectoryParameters.charge();
  float err00 = seed.startingState().errorMatrix()[0];
  //   float p_err = sqr(sptmean/(ptmean*ptmean));
  //  mat[0][0]= p_err;
  float sigmapt = sqrt(err00)*pt*pt;
  TrajectorySeed::range range = seed.recHits();
  TrajectoryContainer result;
  // Make a new seed based on each segment, using the original pt and sigmapt
  for(TrajectorySeed::const_iterator recHitItr = range.first;
      recHitItr != range.second; ++recHitItr)
  {
    const GeomDet * geomDet = theService->trackingGeometry()->idToDet((*recHitItr).geographicalId());
    MuonTransientTrackingRecHit::MuonRecHitPointer muonRecHit 
      = MuonTransientTrackingRecHit::specificBuild(geomDet,&*recHitItr);
    TrajectorySeed tmpSeed(theSeeder.createSeed(pt, sigmapt, muonRecHit));
    TrajectoryContainer trajectories(theTrajBuilder.trajectories(tmpSeed));
    result.insert(result.end(), trajectories.begin(), trajectories.end());
  }
  // choose the best trajectory
  if(!result.empty()) clean(result);
  return result;
}
MuonTrajectoryBuilder::CandidateContainer ExhaustiveMuonTrajectoryBuilder::trajectories ( const TrackCand ) [virtual]

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 54 of file ExhaustiveMuonTrajectoryBuilder.cc.

{
  return CandidateContainer();
}

Member Data Documentation

Definition at line 35 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

Definition at line 36 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by trajectories().

Definition at line 34 of file ExhaustiveMuonTrajectoryBuilder.h.

Referenced by setEvent(), and trajectories().