CMS 3D CMS Logo

Classes | Public Member Functions | Protected Member Functions | Protected Attributes

DualKalmanFactory Class Reference

Inheritance diagram for DualKalmanFactory:
TrajectoryFactoryBase

List of all members.

Classes

struct  DualKalmanInput

Public Member Functions

virtual DualKalmanFactoryclone () const
 DualKalmanFactory (const edm::ParameterSet &config)
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
 Produce the reference trajectories.
virtual ~DualKalmanFactory ()

Protected Member Functions

const DualKalmanInput referenceStateAndRecHits (const ConstTrajTrackPair &track) const

Protected Attributes

const double theMass
const int theResidMethod

Detailed Description

A factory that produces reference trajectory instances of class DualKalmanTrajectory from a given TrajTrackPairCollection.

Currently two methods to set residual and error can be choosen via cfg: 1: the unbiased residal approach 2: the pull approach

Author:
: Gero Flucke date : October 2008
Revision:
1.4
Date:
2011/12/19 14:40:01

(last update by

Author:
mussgill

)

Definition at line 32 of file DualKalmanFactory.cc.


Constructor & Destructor Documentation

DualKalmanFactory::DualKalmanFactory ( const edm::ParameterSet config)

Definition at line 75 of file DualKalmanFactory.cc.

Referenced by clone().

  : TrajectoryFactoryBase(config), theMass(config.getParameter<double>("ParticleMass")),
    theResidMethod(config.getParameter<int>("ResidualMethod"))
{
  // Since theResidMethod is passed to DualKalmanTrajectory, valid values are checked there.
  edm::LogInfo("Alignment") << "@SUB=DualKalmanFactory" << "Factory created.";
}
DualKalmanFactory::~DualKalmanFactory ( ) [virtual]

Definition at line 85 of file DualKalmanFactory.cc.

{}

Member Function Documentation

virtual DualKalmanFactory* DualKalmanFactory::clone ( void  ) const [inline, virtual]

Implements TrajectoryFactoryBase.

Definition at line 49 of file DualKalmanFactory.cc.

References DualKalmanFactory().

{ return new DualKalmanFactory(*this); }
const DualKalmanFactory::DualKalmanInput DualKalmanFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track) const [protected]

Definition at line 139 of file DualKalmanFactory.cc.

References DualKalmanFactory::DualKalmanInput::bwdRecHitNums, DualKalmanFactory::DualKalmanInput::fwdRecHitNums, collect_tpl::input, TrajectoryFactoryBase::orderedTrajectoryMeasurements(), DualKalmanFactory::DualKalmanInput::refTsos, DualKalmanFactory::DualKalmanInput::trajMeasurements, and TrajectoryFactoryBase::useRecHit().

Referenced by trajectories().

{
  // Same idea as in DualTrajectoryFactory::referenceStateAndRecHits(..):
  // Split trajectory in the middle, take middle as reference and provide first
  // and second half of hits, each starting from this middle hit.
  // In contrast to DualTrajectoryFactory we deal here with indices and not rechits directly
  // to be able to get measurements and uncertainties later from the Trajectory that is
  // provided by the Kalman track fit.

  DualKalmanInput input;
 
  // get the trajectory measurements in the correct order, i.e. reverse if needed
  input.trajMeasurements = this->orderedTrajectoryMeasurements(*track.first);

  // get indices of relevant trajectory measurements to find middle of them
  std::vector<unsigned int> usedTrajMeasNums;
  for (unsigned int iM = 0; iM < input.trajMeasurements.size(); ++iM) {
    if (this->useRecHit(input.trajMeasurements[iM].recHit())) usedTrajMeasNums.push_back(iM);
  }
  unsigned int nRefStateMeas = usedTrajMeasNums.size()/2;

  // get the valid RecHits numbers
  for (unsigned int iMeas = 0; iMeas < usedTrajMeasNums.size(); ++iMeas) {
    if (iMeas < nRefStateMeas) {
      input.bwdRecHitNums.push_back(usedTrajMeasNums[iMeas]);
    } else if (iMeas > nRefStateMeas) {
      input.fwdRecHitNums.push_back(usedTrajMeasNums[iMeas]);
    } else { // iMeas == nRefStateMeas
      if (input.trajMeasurements[usedTrajMeasNums[iMeas]].updatedState().isValid()) {
        input.refTsos = input.trajMeasurements[usedTrajMeasNums[iMeas]].updatedState();
        input.bwdRecHitNums.push_back(usedTrajMeasNums[iMeas]);
        input.fwdRecHitNums.push_back(usedTrajMeasNums[iMeas]);
      } else {
        // if the hit/tsos of the middle hit is not valid, try the next one...
        ++nRefStateMeas; // but keep hit if only TSOS bad
        input.bwdRecHitNums.push_back(usedTrajMeasNums[iMeas]);
      }
    }
  }

  // bring input.fwdRecHits into correct order
  std::reverse(input.bwdRecHitNums.begin(), input.bwdRecHitNums.end());

  return input;
}
const DualKalmanFactory::ReferenceTrajectoryCollection DualKalmanFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const [virtual]

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 90 of file DualKalmanFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualKalmanFactory::DualKalmanInput::bwdRecHitNums, DualKalmanFactory::DualKalmanInput::fwdRecHitNums, edm::EventSetup::get(), collect_tpl::input, TrajectoryStateOnSurface::isValid(), TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualKalmanFactory::DualKalmanInput::refTsos, theMass, theResidMethod, TrajectoryFactoryBase::theUseBeamSpot, and DualKalmanFactory::DualKalmanInput::trajMeasurements.

Referenced by trajectories().

{
  ReferenceTrajectoryCollection trajectories;

  edm::ESHandle<MagneticField> magneticField;
  setup.get<IdealMagneticFieldRecord>().get(magneticField);

  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();

  while (itTracks != tracks.end()) { 
    const DualKalmanInput input = this->referenceStateAndRecHits(*itTracks);
    // Check input: If all hits were rejected, the TSOS is initialized as invalid.
    if (input.refTsos.isValid()) {
      ReferenceTrajectoryPtr ptr(new DualKalmanTrajectory(input.trajMeasurements,
                                                          input.refTsos,
                                                          input.fwdRecHitNums,
                                                          input.bwdRecHitNums,
                                                          magneticField.product(),
                                                          this->materialEffects(),
                                                          this->propagationDirection(),
                                                          theMass, theUseBeamSpot, beamSpot,
                                                          theResidMethod));
      trajectories.push_back(ptr);
    }
    ++itTracks;
  }

  return trajectories;
}
const DualKalmanFactory::ReferenceTrajectoryCollection DualKalmanFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const [virtual]

Implements TrajectoryFactoryBase.

Definition at line 124 of file DualKalmanFactory.cc.

References trajectories().

{
  ReferenceTrajectoryCollection trajectories;

  edm::LogError("Alignment") << "@SUB=DualKalmanFactory::trajectories" 
                             << "Not implemented with ExternalPrediction.";
  return trajectories;
}

Member Data Documentation

const double DualKalmanFactory::theMass [protected]

Definition at line 67 of file DualKalmanFactory.cc.

Referenced by trajectories().

const int DualKalmanFactory::theResidMethod [protected]

Definition at line 68 of file DualKalmanFactory.cc.

Referenced by trajectories().