CMS 3D CMS Logo

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< TrajectoryMeasurementfindMeasurements (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::BeamSpottheBeamSpotToken
 
unsigned long long theCacheId_TG
 
const std::string theCategory
 
std::unique_ptr< MuonErrorMatrixtheErrorMatrixAdjuster
 
const edm::ParameterSet theErrorMatrixPset
 
std::unique_ptr< const Chi2MeasurementEstimatortheEstimator
 
const double theFixedErrorRescaling
 
double theFlexErrorRescaling
 
const double theMaxChi2
 
edm::Handle< MeasurementTrackerEventtheMeasTrackerEvent
 
const edm::EDGetTokenT< MeasurementTrackerEventtheMeasurementTrackerEventToken
 
std::unique_ptr< const DirectTrackerNavigationtheNavigation
 
const std::string thePropagatorName
 
const ResetMethod theResetMethod
 
const bool theSelectStateFlag
 
const MuonServiceProxytheService
 
const double theSigmaZ
 
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecordtheTrackerToken
 
const bool theUpdateStateFlag
 
std::unique_ptr< const TrajectoryStateUpdatortheUpdator
 
const bool theUseVertexStateFlag
 

Additional Inherited Members

- Public Types inherited from TrackerSeedGenerator
typedef std::vector< TrajectorySeedBTSeedCollection
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
- 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

◆ ResetMethod

enum TSGFromPropagation::ResetMethod
strongprivate
Enumerator
discrete 
fixed 
matrix 

Definition at line 133 of file TSGFromPropagation.h.

Constructor & Destructor Documentation

◆ TSGFromPropagation() [1/2]

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() [2/2]

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"),
37  theMaxChi2(iConfig.getParameter<double>("MaxChi2")),
38  theFixedErrorRescaling(iConfig.getParameter<double>("ErrorRescaling")),
39  theUseVertexStateFlag(iConfig.getParameter<bool>("UseVertexState")),
40  theUpdateStateFlag(iConfig.getParameter<bool>("UpdateState")),
41  theResetMethod([](const edm::ParameterSet& iConfig) {
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)),
57  theSelectStateFlag(iConfig.getParameter<bool>("SelectState")),
58  thePropagatorName(iConfig.getParameter<std::string>("Propagator")),
59  theSigmaZ(iConfig.getParameter<double>("SigmaZ")),
60  theErrorMatrixPset(iConfig.getParameter<edm::ParameterSet>("errorMatrixPset")),
63  iC.consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent"))),
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const MuonServiceProxy * theService
const edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
Log< level::Error, false > LogError
const ResetMethod theResetMethod
const double theFixedErrorRescaling
const edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
const std::string theCategory
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theTrackerToken
const std::string thePropagatorName
const bool theUseVertexStateFlag
const edm::ParameterSet theErrorMatrixPset

◆ ~TSGFromPropagation()

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

◆ adjust() [1/2]

void TSGFromPropagation::adjust ( FreeTrajectoryState state) const
private

adjust the error matrix of the FTS

Definition at line 309 of file TSGFromPropagation.cc.

References discrete, fixed, MuonErrorMatrix::multiply(), theErrorMatrixAdjuster, theFixedErrorRescaling, theFlexErrorRescaling, and theResetMethod.

Referenced by innerState(), and outerTkState().

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

◆ adjust() [2/2]

void TSGFromPropagation::adjust ( TrajectoryStateOnSurface state) const
private

adjust the error matrix of the TSOS

Definition at line 329 of file TSGFromPropagation.cc.

References discrete, fixed, MuonErrorMatrix::multiply(), theErrorMatrixAdjuster, theFixedErrorRescaling, theFlexErrorRescaling, and theResetMethod.

329  {
330  //rescale the error
332  state.rescaleError(theFlexErrorRescaling);
333  return;
334  }
335 
337  state.rescaleError(theFixedErrorRescaling);
338  return;
339  }
340 
341  CurvilinearTrajectoryError oMat = state.curvilinearError();
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 }
std::unique_ptr< MuonErrorMatrix > theErrorMatrixAdjuster
const ResetMethod theResetMethod
const double theFixedErrorRescaling
static void multiply(CurvilinearTrajectoryError &initial_error, const CurvilinearTrajectoryError &scale_error)
multiply term by term the two matrix

◆ createSeed() [1/2]

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

◆ createSeed() [2/2]

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)

◆ dxyDis()

double TSGFromPropagation::dxyDis ( const TrajectoryStateOnSurface tsos) const
private

◆ estimator()

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

◆ findMeasurements()

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(), MeasurementTrackerEvent::idToDet(), 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
edm::ESHandle< Propagator > propagator() const
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
void validMeasurements(std::vector< TrajectoryMeasurement > &) const
select valid measurements
const Chi2MeasurementEstimator * estimator() const

◆ getRescalingFactor()

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 }

◆ init()

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 
163 
164  theUpdator = std::make_unique<KFUpdator>();
165 
167  theErrorMatrixAdjuster = std::make_unique<MuonErrorMatrix>(theErrorMatrixPset);
168  }
169 }
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
bool empty() const
Definition: ParameterSet.h:201
const edm::ParameterSet theErrorMatrixPset

◆ innerState()

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< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
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)

◆ outerTkState()

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< Propagator > propagator() const
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
TrajectoryStateOnSurface innerState(const TrackCand &) const
void adjust(FreeTrajectoryState &) const
adjust the error matrix of the FTS
const bool theUseVertexStateFlag
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)

◆ passSelection()

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, reco::BeamSpot::z0(), 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 }
bool isValid() const
Definition: HandleBase.h:70
double z0() const
z coordinate
Definition: BeamSpot.h:65
double zDis(const TrajectoryStateOnSurface &tsos) const
edm::Handle< reco::BeamSpot > beamSpot

◆ propagator()

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
const std::string thePropagatorName
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator

◆ setEvent()

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::EventSetup::getHandle(), iEvent, LogTrace, theBeamSpotToken, theCacheId_TG, theCategory, theMeasTrackerEvent, theMeasurementTrackerEventToken, theNavigation, theService, theTrackerToken, and theUpdateStateFlag.

171  {
172  iEvent.getByToken(theBeamSpotToken, beamSpot);
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 MuonServiceProxy * theService
const edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
unsigned long long theCacheId_TG
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< const DirectTrackerNavigation > theNavigation
const edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
const std::string theCategory
T get() const
Definition: EventSetup.h:82
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theTrackerToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const edm::EventSetup & eventSetup() const
edm::Handle< reco::BeamSpot > beamSpot

◆ trackerSeeds()

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(), mps_fire::result, 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 }
TrajectorySeed createSeed(const TrajectoryStateOnSurface &, const DetId &) const
create a hitless seed from a trajectory state
T perp() const
Definition: PV3DBase.h:69
edm::ESHandle< Propagator > propagator() const
const TrajectoryStateUpdator * updator() const
T eta() const
Definition: PV3DBase.h:73
std::vector< TrajectoryMeasurement > findMeasurements(const DetLayer *, const TrajectoryStateOnSurface &) const
look for measurements on the first compatible layer
bool passSelection(const TrajectoryStateOnSurface &) const
check some quantity and beam-spot compatibility and decide to continue
const ResetMethod theResetMethod
const Chi2MeasurementEstimator * estimator() const
#define LogTrace(id)
void push_back(D *&d)
Definition: OwnVector.h:326
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
std::unique_ptr< const DirectTrackerNavigation > theNavigation
GlobalPoint globalPosition() const
void getRescalingFactor(const TrackCand &staMuon)
const std::string theCategory
GlobalVector globalMomentum() const
TrajectoryStateOnSurface outerTkState(const TrackCand &) const
FreeTrajectoryState const * freeState(bool withErrors=true) const

◆ updator()

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

◆ validMeasurements()

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 }

◆ zDis()

double TSGFromPropagation::zDis ( const TrajectoryStateOnSurface tsos) const
private

Member Data Documentation

◆ beamSpot

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

Definition at line 146 of file TSGFromPropagation.h.

Referenced by passSelection(), and setEvent().

◆ theBeamSpotToken

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

Definition at line 147 of file TSGFromPropagation.h.

Referenced by setEvent().

◆ theCacheId_TG

unsigned long long TSGFromPropagation::theCacheId_TG
private

Definition at line 109 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

◆ theCategory

const std::string TSGFromPropagation::theCategory
private

Definition at line 111 of file TSGFromPropagation.h.

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

◆ theErrorMatrixAdjuster

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

Definition at line 140 of file TSGFromPropagation.h.

Referenced by adjust(), and init().

◆ theErrorMatrixPset

const edm::ParameterSet TSGFromPropagation::theErrorMatrixPset
private

Definition at line 144 of file TSGFromPropagation.h.

Referenced by init().

◆ theEstimator

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

Definition at line 121 of file TSGFromPropagation.h.

Referenced by estimator(), and init().

◆ theFixedErrorRescaling

const double TSGFromPropagation::theFixedErrorRescaling
private

Definition at line 127 of file TSGFromPropagation.h.

Referenced by adjust().

◆ theFlexErrorRescaling

double TSGFromPropagation::theFlexErrorRescaling
private

Definition at line 125 of file TSGFromPropagation.h.

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

◆ theMaxChi2

const double TSGFromPropagation::theMaxChi2
private

Definition at line 123 of file TSGFromPropagation.h.

Referenced by init().

◆ theMeasTrackerEvent

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

Definition at line 113 of file TSGFromPropagation.h.

Referenced by findMeasurements(), and setEvent().

◆ theMeasurementTrackerEventToken

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

Definition at line 148 of file TSGFromPropagation.h.

Referenced by setEvent().

◆ theNavigation

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

Definition at line 115 of file TSGFromPropagation.h.

Referenced by setEvent(), and trackerSeeds().

◆ thePropagatorName

const std::string TSGFromPropagation::thePropagatorName
private

Definition at line 138 of file TSGFromPropagation.h.

Referenced by propagator().

◆ theResetMethod

const ResetMethod TSGFromPropagation::theResetMethod
private

Definition at line 134 of file TSGFromPropagation.h.

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

◆ theSelectStateFlag

const bool TSGFromPropagation::theSelectStateFlag
private

Definition at line 136 of file TSGFromPropagation.h.

Referenced by passSelection().

◆ theService

const MuonServiceProxy* TSGFromPropagation::theService
private

Definition at line 117 of file TSGFromPropagation.h.

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

◆ theSigmaZ

const double TSGFromPropagation::theSigmaZ
private

Definition at line 142 of file TSGFromPropagation.h.

Referenced by passSelection().

◆ theTrackerToken

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

Definition at line 149 of file TSGFromPropagation.h.

Referenced by setEvent().

◆ theUpdateStateFlag

const bool TSGFromPropagation::theUpdateStateFlag
private

Definition at line 131 of file TSGFromPropagation.h.

Referenced by setEvent(), and trackerSeeds().

◆ theUpdator

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

Definition at line 119 of file TSGFromPropagation.h.

Referenced by init(), and updator().

◆ theUseVertexStateFlag

const bool TSGFromPropagation::theUseVertexStateFlag
private

Definition at line 129 of file TSGFromPropagation.h.

Referenced by outerTkState().