CMS 3D CMS Logo

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