CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TrackTransformer Class Referencefinal

#include <TrackTransformer.h>

Inheritance diagram for TrackTransformer:
TrackTransformerBase

Public Member Functions

TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits (const reco::TransientTrack &track) const
 
const MagneticFieldmagneticField () const
 the magnetic field More...
 
std::unique_ptr< TrajectoryFitter > const & refitter () const
 the refitter used to refit the reco::Track More...
 
void setServices (const edm::EventSetup &) override
 set the services needed by the TrackTransformer More...
 
std::unique_ptr< TrajectorySmoother > const & smoother () const
 the smoother used to smooth the trajectory which came from the refitting step More...
 
edm::ESHandle< GlobalTrackingGeometrytrackingGeometry () const
 the tracking geometry More...
 
 TrackTransformer (const edm::ParameterSet &)
 Constructor. More...
 
std::vector< Trajectorytransform (const reco::Track &) const override
 Convert a reco::Track into Trajectory. More...
 
std::vector< Trajectorytransform (const reco::TrackRef &) const
 Convert a reco::TrackRef into Trajectory. More...
 
std::vector< Trajectorytransform (const reco::TransientTrack &, TransientTrackingRecHit::ConstRecHitContainer &) const
 Convert a reco::TrackRef into Trajectory, refit with a new set of hits. More...
 
 ~TrackTransformer () override
 Destructor. More...
 
- Public Member Functions inherited from TrackTransformerBase
 TrackTransformerBase ()
 Constructor. More...
 
virtual ~TrackTransformerBase ()
 Destructor. More...
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &descriptions, bool DoPredictionsOnly=false, const std::string &Fitter="KFFitterForRefitInsideOut", const std::string &Smoother="KFSmootherForRefitInsideOut", const std::string &Propagator="SmartPropagatorAnyRK", const std::string &RefitDirection="alongMomentum", bool RefitRPCHits=true, const std::string &TrackerRecHitBuilder="WithTrackAngle", const std::string &MuonRecHitBuilder="MuonRecHitBuilder", const std::string &MTDRecHitBuilder="MTDRecHitBuilder")
 fillDescriptions More...
 

Private Member Functions

RefitDirection::GeometricalDirection checkRecHitsOrdering (TransientTrackingRecHit::ConstRecHitContainer const &) const
 
edm::ESHandle< Propagator > const & propagator () const
 

Private Attributes

TkClonerImpl hitCloner
 
unsigned long long theCacheId_GTG =0
 
unsigned long long theCacheId_MG =0
 
unsigned long long theCacheId_TC =0
 
unsigned long long theCacheId_TRH =0
 
const bool theDoPredictionsOnly
 
std::unique_ptr< TrajectoryFittertheFitter
 
const std::string theFitterName
 
edm::ESHandle< MagneticFieldtheMGField
 
bool theMtdAvailable
 
edm::ESHandle< TransientTrackingRecHitBuildertheMTDRecHitBuilder
 
const std::string theMTDRecHitBuilderName
 
edm::ESHandle< TransientTrackingRecHitBuildertheMuonRecHitBuilder
 
const std::string theMuonRecHitBuilderName
 
edm::ESHandle< PropagatorthePropagator
 
const std::string thePropagatorName
 
const RefitDirection theRefitDirection
 
const bool theRPCInTheFit
 
std::unique_ptr< TrajectorySmoothertheSmoother
 
const std::string theSmootherName
 
edm::ESHandle< TransientTrackingRecHitBuildertheTrackerRecHitBuilder
 
const std::string theTrackerRecHitBuilderName
 
edm::ESHandle< GlobalTrackingGeometrytheTrackingGeometry
 

Detailed Description

This class takes a reco::Track and refits the rechits inside it. The final result is a Trajectory refitted and smoothed. To make the refitting (and the smoothing) the usual KF tools are used.

CAVEAT: till now (it will be changed in the near future) the class stores the pointers to the services, therefore EACH event the setServices(const edm::EventSetup&) method MUST be called in the code in which the TrackTransformer is used.

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

This class takes a reco::Track and refits the rechits inside it. The final result is a Trajectory refitted and smoothed. To make the refitting (and the smoothing) the usual KF tools are used.

CAVEAT: till now (it will be changed in the near future) the class stores the pointers to the services, therefore EACH event the setServices(const edm::EventSetup&) method MUST be called in the code in which the TrackTransformer is used.

Rec hits are ordered in rank of increasing |z| assuing muons are coming from the top of the detector.

$Date: 2009/01/15 author R. Bellan - CERN ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch modified for zed ordering by N. Kypreos - UF nicho.nosp@m.las..nosp@m.theod.nosp@m.ore..nosp@m.kypre.nosp@m.os@c.nosp@m.ern.c.nosp@m.h

This class takes a reco::Track and refits the rechits inside it. The final result is a Trajectory refitted and smoothed. To make the refitting (and the smoothing) the usual KF tools are used.

CAVEAT: till now (it will be changed in the near future) the class stores the pointers to the services, therefore EACH event the setServices(const edm::EventSetup&) method MUST be called in the code in which the TrackTransformer is used.

Author
R. Bellan - CERN ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 38 of file TrackTransformer.h.

Constructor & Destructor Documentation

TrackTransformer::TrackTransformer ( const edm::ParameterSet parameterSet)
explicit

Constructor.

Definition at line 31 of file TrackTransformer.cc.

31  :
32  theRPCInTheFit(parameterSet.getParameter<bool>("RefitRPCHits")),
33  theDoPredictionsOnly(parameterSet.getParameter<bool>("DoPredictionsOnly")),
34  theRefitDirection(parameterSet.getParameter<string>("RefitDirection")),
35  theFitterName(parameterSet.getParameter<string>("Fitter")),
36  theSmootherName(parameterSet.getParameter<string>("Smoother")),
37  thePropagatorName(parameterSet.getParameter<string>("Propagator")),
38  theTrackerRecHitBuilderName(parameterSet.getParameter<string>("TrackerRecHitBuilder")),
39  theMuonRecHitBuilderName(parameterSet.getParameter<string>("MuonRecHitBuilder")),
40  theMTDRecHitBuilderName(parameterSet.getParameter<string>("MTDRecHitBuilder"))
41  {}
T getParameter(std::string const &) const
const std::string theTrackerRecHitBuilderName
const RefitDirection theRefitDirection
const bool theRPCInTheFit
const std::string thePropagatorName
const std::string theFitterName
const std::string theMuonRecHitBuilderName
const std::string theSmootherName
const std::string theMTDRecHitBuilderName
const bool theDoPredictionsOnly
TrackTransformer::~TrackTransformer ( )
override

Destructor.

Definition at line 44 of file TrackTransformer.cc.

44 {}

Member Function Documentation

RefitDirection::GeometricalDirection TrackTransformer::checkRecHitsOrdering ( TransientTrackingRecHit::ConstRecHitContainer const &  recHits) const
private

Definition at line 154 of file TrackTransformer.cc.

References plotBeamSpotDB::first, GlobalTrackingGeometry::idToDet(), RefitDirection::insideOut, plotBeamSpotDB::last, LogDebug, PV3DBase< T, PVType, FrameType >::mag2(), RefitDirection::outsideIn, position, trackingGeometry(), and RefitDirection::undetermined.

Referenced by transform().

154  {
155 
156  if (!recHits.empty()){
157  GlobalPoint first = trackingGeometry()->idToDet(recHits.front()->geographicalId())->position();
158  GlobalPoint last = trackingGeometry()->idToDet(recHits.back()->geographicalId())->position();
159 
160  // maybe perp2?
161  auto rFirst = first.mag2();
162  auto rLast = last.mag2();
163  if(rFirst < rLast) return RefitDirection::insideOut;
164  if(rFirst > rLast) return RefitDirection::outsideIn;
165  }
166  LogDebug("Reco|TrackingTools|TrackTransformer") << "Impossible to determine the rechits order" <<endl;
168 }
#define LogDebug(id)
T mag2() const
Definition: PV3DBase.h:66
static int position[264][3]
Definition: ReadPGInfo.cc:509
const GeomDet * idToDet(DetId) const override
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
void TrackTransformer::fillPSetDescription ( edm::ParameterSetDescription descriptions,
bool  DoPredictionsOnly = false,
const std::string &  Fitter = "KFFitterForRefitInsideOut",
const std::string &  Smoother = "KFSmootherForRefitInsideOut",
const std::string &  Propagator = "SmartPropagatorAnyRK",
const std::string &  RefitDirection = "alongMomentum",
bool  RefitRPCHits = true,
const std::string &  TrackerRecHitBuilder = "WithTrackAngle",
const std::string &  MuonRecHitBuilder = "MuonRecHitBuilder",
const std::string &  MTDRecHitBuilder = "MTDRecHitBuilder" 
)
static

fillDescriptions

Definition at line 46 of file TrackTransformer.cc.

References edm::ParameterSetDescription::add(), rpcPointProducer_cfi::DoPredictionsOnly, egammaCTFFinalFitWithMaterial_cff::Fitter, GlobalTrajectoryBuilderCommon_cff::MTDRecHitBuilder, rpcPointProducer_cfi::MuonRecHitBuilder, LaserSeedGenerator_cfi::Propagator, rpcPointProducer_cfi::RefitDirection, MuonAlignmentFromReference_cff::RefitRPCHits, KFFittingSmootherForInOut_cfi::Smoother, AlCaHLTBitMon_QueryRunRegistry::string, and rpcPointProducer_cfi::TrackerRecHitBuilder.

Referenced by L3MuonProducer::fillDescriptions(), and TrackExtenderWithMTDT< TrackCollection >::fillDescriptions().

55  {
56  desc.add<bool>("DoPredictionsOnly",DoPredictionsOnly);
57  desc.add<std::string>("Fitter",Fitter);
58  desc.add<std::string>("Smoother",Smoother);
59  desc.add<std::string>("Propagator",Propagator);
60  desc.add<std::string>("RefitDirection",RefitDirection);
61  desc.add<bool>("RefitRPCHits",RefitRPCHits);
62  desc.add<std::string>("TrackerRecHitBuilder",TrackerRecHitBuilder);
63  desc.add<std::string>("MuonRecHitBuilder",MuonRecHitBuilder);
64  desc.add<std::string>("MTDRecHitBuilder",MTDRecHitBuilder);
65 }
TransientTrackingRecHit::ConstRecHitContainer TrackTransformer::getTransientRecHits ( const reco::TransientTrack track) const

Definition at line 125 of file TrackTransformer.cc.

References TransientTrackingRecHitBuilder::build(), Exception, FastTime, DetId::Forward, LogTrace, DetId::Muon, edm::ESHandle< T >::product(), reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), mps_fire::result, theMtdAvailable, theMTDRecHitBuilder, theMuonRecHitBuilder, theRPCInTheFit, theTrackerRecHitBuilder, and DetId::Tracker.

Referenced by transform().

125  {
126 
128  auto tkbuilder = static_cast<TkTransientTrackingRecHitBuilder const *>(theTrackerRecHitBuilder.product());
129 
130 
131  for (auto hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) {
132  if((*hit)->isValid()) {
133  if ( (*hit)->geographicalId().det() == DetId::Tracker ) {
134  result.emplace_back((**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) ) );
135  } else if ( (*hit)->geographicalId().det() == DetId::Muon ){
136  if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
137  LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged";
138  continue;
139  }
140  result.push_back(theMuonRecHitBuilder->build(&**hit));
141  } else if ( (*hit)->geographicalId().det() == DetId::Forward &&
142  (*hit)->geographicalId().subdetId() == FastTime ) {
143  if ( theMtdAvailable ) result.push_back(theMTDRecHitBuilder->build(&**hit));
144  else throw cms::Exception("TrackTransformer") << "MTD hit encountered but MTD not available!";
145  }
146  }
147  }
148 
149  return result;
150 }
const bool theRPCInTheFit
edm::ESHandle< TransientTrackingRecHitBuilder > theMTDRecHitBuilder
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
#define LogTrace(id)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
std::vector< ConstRecHitPointer > ConstRecHitContainer
T const * product() const
Definition: ESHandle.h:84
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
const MagneticField* TrackTransformer::magneticField ( ) const
inline

the magnetic field

Definition at line 73 of file TrackTransformer.h.

Referenced by transform().

73 {return &*theMGField;}
edm::ESHandle< MagneticField > theMGField
edm::ESHandle<Propagator> const& TrackTransformer::propagator ( ) const
inlineprivate

Definition at line 116 of file TrackTransformer.h.

Referenced by transform().

116 {return thePropagator;}
edm::ESHandle< Propagator > thePropagator
std::unique_ptr<TrajectoryFitter> const& TrackTransformer::refitter ( ) const
inline

the refitter used to refit the reco::Track

Definition at line 82 of file TrackTransformer.h.

82 {return theFitter;}
std::unique_ptr< TrajectoryFitter > theFitter
void TrackTransformer::setServices ( const edm::EventSetup setup)
overridevirtual

set the services needed by the TrackTransformer

Implements TrackTransformerBase.

Definition at line 67 of file TrackTransformer.cc.

References TrajectorySmoother::clone(), TrajectoryFitter::clone(), edm::EventSetup::get(), hitCloner, edm::ESHandleBase::isValid(), LogTrace, metname, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, theCacheId_GTG, theCacheId_MG, theCacheId_TC, theCacheId_TRH, theFitter, theFitterName, theMGField, theMtdAvailable, theMTDRecHitBuilder, theMTDRecHitBuilderName, theMuonRecHitBuilder, theMuonRecHitBuilderName, thePropagator, thePropagatorName, theSmoother, theSmootherName, theTrackerRecHitBuilder, theTrackerRecHitBuilderName, and theTrackingGeometry.

Referenced by TrackingRecoMaterialAnalyser::analyze(), MuonKinkFinder::init(), MuonReSeeder::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsAlignmentAlgorithm::run(), and GlobalTrajectoryBuilderBase::setEvent().

67  {
68 
69  const std::string metname = "Reco|TrackingTools|TrackTransformer";
70 
73  setup.get<TrajectoryFitter::Record>().get(theFitterName,aFitter);
74  setup.get<TrajectoryFitter::Record>().get(theSmootherName,aSmoother);
75  theFitter = aFitter->clone();
76  theSmoother.reset(aSmoother->clone());
77 
78  unsigned long long newCacheId_TC = setup.get<TrackingComponentsRecord>().cacheIdentifier();
79 
80  if ( newCacheId_TC != theCacheId_TC ){
81  LogTrace(metname) << "Tracking Component changed!";
82  theCacheId_TC = newCacheId_TC;
84  }
85 
86  // Global Tracking Geometry
87  unsigned long long newCacheId_GTG = setup.get<GlobalTrackingGeometryRecord>().cacheIdentifier();
88  if ( newCacheId_GTG != theCacheId_GTG ) {
89  LogTrace(metname) << "GlobalTrackingGeometry changed!";
90  theCacheId_GTG = newCacheId_GTG;
92  }
93 
94  // Magfield Field
95  unsigned long long newCacheId_MG = setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
96  if ( newCacheId_MG != theCacheId_MG ) {
97  LogTrace(metname) << "Magnetic Field changed!";
98  theCacheId_MG = newCacheId_MG;
100  }
101 
102  // Transient Rechit Builders
103  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
104  if ( newCacheId_TRH != theCacheId_TRH ) {
105  theCacheId_TRH = newCacheId_TRH;
106  LogTrace(metname) << "TransientRecHitRecord changed!";
112  }
113  theFitter->setHitCloner(&hitCloner);
114  theSmoother->setHitCloner(&hitCloner);
115 
116 }
const std::string theTrackerRecHitBuilderName
const std::string metname
unsigned long long theCacheId_TRH
virtual TrajectorySmoother * clone() const =0
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
edm::ESHandle< TransientTrackingRecHitBuilder > theMTDRecHitBuilder
virtual std::unique_ptr< TrajectoryFitter > clone() const =0
edm::ESHandle< Propagator > thePropagator
unsigned long long theCacheId_MG
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
std::unique_ptr< TrajectoryFitter > theFitter
unsigned long long theCacheId_TC
const std::string thePropagatorName
const std::string theFitterName
edm::ESHandle< MagneticField > theMGField
unsigned long long theCacheId_GTG
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
#define LogTrace(id)
const std::string theMuonRecHitBuilderName
TkClonerImpl hitCloner
const std::string theSmootherName
const std::string theMTDRecHitBuilderName
T get() const
Definition: EventSetup.h:68
bool isValid() const
Definition: ESHandle.h:45
T const * product() const
Definition: ESHandle.h:84
std::unique_ptr< TrajectorySmoother > theSmoother
std::unique_ptr<TrajectorySmoother> const& TrackTransformer::smoother ( ) const
inline

the smoother used to smooth the trajectory which came from the refitting step

Definition at line 85 of file TrackTransformer.h.

References HiIsolationCommonParameters_cff::track.

85 {return theSmoother;}
std::unique_ptr< TrajectorySmoother > theSmoother
edm::ESHandle<GlobalTrackingGeometry> TrackTransformer::trackingGeometry ( ) const
inline

the tracking geometry

Definition at line 76 of file TrackTransformer.h.

Referenced by checkRecHitsOrdering(), and transform().

76 {return theTrackingGeometry;}
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< Trajectory > TrackTransformer::transform ( const reco::Track newTrack) const
overridevirtual

Convert a reco::Track into Trajectory.

Convert Tracks into Trajectories.

Implements TrackTransformerBase.

Definition at line 172 of file TrackTransformer.cc.

References getTransientRecHits(), magneticField(), metname, AlCaHLTBitMon_QueryRunRegistry::string, HiIsolationCommonParameters_cff::track, and trackingGeometry().

Referenced by TrackingRecoMaterialAnalyser::analyze(), GlobalTrajectoryBuilderBase::build(), CSCPairResidualsConstraint::dphidzFromTrack(), MuonKinkFinder::fillTrkKink(), MuonReSeeder::produce(), TrackerToMuonPropagator::produce(), and transform().

172  {
173 
174  const std::string metname = "Reco|TrackingTools|TrackTransformer";
175 
177 
178  auto recHitsForReFit = getTransientRecHits(track);
179  return transform(track, recHitsForReFit);
180 }
const MagneticField * magneticField() const
the magnetic field
const std::string metname
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::TransientTrack &track) const
std::vector< Trajectory > transform(const reco::Track &) const override
Convert a reco::Track into Trajectory.
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
vector< Trajectory > TrackTransformer::transform ( const reco::TrackRef track) const

Convert a reco::TrackRef into Trajectory.

Definition at line 119 of file TrackTransformer.cc.

References transform().

119  {
120  return transform(*track);
121 }
std::vector< Trajectory > transform(const reco::Track &) const override
Convert a reco::Track into Trajectory.
vector< Trajectory > TrackTransformer::transform ( const reco::TransientTrack track,
TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit 
) const

Convert a reco::TrackRef into Trajectory, refit with a new set of hits.

Convert Tracks into Trajectories with a given set of hits.

Definition at line 184 of file TrackTransformer.cc.

References alongMomentum, anyDirection, checkRecHitsOrdering(), RefitDirection::geometricalDirection(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), reco::Track::innerDetId(), reco::TransientTrack::innermostMeasurementState(), RefitDirection::insideOut, TrajectoryStateOnSurface::isValid(), LogTrace, metname, oppositeToMomentum, reco::Track::outerDetId(), reco::TransientTrack::outermostMeasurementState(), RefitDirection::outsideIn, AlCaHLTBitMon_ParallelJobs::p, position, Propagator::propagate(), RefitDirection::propagationDirection(), propagator(), Trajectory::push(), groupFilesInBlocks::reverse, SurveyInfoScenario_cff::seed, AlCaHLTBitMon_QueryRunRegistry::string, TrajectoryStateOnSurface::surface(), theDoPredictionsOnly, theFitter, theRefitDirection, theSmoother, reco::TransientTrack::track(), HiRegitMuonDetachedTripletStep_cff::trajectories, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

185  {
186 
187  const std::string metname = "Reco|TrackingTools|TrackTransformer";
188 
189  if(recHitsForReFit.size() < 2) return vector<Trajectory>();
190 
191  // 8 cases are foreseen:
192  // [RH = rec hit order, P = momentum dir, FD = fit direction. IO/OI = inside-out/outside-in, AM/OM = along momentum/opposite to momentum]
193  // (1) RH IO | P IO | FD AM ---> Start from IN
194  // (2) RH IO | P IO | FD OM ---> Reverse RH and start from OUT
195  // (3) RH IO | P OI | FD AM ---> Reverse RH and start from IN
196  // (4) RH IO | P OI | FD OM ---> Start from OUT
197  // (5) RH OI | P IO | FD AM ---> Reverse RH and start from IN
198  // (6) RH OI | P IO | FD OM ---> Start from OUT
199  // (7) RH OI | P OI | FD AM ---> Start from IN
200  // (8) RH OI | P OI | FD OM ---> Reverse RH and start from OUT
201  //
202  // *** Rules: ***
203  // -A- If RH-FD agree (IO-AM,OI-OM) do not reverse the RH
204  // -B- If FD along momentum start from innermost state, otherwise use outermost
205 
206  // Other special cases can be handled:
207  // (1 bis) RH IO | P IO | GFD IO => FD AM ---> Start from IN
208  // (2 bis) RH IO | P IO | GFD OI => FD OM ---> Reverse RH and start from OUT
209  // (3 bis) RH IO | P OI | GFD OI => FD AM ---> Reverse RH and start from OUT
210  // (4 bis) RH IO | P OI | GFD IO => FD OM ---> Start from IN
211  // (5 bis) RH OI | P IO | GFD IO => FD AM ---> Reverse RH and start from IN
212  // (6 bis) RH OI | P IO | GFD OI => FD OM ---> Start from OUT
213  // (7 bis) RH OI | P OI | GFD OI => FD AM ---> Start from OUT
214  // (8 bis) RH OI | P OI | GFD IO => FD OM ---> Reverse RH and start from IN
215  //
216  // *** Additional rule: ***
217  // -A0- If P and GFD agree, then FD is AM otherwise is OM
218  // -A00- rechit must be ordered as GFD in order to handle the case of cosmics
219  // -B0- The starting state is decided by GFD
220 
221  // Determine the RH order
222  RefitDirection::GeometricalDirection recHitsOrder = checkRecHitsOrdering(recHitsForReFit); // FIXME change nome of the *type* --> RecHit order!
223  LogTrace(metname) << "RH order (0-insideOut, 1-outsideIn): " << recHitsOrder;
224 
226 
227  // Apply rule -A0-
228  if(propagationDirection == anyDirection){
231  RefitDirection::GeometricalDirection p = (momentum.x()*position.x() > 0 || momentum.y()*position.y() > 0) ? RefitDirection::insideOut : RefitDirection::outsideIn;
232 
234  LogTrace(metname) << "P (0-insideOut, 1-outsideIn): " << p;
235  LogTrace(metname) << "FD (0-OM, 1-AM, 2-ANY): " << propagationDirection;
236  }
237  // -A0-
238 
239  // Apply rule -A-
241  if((recHitsOrder == RefitDirection::insideOut && propagationDirection == oppositeToMomentum) ||
242  (recHitsOrder == RefitDirection::outsideIn && propagationDirection == alongMomentum) )
243  reverse(recHitsForReFit.begin(),recHitsForReFit.end());}
244  // -A-
245  // Apply rule -A00-
246  else{
247  // reorder the rechit as defined in theRefitDirection.geometricalDirection();
248  if(theRefitDirection.geometricalDirection() != recHitsOrder) reverse(recHitsForReFit.begin(),recHitsForReFit.end());
249  }
250  // -A00-
251 
252  // Apply rule -B-
254  unsigned int innerId = track.track().innerDetId();
256  if(propagationDirection == oppositeToMomentum){
257  innerId = track.track().outerDetId();
258  firstTSOS = track.outermostMeasurementState();
259  }
260  }
261  else { // if(theRefitDirection.propagationDirection() == anyDirection)
262  // Apply rule -B0-
264  innerId = track.track().outerDetId();
265  firstTSOS = track.outermostMeasurementState();
266  }
267  // -B0-
268  }
269  // -B-
270 
271  if(!firstTSOS.isValid()){
272  LogTrace(metname)<<"Error wrong initial state!"<<endl;
273  return vector<Trajectory>();
274  }
275 
277 
278  if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){
279  LogTrace(metname)<<"Propagation occured"<<endl;
280  firstTSOS = propagator()->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
281  if(!firstTSOS.isValid()){
282  LogTrace(metname)<<"Propagation error!"<<endl;
283  return vector<Trajectory>();
284  }
285  }
286 
288  Trajectory aTraj(seed,propagationDirection);
289  TrajectoryStateOnSurface predTSOS = firstTSOS;
290  for(auto const & hit : recHitsForReFit) {
291  predTSOS = propagator()->propagate(predTSOS, hit->det()->surface());
292  if (predTSOS.isValid()) aTraj.push(TrajectoryMeasurement(predTSOS, hit));
293  }
294  return vector<Trajectory>(1, aTraj);
295  }
296 
297 
298  auto const & trajectories = theFitter->fit(seed,recHitsForReFit,firstTSOS);
299 
300  if(trajectories.empty()){
301  LogTrace(metname)<<"No Track refitted!"<<endl;
302  return trajectories;
303  }
304 
305  auto const & trajectoryBW = trajectories.front();
306 
307  auto const & trajectoriesSM = theSmoother->trajectories(trajectoryBW);
308 
309  if(trajectoriesSM.empty()){
310  LogTrace(metname)<<"No Track smoothed!"<<endl;
311  }
312 
313  return trajectoriesSM;
314 
315 }
PropagationDirection propagationDirection() const
const std::string metname
const RefitDirection theRefitDirection
GeometricalDirection geometricalDirection() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
PropagationDirection
TrajectoryStateOnSurface innermostMeasurementState() const
RefitDirection::GeometricalDirection checkRecHitsOrdering(TransientTrackingRecHit::ConstRecHitContainer const &) const
const SurfaceType & surface() const
std::unique_ptr< TrajectoryFitter > theFitter
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:96
TrajectoryStateOnSurface outermostMeasurementState() const
edm::ESHandle< Propagator > const & propagator() const
#define LogTrace(id)
Definition: DetId.h:18
const Track & track() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
const bool theDoPredictionsOnly
GlobalVector globalMomentum() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
T x() const
Definition: PV3DBase.h:62
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:101
std::unique_ptr< TrajectorySmoother > theSmoother

Member Data Documentation

TkClonerImpl TrackTransformer::hitCloner
private

Definition at line 121 of file TrackTransformer.h.

Referenced by setServices().

unsigned long long TrackTransformer::theCacheId_GTG =0
private

Definition at line 97 of file TrackTransformer.h.

Referenced by setServices().

unsigned long long TrackTransformer::theCacheId_MG =0
private

Definition at line 98 of file TrackTransformer.h.

Referenced by setServices().

unsigned long long TrackTransformer::theCacheId_TC =0
private

Definition at line 96 of file TrackTransformer.h.

Referenced by setServices().

unsigned long long TrackTransformer::theCacheId_TRH =0
private

Definition at line 99 of file TrackTransformer.h.

Referenced by setServices().

const bool TrackTransformer::theDoPredictionsOnly
private

Definition at line 103 of file TrackTransformer.h.

Referenced by transform().

std::unique_ptr<TrajectoryFitter> TrackTransformer::theFitter
private

Definition at line 110 of file TrackTransformer.h.

Referenced by setServices(), and transform().

const std::string TrackTransformer::theFitterName
private

Definition at line 109 of file TrackTransformer.h.

Referenced by setServices().

edm::ESHandle<MagneticField> TrackTransformer::theMGField
private

Definition at line 107 of file TrackTransformer.h.

Referenced by setServices().

bool TrackTransformer::theMtdAvailable
private

Definition at line 127 of file TrackTransformer.h.

Referenced by getTransientRecHits(), and setServices().

edm::ESHandle<TransientTrackingRecHitBuilder> TrackTransformer::theMTDRecHitBuilder
private

Definition at line 128 of file TrackTransformer.h.

Referenced by getTransientRecHits(), and setServices().

const std::string TrackTransformer::theMTDRecHitBuilderName
private

Definition at line 126 of file TrackTransformer.h.

Referenced by setServices().

edm::ESHandle<TransientTrackingRecHitBuilder> TrackTransformer::theMuonRecHitBuilder
private

Definition at line 124 of file TrackTransformer.h.

Referenced by getTransientRecHits(), and setServices().

const std::string TrackTransformer::theMuonRecHitBuilderName
private

Definition at line 123 of file TrackTransformer.h.

Referenced by setServices().

edm::ESHandle<Propagator> TrackTransformer::thePropagator
private

Definition at line 117 of file TrackTransformer.h.

Referenced by setServices().

const std::string TrackTransformer::thePropagatorName
private

Definition at line 115 of file TrackTransformer.h.

Referenced by setServices().

const RefitDirection TrackTransformer::theRefitDirection
private

Definition at line 104 of file TrackTransformer.h.

Referenced by transform().

const bool TrackTransformer::theRPCInTheFit
private

Definition at line 101 of file TrackTransformer.h.

Referenced by getTransientRecHits().

std::unique_ptr<TrajectorySmoother> TrackTransformer::theSmoother
private

Definition at line 113 of file TrackTransformer.h.

Referenced by setServices(), and transform().

const std::string TrackTransformer::theSmootherName
private

Definition at line 112 of file TrackTransformer.h.

Referenced by setServices().

edm::ESHandle<TransientTrackingRecHitBuilder> TrackTransformer::theTrackerRecHitBuilder
private

Definition at line 120 of file TrackTransformer.h.

Referenced by getTransientRecHits(), and setServices().

const std::string TrackTransformer::theTrackerRecHitBuilderName
private

Definition at line 119 of file TrackTransformer.h.

Referenced by setServices().

edm::ESHandle<GlobalTrackingGeometry> TrackTransformer::theTrackingGeometry
private

Definition at line 106 of file TrackTransformer.h.

Referenced by setServices().