CMS 3D CMS Logo

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/TrajectoryStateClosestToBeamLineBuilder.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 }
00062 
00063 
00064 TrajectoryStateOnSurface TransientTrackFromFTS::impactPointState() const
00065 {
00066   if (!initialTSOSAvailable) calculateTSOSAtVertex();
00067   return initialTSOS;
00068 }
00069 
00070 TrajectoryStateClosestToPoint TransientTrackFromFTS::impactPointTSCP() const
00071 {
00072   if (!initialTSCPAvailable) {
00073     initialTSCP = builder(initialFTS, initialFTS.position());
00074     initialTSCPAvailable = true;
00075   }
00076   return initialTSCP;
00077 }
00078 
00079 TrajectoryStateOnSurface TransientTrackFromFTS::outermostMeasurementState() const
00080 {
00081   throw cms::Exception("LogicError") << 
00082     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an outermostMeasurementState";
00083 }
00084 
00085 TrajectoryStateOnSurface TransientTrackFromFTS::innermostMeasurementState() const
00086 {
00087   throw cms::Exception("LogicError") << 
00088     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an innermostMeasurementState";
00089 }
00090 
00091 
00092 TrackBaseRef TransientTrackFromFTS::trackBaseRef() const
00093 {
00094   throw cms::Exception("LogicError") << 
00095     "TransientTrack built from a FreeTrajectoryState (TransientTrackFromFTS) can not have an TrackBaseRef";
00096 }
00097 
00098 
00099 void TransientTrackFromFTS::calculateTSOSAtVertex() const
00100 {
00101   TransverseImpactPointExtrapolator tipe(theField);
00102   initialTSOS = tipe.extrapolate(initialFTS, initialFTS.position());
00103   initialTSOSAvailable = true;
00104 }
00105 
00106 TrajectoryStateOnSurface 
00107 TransientTrackFromFTS::stateOnSurface(const GlobalPoint & point) const
00108 {
00109   TransverseImpactPointExtrapolator tipe(theField);
00110   return tipe.extrapolate(initialFTS, point);
00111 }
00112 
00113 const Track & TransientTrackFromFTS::track() const
00114 {
00115   if (!trackAvailable) {
00116     GlobalPoint v = initialFTS.position();
00117     math::XYZPoint  pos( v.x(), v.y(), v.z() );
00118     GlobalVector p = initialFTS.momentum();
00119     math::XYZVector mom( p.x(), p.y(), p.z() );
00120 
00121     theTrack = Track(0., 0., pos, mom, initialFTS.charge(),
00122         initialFTS.curvilinearError());
00123     trackAvailable = true;
00124   }
00125   return theTrack;
00126 }
00127 
00128 TrajectoryStateClosestToBeamLine TransientTrackFromFTS::stateAtBeamLine() const
00129 {
00130   if (!blStateAvailable) {
00131     TrajectoryStateClosestToBeamLineBuilder blsBuilder;
00132     trajectoryStateClosestToBeamLine = blsBuilder(initialFTS, theBeamSpot);
00133     blStateAvailable = true;
00134   }
00135   return trajectoryStateClosestToBeamLine;
00136 }
00137 

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