CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Alignment/ReferenceTrajectories/src/BzeroReferenceTrajectory.cc

Go to the documentation of this file.
00001 
00002 #include "Alignment/ReferenceTrajectories/interface/BzeroReferenceTrajectory.h"
00003 
00004 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h" 
00005 #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
00006 
00007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00008 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00009 
00010 
00011 BzeroReferenceTrajectory::BzeroReferenceTrajectory(const TrajectoryStateOnSurface &refTsos,
00012                                                    const TransientTrackingRecHit::ConstRecHitContainer
00013                                                    &recHits, bool hitsAreReverse,
00014                                                    const MagneticField *magField, 
00015                                                    MaterialEffects materialEffects,
00016                                                    PropagationDirection propDir,
00017                                                    double mass, double momentumEstimate,
00018                                                    bool useBeamSpot, const reco::BeamSpot &beamSpot) :
00019   ReferenceTrajectory( refTsos.localParameters().mixedFormatVector().kSize, recHits.size(), materialEffects),
00020   theMomentumEstimate( momentumEstimate )
00021 {
00022   // no check against magField == 0
00023 
00024   // No estimate for momentum of cosmics available -> set to default value.
00025   theParameters = asHepVector(refTsos.localParameters().mixedFormatVector());
00026   theParameters[0] = 1./theMomentumEstimate;
00027 
00028   LocalTrajectoryParameters locParamWithFixedMomentum( asSVector<5>(theParameters),
00029                                                        refTsos.localParameters().pzSign(),
00030                                                        refTsos.localParameters().charge() );
00031 
00032   const TrajectoryStateOnSurface refTsosWithFixedMomentum(locParamWithFixedMomentum, refTsos.localError(),
00033                                                           refTsos.surface(), magField,
00034                                                           surfaceSide(propDir));
00035 
00036   if (hitsAreReverse)
00037   {
00038     TransientTrackingRecHit::ConstRecHitContainer fwdRecHits;
00039     fwdRecHits.reserve(recHits.size());
00040 
00041     for (TransientTrackingRecHit::ConstRecHitContainer::const_reverse_iterator it=recHits.rbegin(); it != recHits.rend(); ++it)
00042       fwdRecHits.push_back(*it);
00043 
00044     theValidityFlag = this->construct(refTsosWithFixedMomentum, fwdRecHits, mass,
00045                                       materialEffects, propDir, magField,
00046                                       useBeamSpot, beamSpot);
00047   } else {
00048     theValidityFlag = this->construct(refTsosWithFixedMomentum, recHits, mass,
00049                                       materialEffects, propDir, magField, 
00050                                       useBeamSpot, beamSpot);
00051   }
00052 
00053   // Exclude momentum from the parameters and also the derivatives of the measurements w.r.t. the momentum.
00054   theParameters = theParameters.sub( 2, 5 );
00055   theDerivatives = theDerivatives.sub( 1, theDerivatives.num_row(), 2, theDerivatives.num_col() );
00056 }