Classes | |
struct | DualKalmanInput |
Public Member Functions | |
virtual DualKalmanFactory * | clone () 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 |
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
(last update by
)
Definition at line 32 of file DualKalmanFactory.cc.
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.
{}
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 194 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 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; // copy paste from DualTrajectoryFactory: if (tracks.size() != external.size()) { edm::LogInfo("ReferenceTrajectories") << "@SUB=DualKalmanFactory::trajectories" << "Inconsistent input:\n" << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size(); return trajectories; } /* edm::ESHandle<MagneticField> magneticField; setup.get<IdealMagneticFieldRecord>().get(magneticField); ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin(); ExternalPredictionCollection::const_iterator itExternal = external.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()) { if ((*itExternal).isValid()) { TrajectoryStateOnSurface propExternal = this->propagateExternal(*itExternal, input.refTsos.surface(), magneticField.product()); if (!propExternal.isValid()) continue; // set the flag for reversing the RecHits to false, since they are already in the correct order. ReferenceTrajectoryPtr ptr(new DualKalmanTrajectory(propExternal, input.fwdRecHits, input.bwdRecHits, magneticField.product(), materialEffects(), propagationDirection(), theMass, theResidMethod)); AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>(propExternal.localError().matrix())); ptr->setParameterErrors(externalParamErrors); trajectories.push_back(ptr); } else { ReferenceTrajectoryPtr ptr(new DualKalmanTrajectory(input.refTsos, input.fwdRecHits, input.bwdRecHits, magneticField.product(), materialEffects(), propagationDirection(), theMass, theResidMethod)); trajectories.push_back(ptr); } } ++itTracks; ++itExternal; } */ return trajectories; }
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().