CMS 3D CMS Logo

GsfTransientTrack.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TransientTrack/interface/GsfTransientTrack.h"
00002 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00003 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00004 #include "TrackingTools/GsfTools/interface/GsfPropagatorAdapter.h"
00005 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateTransform.h"
00006 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00007 #include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
00008 #include <iostream>
00009 
00010 using namespace reco;
00011 using namespace std;
00012 
00013 GsfTransientTrack::GsfTransientTrack() : 
00014   GsfTrack(), tkr_(), theField(0), initialTSOSAvailable(false),
00015   initialTSCPAvailable(false), blStateAvailable(false)
00016 {
00017   init();
00018 }
00019 
00020 GsfTransientTrack::GsfTransientTrack( const GsfTrack & tk , const MagneticField* field) : 
00021   GsfTrack(tk), tkr_(), theField(field), initialTSOSAvailable(false),
00022   initialTSCPAvailable(false), blStateAvailable(false)
00023 {
00024   init();
00025   TrajectoryStateTransform theTransform;
00026   initialFTS = theTransform.initialFreeState(tk, field);
00027 }
00028 
00029 
00030 GsfTransientTrack::GsfTransientTrack( const GsfTrackRef & tk , const MagneticField* field) : 
00031   GsfTrack(*tk), tkr_(tk), theField(field), initialTSOSAvailable(false),
00032   initialTSCPAvailable(false), blStateAvailable(false)
00033 {
00034   init();
00035   TrajectoryStateTransform theTransform;
00036   initialFTS = theTransform.initialFreeState(*tk, field);
00037 }
00038 
00039 GsfTransientTrack::GsfTransientTrack( const GsfTrack & tk , const MagneticField* field, const edm::ESHandle<GlobalTrackingGeometry>& tg) :
00040   GsfTrack(tk), tkr_(), theField(field), initialTSOSAvailable(false),
00041   initialTSCPAvailable(false), blStateAvailable(false), theTrackingGeometry(tg)
00042 {
00043   init();
00044   TrajectoryStateTransform theTransform;
00045   initialFTS = theTransform.initialFreeState(tk, field);
00046 }
00047 
00048 GsfTransientTrack::GsfTransientTrack( const GsfTrackRef & tk , const MagneticField* field, const edm::ESHandle<GlobalTrackingGeometry>& tg) :
00049   GsfTrack(*tk), tkr_(tk), theField(field), initialTSOSAvailable(false),
00050   initialTSCPAvailable(false), blStateAvailable(false), theTrackingGeometry(tg)
00051 {
00052   init();
00053   TrajectoryStateTransform theTransform;
00054   initialFTS = theTransform.initialFreeState(*tk, field);
00055 }
00056 
00057 
00058 GsfTransientTrack::GsfTransientTrack( const GsfTransientTrack & tt ) :
00059   GsfTrack(tt), tkr_(tt.persistentTrackRef()), theField(tt.field()), 
00060   initialFTS(tt.initialFreeState()), initialTSOSAvailable(false),
00061   initialTSCPAvailable(false)
00062 {
00063   init();
00064   if (tt.initialTSOSAvailable) {
00065     initialTSOS= tt.impactPointState();
00066     initialTSOSAvailable = true;
00067   }
00068   if (tt.initialTSCPAvailable) {
00069     initialTSCP= tt.impactPointTSCP();
00070     initialTSCPAvailable = true;
00071   }
00072 }
00073 
00074 void GsfTransientTrack::init()
00075 {
00076   thePropagator = 
00077     new GsfPropagatorAdapter(AnalyticalPropagator(theField, alongMomentum));
00078   theTIPExtrapolator = new TransverseImpactPointExtrapolator(*thePropagator);
00079 }
00080 
00081 
00082 void GsfTransientTrack::setES(const edm::EventSetup& setup) {
00083 
00084   setup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry); 
00085 
00086 }
00087 
00088 void GsfTransientTrack::setTrackingGeometry(const edm::ESHandle<GlobalTrackingGeometry>& tg) {
00089 
00090   theTrackingGeometry = tg;
00091 
00092 }
00093 
00094 void GsfTransientTrack::setBeamSpot(const BeamSpot& beamSpot)
00095 {
00096   theBeamSpot = beamSpot;
00097 }
00098 
00099 
00100 TrajectoryStateOnSurface GsfTransientTrack::impactPointState() const
00101 {
00102   if (!initialTSOSAvailable) calculateTSOSAtVertex();
00103   return initialTSOS;
00104 }
00105 
00106 TrajectoryStateClosestToPoint GsfTransientTrack::impactPointTSCP() const
00107 {
00108   if (!initialTSCPAvailable) {
00109     initialTSCP = builder(initialFTS, initialFTS.position());
00110     initialTSCPAvailable = true;
00111   }
00112   return initialTSCP;
00113 }
00114 
00115 TrajectoryStateOnSurface GsfTransientTrack::outermostMeasurementState() const
00116 {
00117     MultiTrajectoryStateTransform theTransform;
00118     return theTransform.outerStateOnSurface((*this),*theTrackingGeometry,theField);
00119 }
00120 
00121 TrajectoryStateOnSurface GsfTransientTrack::innermostMeasurementState() const
00122 {
00123     MultiTrajectoryStateTransform theTransform;
00124     return theTransform.innerStateOnSurface((*this),*theTrackingGeometry,theField);
00125 }
00126 
00127 void GsfTransientTrack::calculateTSOSAtVertex() const
00128 {
00129   TransverseImpactPointExtrapolator tipe(theField);
00130   initialTSOS = tipe.extrapolate(initialFTS, initialFTS.position());
00131   initialTSOSAvailable = true;
00132 }
00133 
00134 TrajectoryStateOnSurface 
00135 GsfTransientTrack::stateOnSurface(const GlobalPoint & point) const
00136 {
00137   return theTIPExtrapolator->extrapolate(innermostMeasurementState(), point);
00138 }
00139 
00140 
00141 TrajectoryStateClosestToPoint 
00142 GsfTransientTrack::trajectoryStateClosestToPoint( const GlobalPoint & point ) const
00143 {
00144   return builder(stateOnSurface(point), point);
00145 }
00146 
00147 TrajectoryStateClosestToBeamLine GsfTransientTrack::stateAtBeamLine() const
00148 {
00149   if (!blStateAvailable) {
00150     TrajectoryStateClosestToBeamLineBuilder blsBuilder;
00151     trajectoryStateClosestToBeamLine = blsBuilder(initialFTS, theBeamSpot);
00152     blStateAvailable = true;
00153   }
00154   return trajectoryStateClosestToBeamLine;
00155 }
00156 

Generated on Tue Jun 9 17:48:40 2009 for CMSSW by  doxygen 1.5.4