CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
GsfTrackProducerBase Class Reference

#include <GsfTrackProducerBase.h>

Inheritance diagram for GsfTrackProducerBase:
TrackProducerBase< reco::GsfTrack > AlgoProductTraits< reco::GsfTrack > GsfTrackProducer GsfTrackRefitter

Public Member Functions

 GsfTrackProducerBase (bool trajectoryInEvent, bool split)
 Constructor. More...
 
virtual void putInEvt (edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::unique_ptr< TrackingRecHitCollection > &, std::unique_ptr< reco::GsfTrackCollection > &, std::unique_ptr< reco::TrackExtraCollection > &, std::unique_ptr< reco::GsfTrackExtraCollection > &, std::unique_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, const reco::BeamSpot &, const TrackerTopology *ttopo)
 Put produced collections in the event. More...
 
- Public Member Functions inherited from TrackProducerBase< reco::GsfTrack >
const edm::ParameterSetgetConf () const
 
virtual void getFromES (const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
 Get needed services from the Event Setup. More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
 Get TrackCandidateCollection from the Event (needed by TrackProducer) More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackView > &, reco::BeamSpot &)
 Get TrackCollection from the Event (needed by TrackRefitter) More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)=0
 Method where the procduction take place. To be implemented in concrete classes. More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setClusterRemovalInfo (const edm::InputTag &clusterRemovalInfo)
 Sets the information on cluster removal, and turns it on. More...
 
void setConf (const edm::ParameterSet &conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::GsfTrack &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
void setSrc (const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase ()(false)
 Destructor. More...
 

Protected Member Functions

void fillMode (reco::GsfTrack &track, const TrajectoryStateOnSurface innertsos, const Propagator &gsfProp, const TransverseImpactPointExtrapolator &tipExtrapolator, TrajectoryStateClosestToBeamLineBuilder &tscblBuilder, const reco::BeamSpot &bs) const
 
void fillStates (TrajectoryStateOnSurface tsos, std::vector< reco::GsfComponent5D > &states) const
 

Private Member Functions

bool computeModeAtTM (const TrajectoryMeasurement &tm, reco::GsfTrackExtra::Point &position, reco::GsfTrackExtra::Vector &momentum, Measurement1D &deltaP) const
 position, momentum and estimated deltaP at an intermediate measurement (true if successful) More...
 
void localParametersFromQpMode (const TrajectoryStateOnSurface tsos, AlgebraicVector5 &parameters, AlgebraicSymMatrix55 &covariance) const
 local parameters rescaled with q/p from mode More...
 

Private Attributes

bool useSplitting
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::GsfTrack >
using AlgoProductCollection = typename Base::AlgoProductCollection
 
using Base = AlgoProductTraits< reco::GsfTrack >
 
using TrackCollection = typename Base::TrackCollection
 
using TrackView = typename Base::TrackView
 
- Public Types inherited from AlgoProductTraits< reco::GsfTrack >
using AlgoProductCollection = std::vector< AlgoProduct >
 
using TrackCollection = std::vector< reco::GsfTrack >
 
using TrackView = edm::View< reco::GsfTrack >
 
- Protected Attributes inherited from TrackProducerBase< reco::GsfTrack >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::InputTag clusterRemovalInfo_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT< MeasurementTrackerEventmteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle< TrackCollectionrTracks_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Produce Tracks from TrackCandidates

Author
cerati

Definition at line 26 of file GsfTrackProducerBase.h.

Constructor & Destructor Documentation

GsfTrackProducerBase::GsfTrackProducerBase ( bool  trajectoryInEvent,
bool  split 
)
inlineexplicit

Member Function Documentation

bool GsfTrackProducerBase::computeModeAtTM ( const TrajectoryMeasurement tm,
reco::GsfTrackExtra::Point position,
reco::GsfTrackExtra::Vector momentum,
Measurement1D deltaP 
) const
private

position, momentum and estimated deltaP at an intermediate measurement (true if successful)

Definition at line 351 of file GsfTrackProducerBase.cc.

References TrajectoryMeasurement::backwardPredictedState(), CollinearFitAtTM2::deltaP(), TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), localParametersFromQpMode(), LocalTrajectoryError::matrix(), TrajectoryMeasurement::recHit(), mps_fire::result, TrajectoryMeasurement::updatedState(), LocalTrajectoryParameters::vector(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GsfTrackProducerBase(), and putInEvt().

355 {
356  //
357  // states
358  //
361  TrajectoryStateOnSurface upState = tm.updatedState();
362 
363 
364  if ( !fwdState.isValid() || !bwdState.isValid() || !upState.isValid() ) {
365  return false;
366  }
367  //
368  // position from mean, momentum from mode (in cartesian coordinates)
369  // following PF code
370  //
371  GlobalPoint pos = upState.globalPosition();
372  position = reco::GsfTrackExtra::Point(pos.x(),pos.y(),pos.z());
374  GlobalVector mom;
375  bool result = mts.momentumFromModeCartesian(upState,mom);
376  if ( !result ) {
377 // std::cout << "momentumFromModeCartesian failed" << std::endl;
378  return false;
379  }
380  momentum = reco::GsfTrackExtra::Vector(mom.x(),mom.y(),mom.z());
381  //
382  // calculation from deltaP from fit to forward & backward predictions
383  // (momentum from mode) and hit
384  //
385  // prepare input parameter vectors and covariance matrices
386  AlgebraicVector5 fwdPars = fwdState.localParameters().vector();
387  AlgebraicSymMatrix55 fwdCov = fwdState.localError().matrix();
388  localParametersFromQpMode(fwdState,fwdPars,fwdCov);
389  AlgebraicVector5 bwdPars = bwdState.localParameters().vector();
390  AlgebraicSymMatrix55 bwdCov = bwdState.localError().matrix();
391  localParametersFromQpMode(bwdState,bwdPars,bwdCov);
392  LocalPoint hitPos(0.,0.,0.);
393  LocalError hitErr(-1.,-1.,-1.);
394  if ( tm.recHit()->isValid() ) {
395  hitPos = tm.recHit()->localPosition();
396  hitErr = tm.recHit()->localPositionError();
397  }
398  CollinearFitAtTM2 collinearFit(fwdPars,fwdCov,bwdPars,bwdCov,hitPos,hitErr);
399  deltaP = collinearFit.deltaP();
400 
401  return true;
402 }
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
AlgebraicVector5 vector() const
T z() const
Definition: PV3DBase.h:64
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
void localParametersFromQpMode(const TrajectoryStateOnSurface tsos, AlgebraicVector5 &parameters, AlgebraicSymMatrix55 &covariance) const
local parameters rescaled with q/p from mode
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
math::XYZPoint Point
point in the space
Definition: GsfTrackExtra.h:25
static int position[264][3]
Definition: ReadPGInfo.cc:509
TrajectoryStateOnSurface const & updatedState() const
math::XYZVector Vector
spatial vector
Definition: GsfTrackExtra.h:27
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
void GsfTrackProducerBase::fillMode ( reco::GsfTrack track,
const TrajectoryStateOnSurface  innertsos,
const Propagator gsfProp,
const TransverseImpactPointExtrapolator tipExtrapolator,
TrajectoryStateClosestToBeamLineBuilder tscblBuilder,
const reco::BeamSpot bs 
) const
protected

Definition at line 254 of file GsfTrackProducerBase.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::curvilinearError(), reco::GsfTrack::dimensionMode, reco::BeamSpot::dxdz(), reco::BeamSpot::dydz(), TransverseImpactPointExtrapolator::extrapolate(), CurvilinearTrajectoryError::matrix(), SingleGaussianState1D::mean(), GaussianSumUtilities1D::mean(), GaussianSumUtilities1D::mode(), GaussianSumUtilities1D::modeIsValid(), FreeTrajectoryState::momentum(), MultiGaussianStateTransform::multiState1D(), reco::BeamSpot::position(), Propagator::propagate(), reco::GsfTrack::setMode(), mathSSE::sqrt(), TrajectoryStateOnSurface::surface(), SingleGaussianState1D::variance(), GaussianSumUtilities1D::variance(), reco::TrackBase::vz(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GsfTrackProducerBase(), and putInEvt().

259 {
260  // Get transverse impact parameter plane (from mean). This is a first approximation;
261  // the mode is then extrapolated to the
262  // final position closest to the beamline.
263  GlobalPoint bsPos(bs.position().x()+(track.vz()-bs.position().z())*bs.dxdz(),
264  bs.position().y()+(track.vz()-bs.position().z())*bs.dydz(),
265  track.vz());
266  TrajectoryStateOnSurface vtxTsos = tipExtrapolator.extrapolate(innertsos,bsPos);
267  if ( !vtxTsos.isValid() ) vtxTsos = innertsos;
268  // extrapolate mixture
269  vtxTsos = gsfProp.propagate(innertsos,vtxTsos.surface());
270  if ( !vtxTsos.isValid() ) return; // failed (GsfTrack keeps mode = mean)
271  // extract mode
272  // build perigee parameters (for covariance to be stored)
273  AlgebraicVector5 modeParameters;
274  AlgebraicSymMatrix55 modeCovariance;
275  // set parameters and variances for "mode" state (local parameters)
276  for ( unsigned int iv=0; iv<5; ++iv ) {
278  GaussianSumUtilities1D utils(state1D);
279  modeParameters(iv) = utils.mode().mean();
280  modeCovariance(iv,iv) = utils.mode().variance();
281  if ( !utils.modeIsValid() ) {
282  // if mode calculation fails: use mean
283  modeParameters(iv) = utils.mean();
284  modeCovariance(iv,iv) = utils.variance();
285  }
286  }
287  // complete covariance matrix
288  // approximation: use correlations from mean
289  const AlgebraicSymMatrix55& meanCovariance(vtxTsos.localError().matrix());
290  for ( unsigned int iv1=0; iv1<5; ++iv1 ) {
291  for ( unsigned int iv2=0; iv2<iv1; ++iv2 ) {
292  double cov12 = meanCovariance(iv1,iv2) *
293  sqrt(modeCovariance(iv1,iv1)/meanCovariance(iv1,iv1)*
294  modeCovariance(iv2,iv2)/meanCovariance(iv2,iv2));
295  modeCovariance(iv1,iv2) = modeCovariance(iv2,iv1) = cov12;
296  }
297  }
298  TrajectoryStateOnSurface modeTsos(LocalTrajectoryParameters(modeParameters,
299  vtxTsos.localParameters().pzSign()),
300  LocalTrajectoryError(modeCovariance),
301  vtxTsos.surface(),
302  vtxTsos.magneticField(),
303  vtxTsos.surfaceSide());
304  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*modeTsos.freeState(),bs);
305  if ( !tscbl.isValid() ) return; // failed (GsfTrack keeps mode = mean)
306  //
307  // extract state at PCA and create momentum vector and covariance matrix
308  //
309  FreeTrajectoryState fts = tscbl.trackStateAtPCA();
310  GlobalVector tscblMom = fts.momentum();
311  reco::GsfTrack::Vector mom(tscblMom.x(),tscblMom.y(),tscblMom.z());
313  const AlgebraicSymMatrix55& tscblCov = fts.curvilinearError().matrix();
314  for ( unsigned int iv1=0; iv1<reco::GsfTrack::dimensionMode; ++iv1 ) {
315  for ( unsigned int iv2=0; iv2<reco::GsfTrack::dimensionMode; ++iv2 ) {
316  cov(iv1,iv2) = tscblCov(iv1,iv2);
317  }
318  }
319  track.setMode(fts.charge(),mom,cov);
320 }
math::Error< dimensionMode >::type CovarianceMatrixMode
3 parameter covariance matrix (momentum part) from mode
Definition: GsfTrack.h:21
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
double dydz() const
dydz slope
Definition: BeamSpot.h:84
void setMode(int chargeMode, const Vector &momentumMode, const CovarianceMatrixMode &covarianceMode)
set mode parameters
Definition: GsfTrack.cc:27
const SurfaceType & surface() const
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:664
ROOT::Math::SVector< double, 5 > AlgebraicVector5
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
Definition: utils.py:1
const AlgebraicSymMatrix55 & matrix() const
const Point & position() const
position
Definition: BeamSpot.h:62
T x() const
Definition: PV3DBase.h:62
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80
void GsfTrackProducerBase::fillStates ( TrajectoryStateOnSurface  tsos,
std::vector< reco::GsfComponent5D > &  states 
) const
protected

Definition at line 241 of file GsfTrackProducerBase.cc.

References makeMuonMisalignmentScenario::components.

Referenced by GsfTrackProducerBase(), and putInEvt().

243 {
246  GetComponents comps(tsos);
247  auto const & components = comps();
248  states.reserve(components.size());
249  for (auto const & st : components)
250  states.emplace_back(st.weight(),st.localParameters().vector(),st.localError().matrix());
251 }
math::Error< dimension >::type CovarianceMatrix
math::Vector< dimension >::type ParameterVector
void GsfTrackProducerBase::localParametersFromQpMode ( const TrajectoryStateOnSurface  tsos,
AlgebraicVector5 parameters,
AlgebraicSymMatrix55 covariance 
) const
private

local parameters rescaled with q/p from mode

Definition at line 323 of file GsfTrackProducerBase.cc.

References mps_fire::i, TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LocalTrajectoryError::matrix(), SingleGaussianState1D::mean(), GaussianSumUtilities1D::mode(), GaussianSumUtilities1D::modeIsValid(), MultiGaussianStateTransform::multiState1D(), metProducer_cfi::parameters, mathSSE::sqrt(), SingleGaussianState1D::variance(), and LocalTrajectoryParameters::vector().

Referenced by computeModeAtTM(), and GsfTrackProducerBase().

326 {
327  //
328  // parameters and errors from combined state
329  //
330  parameters = tsos.localParameters().vector();
331  covariance = tsos.localError().matrix();
332  //
333  // mode for parameter 0 (q/p)
334  //
336  GaussianSumUtilities1D qpGS(qpState);
337  if ( !qpGS.modeIsValid() ) return;
338  double qp = qpGS.mode().mean();
339  double varQp = qpGS.mode().variance();
340  //
341  // replace q/p value and variance, rescale correlation terms
342  // (heuristic procedure - alternative would be mode in 5D ...)
343  //
344  double VarQpRatio = sqrt(varQp/covariance(0,0));
345  parameters(0) = qp;
346  covariance(0,0) = varQp;
347  for ( int i=1; i<5; ++i ) covariance(i,0) *= VarQpRatio;
348 }
const LocalTrajectoryParameters & localParameters() const
AlgebraicVector5 vector() const
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
T sqrt(T t)
Definition: SSEVec.h:18
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
void GsfTrackProducerBase::putInEvt ( edm::Event evt,
const Propagator prop,
const MeasurementTracker measTk,
std::unique_ptr< TrackingRecHitCollection > &  selHits,
std::unique_ptr< reco::GsfTrackCollection > &  selTracks,
std::unique_ptr< reco::TrackExtraCollection > &  selTrackExtras,
std::unique_ptr< reco::GsfTrackExtraCollection > &  selGsfTrackExtras,
std::unique_ptr< std::vector< Trajectory > > &  selTrajectories,
AlgoProductCollection algoResults,
TransientTrackingRecHitBuilder const *  hitBuilder,
const reco::BeamSpot bs,
const TrackerTopology ttopo 
)
virtual

Put produced collections in the event.

Definition at line 31 of file GsfTrackProducerBase.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, reco::TrackBase::appendHitPattern(), computeModeAtTM(), TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), fillMode(), fillStates(), Trajectory::firstMeasurement(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalParameters(), mps_fire::i, training_settings::idx, edm::ESHandleBase::isValid(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), TrajectoryStateOnSurface::localParameters(), LogDebug, LogTrace, TrajectoryStateOnSurface::magneticField(), Trajectory::measurements(), GlobalTrajectoryParameters::momentum(), eostools::move(), TrackProducerBase< reco::GsfTrack >::mteSrc_, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), position, edm::Event::put(), LocalTrajectoryParameters::pzSign(), TrajectoryMeasurement::recHit(), TrackProducerBase< reco::GsfTrack >::rTracks_, Trajectory::seedRef(), reco::Track::setExtra(), reco::GsfTrack::setGsfExtra(), reco::TrackExtraBase::setHits(), TrackProducerBase< reco::GsfTrack >::setSecondHitPattern(), reco::TrackExtraBase::setTrajParams(), DetId::subdetId(), lumiQTWidget::t, SiStripDetId::TEC, TrackProducerBase< reco::GsfTrack >::theSchool, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, HiIsolationCommonParameters_cff::track, DetId::Tracker, TrackProducerBase< reco::GsfTrack >::trajectoryInEvent_, TrajectoryMeasurement::updatedState(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GsfTrackProducerBase(), GsfTrackProducer::produce(), and GsfTrackRefitter::produce().

42 {
43 
48 
52  edm::Ref< std::vector<Trajectory> >::key_type iTjRef = 0;
53  std::map<unsigned int, unsigned int> tjTkMap;
54 
55  TSCBLBuilderNoMaterial tscblBuilder;
56 
57  for(auto & i : algoResults){
58  Trajectory * theTraj = i.trajectory;
59  if(trajectoryInEvent_) {
60  selTrajectories->push_back(*theTraj);
61  iTjRef++;
62  }
63 
64  reco::GsfTrack * theTrack = i.track;
65  PropagationDirection seedDir = i.pDir;
66 
67  LogDebug("TrackProducer") << "In GsfTrackProducerBase::putInEvt - seedDir=" << seedDir;
68 
69  reco::GsfTrack t = * theTrack;
70  selTracks->push_back( t );
71  iTkRef++;
72 
73  // Store indices in local map (starts at 0)
74  if(trajectoryInEvent_) tjTkMap[iTjRef-1] = iTkRef-1;
75 
76  //sets the outermost and innermost TSOSs
77  TrajectoryStateOnSurface outertsos;
78  TrajectoryStateOnSurface innertsos;
79  unsigned int innerId, outerId;
80 
81  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
82  // This is consistent with innermost and outermost labels only for tracks from LHC collision
83  if (theTraj->direction() == alongMomentum) {
84  outertsos = theTraj->lastMeasurement().updatedState();
85  innertsos = theTraj->firstMeasurement().updatedState();
86  outerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
87  innerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
88  } else {
89  outertsos = theTraj->firstMeasurement().updatedState();
90  innertsos = theTraj->lastMeasurement().updatedState();
91  outerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
92  innerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
93  }
94  //build the TrackExtra
95  GlobalPoint v = outertsos.globalParameters().position();
96  GlobalVector p = outertsos.globalParameters().momentum();
97  math::XYZVector outmom( p.x(), p.y(), p.z() );
98  math::XYZPoint outpos( v.x(), v.y(), v.z() );
99  v = innertsos.globalParameters().position();
100  p = innertsos.globalParameters().momentum();
101  math::XYZVector inmom( p.x(), p.y(), p.z() );
102  math::XYZPoint inpos( v.x(), v.y(), v.z() );
103 
104  reco::TrackExtraRef teref= reco::TrackExtraRef ( rTrackExtras, idx ++ );
105  reco::GsfTrack & track = selTracks->back();
106  track.setExtra( teref );
107 
108  //======= I want to set the second hitPattern here =============
109  if (theSchool.isValid())
110  {
112  evt.getByToken(mteSrc_, mte);
113  // NavigationSetter setter( *theSchool );
114  setSecondHitPattern(theTraj,track,prop,&*mte, ttopo);
115  }
116  //==============================================================
117 
118  selTrackExtras->push_back( reco::TrackExtra (outpos, outmom, true, inpos, inmom, true,
119  outertsos.curvilinearError(), outerId,
120  innertsos.curvilinearError(), innerId,
121  seedDir, theTraj->seedRef()));
122 
123 
124  reco::TrackExtra & tx = selTrackExtras->back();
125 
126  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
127  // This is consistent with innermost and outermost labels only for tracks from LHC collisions
128  reco::TrackExtra::TrajParams trajParams;
130  Traj2TrackHits t2t;
131  auto ih = selHits->size();
132  t2t(*theTraj,*selHits,trajParams,chi2s);
133  auto ie = selHits->size();
134  tx.setHits(rHits,ih,ie-ih);
135  tx.setTrajParams(std::move(trajParams),std::move(chi2s));
136  for (;ih<ie; ++ih) {
137  auto const & hit = (*selHits)[ih];
138  track.appendHitPattern(hit, *ttopo);
139  }
140 
141  // ----
142 
143  std::vector<reco::GsfTangent> tangents;
144  const Trajectory::DataContainer& measurements = theTraj->measurements();
145  if ( measurements.size()>2 ) {
146  tangents.reserve(measurements.size()-2);
147  Trajectory::DataContainer::const_iterator ibegin,iend;
148  int increment(0);
149  if (theTraj->direction() == alongMomentum) {
150  ibegin = measurements.begin() + 1;
151  iend = measurements.end() - 1;
152  increment = 1;
153  }
154  else {
155  ibegin = measurements.end() - 2;
156  iend = measurements.begin();
157  increment = -1;
158  }
160  math::XYZVector momentum;
161  Measurement1D deltaP;
162  // only measurements on "mono" detectors
163  for ( Trajectory::DataContainer::const_iterator i=ibegin;
164  i!=iend; i+=increment ) {
165  if ( i->recHit().get() ) {
166  DetId detId(i->recHit()->geographicalId());
167  if ( detId.det()==DetId::Tracker ) {
168  int subdetId = detId.subdetId();
169  if ( subdetId==SiStripDetId::TIB || subdetId==SiStripDetId::TID ||
170  subdetId==SiStripDetId::TOB || subdetId==SiStripDetId::TEC ) {
171  if ( SiStripDetId(detId).stereo() ) continue;
172  }
173  }
174  }
175  bool valid = computeModeAtTM(*i,position,momentum,deltaP);
176  if ( valid ) {
177  tangents.push_back(reco::GsfTangent(position,momentum,deltaP));
178  }
179  }
180  }
181 
182 
183  //build the GsfTrackExtra
184  std::vector<reco::GsfComponent5D> outerStates;
185  fillStates(outertsos,outerStates);
186  std::vector<reco::GsfComponent5D> innerStates;
187  fillStates(innertsos,innerStates);
188 
189 
190  reco::GsfTrackExtraRef terefGsf = reco::GsfTrackExtraRef ( rGsfTrackExtras, idxGsf ++ );
191  track.setGsfExtra( terefGsf );
192  selGsfTrackExtras->push_back( reco::GsfTrackExtra (outerStates, outertsos.localParameters().pzSign(),
193  innerStates, innertsos.localParameters().pzSign(),
194  tangents));
195 
196  if ( innertsos.isValid() ) {
198  TransverseImpactPointExtrapolator tipExtrapolator(gsfProp);
199  fillMode(track,innertsos,gsfProp,tipExtrapolator,tscblBuilder,bs);
200  }
201 
202  delete theTrack;
203  delete theTraj;
204  }
205 
206  LogTrace("TrackingRegressionTest") << "========== TrackProducer Info ===================";
207  LogTrace("TrackingRegressionTest") << "number of finalGsfTracks: " << selTracks->size();
208  for (reco::GsfTrackCollection::const_iterator it = selTracks->begin(); it != selTracks->end(); it++) {
209  LogTrace("TrackingRegressionTest") << "track's n valid and invalid hit, chi2, pt : "
210  << it->found() << " , "
211  << it->lost() <<" , "
212  << it->normalizedChi2() << " , "
213  << it->pt() << " , "
214  << it->eta() ;
215  }
216  LogTrace("TrackingRegressionTest") << "=================================================";
217 
218 
219  rTracks_ = evt.put(std::move(selTracks) );
220  evt.put(std::move(selTrackExtras) );
221  evt.put(std::move(selGsfTrackExtras) );
222  evt.put(std::move(selHits) );
223 
224  if(trajectoryInEvent_) {
225  edm::OrphanHandle<std::vector<Trajectory> > rTrajs = evt.put(std::move(selTrajectories));
226 
227  // Now Create traj<->tracks association map
228  std::unique_ptr<TrajGsfTrackAssociationCollection> trajTrackMap( new TrajGsfTrackAssociationCollection(rTrajs, rTracks_) );
229  for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
230  i != tjTkMap.end(); i++ ) {
231  edm::Ref<std::vector<Trajectory> > trajRef( rTrajs, (*i).first );
232  edm::Ref<reco::GsfTrackCollection> tkRef( rTracks_, (*i).second );
233  trajTrackMap->insert( edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
235  }
236  evt.put( std::move(trajTrackMap) );
237  }
238 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
ConstRecHitPointer const & recHit() const
std::vector< unsigned char > Chi2sFive
const LocalTrajectoryParameters & localParameters() const
void setGsfExtra(const GsfTrackExtraRef &ref)
set reference to GSF "extra" object
Definition: GsfTrack.h:30
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
const CurvilinearTrajectoryError & curvilinearError() const
T y() const
Definition: PV3DBase.h:63
void setSecondHitPattern(Trajectory *traj, reco::GsfTrack &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
PropagationDirection
void fillMode(reco::GsfTrack &track, const TrajectoryStateOnSurface innertsos, const Propagator &gsfProp, const TransverseImpactPointExtrapolator &tipExtrapolator, TrajectoryStateClosestToBeamLineBuilder &tscblBuilder, const reco::BeamSpot &bs) const
const MagneticField * magneticField() const
void fillStates(TrajectoryStateOnSurface tsos, std::vector< reco::GsfComponent5D > &states) const
PropagationDirection const & direction() const
Definition: Trajectory.cc:140
DataContainer const & measurements() const
Definition: Trajectory.h:196
std::vector< LocalTrajectoryParameters > TrajParams
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:44
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:174
T z() const
Definition: PV3DBase.h:64
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:321
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
#define LogTrace(id)
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
edm::Ref< GsfTrackExtraCollection > GsfTrackExtraRef
persistent reference to a GsfTrackExtra
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > > TrajGsfTrackAssociationCollection
edm::EDGetTokenT< MeasurementTrackerEvent > mteSrc_
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
bool computeModeAtTM(const TrajectoryMeasurement &tm, reco::GsfTrackExtra::Point &position, reco::GsfTrackExtra::Vector &momentum, Measurement1D &deltaP) const
position, momentum and estimated deltaP at an intermediate measurement (true if successful) ...
Definition: DetId.h:18
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
Definition: Track.h:184
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:187
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool appendHitPattern(const TrackingRecHit &hit, const TrackerTopology &ttopo)
append a single hit to the HitPattern
Definition: TrackBase.h:455
static int position[264][3]
Definition: ReadPGInfo.cc:509
edm::ESHandle< NavigationSchool > theSchool
TrajectoryStateOnSurface const & updatedState() const
float pzSign() const
Sign of the z-component of the momentum in the local frame.
bool isValid() const
Definition: ESHandle.h:47
edm::OrphanHandle< TrackCollection > rTracks_
T x() const
Definition: PV3DBase.h:62
def move(src, dest)
Definition: eostools.py:510
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168

Member Data Documentation

bool GsfTrackProducerBase::useSplitting
private

Definition at line 68 of file GsfTrackProducerBase.h.