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 > GsfTrackProducer GsfTrackRefitter

Public Member Functions

 GsfTrackProducerBase (bool trajectoryInEvent, bool split)
 Constructor. More...
 
virtual void putInEvt (edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::GsfTrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< reco::GsfTrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, const reco::BeamSpot &)
 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)
 
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 >
typedef std::pair< Trajectory
*, std::pair< reco::GsfTrack
*, PropagationDirection > > 
AlgoProduct
 
typedef std::vector< AlgoProductAlgoProductCollection
 
typedef std::vector
< reco::GsfTrack
TrackCollection
 
- 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 361 of file GsfTrackProducerBase.cc.

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

Referenced by putInEvt().

365 {
366  //
367  // states
368  //
371  TrajectoryStateOnSurface upState = tm.updatedState();
372 
373 
374  if ( !fwdState.isValid() || !bwdState.isValid() || !upState.isValid() ) {
375  return false;
376  }
377  //
378  // position from mean, momentum from mode (in cartesian coordinates)
379  // following PF code
380  //
381  GlobalPoint pos = upState.globalPosition();
382  position = reco::GsfTrackExtra::Point(pos.x(),pos.y(),pos.z());
384  GlobalVector mom;
385  bool result = mts.momentumFromModeCartesian(upState,mom);
386  if ( !result ) {
387 // std::cout << "momentumFromModeCartesian failed" << std::endl;
388  return false;
389  }
390  momentum = reco::GsfTrackExtra::Vector(mom.x(),mom.y(),mom.z());
391  //
392  // calculation from deltaP from fit to forward & backward predictions
393  // (momentum from mode) and hit
394  //
395  // prepare input parameter vectors and covariance matrices
396  AlgebraicVector5 fwdPars = fwdState.localParameters().vector();
397  AlgebraicSymMatrix55 fwdCov = fwdState.localError().matrix();
398  localParametersFromQpMode(fwdState,fwdPars,fwdCov);
399  AlgebraicVector5 bwdPars = bwdState.localParameters().vector();
400  AlgebraicSymMatrix55 bwdCov = bwdState.localError().matrix();
401  localParametersFromQpMode(bwdState,bwdPars,bwdCov);
402  LocalPoint hitPos(0.,0.,0.);
403  LocalError hitErr(-1.,-1.,-1.);
404  if ( tm.recHit()->isValid() ) {
405  hitPos = tm.recHit()->localPosition();
406  hitErr = tm.recHit()->localPositionError();
407  }
408  CollinearFitAtTM2 collinearFit(fwdPars,fwdCov,bwdPars,bwdCov,hitPos,hitErr);
409  deltaP = collinearFit.deltaP();
410 
411  return true;
412 }
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
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
AlgebraicVector5 vector() const
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
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
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 264 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().

269 {
270  // Get transverse impact parameter plane (from mean). This is a first approximation;
271  // the mode is then extrapolated to the
272  // final position closest to the beamline.
273  GlobalPoint bsPos(bs.position().x()+(track.vz()-bs.position().z())*bs.dxdz(),
274  bs.position().y()+(track.vz()-bs.position().z())*bs.dydz(),
275  track.vz());
276  TrajectoryStateOnSurface vtxTsos = tipExtrapolator.extrapolate(innertsos,bsPos);
277  if ( !vtxTsos.isValid() ) vtxTsos = innertsos;
278  // extrapolate mixture
279  vtxTsos = gsfProp.propagate(innertsos,vtxTsos.surface());
280  if ( !vtxTsos.isValid() ) return; // failed (GsfTrack keeps mode = mean)
281  // extract mode
282  // build perigee parameters (for covariance to be stored)
283  AlgebraicVector5 modeParameters;
284  AlgebraicSymMatrix55 modeCovariance;
285  // set parameters and variances for "mode" state (local parameters)
286  for ( unsigned int iv=0; iv<5; ++iv ) {
288  GaussianSumUtilities1D utils(state1D);
289  modeParameters(iv) = utils.mode().mean();
290  modeCovariance(iv,iv) = utils.mode().variance();
291  if ( !utils.modeIsValid() ) {
292  // if mode calculation fails: use mean
293  modeParameters(iv) = utils.mean();
294  modeCovariance(iv,iv) = utils.variance();
295  }
296  }
297  // complete covariance matrix
298  // approximation: use correlations from mean
299  const AlgebraicSymMatrix55& meanCovariance(vtxTsos.localError().matrix());
300  for ( unsigned int iv1=0; iv1<5; ++iv1 ) {
301  for ( unsigned int iv2=0; iv2<iv1; ++iv2 ) {
302  double cov12 = meanCovariance(iv1,iv2) *
303  sqrt(modeCovariance(iv1,iv1)/meanCovariance(iv1,iv1)*
304  modeCovariance(iv2,iv2)/meanCovariance(iv2,iv2));
305  modeCovariance(iv1,iv2) = modeCovariance(iv2,iv1) = cov12;
306  }
307  }
308  TrajectoryStateOnSurface modeTsos(LocalTrajectoryParameters(modeParameters,
309  vtxTsos.localParameters().pzSign()),
310  LocalTrajectoryError(modeCovariance),
311  vtxTsos.surface(),
312  vtxTsos.magneticField(),
313  vtxTsos.surfaceSide());
314  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*modeTsos.freeState(),bs);
315  if ( !tscbl.isValid() ) return; // failed (GsfTrack keeps mode = mean)
316  //
317  // extract state at PCA and create momentum vector and covariance matrix
318  //
319  FreeTrajectoryState fts = tscbl.trackStateAtPCA();
320  GlobalVector tscblMom = fts.momentum();
321  reco::GsfTrack::Vector mom(tscblMom.x(),tscblMom.y(),tscblMom.z());
323  const AlgebraicSymMatrix55& tscblCov = fts.curvilinearError().matrix();
324  for ( unsigned int iv1=0; iv1<reco::GsfTrack::dimensionMode; ++iv1 ) {
325  for ( unsigned int iv2=0; iv2<reco::GsfTrack::dimensionMode; ++iv2 ) {
326  cov(iv1,iv2) = tscblCov(iv1,iv2);
327  }
328  }
329  track.setMode(fts.charge(),mom,cov);
330 }
math::Error< dimensionMode >::type CovarianceMatrixMode
3 parameter covariance matrix (momentum part) from mode
Definition: GsfTrack.h:20
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:48
T z() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:145
ROOT::Math::SVector< double, 5 > AlgebraicVector5
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:72
void GsfTrackProducerBase::fillStates ( TrajectoryStateOnSurface  tsos,
std::vector< reco::GsfComponent5D > &  states 
) const
protected

Definition at line 251 of file GsfTrackProducerBase.cc.

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

Referenced by putInEvt().

253 {
256  std::vector<TrajectoryStateOnSurface> components(tsos.components());
257  for ( std::vector<TrajectoryStateOnSurface>::const_iterator i=components.begin();
258  i!=components.end(); ++i ) {
259  states.push_back(reco::GsfComponent5D(i->weight(),i->localParameters().vector(),i->localError().matrix()));
260  }
261 }
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 333 of file GsfTrackProducerBase.cc.

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

Referenced by computeModeAtTM().

336 {
337  //
338  // parameters and errors from combined state
339  //
340  parameters = tsos.localParameters().vector();
341  covariance = tsos.localError().matrix();
342  //
343  // mode for parameter 0 (q/p)
344  //
346  GaussianSumUtilities1D qpGS(qpState);
347  if ( !qpGS.modeIsValid() ) return;
348  double qp = qpGS.mode().mean();
349  double varQp = qpGS.mode().variance();
350  //
351  // replace q/p value and variance, rescale correlation terms
352  // (heuristic procedure - alternative would be mode in 5D ...)
353  //
354  double VarQpRatio = sqrt(varQp/covariance(0,0));
355  parameters(0) = qp;
356  covariance(0,0) = varQp;
357  for ( int i=1; i<5; ++i ) covariance(i,0) *= VarQpRatio;
358 }
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
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:48
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
void GsfTrackProducerBase::putInEvt ( edm::Event evt,
const Propagator prop,
const MeasurementTracker measTk,
std::auto_ptr< TrackingRecHitCollection > &  selHits,
std::auto_ptr< reco::GsfTrackCollection > &  selTracks,
std::auto_ptr< reco::TrackExtraCollection > &  selTrackExtras,
std::auto_ptr< reco::GsfTrackExtraCollection > &  selGsfTrackExtras,
std::auto_ptr< std::vector< Trajectory > > &  selTrajectories,
AlgoProductCollection algoResults,
const reco::BeamSpot bs 
)
virtual

Put produced collections in the event.

Definition at line 27 of file GsfTrackProducerBase.cc.

References reco::TrackExtraBase::add(), alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, 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(), j, Trajectory::lastMeasurement(), TrajectoryStateOnSurface::localParameters(), LogDebug, LogTrace, TrajectoryStateOnSurface::magneticField(), Trajectory::measurements(), GlobalTrajectoryParameters::momentum(), TrackProducerBase< reco::GsfTrack >::mteSrc_, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), position, edm::Event::put(), LocalTrajectoryParameters::pzSign(), TrajectoryMeasurement::recHit(), Trajectory::recHits(), TrackProducerBase< reco::GsfTrack >::rTracks_, Trajectory::seedRef(), reco::Track::setExtra(), reco::GsfTrack::setGsfExtra(), reco::TrackBase::setHitPattern(), 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, TrackValidation_HighPurity_cff::valid, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

37 {
38 
43 
48  edm::Ref< std::vector<Trajectory> >::key_type iTjRef = 0;
49  std::map<unsigned int, unsigned int> tjTkMap;
50 
51  TSCBLBuilderNoMaterial tscblBuilder;
52 
53  for(AlgoProductCollection::iterator i=algoResults.begin(); i!=algoResults.end();i++){
54  Trajectory * theTraj = (*i).first;
55  if(trajectoryInEvent_) {
56  selTrajectories->push_back(*theTraj);
57  iTjRef++;
58  }
59 
60  // const TrajectoryFitter::RecHitContainer& transHits = theTraj->recHits(useSplitting); // NO: the return type in Trajectory is by VALUE
62  reco::GsfTrack * theTrack = (*i).second.first;
63  PropagationDirection seedDir = (*i).second.second;
64 
65  LogDebug("TrackProducer") << "In GsfTrackProducerBase::putInEvt - seedDir=" << seedDir;
66 
67  reco::GsfTrack t = * theTrack;
68  selTracks->push_back( t );
69  iTkRef++;
70 
71  // Store indices in local map (starts at 0)
72  if(trajectoryInEvent_) tjTkMap[iTjRef-1] = iTkRef-1;
73 
74  //sets the outermost and innermost TSOSs
75  TrajectoryStateOnSurface outertsos;
76  TrajectoryStateOnSurface innertsos;
77  unsigned int innerId, outerId;
78 
79  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
80  // This is consistent with innermost and outermost labels only for tracks from LHC collision
81  if (theTraj->direction() == alongMomentum) {
82  outertsos = theTraj->lastMeasurement().updatedState();
83  innertsos = theTraj->firstMeasurement().updatedState();
84  outerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
85  innerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
86  } else {
87  outertsos = theTraj->firstMeasurement().updatedState();
88  innertsos = theTraj->lastMeasurement().updatedState();
89  outerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
90  innerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
91  }
92  //build the TrackExtra
93  GlobalPoint v = outertsos.globalParameters().position();
94  GlobalVector p = outertsos.globalParameters().momentum();
95  math::XYZVector outmom( p.x(), p.y(), p.z() );
96  math::XYZPoint outpos( v.x(), v.y(), v.z() );
97  v = innertsos.globalParameters().position();
98  p = innertsos.globalParameters().momentum();
99  math::XYZVector inmom( p.x(), p.y(), p.z() );
100  math::XYZPoint inpos( v.x(), v.y(), v.z() );
101 
102  reco::TrackExtraRef teref= reco::TrackExtraRef ( rTrackExtras, idx ++ );
103  reco::GsfTrack & track = selTracks->back();
104  track.setExtra( teref );
105 
106  //======= I want to set the second hitPattern here =============
107  if (theSchool.isValid())
108  {
110  evt.getByToken(mteSrc_, mte);
111  NavigationSetter setter( *theSchool );
112  setSecondHitPattern(theTraj,track,prop,&*mte);
113  }
114  //==============================================================
115 
116  selTrackExtras->push_back( reco::TrackExtra (outpos, outmom, true, inpos, inmom, true,
117  outertsos.curvilinearError(), outerId,
118  innertsos.curvilinearError(), innerId,
119  seedDir, theTraj->seedRef()));
120 
121 
122  reco::TrackExtra & tx = selTrackExtras->back();
123 
124 
125  size_t ih = 0;
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  if (theTraj->direction() == alongMomentum) {
129  for( TrajectoryFitter::RecHitContainer::const_iterator j = transHits.begin();
130  j != transHits.end(); j ++ ) {
131  if ((**j).hit()!=0){
132  TrackingRecHit * hit = (**j).hit()->clone();
133  track.setHitPattern( * hit, ih ++ );
134  selHits->push_back( hit );
135  tx.add( TrackingRecHitRef( rHits, hidx ++ ) );
136  }
137  }
138  }else{
139  for( TrajectoryFitter::RecHitContainer::const_iterator j = transHits.end()-1;
140  j != transHits.begin()-1; --j ) {
141  if ((**j).hit()!=0){
142  TrackingRecHit * hit = (**j).hit()->clone();
143  track.setHitPattern( * hit, ih ++ );
144  selHits->push_back( hit );
145  tx.add( TrackingRecHitRef( rHits, hidx ++ ) );
146  }
147  }
148  }
149  // ----
150 
151  std::vector<reco::GsfTangent> tangents;
152  const Trajectory::DataContainer& measurements = theTraj->measurements();
153  if ( measurements.size()>2 ) {
154  tangents.reserve(measurements.size()-2);
155  Trajectory::DataContainer::const_iterator ibegin,iend;
156  int increment(0);
157  if (theTraj->direction() == alongMomentum) {
158  ibegin = measurements.begin() + 1;
159  iend = measurements.end() - 1;
160  increment = 1;
161  }
162  else {
163  ibegin = measurements.end() - 2;
164  iend = measurements.begin();
165  increment = -1;
166  }
168  math::XYZVector momentum;
169  Measurement1D deltaP;
170  // only measurements on "mono" detectors
171  for ( Trajectory::DataContainer::const_iterator i=ibegin;
172  i!=iend; i+=increment ) {
173  if ( i->recHit().get() ) {
174  DetId detId(i->recHit()->geographicalId());
175  if ( detId.det()==DetId::Tracker ) {
176  int subdetId = detId.subdetId();
177  if ( subdetId==SiStripDetId::TIB || subdetId==SiStripDetId::TID ||
178  subdetId==SiStripDetId::TOB || subdetId==SiStripDetId::TEC ) {
179  if ( SiStripDetId(detId).stereo() ) continue;
180  }
181  }
182  }
183  bool valid = computeModeAtTM(*i,position,momentum,deltaP);
184  if ( valid ) {
185  tangents.push_back(reco::GsfTangent(position,momentum,deltaP));
186  }
187  }
188  }
189 
190 
191  //build the GsfTrackExtra
192  std::vector<reco::GsfComponent5D> outerStates;
193  outerStates.reserve(outertsos.components().size());
194  fillStates(outertsos,outerStates);
195  std::vector<reco::GsfComponent5D> innerStates;
196  innerStates.reserve(innertsos.components().size());
197  fillStates(innertsos,innerStates);
198 
199 
200  reco::GsfTrackExtraRef terefGsf = reco::GsfTrackExtraRef ( rGsfTrackExtras, idxGsf ++ );
201  track.setGsfExtra( terefGsf );
202  selGsfTrackExtras->push_back( reco::GsfTrackExtra (outerStates, outertsos.localParameters().pzSign(),
203  innerStates, innertsos.localParameters().pzSign(),
204  tangents));
205 
206  if ( innertsos.isValid() ) {
208  TransverseImpactPointExtrapolator tipExtrapolator(gsfProp);
209  fillMode(track,innertsos,gsfProp,tipExtrapolator,tscblBuilder,bs);
210  }
211 
212  delete theTrack;
213  delete theTraj;
214  }
215 
216  LogTrace("TrackingRegressionTest") << "========== TrackProducer Info ===================";
217  LogTrace("TrackingRegressionTest") << "number of finalGsfTracks: " << selTracks->size();
218  for (reco::GsfTrackCollection::const_iterator it = selTracks->begin(); it != selTracks->end(); it++) {
219  LogTrace("TrackingRegressionTest") << "track's n valid and invalid hit, chi2, pt : "
220  << it->found() << " , "
221  << it->lost() <<" , "
222  << it->normalizedChi2() << " , "
223  << it->pt() << " , "
224  << it->eta() ;
225  }
226  LogTrace("TrackingRegressionTest") << "=================================================";
227 
228 
229  rTracks_ = evt.put( selTracks );
230  evt.put( selTrackExtras );
231  evt.put( selGsfTrackExtras );
232  evt.put( selHits );
233 
234  if(trajectoryInEvent_) {
235  edm::OrphanHandle<std::vector<Trajectory> > rTrajs = evt.put(selTrajectories);
236 
237  // Now Create traj<->tracks association map
238  std::auto_ptr<TrajGsfTrackAssociationCollection> trajTrackMap( new TrajGsfTrackAssociationCollection() );
239  for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
240  i != tjTkMap.end(); i++ ) {
241  edm::Ref<std::vector<Trajectory> > trajRef( rTrajs, (*i).first );
242  edm::Ref<reco::GsfTrackCollection> tkRef( rTracks_, (*i).second );
243  trajTrackMap->insert( edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
245  }
246  evt.put( trajTrackMap );
247  }
248 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double pzSign() const
Sign of the z-component of the momentum in the local frame.
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
void setGsfExtra(const GsfTrackExtraRef &ref)
set reference to GSF &quot;extra&quot; object
Definition: GsfTrack.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
const CurvilinearTrajectoryError & curvilinearError() const
T y() const
Definition: PV3DBase.h:63
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:13
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
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:196
DataContainer const & measurements() const
Definition: Trajectory.h:215
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:193
void setSecondHitPattern(Trajectory *traj, reco::GsfTrack &track, const Propagator *prop, const MeasurementTrackerEvent *measTk)
T z() const
Definition: PV3DBase.h:64
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
int j
Definition: DBlmapReader.cc:9
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:308
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:128
edm::Ref< GsfTrackExtraCollection > GsfTrackExtraRef
persistent reference to a GsfTrackExtra
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > > TrajGsfTrackAssociationCollection
virtual TrackingRecHit * clone() const =0
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
void setHitPattern(const C &c)
set hit patterns from vector of hit references
Definition: TrackBase.h:244
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
void setExtra(const TrackExtraRef &ref)
set reference to &quot;extra&quot; object
Definition: Track.h:94
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:206
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...
void add(const TrackingRecHitRef &r)
add a reference to a RecHit
edm::ESHandle< NavigationSchool > theSchool
TrajectoryStateOnSurface const & updatedState() const
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:170
bool isValid() const
Definition: ESHandle.h:37
edm::OrphanHandle< TrackCollection > rTracks_
std::vector< TrajectoryStateOnSurface > components() const
T x() const
Definition: PV3DBase.h:62
Trajectory::RecHitContainer RecHitContainer

Member Data Documentation

bool GsfTrackProducerBase::useSplitting
private

Definition at line 67 of file GsfTrackProducerBase.h.

Referenced by putInEvt().