test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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< TrackCollection > &, 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 ()
 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
 
- Public Types inherited from AlgoProductTraits< reco::GsfTrack >
using AlgoProductCollection = std::vector< AlgoProduct >
 
using TrackCollection = std::vector< reco::GsfTrack >
 
- Protected Attributes inherited from TrackProducerBase< reco::GsfTrack >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::InputTag clusterRemovalInfo_
 
edm::EDGetTokenT
< MeasurementTrackerEvent
mteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
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

Constructor.

Definition at line 30 of file GsfTrackProducerBase.h.

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 379 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 putInEvt().

383 {
384  //
385  // states
386  //
389  TrajectoryStateOnSurface upState = tm.updatedState();
390 
391 
392  if ( !fwdState.isValid() || !bwdState.isValid() || !upState.isValid() ) {
393  return false;
394  }
395  //
396  // position from mean, momentum from mode (in cartesian coordinates)
397  // following PF code
398  //
399  GlobalPoint pos = upState.globalPosition();
400  position = reco::GsfTrackExtra::Point(pos.x(),pos.y(),pos.z());
402  GlobalVector mom;
403  bool result = mts.momentumFromModeCartesian(upState,mom);
404  if ( !result ) {
405 // std::cout << "momentumFromModeCartesian failed" << std::endl;
406  return false;
407  }
408  momentum = reco::GsfTrackExtra::Vector(mom.x(),mom.y(),mom.z());
409  //
410  // calculation from deltaP from fit to forward & backward predictions
411  // (momentum from mode) and hit
412  //
413  // prepare input parameter vectors and covariance matrices
414  AlgebraicVector5 fwdPars = fwdState.localParameters().vector();
415  AlgebraicSymMatrix55 fwdCov = fwdState.localError().matrix();
416  localParametersFromQpMode(fwdState,fwdPars,fwdCov);
417  AlgebraicVector5 bwdPars = bwdState.localParameters().vector();
418  AlgebraicSymMatrix55 bwdCov = bwdState.localError().matrix();
419  localParametersFromQpMode(bwdState,bwdPars,bwdCov);
420  LocalPoint hitPos(0.,0.,0.);
421  LocalError hitErr(-1.,-1.,-1.);
422  if ( tm.recHit()->isValid() ) {
423  hitPos = tm.recHit()->localPosition();
424  hitErr = tm.recHit()->localPositionError();
425  }
426  CollinearFitAtTM2 collinearFit(fwdPars,fwdCov,bwdPars,bwdCov,hitPos,hitErr);
427  deltaP = collinearFit.deltaP();
428 
429  return true;
430 }
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
tuple result
Definition: mps_fire.py:83
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 282 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 putInEvt().

287 {
288  // Get transverse impact parameter plane (from mean). This is a first approximation;
289  // the mode is then extrapolated to the
290  // final position closest to the beamline.
291  GlobalPoint bsPos(bs.position().x()+(track.vz()-bs.position().z())*bs.dxdz(),
292  bs.position().y()+(track.vz()-bs.position().z())*bs.dydz(),
293  track.vz());
294  TrajectoryStateOnSurface vtxTsos = tipExtrapolator.extrapolate(innertsos,bsPos);
295  if ( !vtxTsos.isValid() ) vtxTsos = innertsos;
296  // extrapolate mixture
297  vtxTsos = gsfProp.propagate(innertsos,vtxTsos.surface());
298  if ( !vtxTsos.isValid() ) return; // failed (GsfTrack keeps mode = mean)
299  // extract mode
300  // build perigee parameters (for covariance to be stored)
301  AlgebraicVector5 modeParameters;
302  AlgebraicSymMatrix55 modeCovariance;
303  // set parameters and variances for "mode" state (local parameters)
304  for ( unsigned int iv=0; iv<5; ++iv ) {
306  GaussianSumUtilities1D utils(state1D);
307  modeParameters(iv) = utils.mode().mean();
308  modeCovariance(iv,iv) = utils.mode().variance();
309  if ( !utils.modeIsValid() ) {
310  // if mode calculation fails: use mean
311  modeParameters(iv) = utils.mean();
312  modeCovariance(iv,iv) = utils.variance();
313  }
314  }
315  // complete covariance matrix
316  // approximation: use correlations from mean
317  const AlgebraicSymMatrix55& meanCovariance(vtxTsos.localError().matrix());
318  for ( unsigned int iv1=0; iv1<5; ++iv1 ) {
319  for ( unsigned int iv2=0; iv2<iv1; ++iv2 ) {
320  double cov12 = meanCovariance(iv1,iv2) *
321  sqrt(modeCovariance(iv1,iv1)/meanCovariance(iv1,iv1)*
322  modeCovariance(iv2,iv2)/meanCovariance(iv2,iv2));
323  modeCovariance(iv1,iv2) = modeCovariance(iv2,iv1) = cov12;
324  }
325  }
326  TrajectoryStateOnSurface modeTsos(LocalTrajectoryParameters(modeParameters,
327  vtxTsos.localParameters().pzSign()),
328  LocalTrajectoryError(modeCovariance),
329  vtxTsos.surface(),
330  vtxTsos.magneticField(),
331  vtxTsos.surfaceSide());
332  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*modeTsos.freeState(),bs);
333  if ( !tscbl.isValid() ) return; // failed (GsfTrack keeps mode = mean)
334  //
335  // extract state at PCA and create momentum vector and covariance matrix
336  //
337  FreeTrajectoryState fts = tscbl.trackStateAtPCA();
338  GlobalVector tscblMom = fts.momentum();
339  reco::GsfTrack::Vector mom(tscblMom.x(),tscblMom.y(),tscblMom.z());
341  const AlgebraicSymMatrix55& tscblCov = fts.curvilinearError().matrix();
342  for ( unsigned int iv1=0; iv1<reco::GsfTrack::dimensionMode; ++iv1 ) {
343  for ( unsigned int iv2=0; iv2<reco::GsfTrack::dimensionMode; ++iv2 ) {
344  cov(iv1,iv2) = tscblCov(iv1,iv2);
345  }
346  }
347  track.setMode(fts.charge(),mom,cov);
348 }
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
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 269 of file GsfTrackProducerBase.cc.

References makeMuonMisalignmentScenario::components, TrajectoryStateOnSurface::components(), and i.

Referenced by putInEvt().

271 {
274  std::vector<TrajectoryStateOnSurface> components(tsos.components());
275  for ( std::vector<TrajectoryStateOnSurface>::const_iterator i=components.begin();
276  i!=components.end(); ++i ) {
277  states.push_back(reco::GsfComponent5D(i->weight(),i->localParameters().vector(),i->localError().matrix()));
278  }
279 }
math::Error< dimension >::type CovarianceMatrix
int i
Definition: DBlmapReader.cc:9
std::vector< TrajectoryStateOnSurface > components() const
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 351 of file GsfTrackProducerBase.cc.

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

Referenced by computeModeAtTM().

354 {
355  //
356  // parameters and errors from combined state
357  //
358  parameters = tsos.localParameters().vector();
359  covariance = tsos.localError().matrix();
360  //
361  // mode for parameter 0 (q/p)
362  //
364  GaussianSumUtilities1D qpGS(qpState);
365  if ( !qpGS.modeIsValid() ) return;
366  double qp = qpGS.mode().mean();
367  double varQp = qpGS.mode().variance();
368  //
369  // replace q/p value and variance, rescale correlation terms
370  // (heuristic procedure - alternative would be mode in 5D ...)
371  //
372  double VarQpRatio = sqrt(varQp/covariance(0,0));
373  parameters(0) = qp;
374  covariance(0,0) = varQp;
375  for ( int i=1; i<5; ++i ) covariance(i,0) *= VarQpRatio;
376 }
int i
Definition: DBlmapReader.cc:9
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 29 of file GsfTrackProducerBase.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, reco::TrackBase::appendHitPattern(), assert(), TrajectoryStateOnSurface::components(), computeModeAtTM(), TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), fillMode(), fillStates(), Trajectory::firstMeasurement(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalParameters(), i, customizeTrackingMonitorSeedNumber::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(), DetId::subdetId(), lumiQTWidget::t, SiStripDetId::TEC, TrackProducerBase< reco::GsfTrack >::theSchool, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, DetId::Tracker, TrackProducerBase< reco::GsfTrack >::trajectoryInEvent_, TrajectoryMeasurement::updatedState(), useSplitting, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

40 {
41 
46 
51  edm::Ref< std::vector<Trajectory> >::key_type iTjRef = 0;
52  std::map<unsigned int, unsigned int> tjTkMap;
53 
54  TSCBLBuilderNoMaterial tscblBuilder;
55 
56  for(auto & i : algoResults){
57  Trajectory * theTraj = i.trajectory;
58  if(trajectoryInEvent_) {
59  selTrajectories->push_back(*theTraj);
60  iTjRef++;
61  }
62 
63  reco::GsfTrack * theTrack = i.track;
64  PropagationDirection seedDir = i.pDir;
65 
66  LogDebug("TrackProducer") << "In GsfTrackProducerBase::putInEvt - seedDir=" << seedDir;
67 
68  reco::GsfTrack t = * theTrack;
69  selTracks->push_back( t );
70  iTkRef++;
71 
72  // Store indices in local map (starts at 0)
73  if(trajectoryInEvent_) tjTkMap[iTjRef-1] = iTkRef-1;
74 
75  //sets the outermost and innermost TSOSs
76  TrajectoryStateOnSurface outertsos;
77  TrajectoryStateOnSurface innertsos;
78  unsigned int innerId, outerId;
79 
80  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
81  // This is consistent with innermost and outermost labels only for tracks from LHC collision
82  if (theTraj->direction() == alongMomentum) {
83  outertsos = theTraj->lastMeasurement().updatedState();
84  innertsos = theTraj->firstMeasurement().updatedState();
85  outerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
86  innerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
87  } else {
88  outertsos = theTraj->firstMeasurement().updatedState();
89  innertsos = theTraj->lastMeasurement().updatedState();
90  outerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
91  innerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
92  }
93  //build the TrackExtra
94  GlobalPoint v = outertsos.globalParameters().position();
95  GlobalVector p = outertsos.globalParameters().momentum();
96  math::XYZVector outmom( p.x(), p.y(), p.z() );
97  math::XYZPoint outpos( v.x(), v.y(), v.z() );
98  v = innertsos.globalParameters().position();
99  p = innertsos.globalParameters().momentum();
100  math::XYZVector inmom( p.x(), p.y(), p.z() );
101  math::XYZPoint inpos( v.x(), v.y(), v.z() );
102 
103  reco::TrackExtraRef teref= reco::TrackExtraRef ( rTrackExtras, idx ++ );
104  reco::GsfTrack & track = selTracks->back();
105  track.setExtra( teref );
106 
107  //======= I want to set the second hitPattern here =============
108  if (theSchool.isValid())
109  {
111  evt.getByToken(mteSrc_, mte);
112  // NavigationSetter setter( *theSchool );
113  setSecondHitPattern(theTraj,track,prop,&*mte, ttopo);
114  }
115  //==============================================================
116 
117  selTrackExtras->push_back( reco::TrackExtra (outpos, outmom, true, inpos, inmom, true,
118  outertsos.curvilinearError(), outerId,
119  innertsos.curvilinearError(), innerId,
120  seedDir, theTraj->seedRef()));
121 
122 
123  reco::TrackExtra & tx = selTrackExtras->back();
124 
125  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
126  // This is consistent with innermost and outermost labels only for tracks from LHC collisions
127  Traj2TrackHits t2t(hitBuilder,false);
128  auto ih = selHits->size();
129  assert(ih==hidx);
130  t2t(*theTraj,*selHits,useSplitting);
131  auto ie = selHits->size();
132  unsigned int nHitsAdded = 0;
133  for (;ih<ie; ++ih) {
134  auto const & hit = (*selHits)[ih];
135  track.appendHitPattern(hit, *ttopo);
136  ++nHitsAdded;
137  }
138  tx.setHits(rHits, hidx, nHitsAdded);
139  hidx += nHitsAdded;
140 
141  /*
142  TrajectoryFitter::RecHitContainer transHits; theTraj->recHitsV(transHits,useSplitting);
143  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
144  // This is consistent with innermost and outermost labels only for tracks from LHC collisions
145  if (theTraj->direction() == alongMomentum) {
146  for(TrajectoryFitter::RecHitContainer::const_iterator j = transHits.begin();
147  j != transHits.end(); j++) {
148  if ((**j).hit() != 0){
149  TrackingRecHit *hit = (**j).hit()->clone();
150  track.appendHitPattern(*hit, *ttopo);
151  selHits->push_back(hit);
152  tx.add(TrackingRecHitRef(rHits, hidx++));
153  }
154  }
155  }else{
156  for(TrajectoryFitter::RecHitContainer::const_iterator j = transHits.end() - 1;
157  j != transHits.begin() - 1; --j) {
158  if ((**j).hit() != 0){
159  TrackingRecHit *hit = (**j).hit()->clone();
160  track.appendHitPattern(*hit, *ttopo);
161  selHits->push_back(hit);
162  tx.add(TrackingRecHitRef(rHits, hidx++));
163  }
164  }
165  }
166  */
167  // ----
168 
169  std::vector<reco::GsfTangent> tangents;
170  const Trajectory::DataContainer& measurements = theTraj->measurements();
171  if ( measurements.size()>2 ) {
172  tangents.reserve(measurements.size()-2);
173  Trajectory::DataContainer::const_iterator ibegin,iend;
174  int increment(0);
175  if (theTraj->direction() == alongMomentum) {
176  ibegin = measurements.begin() + 1;
177  iend = measurements.end() - 1;
178  increment = 1;
179  }
180  else {
181  ibegin = measurements.end() - 2;
182  iend = measurements.begin();
183  increment = -1;
184  }
186  math::XYZVector momentum;
187  Measurement1D deltaP;
188  // only measurements on "mono" detectors
189  for ( Trajectory::DataContainer::const_iterator i=ibegin;
190  i!=iend; i+=increment ) {
191  if ( i->recHit().get() ) {
192  DetId detId(i->recHit()->geographicalId());
193  if ( detId.det()==DetId::Tracker ) {
194  int subdetId = detId.subdetId();
195  if ( subdetId==SiStripDetId::TIB || subdetId==SiStripDetId::TID ||
196  subdetId==SiStripDetId::TOB || subdetId==SiStripDetId::TEC ) {
197  if ( SiStripDetId(detId).stereo() ) continue;
198  }
199  }
200  }
201  bool valid = computeModeAtTM(*i,position,momentum,deltaP);
202  if ( valid ) {
203  tangents.push_back(reco::GsfTangent(position,momentum,deltaP));
204  }
205  }
206  }
207 
208 
209  //build the GsfTrackExtra
210  std::vector<reco::GsfComponent5D> outerStates;
211  outerStates.reserve(outertsos.components().size());
212  fillStates(outertsos,outerStates);
213  std::vector<reco::GsfComponent5D> innerStates;
214  innerStates.reserve(innertsos.components().size());
215  fillStates(innertsos,innerStates);
216 
217 
218  reco::GsfTrackExtraRef terefGsf = reco::GsfTrackExtraRef ( rGsfTrackExtras, idxGsf ++ );
219  track.setGsfExtra( terefGsf );
220  selGsfTrackExtras->push_back( reco::GsfTrackExtra (outerStates, outertsos.localParameters().pzSign(),
221  innerStates, innertsos.localParameters().pzSign(),
222  tangents));
223 
224  if ( innertsos.isValid() ) {
226  TransverseImpactPointExtrapolator tipExtrapolator(gsfProp);
227  fillMode(track,innertsos,gsfProp,tipExtrapolator,tscblBuilder,bs);
228  }
229 
230  delete theTrack;
231  delete theTraj;
232  }
233 
234  LogTrace("TrackingRegressionTest") << "========== TrackProducer Info ===================";
235  LogTrace("TrackingRegressionTest") << "number of finalGsfTracks: " << selTracks->size();
236  for (reco::GsfTrackCollection::const_iterator it = selTracks->begin(); it != selTracks->end(); it++) {
237  LogTrace("TrackingRegressionTest") << "track's n valid and invalid hit, chi2, pt : "
238  << it->found() << " , "
239  << it->lost() <<" , "
240  << it->normalizedChi2() << " , "
241  << it->pt() << " , "
242  << it->eta() ;
243  }
244  LogTrace("TrackingRegressionTest") << "=================================================";
245 
246 
247  rTracks_ = evt.put(std::move(selTracks) );
248  evt.put(std::move(selTrackExtras) );
249  evt.put(std::move(selGsfTrackExtras) );
250  evt.put(std::move(selHits) );
251 
252  if(trajectoryInEvent_) {
253  edm::OrphanHandle<std::vector<Trajectory> > rTrajs = evt.put(std::move(selTrajectories));
254 
255  // Now Create traj<->tracks association map
256  std::unique_ptr<TrajGsfTrackAssociationCollection> trajTrackMap( new TrajGsfTrackAssociationCollection(rTrajs, rTracks_) );
257  for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
258  i != tjTkMap.end(); i++ ) {
259  edm::Ref<std::vector<Trajectory> > trajRef( rTrajs, (*i).first );
260  edm::Ref<reco::GsfTrackCollection> tkRef( rTracks_, (*i).second );
261  trajTrackMap->insert( edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
263  }
264  evt.put( std::move(trajTrackMap) );
265  }
266 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
void setGsfExtra(const GsfTrackExtraRef &ref)
set reference to GSF &quot;extra&quot; object
Definition: GsfTrack.h:30
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
const CurvilinearTrajectoryError & curvilinearError() const
assert(m_qm.get())
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:125
DataContainer const & measurements() const
Definition: Trajectory.h:250
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:44
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:228
T z() const
Definition: PV3DBase.h:64
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
def move
Definition: eostools.py:510
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:361
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:141
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 &quot;extra&quot; object
Definition: Track.h:184
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:241
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
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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_
std::vector< TrajectoryStateOnSurface > components() const
T x() const
Definition: PV3DBase.h:62
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.

Referenced by putInEvt().