CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TrackingTools/TransientTrack/src/TransientTrackFromFTS.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TransientTrack/interface/TransientTrackFromFTS.h"
00002 #include "DataFormats/Math/interface/Error.h" 
00003 #include "DataFormats/Math/interface/Vector3D.h" 
00004 #include "TrackingTools/PatternTools/interface/TransverseImpactPointExtrapolator.h"
00005 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00006 #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h"
00007 #include <iostream>
00008 
00009 using namespace reco;
00010 
00011 TransientTrackFromFTS::TransientTrackFromFTS() : 
00012   theField(0), initialTSOSAvailable(false), initialTSCPAvailable(false),
00013   trackAvailable(false), blStateAvailable(false)
00014 {}
00015 
00016 TransientTrackFromFTS::TransientTrackFromFTS(const FreeTrajectoryState & fts) :
00017   initialFTS(fts), theField(&(initialFTS.parameters().magneticField())),
00018   initialTSOSAvailable(false), initialTSCPAvailable(false), trackAvailable(false),
00019   blStateAvailable(false)
00020 {}
00021 
00022 
00023 TransientTrackFromFTS::TransientTrackFromFTS(const FreeTrajectoryState & fts,
00024         const edm::ESHandle<GlobalTrackingGeometry>& tg) :
00025   initialFTS(fts), theField(&(initialFTS.parameters().magneticField())),
00026   initialTSOSAvailable(false), initialTSCPAvailable(false), trackAvailable(false),
00027   blStateAvailable(false), theTrackingGeometry(tg)
00028 {}
00029 
00030 
00031 TransientTrackFromFTS::TransientTrackFromFTS( const TransientTrackFromFTS & tt ) :
00032   initialFTS(tt.initialFreeState()), theField(tt.field()), initialTSOSAvailable(false),
00033   initialTSCPAvailable(false), trackAvailable(false)
00034 {
00035   if (tt.initialTSOSAvailable) {
00036     initialTSOS= tt.impactPointState();
00037     initialTSOSAvailable = true;
00038   }
00039   if (tt.initialTSCPAvailable) {
00040     initialTSCP= tt.impactPointTSCP();
00041     initialTSCPAvailable = true;
00042   }
00043 }
00044 
00045 
00046 
00047 void TransientTrackFromFTS::setES(const edm::EventSetup& setup)
00048 {
00049   setup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry); 
00050 }
00051 
00052 void
00053 TransientTrackFromFTS::setTrackingGeometry(const edm::ESHandle<GlobalTrackingGeometry>& tg)
00054 {
00055   theTrackingGeometry = tg;
00056 }
00057 
00058 void TransientTrackFromFTS::setBeamSpot(const BeamSpot& beamSpot)
00059 {
00060   theBeamSpot = beamSpot;
00061   blStateAvailable = false;
00062 }
00063 
00064 
00065 TrajectoryStateOnSurface TransientTrackFromFTS::impactPointState() const
00066 {
00067   if (!initialTSOSAvailable) calculateTSOSAtVertex();
00068   return initialTSOS;
00069 }
00070 
00071 TrajectoryStateClosestToPoint TransientTrackFromFTS::impactPointTSCP() const
00072 {
00073   if (!initialTSCPAvailable) {
00074     initialTSCP = builder(initialFTS, initialFTS.position());
00075     initialTSCPAvailable = true;
00076   }
00077   return initialTSCP;
00078 }
00079 
00080 TrajectoryStateOnSurface TransientTrackFromFTS::outermostMeasurementState() const
00081 {
00082   throw cms::Exception("LogicError") << 
00083     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an outermostMeasurementState";
00084 }
00085 
00086 TrajectoryStateOnSurface TransientTrackFromFTS::innermostMeasurementState() const
00087 {
00088   throw cms::Exception("LogicError") << 
00089     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an innermostMeasurementState";
00090 }
00091 
00092 
00093 TrackBaseRef TransientTrackFromFTS::trackBaseRef() const
00094 {
00095   throw cms::Exception("LogicError") << 
00096     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an TrackBaseRef";
00097 }
00098 
00099 
00100 void TransientTrackFromFTS::calculateTSOSAtVertex() const
00101 {
00102   TransverseImpactPointExtrapolator tipe(theField);
00103   initialTSOS = tipe.extrapolate(initialFTS, initialFTS.position());
00104   initialTSOSAvailable = true;
00105 }
00106 
00107 TrajectoryStateOnSurface 
00108 TransientTrackFromFTS::stateOnSurface(const GlobalPoint & point) const
00109 {
00110   TransverseImpactPointExtrapolator tipe(theField);
00111   return tipe.extrapolate(initialFTS, point);
00112 }
00113 
00114 const Track & TransientTrackFromFTS::track() const
00115 {
00116   if (!trackAvailable) {
00117     GlobalPoint v = initialFTS.position();
00118     math::XYZPoint  pos( v.x(), v.y(), v.z() );
00119     GlobalVector p = initialFTS.momentum();
00120     math::XYZVector mom( p.x(), p.y(), p.z() );
00121 
00122     theTrack = Track(0., 0., pos, mom, initialFTS.charge(),
00123         initialFTS.curvilinearError());
00124     trackAvailable = true;
00125   }
00126   return theTrack;
00127 }
00128 
00129 TrajectoryStateClosestToBeamLine TransientTrackFromFTS::stateAtBeamLine() const
00130 {
00131   if (!blStateAvailable) {
00132     TSCBLBuilderNoMaterial blsBuilder;
00133     trajectoryStateClosestToBeamLine = blsBuilder(initialFTS, theBeamSpot);
00134     blStateAvailable = true;
00135   }
00136   return trajectoryStateClosestToBeamLine;
00137 }
00138