CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | 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 *)
 initialize More...
 
void setEvent (const edm::Event &)
 set an event More...
 
void trackerSeeds (const TrackCand &, const TrackingRegion &, std::vector< TrajectorySeed > &)
 generate seed(s) for a track More...
 
 TSGFromPropagation (const edm::ParameterSet &pset)
 constructor More...
 
 TSGFromPropagation (const edm::ParameterSet &par, const MuonServiceProxy *)
 
virtual ~TSGFromPropagation ()
 destructor More...
 
- Public Member Functions inherited from TrackerSeedGenerator
const edm::EventgetEvent () const
 
 TrackerSeedGenerator ()
 
virtual void trackerSeeds (const TrackCand &, const TrackingRegion &, BTSeedCollection &)
 
virtual ~TrackerSeedGenerator ()
 destructor More...
 

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...
 
std::vector
< TrajectoryMeasurement
findMeasurements_new (const DetLayer *, const TrajectoryStateOnSurface &) const
 look for measurements on the first compatible layer (faster way) 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 LayerMeasurementstkLayerMeasurements () 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
 
bool theAdjustAtIp
 
edm::InputTag theBeamSpotInputTag
 
unsigned long long theCacheId_MT
 
unsigned long long theCacheId_TG
 
std::string theCategory
 
edm::ParameterSet theConfig
 
MuonErrorMatrixtheErrorMatrixAdjuster
 
const Chi2MeasurementEstimatortheEstimator
 
double theFixedErrorRescaling
 
double theFlexErrorRescaling
 
double theMaxChi2
 
edm::ESHandle< MeasurementTrackertheMeasTracker
 
std::string theMeasTrackerName
 
const DirectTrackerNavigationtheNavigation
 
std::string thePropagatorName
 
std::string theResetMethod
 
bool theSelectStateFlag
 
const MuonServiceProxytheService
 
double theSigmaZ
 
const LayerMeasurementstheTkLayerMeasurements
 
edm::ESHandle
< GeometricSearchTracker
theTracker
 
TrajectoryStateTransformtheTSTransformer
 
bool theUpdateStateFlag
 
const TrajectoryStateUpdatortheUpdator
 
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

Date:
2011/12/22 21:08:02
Revision:
1.39
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

Date:
2010/09/06 18:44:33
Revision:
1.14
Author
Chang Liu - Purdue University

Definition at line 30 of file TSGFromPropagation.h.

Constructor & Destructor Documentation

TSGFromPropagation::TSGFromPropagation ( const edm::ParameterSet pset)

constructor

Definition at line 30 of file TSGFromPropagation.cc.

References edm::ParameterSet::getParameter(), theCategory, and theMeasTrackerName.

31 {
32  theCategory = "Muon|RecoMuon|TSGFromPropagation";
33  theMeasTrackerName = iConfig.getParameter<std::string>("MeasurementTrackerName");
34 
35 }
const MuonServiceProxy * theService
TrajectoryStateTransform * theTSTransformer
edm::ParameterSet theConfig
edm::ESHandle< MeasurementTracker > theMeasTracker
edm::ESHandle< GeometricSearchTracker > theTracker
const DirectTrackerNavigation * theNavigation
std::string theMeasTrackerName
const LayerMeasurements * theTkLayerMeasurements
const Chi2MeasurementEstimator * theEstimator
TSGFromPropagation::TSGFromPropagation ( const edm::ParameterSet par,
const MuonServiceProxy service 
)

Definition at line 37 of file TSGFromPropagation.cc.

References edm::ParameterSet::getParameter(), theCategory, and theMeasTrackerName.

38 {
39  theCategory = "Muon|RecoMuon|TSGFromPropagation";
40  theMeasTrackerName = iConfig.getParameter<std::string>("MeasurementTrackerName");
41 }
const MuonServiceProxy * theService
TrajectoryStateTransform * theTSTransformer
edm::ParameterSet theConfig
const TrajectoryStateUpdator * theUpdator
edm::ESHandle< MeasurementTracker > theMeasTracker
edm::ESHandle< GeometricSearchTracker > theTracker
const DirectTrackerNavigation * theNavigation
std::string theMeasTrackerName
const LayerMeasurements * theTkLayerMeasurements
const Chi2MeasurementEstimator * theEstimator
TSGFromPropagation::~TSGFromPropagation ( )
virtual

destructor

Definition at line 43 of file TSGFromPropagation.cc.

References LogTrace, theCategory, theErrorMatrixAdjuster, theEstimator, theNavigation, theTkLayerMeasurements, and theUpdator.

44 {
45 
46  LogTrace(theCategory) << " TSGFromPropagation dtor called ";
47  if ( theNavigation ) delete theNavigation;
48  if ( theUpdator ) delete theUpdator;
49  if ( theEstimator ) delete theEstimator;
52 
53 }
const TrajectoryStateUpdator * theUpdator
#define LogTrace(id)
const DirectTrackerNavigation * theNavigation
const LayerMeasurements * theTkLayerMeasurements
MuonErrorMatrix * theErrorMatrixAdjuster
const Chi2MeasurementEstimator * theEstimator

Member Function Documentation

void TSGFromPropagation::adjust ( FreeTrajectoryState state) const
private

adjust the error matrix of the FTS

Definition at line 361 of file TSGFromPropagation.cc.

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

Referenced by innerState(), and outerTkState().

361  {
362 
363  //rescale the error
364  if ( theResetMethod == "discreate" ) {
366  return;
367  }
368 
369  //rescale the error
370  if ( theResetMethod == "fixed" || !theErrorMatrixAdjuster) {
372  return;
373  }
374 
376  CurvilinearTrajectoryError sfMat = theErrorMatrixAdjuster->get(state.momentum());//FIXME with position
377  MuonErrorMatrix::multiply(oMat, sfMat);
378 
379  state = FreeTrajectoryState(state.parameters(),
380  oMat);
381 }
const GlobalTrajectoryParameters & parameters() const
CurvilinearTrajectoryError get(GlobalVector momentum, bool convolute=true)
main method to be used. Retrieve a 5x5 symetrical matrix according to parametrization of error or sca...
const CurvilinearTrajectoryError & curvilinearError() const
static void multiply(CurvilinearTrajectoryError &initial_error, const CurvilinearTrajectoryError &scale_error)
multiply term by term the two matrix
GlobalVector momentum() const
void rescaleError(double factor)
MuonErrorMatrix * theErrorMatrixAdjuster
void TSGFromPropagation::adjust ( TrajectoryStateOnSurface state) const
private

adjust the error matrix of the TSOS

Definition at line 383 of file TSGFromPropagation.cc.

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

383  {
384 
385  //rescale the error
386  if ( theResetMethod == "discreate" ) {
388  return;
389  }
390 
391  if ( theResetMethod == "fixed" || !theErrorMatrixAdjuster) {
393  return;
394  }
395 
397  CurvilinearTrajectoryError sfMat = theErrorMatrixAdjuster->get(state.globalMomentum());//FIXME with position
398  MuonErrorMatrix::multiply(oMat, sfMat);
399 
401  oMat,
402  state.surface(),
403  state.surfaceSide(),
404  state.weight());
405 }
const CurvilinearTrajectoryError & curvilinearError() const
CurvilinearTrajectoryError get(GlobalVector momentum, bool convolute=true)
main method to be used. Retrieve a 5x5 symetrical matrix according to parametrization of error or sca...
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
const Surface & surface() const
MuonErrorMatrix * theErrorMatrixAdjuster
TrajectorySeed TSGFromPropagation::createSeed ( const TrajectoryStateOnSurface tsos,
const DetId id 
) const
private

create a hitless seed from a trajectory state

Definition at line 274 of file TSGFromPropagation.cc.

Referenced by trackerSeeds().

274  {
275 
277  return createSeed(tsos, container, id);
278 
279 }
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 281 of file TSGFromPropagation.cc.

References oppositeToMomentum, and trajectoryStateTransform::persistentState().

281  {
282 
283  PTrajectoryStateOnDet const & seedTSOS = trajectoryStateTransform::persistentState(tsos,id.rawId());
284  return TrajectorySeed(seedTSOS,container,oppositeToMomentum);
285 
286 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
double TSGFromPropagation::dxyDis ( const TrajectoryStateOnSurface tsos) const
private
const Chi2MeasurementEstimator* TSGFromPropagation::estimator ( void  ) const
inlineprivate

Definition at line 60 of file TSGFromPropagation.h.

References theEstimator.

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

60 { return theEstimator; }
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 322 of file TSGFromPropagation.cc.

References estimator(), LayerMeasurements::measurements(), propagator(), query::result, tkLayerMeasurements(), and validMeasurements().

322  {
323 
324  std::vector<TrajectoryMeasurement> result = tkLayerMeasurements()->measurements((*nl), staState, *propagator(), *estimator());
325  validMeasurements(result);
326  return result;
327 }
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
tuple result
Definition: query.py:137
void validMeasurements(std::vector< TrajectoryMeasurement > &) const
select valid measurements
const LayerMeasurements * tkLayerMeasurements() const
const Chi2MeasurementEstimator * estimator() const
edm::ESHandle< Propagator > propagator() const
std::vector< TrajectoryMeasurement > TSGFromPropagation::findMeasurements_new ( const DetLayer nl,
const TrajectoryStateOnSurface staState 
) const
private

look for measurements on the first compatible layer (faster way)

Definition at line 297 of file TSGFromPropagation.cc.

References GeometricSearchDet::compatibleDets(), estimator(), propagator(), query::result, theMeasTracker, and validMeasurements().

Referenced by trackerSeeds().

297  {
298 
299  std::vector<TrajectoryMeasurement> result;
300 
301  std::vector<DetLayer::DetWithState> compatDets = nl->compatibleDets(staState, *propagator(), *estimator());
302  if ( compatDets.empty() ) return result;
303 
304  for (std::vector<DetLayer::DetWithState>::const_iterator idws = compatDets.begin(); idws != compatDets.end(); ++idws) {
305  if ( idws->second.isValid() && (idws->first) ) {
306  std::vector<TrajectoryMeasurement> tmptm =
307  theMeasTracker->idToDet(idws->first->geographicalId())->fastMeasurements(idws->second, idws->second, *propagator(), *estimator());
308  validMeasurements(tmptm);
309 // if ( tmptm.size() > 2 ) {
310 // std::stable_sort(tmptm.begin(),tmptm.end(),increasingEstimate());
311 // result.insert(result.end(),tmptm.begin(), tmptm.begin()+2);
312 // } else {
313  result.insert(result.end(),tmptm.begin(), tmptm.end());
314 // }
315  }
316  }
317 
318  return result;
319 
320 }
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
edm::ESHandle< MeasurementTracker > theMeasTracker
tuple result
Definition: query.py:137
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 352 of file TSGFromPropagation.cc.

References theFlexErrorRescaling.

Referenced by trackerSeeds().

352  {
353  float pt = (staMuon.second)->pt();
354  if ( pt < 13.0 ) theFlexErrorRescaling = 3;
355  else if ( pt < 30.0 ) theFlexErrorRescaling = 5;
356  else theFlexErrorRescaling = 10;
357  return;
358 }
void TSGFromPropagation::init ( const MuonServiceProxy service)
virtual

initialize

Reimplemented from TrackerSeedGenerator.

Definition at line 140 of file TSGFromPropagation.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, MuonErrorMatrix::get(), edm::ParameterSet::getParameter(), theAdjustAtIp, theBeamSpotInputTag, theCacheId_MT, theCacheId_TG, theConfig, theErrorMatrixAdjuster, theEstimator, theFixedErrorRescaling, theFlexErrorRescaling, theMaxChi2, theNavigation, thePropagatorName, theResetMethod, theSelectStateFlag, theService, theSigmaZ, theTracker, theUpdateStateFlag, theUpdator, and theUseVertexStateFlag.

140  {
141 
142  theMaxChi2 = theConfig.getParameter<double>("MaxChi2");
143 
144  theFixedErrorRescaling = theConfig.getParameter<double>("ErrorRescaling");
145 
146  theFlexErrorRescaling = 1.0;
147 
148  theResetMethod = theConfig.getParameter<std::string>("ResetMethod");
149 
150  if (theResetMethod != "discrete" && theResetMethod != "fixed" && theResetMethod != "matrix" ) {
151  edm::LogError("TSGFromPropagation")
152  <<"Wrong error rescaling method: "<<theResetMethod <<"\n"
153  <<"Possible choices are: discrete, fixed, matrix.\n"
154  <<"Use discrete method" <<std::endl;
155  theResetMethod = "discrete";
156  }
157 
159 
160  theCacheId_MT = 0;
161 
162  theCacheId_TG = 0;
163 
164  thePropagatorName = theConfig.getParameter<std::string>("Propagator");
165 
166  theService = service;
167 
168  theUseVertexStateFlag = theConfig.getParameter<bool>("UseVertexState");
169 
170  theUpdateStateFlag = theConfig.getParameter<bool>("UpdateState");
171 
172  theSelectStateFlag = theConfig.getParameter<bool>("SelectState");
173 
174  theUpdator = new KFUpdator();
175 
176  theSigmaZ = theConfig.getParameter<double>("SigmaZ");
177 
179 
180  edm::ParameterSet errorMatrixPset = theConfig.getParameter<edm::ParameterSet>("errorMatrixPset");
181  if ( theResetMethod == "matrix" && !errorMatrixPset.empty()){
182  theAdjustAtIp = errorMatrixPset.getParameter<bool>("atIP");
183  theErrorMatrixAdjuster = new MuonErrorMatrix(errorMatrixPset);
184  } else {
185  theAdjustAtIp =false;
187  }
188 
189  theService->eventSetup().get<TrackerRecoGeometryRecord>().get(theTracker);
191 
192 }
T getParameter(std::string const &) const
const MuonServiceProxy * theService
unsigned long long theCacheId_TG
CurvilinearTrajectoryError get(GlobalVector momentum, bool convolute=true)
main method to be used. Retrieve a 5x5 symetrical matrix according to parametrization of error or sca...
edm::ParameterSet theConfig
const TrajectoryStateUpdator * theUpdator
std::string thePropagatorName
edm::ESHandle< GeometricSearchTracker > theTracker
const DirectTrackerNavigation * theNavigation
unsigned long long theCacheId_MT
edm::InputTag theBeamSpotInputTag
MuonErrorMatrix * theErrorMatrixAdjuster
const Chi2MeasurementEstimator * theEstimator
TrajectoryStateOnSurface TSGFromPropagation::innerState ( const TrackCand staMuon) const
private

Definition at line 234 of file TSGFromPropagation.cc.

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

Referenced by outerTkState().

234  {
235 
236  TrajectoryStateOnSurface innerTS;
237 
238  if ( staMuon.first && staMuon.first->isValid() ) {
239  if (staMuon.first->direction() == alongMomentum) {
240  innerTS = staMuon.first->firstMeasurement().updatedState();
241  }
242  else if (staMuon.first->direction() == oppositeToMomentum) {
243  innerTS = staMuon.first->lastMeasurement().updatedState();
244  }
245  } else {
247  }
248  //rescale the error
249  adjust(innerTS);
250 
251  return innerTS;
252 
253 // return trajectoryStateTransform::innerStateOnSurface(*(staMuon.second),*theService->trackingGeometry(), &*theService->magneticField());
254 }
const MuonServiceProxy * theService
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field)
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 TSGFromPropagation::outerTkState ( const TrackCand staMuon) const
private

Definition at line 256 of file TSGFromPropagation.cc.

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

Referenced by trackerSeeds().

256  {
257 
259 
260  if ( theUseVertexStateFlag && staMuon.second->pt() > 1.0 ) {
262  //rescale the error at IP
263  adjust(iniState);
264 
265  StateOnTrackerBound fromInside(&*(theService->propagator("PropagatorWithMaterial")));
266  result = fromInside(iniState);
267  } else {
268  StateOnTrackerBound fromOutside(&*propagator());
269  result = fromOutside(innerState(staMuon));
270  }
271  return result;
272 }
const MuonServiceProxy * theService
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
TrajectoryStateOnSurface innerState(const TrackCand &) const
tuple result
Definition: query.py:137
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field)
edm::ESHandle< Propagator > propagator() const
void adjust(FreeTrajectoryState &) const
adjust the error matrix of the FTS
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
bool TSGFromPropagation::passSelection ( const TrajectoryStateOnSurface tsos) const
private

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

Definition at line 329 of file TSGFromPropagation.cc.

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

Referenced by trackerSeeds().

329  {
330  if ( !theSelectStateFlag ) return true;
331  else {
332  if ( beamSpot.isValid() ) {
333  return ( ( fabs(zDis(tsos) - beamSpot->z0() ) < theSigmaZ) );
334 
335  } else {
336  return ( ( fabs(zDis(tsos)) < theSigmaZ) );
337 // double theDxyCut = 100;
338 // return ( (zDis(tsos) < theSigmaZ) && (dxyDis(tsos) < theDxyCut) );
339  }
340  }
341 
342 }
double zDis(const TrajectoryStateOnSurface &tsos) const
bool isValid() const
Definition: HandleBase.h:76
edm::Handle< reco::BeamSpot > beamSpot
edm::ESHandle<Propagator> TSGFromPropagation::propagator ( void  ) const
inlineprivate

Definition at line 62 of file TSGFromPropagation.h.

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

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

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

set an event

Reimplemented from TrackerSeedGenerator.

Definition at line 194 of file TSGFromPropagation.cc.

References beamSpot, MuonServiceProxy::eventSetup(), edm::EventSetup::get(), edm::Event::getByLabel(), LogTrace, theBeamSpotInputTag, theCacheId_MT, theCacheId_TG, theCategory, theMeasTracker, theMeasTrackerName, theNavigation, theService, theTkLayerMeasurements, theTracker, and theUpdateStateFlag.

194  {
195 
196  bool measTrackerChanged = false;
197 
198  //edm::Handle<reco::BeamSpot> beamSpot;
200 
201  unsigned long long newCacheId_MT = theService->eventSetup().get<CkfComponentsRecord>().cacheIdentifier();
202 
203  if ( theUpdateStateFlag && newCacheId_MT != theCacheId_MT ) {
204  LogTrace(theCategory) << "Measurment Tracker Geometry changed!";
205  theCacheId_MT = newCacheId_MT;
207  measTrackerChanged = true;
208  }
209 
210  if ( theUpdateStateFlag ) theMeasTracker->update(iEvent);
211 
212  if ( measTrackerChanged && (&*theMeasTracker) ) {
215  }
216 
217  bool trackerGeomChanged = false;
218 
219  unsigned long long newCacheId_TG = theService->eventSetup().get<TrackerRecoGeometryRecord>().cacheIdentifier();
220 
221  if ( newCacheId_TG != theCacheId_TG ) {
222  LogTrace(theCategory) << "Tracker Reco Geometry changed!";
223  theCacheId_TG = newCacheId_TG;
225  trackerGeomChanged = true;
226  }
227 
228  if ( trackerGeomChanged && (&*theTracker) ) {
229  if ( theNavigation ) delete theNavigation;
231  }
232 }
const edm::EventSetup & eventSetup() const
get the whole EventSetup
const MuonServiceProxy * theService
unsigned long long theCacheId_TG
edm::ESHandle< MeasurementTracker > theMeasTracker
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
edm::ESHandle< GeometricSearchTracker > theTracker
const T & get() const
Definition: EventSetup.h:55
const DirectTrackerNavigation * theNavigation
std::string theMeasTrackerName
unsigned long long theCacheId_MT
edm::InputTag theBeamSpotInputTag
const LayerMeasurements * theTkLayerMeasurements
edm::Handle< reco::BeamSpot > beamSpot
const LayerMeasurements* TSGFromPropagation::tkLayerMeasurements ( ) const
inlineprivate

Definition at line 56 of file TSGFromPropagation.h.

References theTkLayerMeasurements.

Referenced by findMeasurements().

56 { return theTkLayerMeasurements; }
const LayerMeasurements * theTkLayerMeasurements
void TSGFromPropagation::trackerSeeds ( const TrackCand staMuon,
const TrackingRegion region,
std::vector< TrajectorySeed > &  result 
)

generate seed(s) for a track

Definition at line 55 of file TSGFromPropagation.cc.

References DirectTrackerNavigation::compatibleLayers(), createSeed(), estimator(), PV3DBase< T, PVType, FrameType >::eta(), findMeasurements_new(), TrajectoryStateOnSurface::freeState(), getRescalingFactor(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), 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().

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

Definition at line 58 of file TSGFromPropagation.h.

References theUpdator.

Referenced by trackerSeeds().

58 {return theUpdator;}
const TrajectoryStateUpdator * theUpdator
void TSGFromPropagation::validMeasurements ( std::vector< TrajectoryMeasurement > &  tms) const
private

select valid measurements

Definition at line 289 of file TSGFromPropagation.cc.

Referenced by findMeasurements(), and findMeasurements_new().

289  {
290 
291  std::vector<TrajectoryMeasurement>::iterator tmsend = std::remove_if(tms.begin(), tms.end(), isInvalid());
292  tms.erase(tmsend, tms.end());
293  return;
294 
295 }
double TSGFromPropagation::zDis ( const TrajectoryStateOnSurface tsos) const
private

Member Data Documentation

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

Definition at line 153 of file TSGFromPropagation.h.

Referenced by passSelection(), and setEvent().

bool TSGFromPropagation::theAdjustAtIp
private

Definition at line 147 of file TSGFromPropagation.h.

Referenced by init().

edm::InputTag TSGFromPropagation::theBeamSpotInputTag
private

Definition at line 154 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

unsigned long long TSGFromPropagation::theCacheId_MT
private

Definition at line 107 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

unsigned long long TSGFromPropagation::theCacheId_TG
private

Definition at line 108 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

std::string TSGFromPropagation::theCategory
private
edm::ParameterSet TSGFromPropagation::theConfig
private

Definition at line 151 of file TSGFromPropagation.h.

Referenced by init().

MuonErrorMatrix* TSGFromPropagation::theErrorMatrixAdjuster
private

Definition at line 145 of file TSGFromPropagation.h.

Referenced by adjust(), init(), and ~TSGFromPropagation().

const Chi2MeasurementEstimator* TSGFromPropagation::theEstimator
private

Definition at line 125 of file TSGFromPropagation.h.

Referenced by estimator(), init(), and ~TSGFromPropagation().

double TSGFromPropagation::theFixedErrorRescaling
private

Definition at line 133 of file TSGFromPropagation.h.

Referenced by adjust(), and init().

double TSGFromPropagation::theFlexErrorRescaling
private

Definition at line 131 of file TSGFromPropagation.h.

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

double TSGFromPropagation::theMaxChi2
private

Definition at line 129 of file TSGFromPropagation.h.

Referenced by init().

edm::ESHandle<MeasurementTracker> TSGFromPropagation::theMeasTracker
private

Definition at line 117 of file TSGFromPropagation.h.

Referenced by findMeasurements_new(), and setEvent().

std::string TSGFromPropagation::theMeasTrackerName
private

Definition at line 116 of file TSGFromPropagation.h.

Referenced by setEvent(), and TSGFromPropagation().

const DirectTrackerNavigation* TSGFromPropagation::theNavigation
private

Definition at line 119 of file TSGFromPropagation.h.

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

std::string TSGFromPropagation::thePropagatorName
private

Definition at line 143 of file TSGFromPropagation.h.

Referenced by init(), and propagator().

std::string TSGFromPropagation::theResetMethod
private

Definition at line 139 of file TSGFromPropagation.h.

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

bool TSGFromPropagation::theSelectStateFlag
private

Definition at line 141 of file TSGFromPropagation.h.

Referenced by init(), and passSelection().

const MuonServiceProxy* TSGFromPropagation::theService
private

Definition at line 121 of file TSGFromPropagation.h.

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

double TSGFromPropagation::theSigmaZ
private

Definition at line 149 of file TSGFromPropagation.h.

Referenced by init(), and passSelection().

const LayerMeasurements* TSGFromPropagation::theTkLayerMeasurements
private

Definition at line 112 of file TSGFromPropagation.h.

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

edm::ESHandle<GeometricSearchTracker> TSGFromPropagation::theTracker
private

Definition at line 114 of file TSGFromPropagation.h.

Referenced by init(), and setEvent().

TrajectoryStateTransform* TSGFromPropagation::theTSTransformer
private

Definition at line 127 of file TSGFromPropagation.h.

bool TSGFromPropagation::theUpdateStateFlag
private

Definition at line 137 of file TSGFromPropagation.h.

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

const TrajectoryStateUpdator* TSGFromPropagation::theUpdator
private

Definition at line 123 of file TSGFromPropagation.h.

Referenced by init(), updator(), and ~TSGFromPropagation().

bool TSGFromPropagation::theUseVertexStateFlag
private

Definition at line 135 of file TSGFromPropagation.h.

Referenced by init(), and outerTkState().