Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:10:23

0001 #include "TrackingTools/TransientTrack/interface/GsfTransientTrack.h"
0002 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0003 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
0004 #include "TrackingTools/GsfTools/interface/GsfPropagatorAdapter.h"
0005 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateTransform.h"
0006 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0007 #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h"
0008 #include <iostream>
0009 
0010 using namespace reco;
0011 using namespace std;
0012 
0013 GsfTransientTrack::GsfTransientTrack()
0014     : GsfTrack(),
0015       tkr_(),
0016       hasTime(false),
0017       timeExt_(0.),
0018       dtErrorExt_(0.),
0019       theField(nullptr),
0020       initialTSOSAvailable(false),
0021       initialTSCPAvailable(false),
0022       blStateAvailable(false),
0023       theTIPExtrapolator() {}
0024 
0025 GsfTransientTrack::GsfTransientTrack(const GsfTrack& tk, const MagneticField* field)
0026     : GsfTrack(tk),
0027       tkr_(),
0028       hasTime(false),
0029       timeExt_(0.),
0030       dtErrorExt_(0.),
0031       theField(field),
0032       initialTSOSAvailable(false),
0033       initialTSCPAvailable(false),
0034       blStateAvailable(false) {
0035   initialFTS = trajectoryStateTransform::initialFreeState(tk, field);
0036 }
0037 
0038 GsfTransientTrack::GsfTransientTrack(const GsfTrack& tk,
0039                                      const double time,
0040                                      const double dtime,
0041                                      const MagneticField* field)
0042     : GsfTrack(tk),
0043       tkr_(),
0044       hasTime(true),
0045       timeExt_(time),
0046       dtErrorExt_(dtime),
0047       theField(field),
0048       initialTSOSAvailable(false),
0049       initialTSCPAvailable(false),
0050       blStateAvailable(false) {
0051   initialFTS = trajectoryStateTransform::initialFreeState(tk, field);
0052 }
0053 
0054 GsfTransientTrack::GsfTransientTrack(const GsfTrackRef& tk, const MagneticField* field)
0055     : GsfTrack(*tk),
0056       tkr_(tk),
0057       hasTime(false),
0058       timeExt_(0.),
0059       dtErrorExt_(0.),
0060       theField(field),
0061       initialTSOSAvailable(false),
0062       initialTSCPAvailable(false),
0063       blStateAvailable(false),
0064       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0065   initialFTS = trajectoryStateTransform::initialFreeState(*tk, field);
0066 }
0067 
0068 GsfTransientTrack::GsfTransientTrack(const GsfTrackRef& tk,
0069                                      const double time,
0070                                      const double dtime,
0071                                      const MagneticField* field)
0072     : GsfTrack(*tk),
0073       tkr_(tk),
0074       hasTime(true),
0075       timeExt_(time),
0076       dtErrorExt_(dtime),
0077       theField(field),
0078       initialTSOSAvailable(false),
0079       initialTSCPAvailable(false),
0080       blStateAvailable(false),
0081       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0082   initialFTS = trajectoryStateTransform::initialFreeState(*tk, field);
0083 }
0084 
0085 GsfTransientTrack::GsfTransientTrack(const GsfTrack& tk,
0086                                      const MagneticField* field,
0087                                      const edm::ESHandle<GlobalTrackingGeometry>& tg)
0088     : GsfTrack(tk),
0089       tkr_(),
0090       hasTime(false),
0091       timeExt_(0.),
0092       dtErrorExt_(0.),
0093       theField(field),
0094       initialTSOSAvailable(false),
0095       initialTSCPAvailable(false),
0096       blStateAvailable(false),
0097       theTrackingGeometry(tg),
0098       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0099   initialFTS = trajectoryStateTransform::initialFreeState(tk, field);
0100 }
0101 
0102 GsfTransientTrack::GsfTransientTrack(const GsfTrack& tk,
0103                                      const double time,
0104                                      const double dtime,
0105                                      const MagneticField* field,
0106                                      const edm::ESHandle<GlobalTrackingGeometry>& tg)
0107     : GsfTrack(tk),
0108       tkr_(),
0109       hasTime(true),
0110       timeExt_(time),
0111       dtErrorExt_(dtime),
0112       theField(field),
0113       initialTSOSAvailable(false),
0114       initialTSCPAvailable(false),
0115       blStateAvailable(false),
0116       theTrackingGeometry(tg),
0117       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0118   initialFTS = trajectoryStateTransform::initialFreeState(tk, field);
0119 }
0120 
0121 GsfTransientTrack::GsfTransientTrack(const GsfTrackRef& tk,
0122                                      const MagneticField* field,
0123                                      const edm::ESHandle<GlobalTrackingGeometry>& tg)
0124     : GsfTrack(*tk),
0125       tkr_(tk),
0126       hasTime(false),
0127       timeExt_(0.),
0128       dtErrorExt_(0.),
0129       theField(field),
0130       initialTSOSAvailable(false),
0131       initialTSCPAvailable(false),
0132       blStateAvailable(false),
0133       theTrackingGeometry(tg),
0134       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0135   initialFTS = trajectoryStateTransform::initialFreeState(*tk, field);
0136 }
0137 
0138 GsfTransientTrack::GsfTransientTrack(const GsfTrackRef& tk,
0139                                      const double time,
0140                                      const double dtime,
0141                                      const MagneticField* field,
0142                                      const edm::ESHandle<GlobalTrackingGeometry>& tg)
0143     : GsfTrack(*tk),
0144       tkr_(tk),
0145       hasTime(true),
0146       timeExt_(time),
0147       dtErrorExt_(dtime),
0148       theField(field),
0149       initialTSOSAvailable(false),
0150       initialTSCPAvailable(false),
0151       blStateAvailable(false),
0152       theTrackingGeometry(tg),
0153       theTIPExtrapolator(AnalyticalPropagator(field, alongMomentum)) {
0154   initialFTS = trajectoryStateTransform::initialFreeState(*tk, field);
0155 }
0156 
0157 GsfTransientTrack::GsfTransientTrack(const GsfTransientTrack& tt)
0158     : GsfTrack(tt),
0159       tkr_(tt.persistentTrackRef()),
0160       hasTime(tt.hasTime),
0161       timeExt_(tt.timeExt_),
0162       dtErrorExt_(tt.dtErrorExt_),
0163       theField(tt.field()),
0164       initialFTS(tt.initialFreeState()),
0165       initialTSOSAvailable(false),
0166       initialTSCPAvailable(false),
0167       theTIPExtrapolator(AnalyticalPropagator(tt.field(), alongMomentum)) {
0168   if (tt.initialTSOSAvailable) {
0169     initialTSOS = tt.impactPointState();
0170     initialTSOSAvailable = true;
0171   }
0172   if (tt.initialTSCPAvailable) {
0173     initialTSCP = tt.impactPointTSCP();
0174     initialTSCPAvailable = true;
0175   }
0176 }
0177 
0178 void GsfTransientTrack::setTrackingGeometry(const edm::ESHandle<GlobalTrackingGeometry>& tg) {
0179   theTrackingGeometry = tg;
0180 }
0181 
0182 void GsfTransientTrack::setBeamSpot(const BeamSpot& beamSpot) {
0183   theBeamSpot = beamSpot;
0184   blStateAvailable = false;
0185 }
0186 
0187 TrajectoryStateOnSurface GsfTransientTrack::impactPointState() const {
0188   if (!initialTSOSAvailable)
0189     calculateTSOSAtVertex();
0190   return initialTSOS;
0191 }
0192 
0193 TrajectoryStateClosestToPoint GsfTransientTrack::impactPointTSCP() const {
0194   if (!initialTSCPAvailable) {
0195     initialTSCP = builder(initialFTS, initialFTS.position());
0196     initialTSCPAvailable = true;
0197   }
0198   return initialTSCP;
0199 }
0200 
0201 TrajectoryStateOnSurface GsfTransientTrack::outermostMeasurementState() const {
0202   return MultiTrajectoryStateTransform::outerStateOnSurface(*this, *theTrackingGeometry, theField);
0203 }
0204 
0205 TrajectoryStateOnSurface GsfTransientTrack::innermostMeasurementState() const {
0206   return MultiTrajectoryStateTransform::innerStateOnSurface(*this, *theTrackingGeometry, theField);
0207 }
0208 
0209 void GsfTransientTrack::calculateTSOSAtVertex() const {
0210   TransverseImpactPointExtrapolator tipe(theField);
0211   initialTSOS = tipe.extrapolate(initialFTS, initialFTS.position());
0212   initialTSOSAvailable = true;
0213 }
0214 
0215 TrajectoryStateOnSurface GsfTransientTrack::stateOnSurface(const GlobalPoint& point) const {
0216   return theTIPExtrapolator.extrapolate(innermostMeasurementState(), point);
0217 }
0218 
0219 TrajectoryStateClosestToPoint GsfTransientTrack::trajectoryStateClosestToPoint(const GlobalPoint& point) const {
0220   return builder(stateOnSurface(point), point);
0221 }
0222 
0223 TrajectoryStateClosestToBeamLine GsfTransientTrack::stateAtBeamLine() const {
0224   if (!blStateAvailable) {
0225     TSCBLBuilderNoMaterial blsBuilder;
0226     trajectoryStateClosestToBeamLine = blsBuilder(initialFTS, theBeamSpot);
0227     blStateAvailable = true;
0228   }
0229   return trajectoryStateClosestToBeamLine;
0230 }