CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/TrackingTools/TransientTrack/src/TrackTransientTrack.cc

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