CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TSGFromPropagation Class Reference

#include <TSGFromPropagation.h>

Inheritance diagram for TSGFromPropagation:
TrackerSeedGenerator

Classes

struct  increasingEstimate
 
struct  isInvalid
 

Public Member Functions

void init (const MuonServiceProxy *) override
 initialize More...
 
void setEvent (const edm::Event &) override
 set an event More...
 
void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *, std::vector< TrajectorySeed > &) override
 generate seed(s) for a track More...
 
 TSGFromPropagation (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 constructor More...
 
 TSGFromPropagation (const edm::ParameterSet &par, edm::ConsumesCollector &iC, const MuonServiceProxy *)
 
 ~TSGFromPropagation () override
 destructor More...
 
- Public Member Functions inherited from TrackerSeedGenerator
const edm::EventgetEvent () const
 
 TrackerSeedGenerator ()
 
virtual void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &)
 
virtual ~TrackerSeedGenerator ()
 destructor More...
 

Private Types

enum  ResetMethod { ResetMethod::discrete, ResetMethod::fixed, ResetMethod::matrix }
 

Private Member Functions

void adjust (FreeTrajectoryState &) const
 adjust the error matrix of the FTS More...
 
void adjust (TrajectoryStateOnSurface &) const
 adjust the error matrix of the TSOS More...
 
TrajectorySeed createSeed (const TrajectoryStateOnSurface &, const DetId &) const
 create a hitless seed from a trajectory state More...
 
TrajectorySeed createSeed (const TrajectoryStateOnSurface &tsos, const edm::OwnVector< TrackingRecHit > &container, const DetId &id) const
 create a seed from a trajectory state More...
 
double dxyDis (const TrajectoryStateOnSurface &tsos) const
 
const Chi2MeasurementEstimatorestimator () const
 
std::vector
< TrajectoryMeasurement
findMeasurements (const DetLayer *, const TrajectoryStateOnSurface &) const
 look for measurements on the first compatible layer More...
 
void getRescalingFactor (const TrackCand &staMuon)
 
TrajectoryStateOnSurface innerState (const TrackCand &) const
 
TrajectoryStateOnSurface outerTkState (const TrackCand &) const
 
bool passSelection (const TrajectoryStateOnSurface &) const
 check some quantity and beam-spot compatibility and decide to continue More...
 
edm::ESHandle< Propagatorpropagator () const
 
const TrajectoryStateUpdatorupdator () const
 
void validMeasurements (std::vector< TrajectoryMeasurement > &) const
 select valid measurements More...
 
double zDis (const TrajectoryStateOnSurface &tsos) const
 

Private Attributes

edm::Handle< reco::BeamSpotbeamSpot
 
const edm::EDGetTokenT
< reco::BeamSpot
theBeamSpotToken
 
unsigned long long theCacheId_TG
 
const std::string theCategory
 
std::unique_ptr< MuonErrorMatrixtheErrorMatrixAdjuster
 
const edm::ParameterSet theErrorMatrixPset
 
std::unique_ptr< const
Chi2MeasurementEstimator
theEstimator
 
const double theFixedErrorRescaling
 
double theFlexErrorRescaling
 
const double theMaxChi2
 
edm::Handle
< MeasurementTrackerEvent
theMeasTrackerEvent
 
const edm::EDGetTokenT
< MeasurementTrackerEvent
theMeasurementTrackerEventToken
 
std::unique_ptr< const
DirectTrackerNavigation
theNavigation
 
const std::string thePropagatorName
 
const ResetMethod theResetMethod
 
const bool theSelectStateFlag
 
const MuonServiceProxytheService
 
const double theSigmaZ
 
const edm::ESGetToken
< GeometricSearchTracker,
TrackerRecoGeometryRecord
theTrackerToken
 
const bool theUpdateStateFlag
 
std::unique_ptr< const
TrajectoryStateUpdator
theUpdator
 
const bool theUseVertexStateFlag
 

Additional Inherited Members

- Public Types inherited from TrackerSeedGenerator
typedef std::vector
< TrajectorySeed
BTSeedCollection
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
- Protected Attributes inherited from TrackerSeedGenerator
const edm::EventtheEvent
 
const MuonServiceProxytheProxyService
 

Detailed Description

Author
Chang Liu - Purdue University

Tracker Seed Generator by propagating and updating a standAlone muon to the first 2 (or 1) rechits it meets in tracker system

Author
Chang Liu - Purdue University

Definition at line 34 of file TSGFromPropagation.h.

Member Enumeration Documentation

enum TSGFromPropagation::ResetMethod
strongprivate
Enumerator
discrete 
fixed 
matrix 

Definition at line 133 of file TSGFromPropagation.h.

133 { discrete, fixed, matrix };

Constructor & Destructor Documentation

TSGFromPropagation::TSGFromPropagation ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)

constructor

Definition at line 29 of file TSGFromPropagation.cc.

30  : TSGFromPropagation(iConfig, iC, nullptr) {}
TSGFromPropagation(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
constructor
TSGFromPropagation::TSGFromPropagation ( const edm::ParameterSet par,
edm::ConsumesCollector iC,
const MuonServiceProxy service 
)

Definition at line 32 of file TSGFromPropagation.cc.

References discrete, fixed, edm::ParameterSet::getParameter(), matrix, and AlCaHLTBitMon_QueryRunRegistry::string.

35  : theCategory("Muon|RecoMuon|TSGFromPropagation"),
36  theService(service),
37  theMaxChi2(iConfig.getParameter<double>("MaxChi2")),
38  theFixedErrorRescaling(iConfig.getParameter<double>("ErrorRescaling")),
39  theUseVertexStateFlag(iConfig.getParameter<bool>("UseVertexState")),
40  theUpdateStateFlag(iConfig.getParameter<bool>("UpdateState")),
42  auto resetMethod = iConfig.getParameter<std::string>("ResetMethod");
43  if (resetMethod != "discrete" && resetMethod != "fixed" && resetMethod != "matrix") {
44  edm::LogError("TSGFromPropagation") << "Wrong error rescaling method: " << resetMethod << "\n"
45  << "Possible choices are: discrete, fixed, matrix.\n"
46  << "Use discrete method" << std::endl;
47  resetMethod = "discrete";
48  }
49  if ("fixed" == resetMethod) {
50  return ResetMethod::fixed;
51  }
52  if ("matrix" == resetMethod) {
53  return ResetMethod::matrix;
54  }
55  return ResetMethod::discrete;
56  }(iConfig)),
const MuonServiceProxy * theService
Log< level::Error, false > LogError
const ResetMethod theResetMethod
const double theFixedErrorRescaling
const std::string theCategory
const bool theUseVertexStateFlag
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TSGFromPropagation::~TSGFromPropagation ( )
override

destructor

Definition at line 66 of file TSGFromPropagation.cc.

References LogTrace, and theCategory.

66 { LogTrace(theCategory) << " TSGFromPropagation dtor called "; }
#define LogTrace(id)
const std::string theCategory

Member Function Documentation

void TSGFromPropagation::adjust ( FreeTrajectoryState state) const
private

adjust the error matrix of the FTS

Definition at line 309 of file TSGFromPropagation.cc.

References FreeTrajectoryState::curvilinearError(), discrete, fixed, FreeTrajectoryState::momentum(), MuonErrorMatrix::multiply(), FreeTrajectoryState::parameters(), FreeTrajectoryState::rescaleError(), theErrorMatrixAdjuster, theFixedErrorRescaling, theFlexErrorRescaling, and theResetMethod.

Referenced by innerState(), and outerTkState().

309  {
310  //rescale the error
313  return;
314  }
315 
316  //rescale the error
319  return;
320  }
321 
323  CurvilinearTrajectoryError sfMat = theErrorMatrixAdjuster->get(state.momentum()); //FIXME with position
324  MuonErrorMatrix::multiply(oMat, sfMat);
325 
326  state = FreeTrajectoryState(state.parameters(), oMat);
327 }
const GlobalTrajectoryParameters & parameters() const
std::unique_ptr< MuonErrorMatrix > theErrorMatrixAdjuster
const ResetMethod theResetMethod
const CurvilinearTrajectoryError & curvilinearError() const
const double theFixedErrorRescaling
static void multiply(CurvilinearTrajectoryError &initial_error, const CurvilinearTrajectoryError &scale_error)
multiply term by term the two matrix
GlobalVector momentum() const
void rescaleError(double factor)
void TSGFromPropagation::adjust ( TrajectoryStateOnSurface state) const
private

adjust the error matrix of the TSOS

Definition at line 329 of file TSGFromPropagation.cc.

References TrajectoryStateOnSurface::curvilinearError(), discrete, fixed, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalParameters(), MuonErrorMatrix::multiply(), TrajectoryStateOnSurface::rescaleError(), TrajectoryStateOnSurface::surface(), TrajectoryStateOnSurface::surfaceSide(), theErrorMatrixAdjuster, theFixedErrorRescaling, theFlexErrorRescaling, theResetMethod, and TrajectoryStateOnSurface::weight().

329  {
330  //rescale the error
333  return;
334  }
335 
338  return;
339  }
340 
342  CurvilinearTrajectoryError sfMat = theErrorMatrixAdjuster->get(state.globalMomentum()); //FIXME with position
343  MuonErrorMatrix::multiply(oMat, sfMat);
344 
345  state =
346  TrajectoryStateOnSurface(state.weight(), state.globalParameters(), oMat, state.surface(), state.surfaceSide());
347 }
const CurvilinearTrajectoryError & curvilinearError() const
std::unique_ptr< MuonErrorMatrix > theErrorMatrixAdjuster
const ResetMethod theResetMethod
const SurfaceType & surface() const
const double theFixedErrorRescaling
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
static void multiply(CurvilinearTrajectoryError &initial_error, const CurvilinearTrajectoryError &scale_error)
multiply term by term the two matrix
const GlobalTrajectoryParameters & globalParameters() const
GlobalVector globalMomentum() const
TrajectorySeed TSGFromPropagation::createSeed ( const TrajectoryStateOnSurface tsos,
const DetId id 
) const
private

create a hitless seed from a trajectory state

Definition at line 227 of file TSGFromPropagation.cc.

Referenced by trackerSeeds().

227  {
229  return createSeed(tsos, container, id);
230 }
TrajectorySeed createSeed(const TrajectoryStateOnSurface &, const DetId &) const
create a hitless seed from a trajectory state
TrajectorySeed TSGFromPropagation::createSeed ( const TrajectoryStateOnSurface tsos,
const edm::OwnVector< TrackingRecHit > &  container,
const DetId id 
) const
private

create a seed from a trajectory state

Definition at line 232 of file TSGFromPropagation.cc.

References oppositeToMomentum, and trajectoryStateTransform::persistentState().

234  {
235  PTrajectoryStateOnDet const& seedTSOS = trajectoryStateTransform::persistentState(tsos, id.rawId());
236  return TrajectorySeed(seedTSOS, container, oppositeToMomentum);
237 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
double TSGFromPropagation::dxyDis ( const TrajectoryStateOnSurface tsos) const
private

Definition at line 287 of file TSGFromPropagation.cc.

References TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

287  {
288  return fabs(
289  (-tsos.globalPosition().x() * tsos.globalMomentum().y() + tsos.globalPosition().y() * tsos.globalMomentum().x()) /
290  tsos.globalMomentum().perp());
291 }
T perp() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
GlobalVector globalMomentum() const
T x() const
Definition: PV3DBase.h:59
const Chi2MeasurementEstimator* TSGFromPropagation::estimator ( void  ) const
inlineprivate

Definition at line 63 of file TSGFromPropagation.h.

References theEstimator.

Referenced by findMeasurements(), and trackerSeeds().

63 { return theEstimator.get(); }
std::unique_ptr< const Chi2MeasurementEstimator > theEstimator
std::vector< TrajectoryMeasurement > TSGFromPropagation::findMeasurements ( const DetLayer nl,
const TrajectoryStateOnSurface staState 
) const
private

look for measurements on the first compatible layer

Definition at line 245 of file TSGFromPropagation.cc.

References GeometricSearchDet::compatibleDets(), estimator(), propagator(), mps_fire::result, theMeasTrackerEvent, and validMeasurements().

Referenced by trackerSeeds().

246  {
247  std::vector<TrajectoryMeasurement> result;
248 
249  std::vector<DetLayer::DetWithState> compatDets = nl->compatibleDets(staState, *propagator(), *estimator());
250  if (compatDets.empty())
251  return result;
252 
253  for (std::vector<DetLayer::DetWithState>::const_iterator idws = compatDets.begin(); idws != compatDets.end();
254  ++idws) {
255  if (idws->second.isValid() && (idws->first)) {
256  std::vector<TrajectoryMeasurement> tmptm =
257  theMeasTrackerEvent->idToDet(idws->first->geographicalId())
258  .fastMeasurements(idws->second, idws->second, *propagator(), *estimator());
259  validMeasurements(tmptm);
260  // if ( tmptm.size() > 2 ) {
261  // std::stable_sort(tmptm.begin(),tmptm.end(),increasingEstimate());
262  // result.insert(result.end(),tmptm.begin(), tmptm.begin()+2);
263  // } else {
264  result.insert(result.end(), tmptm.begin(), tmptm.end());
265  // }
266  }
267  }
268 
269  return result;
270 }
edm::Handle< MeasurementTrackerEvent > theMeasTrackerEvent
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
tuple result
Definition: mps_fire.py:311
void validMeasurements(std::vector< TrajectoryMeasurement > &) const
select valid measurements
const Chi2MeasurementEstimator * estimator() const
edm::ESHandle< Propagator > propagator() const
void TSGFromPropagation::getRescalingFactor ( const TrackCand staMuon)
private

Definition at line 298 of file TSGFromPropagation.cc.

References DiDispStaMuonMonitor_cfi::pt, and theFlexErrorRescaling.

Referenced by trackerSeeds().

298  {
299  float pt = (staMuon.second)->pt();
300  if (pt < 13.0)
302  else if (pt < 30.0)
304  else
306  return;
307 }
void TSGFromPropagation::init ( const MuonServiceProxy service)
overridevirtual

initialize

Reimplemented from TrackerSeedGenerator.

Definition at line 155 of file TSGFromPropagation.cc.

References edm::ParameterSet::empty(), matrix, theCacheId_TG, theErrorMatrixAdjuster, theErrorMatrixPset, theEstimator, theFlexErrorRescaling, theMaxChi2, theResetMethod, theService, and theUpdator.

155  {
156  theFlexErrorRescaling = 1.0;
157 
158  theEstimator = std::make_unique<Chi2MeasurementEstimator>(theMaxChi2);
159 
160  theCacheId_TG = 0;
161 
162  theService = service;
163 
164  theUpdator = std::make_unique<KFUpdator>();
165 
167  theErrorMatrixAdjuster = std::make_unique<MuonErrorMatrix>(theErrorMatrixPset);
168  }
169 }
bool empty() const
Definition: ParameterSet.h:201
std::unique_ptr< const Chi2MeasurementEstimator > theEstimator
const MuonServiceProxy * theService
unsigned long long theCacheId_TG
std::unique_ptr< MuonErrorMatrix > theErrorMatrixAdjuster
std::unique_ptr< const TrajectoryStateUpdator > theUpdator
const ResetMethod theResetMethod
const edm::ParameterSet theErrorMatrixPset
TrajectoryStateOnSurface TSGFromPropagation::innerState ( const TrackCand staMuon) const
private

Definition at line 188 of file TSGFromPropagation.cc.

References adjust(), alongMomentum, trajectoryStateTransform::innerStateOnSurface(), MuonServiceProxy::magneticField(), oppositeToMomentum, theService, and MuonServiceProxy::trackingGeometry().

Referenced by outerTkState().

188  {
189  TrajectoryStateOnSurface innerTS;
190 
191  if (staMuon.first && staMuon.first->isValid()) {
192  if (staMuon.first->direction() == alongMomentum) {
193  innerTS = staMuon.first->firstMeasurement().updatedState();
194  } else if (staMuon.first->direction() == oppositeToMomentum) {
195  innerTS = staMuon.first->lastMeasurement().updatedState();
196  }
197  } else {
199  *(staMuon.second), *theService->trackingGeometry(), &*theService->magneticField());
200  }
201  //rescale the error
202  adjust(innerTS);
203 
204  return innerTS;
205 
206  // return trajectoryStateTransform::innerStateOnSurface(*(staMuon.second),*theService->trackingGeometry(), &*theService->magneticField());
207 }
const MuonServiceProxy * theService
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
void adjust(FreeTrajectoryState &) const
adjust the error matrix of the FTS
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
TrajectoryStateOnSurface TSGFromPropagation::outerTkState ( const TrackCand staMuon) const
private

Definition at line 209 of file TSGFromPropagation.cc.

References adjust(), trajectoryStateTransform::initialFreeState(), innerState(), MuonServiceProxy::magneticField(), MuonServiceProxy::propagator(), propagator(), mps_fire::result, theService, and theUseVertexStateFlag.

Referenced by trackerSeeds().

209  {
211 
212  if (theUseVertexStateFlag && staMuon.second->pt() > 1.0) {
213  FreeTrajectoryState iniState =
215  //rescale the error at IP
216  adjust(iniState);
217 
218  StateOnTrackerBound fromInside(&*(theService->propagator("PropagatorWithMaterial")));
219  result = fromInside(iniState);
220  } else {
221  StateOnTrackerBound fromOutside(&*propagator());
222  result = fromOutside(innerState(staMuon));
223  }
224  return result;
225 }
const MuonServiceProxy * theService
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
tuple result
Definition: mps_fire.py:311
TrajectoryStateOnSurface innerState(const TrackCand &) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
const bool theUseVertexStateFlag
edm::ESHandle< Propagator > propagator() const
void adjust(FreeTrajectoryState &) const
adjust the error matrix of the FTS
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
bool TSGFromPropagation::passSelection ( const TrajectoryStateOnSurface tsos) const
private

check some quantity and beam-spot compatibility and decide to continue

Definition at line 272 of file TSGFromPropagation.cc.

References beamSpot, edm::HandleBase::isValid(), theSelectStateFlag, theSigmaZ, and zDis().

Referenced by trackerSeeds().

272  {
273  if (!theSelectStateFlag)
274  return true;
275  else {
276  if (beamSpot.isValid()) {
277  return ((fabs(zDis(tsos) - beamSpot->z0()) < theSigmaZ));
278 
279  } else {
280  return ((fabs(zDis(tsos)) < theSigmaZ));
281  // double theDxyCut = 100;
282  // return ( (zDis(tsos) < theSigmaZ) && (dxyDis(tsos) < theDxyCut) );
283  }
284  }
285 }
double zDis(const TrajectoryStateOnSurface &tsos) const
bool isValid() const
Definition: HandleBase.h:70
edm::Handle< reco::BeamSpot > beamSpot
edm::ESHandle<Propagator> TSGFromPropagation::propagator ( ) const
inlineprivate

Definition at line 65 of file TSGFromPropagation.h.

References MuonServiceProxy::propagator(), thePropagatorName, and theService.

Referenced by findMeasurements(), outerTkState(), and trackerSeeds().

const MuonServiceProxy * theService
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
const std::string thePropagatorName
void TSGFromPropagation::setEvent ( const edm::Event iEvent)
overridevirtual

set an event

Reimplemented from TrackerSeedGenerator.

Definition at line 171 of file TSGFromPropagation.cc.

References beamSpot, MuonServiceProxy::eventSetup(), edm::EventSetup::get(), edm::Event::getByToken(), edm::EventSetup::getHandle(), LogTrace, theBeamSpotToken, theCacheId_TG, theCategory, theMeasTrackerEvent, theMeasurementTrackerEventToken, theNavigation, theService, theTrackerToken, and theUpdateStateFlag.

171  {
173 
174  if (theUpdateStateFlag) {
176  }
177 
178  unsigned long long newCacheId_TG = theService->eventSetup().get<TrackerRecoGeometryRecord>().cacheIdentifier();
179 
180  if (newCacheId_TG != theCacheId_TG) {
181  LogTrace(theCategory) << "Tracker Reco Geometry changed!";
182  theCacheId_TG = newCacheId_TG;
184  theNavigation = std::make_unique<DirectTrackerNavigation>(theTracker);
185  }
186 }
edm::Handle< MeasurementTrackerEvent > theMeasTrackerEvent
const edm::EventSetup & eventSetup() const
const MuonServiceProxy * theService
const edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
unsigned long long theCacheId_TG
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define LogTrace(id)
std::unique_ptr< const DirectTrackerNavigation > theNavigation
const edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
const std::string theCategory
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theTrackerToken
T get() const
Definition: EventSetup.h:82
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::Handle< reco::BeamSpot > beamSpot
void TSGFromPropagation::trackerSeeds ( const TrackCand staMuon,
const TrackingRegion region,
const TrackerTopology tTopo,
std::vector< TrajectorySeed > &  result 
)
override

generate seed(s) for a track

Definition at line 68 of file TSGFromPropagation.cc.

References createSeed(), discrete, estimator(), PV3DBase< T, PVType, FrameType >::eta(), findMeasurements(), TrajectoryStateOnSurface::freeState(), getRescalingFactor(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, TrajectoryStateOnSurface::isValid(), LogTrace, oppositeToMomentum, outerTkState(), passSelection(), PV3DBase< T, PVType, FrameType >::perp(), propagator(), edm::OwnVector< T, P >::push_back(), theCategory, theNavigation, theResetMethod, theUpdateStateFlag, TrajectoryStateUpdator::update(), and updator().

71  {
73  getRescalingFactor(staMuon);
74 
75  TrajectoryStateOnSurface staState = outerTkState(staMuon);
76 
77  if (!staState.isValid()) {
78  LogTrace(theCategory) << "Error: initial state from L2 muon is invalid.";
79  return;
80  }
81 
82  LogTrace(theCategory) << "begin of trackerSeed:\n staState pos: " << staState.globalPosition()
83  << " mom: " << staState.globalMomentum() << "pos eta: " << staState.globalPosition().eta()
84  << "mom eta: " << staState.globalMomentum().eta();
85 
86  std::vector<const DetLayer*> nls = theNavigation->compatibleLayers(*(staState.freeState()), oppositeToMomentum);
87 
88  LogTrace(theCategory) << " compatible layers: " << nls.size();
89 
90  if (nls.empty())
91  return;
92 
93  int ndesLayer = 0;
94 
95  bool usePredictedState = false;
96 
97  if (theUpdateStateFlag) { //use updated states
98  std::vector<TrajectoryMeasurement> alltm;
99 
100  for (std::vector<const DetLayer*>::const_iterator inl = nls.begin(); inl != nls.end(); inl++, ndesLayer++) {
101  if ((*inl == nullptr))
102  break;
103  // if ( (inl != nls.end()-1 ) && ( (*inl)->subDetector() == GeomDetEnumerators::TEC ) && ( (*(inl+1))->subDetector() == GeomDetEnumerators::TOB ) ) continue;
104  alltm = findMeasurements(*inl, staState);
105  if ((!alltm.empty())) {
106  LogTrace(theCategory) << "final compatible layer: " << ndesLayer;
107  break;
108  }
109  }
110 
111  if (alltm.empty()) {
112  LogTrace(theCategory) << " NO Measurements Found: eta: " << staState.globalPosition().eta() << "pt "
113  << staState.globalMomentum().perp();
114  usePredictedState = true;
115  } else {
116  LogTrace(theCategory) << " Measurements for seeds: " << alltm.size();
117  std::stable_sort(alltm.begin(), alltm.end(), increasingEstimate());
118  if (alltm.size() > 5)
119  alltm.erase(alltm.begin() + 5, alltm.end());
120 
121  int i = 0;
122  for (std::vector<TrajectoryMeasurement>::const_iterator itm = alltm.begin(); itm != alltm.end(); itm++, i++) {
123  TrajectoryStateOnSurface updatedTSOS = updator()->update(itm->predictedState(), *(itm->recHit()));
124  if (updatedTSOS.isValid() && passSelection(updatedTSOS)) {
126  container.push_back(itm->recHit()->hit()->clone());
127  TrajectorySeed ts = createSeed(updatedTSOS, container, itm->recHit()->geographicalId());
128  result.push_back(ts);
129  }
130  }
131  LogTrace(theCategory) << "result: " << result.size();
132  return;
133  }
134  }
135 
136  if (!theUpdateStateFlag || usePredictedState) { //use predicted states
137  LogTrace(theCategory) << "use predicted state: ";
138  for (std::vector<const DetLayer*>::const_iterator inl = nls.begin(); inl != nls.end(); inl++) {
139  if (!result.empty() || *inl == nullptr) {
140  break;
141  }
142  std::vector<DetLayer::DetWithState> compatDets = (*inl)->compatibleDets(staState, *propagator(), *estimator());
143  LogTrace(theCategory) << " compatDets " << compatDets.size();
144  if (compatDets.empty())
145  continue;
146  TrajectorySeed ts = createSeed(compatDets.front().second, compatDets.front().first->geographicalId());
147  result.push_back(ts);
148  }
149  LogTrace(theCategory) << "result: " << result.size();
150  return;
151  }
152  return;
153 }
T perp() const
Definition: PV3DBase.h:69
TrajectoryStateOnSurface outerTkState(const TrackCand &) const
GlobalPoint globalPosition() const
const ResetMethod theResetMethod
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
void push_back(D *&d)
Definition: OwnVector.h:326
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
std::vector< TrajectoryMeasurement > findMeasurements(const DetLayer *, const TrajectoryStateOnSurface &) const
look for measurements on the first compatible layer
std::unique_ptr< const DirectTrackerNavigation > theNavigation
void getRescalingFactor(const TrackCand &staMuon)
FreeTrajectoryState const * freeState(bool withErrors=true) const
bool passSelection(const TrajectoryStateOnSurface &) const
check some quantity and beam-spot compatibility and decide to continue
const std::string theCategory
const TrajectoryStateUpdator * updator() const
TrajectorySeed createSeed(const TrajectoryStateOnSurface &, const DetId &) const
create a hitless seed from a trajectory state
T eta() const
Definition: PV3DBase.h:73
GlobalVector globalMomentum() const
const Chi2MeasurementEstimator * estimator() const
edm::ESHandle< Propagator > propagator() const
const TrajectoryStateUpdator* TSGFromPropagation::updator ( ) const
inlineprivate

Definition at line 61 of file TSGFromPropagation.h.

References theUpdator.

Referenced by trackerSeeds().

61 { return theUpdator.get(); }
std::unique_ptr< const TrajectoryStateUpdator > theUpdator
void TSGFromPropagation::validMeasurements ( std::vector< TrajectoryMeasurement > &  tms) const
private

select valid measurements

Definition at line 239 of file TSGFromPropagation.cc.

Referenced by findMeasurements().

239  {
240  std::vector<TrajectoryMeasurement>::iterator tmsend = std::remove_if(tms.begin(), tms.end(), isInvalid());
241  tms.erase(tmsend, tms.end());
242  return;
243 }
double TSGFromPropagation::zDis ( const TrajectoryStateOnSurface tsos) const
private

Definition at line 293 of file TSGFromPropagation.cc.

References TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::perp(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by passSelection().

293  {
294  return tsos.globalPosition().z() -
295  tsos.globalPosition().perp() * tsos.globalMomentum().z() / tsos.globalMomentum().perp();
296 }
T perp() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
T z() const
Definition: PV3DBase.h:61
GlobalVector globalMomentum() const

Member Data Documentation

edm::Handle<reco::BeamSpot> TSGFromPropagation::beamSpot
private

Definition at line 146 of file TSGFromPropagation.h.

Referenced by passSelection(), and setEvent().

const edm::EDGetTokenT<reco::BeamSpot> TSGFromPropagation::theBeamSpotToken
private

Definition at line 147 of file TSGFromPropagation.h.

Referenced by setEvent().

unsigned long long TSGFromPropagation::theCacheId_TG
private

Definition at line 109 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

const std::string TSGFromPropagation::theCategory
private

Definition at line 111 of file TSGFromPropagation.h.

Referenced by setEvent(), trackerSeeds(), and ~TSGFromPropagation().

std::unique_ptr<MuonErrorMatrix> TSGFromPropagation::theErrorMatrixAdjuster
private

Definition at line 140 of file TSGFromPropagation.h.

Referenced by adjust(), and init().

const edm::ParameterSet TSGFromPropagation::theErrorMatrixPset
private

Definition at line 144 of file TSGFromPropagation.h.

Referenced by init().

std::unique_ptr<const Chi2MeasurementEstimator> TSGFromPropagation::theEstimator
private

Definition at line 121 of file TSGFromPropagation.h.

Referenced by estimator(), and init().

const double TSGFromPropagation::theFixedErrorRescaling
private

Definition at line 127 of file TSGFromPropagation.h.

Referenced by adjust().

double TSGFromPropagation::theFlexErrorRescaling
private

Definition at line 125 of file TSGFromPropagation.h.

Referenced by adjust(), getRescalingFactor(), and init().

const double TSGFromPropagation::theMaxChi2
private

Definition at line 123 of file TSGFromPropagation.h.

Referenced by init().

edm::Handle<MeasurementTrackerEvent> TSGFromPropagation::theMeasTrackerEvent
private

Definition at line 113 of file TSGFromPropagation.h.

Referenced by findMeasurements(), and setEvent().

const edm::EDGetTokenT<MeasurementTrackerEvent> TSGFromPropagation::theMeasurementTrackerEventToken
private

Definition at line 148 of file TSGFromPropagation.h.

Referenced by setEvent().

std::unique_ptr<const DirectTrackerNavigation> TSGFromPropagation::theNavigation
private

Definition at line 115 of file TSGFromPropagation.h.

Referenced by setEvent(), and trackerSeeds().

const std::string TSGFromPropagation::thePropagatorName
private

Definition at line 138 of file TSGFromPropagation.h.

Referenced by propagator().

const ResetMethod TSGFromPropagation::theResetMethod
private

Definition at line 134 of file TSGFromPropagation.h.

Referenced by adjust(), init(), and trackerSeeds().

const bool TSGFromPropagation::theSelectStateFlag
private

Definition at line 136 of file TSGFromPropagation.h.

Referenced by passSelection().

const MuonServiceProxy* TSGFromPropagation::theService
private

Definition at line 117 of file TSGFromPropagation.h.

Referenced by init(), innerState(), outerTkState(), propagator(), and setEvent().

const double TSGFromPropagation::theSigmaZ
private

Definition at line 142 of file TSGFromPropagation.h.

Referenced by passSelection().

const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> TSGFromPropagation::theTrackerToken
private

Definition at line 149 of file TSGFromPropagation.h.

Referenced by setEvent().

const bool TSGFromPropagation::theUpdateStateFlag
private

Definition at line 131 of file TSGFromPropagation.h.

Referenced by setEvent(), and trackerSeeds().

std::unique_ptr<const TrajectoryStateUpdator> TSGFromPropagation::theUpdator
private

Definition at line 119 of file TSGFromPropagation.h.

Referenced by init(), and updator().

const bool TSGFromPropagation::theUseVertexStateFlag
private

Definition at line 129 of file TSGFromPropagation.h.

Referenced by outerTkState().