CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

SeedFromConsecutiveHitsCreator Class Reference

#include <SeedFromConsecutiveHitsCreator.h>

Inheritance diagram for SeedFromConsecutiveHitsCreator:
SeedCreator SeedFromConsecutiveHitsStraightLineCreator SeedFromConsecutiveHitsTripletOnlyCreator

List of all members.

Public Member Functions

 SeedFromConsecutiveHitsCreator (const edm::ParameterSet &cfg)
 SeedFromConsecutiveHitsCreator (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0)
virtual const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &ordered, const TrackingRegion &region, const edm::EventSetup &es)
virtual ~SeedFromConsecutiveHitsCreator ()

Protected Member Functions

virtual const TrajectorySeedbuildSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
virtual bool checkHit (const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit, const edm::EventSetup &es) const
virtual CurvilinearTrajectoryError initialError (const TrackingRegion &region, float sinTheta) const
virtual GlobalTrajectoryParameters initialKinematic (const SeedingHitSet &hits, const TrackingRegion &region, const edm::EventSetup &es) const
virtual
TransientTrackingRecHit::RecHitPointer 
refitHit (const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const

Protected Attributes

double theBOFFMomentum
std::string thePropagatorLabel

Detailed Description

Definition at line 8 of file SeedFromConsecutiveHitsCreator.h.


Constructor & Destructor Documentation

SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator ( const edm::ParameterSet cfg) [inline]

Definition at line 11 of file SeedFromConsecutiveHitsCreator.h.

                                                              :
    thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
    theBOFFMomentum(cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
      {}
SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0 
) [inline]

Definition at line 16 of file SeedFromConsecutiveHitsCreator.h.

   : thePropagatorLabel(propagator), theBOFFMomentum(seedMomentumForBOFF) { }
virtual SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator ( ) [inline, virtual]

Definition at line 21 of file SeedFromConsecutiveHitsCreator.h.

{}

Member Function Documentation

const TrajectorySeed * SeedFromConsecutiveHitsCreator::buildSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const FreeTrajectoryState fts,
const edm::EventSetup es 
) const [protected, virtual]

Definition at line 101 of file SeedFromConsecutiveHitsCreator.cc.

References alongMomentum, checkHit(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), TrajectoryStateOnSurface::isValid(), TrajectoryStateTransform::persistentState(), Propagator::propagate(), LargeD0_PixelPairStep_cff::propagator, edm::OwnVector< T, P >::push_back(), DetId::rawId(), refitHit(), SeedingHitSet::size(), thePropagatorLabel, patCandidatesForDimuonsSequences_cff::tracker, and KFUpdator::update().

Referenced by trajectorySeed().

{
  // get tracker
  edm::ESHandle<TrackerGeometry> tracker;
  es.get<TrackerDigiGeometryRecord>().get(tracker);
  
  // get propagator
  edm::ESHandle<Propagator>  propagatorHandle;
  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
  const Propagator*  propagator = &(*propagatorHandle);
  
  // get updator
  KFUpdator  updator;
  
  // Now update initial state track using information from seed hits.
  
  TrajectoryStateOnSurface updatedState;
  edm::OwnVector<TrackingRecHit> seedHits;
  
  const TrackingRecHit* hit = 0;
  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
    hit = hits[iHit]->hit();
    TrajectoryStateOnSurface state = (iHit==0) ? 
      propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
      : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
    if (!state.isValid()) return 0;
    
    TransientTrackingRecHit::ConstRecHitPointer tth = hits[iHit]; 
    
    TransientTrackingRecHit::RecHitPointer newtth = refitHit( tth, state);
    
    if (!checkHit(state,newtth,es)) return 0;

    updatedState =  updator.update(state, *newtth);
    if (!updatedState.isValid()) return 0;
    
    seedHits.push_back(newtth->hit()->clone());
  } 

  TrajectoryStateTransform transformer;
  boost::shared_ptr<PTrajectoryStateOnDet> PTraj(
      transformer.persistentState(updatedState, hit->geographicalId().rawId()));
  
  seedCollection.push_back( TrajectorySeed(*PTraj,seedHits,alongMomentum));
  return &seedCollection.back();
}
virtual bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface ,
const TransientTrackingRecHit::ConstRecHitPointer hit,
const edm::EventSetup es 
) const [inline, protected, virtual]

Definition at line 29 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed().

                                     { return true; }
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( const TrackingRegion region,
float  sinTheta 
) const [protected, virtual]

Definition at line 75 of file SeedFromConsecutiveHitsCreator.cc.

References funct::C, GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), max(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), PtMinSelector_cfg::ptMin, TrackingRegion::ptMin(), and funct::sqr().

Referenced by trajectorySeed().

{
  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
  // information.
  GlobalError vertexErr( sqr(region.originRBound()), 0, sqr(region.originRBound()),
                   0, 0, sqr(region.originZBound()));

  float ptMin = region.ptMin();


  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();

// FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small, 
// to avoid instabilities.
// N.B. This parameter needs optimising ...
  float sin2th = sqr(sinTheta);
  float minC00 = 1.0;
  C[0][0] = std::max(sin2th/sqr(ptMin), minC00);
  float zErr = vertexErr.czz();
  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
  C[3][3] = transverseErr;
  C[4][4] = zErr*sin2th + transverseErr*(1-sin2th);

  return CurvilinearTrajectoryError(C);
}
GlobalTrajectoryParameters SeedFromConsecutiveHitsCreator::initialKinematic ( const SeedingHitSet hits,
const TrackingRegion region,
const edm::EventSetup es 
) const [protected, virtual]

Reimplemented in SeedFromConsecutiveHitsStraightLineCreator, and SeedFromConsecutiveHitsTripletOnlyCreator.

Definition at line 39 of file SeedFromConsecutiveHitsCreator.cc.

References abs, GlobalTrajectoryParameters::charge(), edm::EventSetup::get(), GlobalTrajectoryParameters::momentum(), TrackingRegion::origin(), GlobalTrajectoryParameters::position(), theBOFFMomentum, and Vector3DBase< T, FrameTag >::unit().

Referenced by trajectorySeed().

{
  edm::ESHandle<MagneticField> bfield;
  es.get<IdealMagneticFieldRecord>().get(bfield);

  GlobalTrajectoryParameters kine;

  TransientTrackingRecHit::ConstRecHitPointer tth1 = hits[0];
  TransientTrackingRecHit::ConstRecHitPointer tth2 = hits[1];
  const GlobalPoint& vertexPos = region.origin();

  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, es);
  if (helix.isValid()) {
    kine = helix.stateAtVertex().parameters();
  } else {
    GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
    initMomentum *= (100./initMomentum.perp()); 
    kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
  } 

  bool isBOFF = ( std::abs(bfield->inTesla(GlobalPoint(0,0,0)).z()) < 1e-3 );
  if (isBOFF && (theBOFFMomentum > 0)) {
    kine = GlobalTrajectoryParameters(kine.position(),
                              kine.momentum().unit() * theBOFFMomentum,
                              kine.charge(),
                              &*bfield);
  }
  return kine;
}
TransientTrackingRecHit::RecHitPointer SeedFromConsecutiveHitsCreator::refitHit ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrajectoryStateOnSurface state 
) const [protected, virtual]

Definition at line 152 of file SeedFromConsecutiveHitsCreator.cc.

Referenced by buildSeed().

{
  return hit->clone(state);
}
const TrajectorySeed * SeedFromConsecutiveHitsCreator::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet ordered,
const TrackingRegion region,
const edm::EventSetup es 
) [virtual]

Implements SeedCreator.

Definition at line 21 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), error, initialError(), initialKinematic(), GlobalTrajectoryParameters::momentum(), funct::sin(), SeedingHitSet::size(), and PV3DBase< T, PVType, FrameType >::theta().

{
  if ( hits.size() < 2) return 0;

  GlobalTrajectoryParameters kine = initialKinematic(hits, region, es);
  float sinTheta = sin(kine.momentum().theta());

  CurvilinearTrajectoryError error = initialError(region,  sinTheta);
  FreeTrajectoryState fts(kine, error);

  return buildSeed(seedCollection,hits,fts,es); 
}

Member Data Documentation

Definition at line 54 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed().