CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TSGForRoadSearch Class Reference

#include <TSGForRoadSearch.h>

Inheritance diagram for TSGForRoadSearch:
TrackerSeedGenerator

Public Types

typedef std::vector< TrajectorySeedBTSeedCollection
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
- Public Types inherited from TrackerSeedGenerator
typedef std::vector< TrajectorySeedBTSeedCollection
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 

Public Member Functions

void init (const MuonServiceProxy *service) override
 initialize the service More...
 
void setEvent (const edm::Event &event) override
 set the event: update the MeasurementTracker More...
 
void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &) override
 generated seed(s) for a track. the tracking region is not used. More...
 
 TSGForRoadSearch (const edm::ParameterSet &pset, edm::ConsumesCollector &IC)
 
 ~TSGForRoadSearch () override
 
- Public Member Functions inherited from TrackerSeedGenerator
const edm::EventgetEvent () const
 
 TrackerSeedGenerator ()
 
virtual ~TrackerSeedGenerator ()
 destructor More...
 

Private Member Functions

bool IPfts (const reco::Track &, FreeTrajectoryState &)
 get the FTS for a Track: adjusting the error matrix if requested More...
 
void makeSeeds_0 (const reco::Track &, std::vector< TrajectorySeed > &)
 oseed from inside-out: innermost Strip layer More...
 
void makeSeeds_1 (const reco::Track &, std::vector< TrajectorySeed > &)
 not implemented More...
 
void makeSeeds_2 (const reco::Track &, std::vector< TrajectorySeed > &)
 not implemented More...
 
void makeSeeds_3 (const reco::Track &, std::vector< TrajectorySeed > &)
 outside-in: outermost Strip layer More...
 
void makeSeeds_4 (const reco::Track &, std::vector< TrajectorySeed > &)
 inside-out: innermost Pixel/Strip layer More...
 
bool notAtIPtsos (TrajectoryStateOnSurface &state)
 make the adjustement away from PCA state if requested More...
 
void pushTrajectorySeed (const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
 add the seed(s) to the collection of seeds More...
 

Private Attributes

bool theAdjustAtIp
 adjust the state at IP or where it is defined for the seed More...
 
std::string theCategory
 
Chi2MeasurementEstimatortheChi2Estimator
 
edm::ParameterSet theConfig
 
bool theCopyMuonRecHit
 
MuonErrorMatrixtheErrorMatrixAdjuster
 
edm::ESHandle< GeometricSearchTrackertheGeometricSearchTracker
 
bool theManySeeds
 
edm::ESHandle< MeasurementTrackertheMeasurementTracker
 
const MeasurementTrackerEventtheMeasurementTrackerEvent
 
edm::InputTag theMeasurementTrackerEventTag
 
edm::EDGetTokenT< MeasurementTrackerEventtheMeasurementTrackerEventToken
 
unsigned int theOption
 
edm::ESHandle< PropagatortheProp
 
std::string thePropagatorCompatibleName
 
std::string thePropagatorName
 
edm::ESHandle< PropagatorthePropCompatible
 
const MuonServiceProxytheProxyService
 
TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Protected Attributes inherited from TrackerSeedGenerator
const edm::EventtheEvent
 
const MuonServiceProxytheProxyService
 

Detailed Description

Description: this class generates hit-less TrajectorySeed from a given Track. the original error matrix of the Track is adjusted (configurable). this class is principally used for muon HLT. for options are available:

regular operation is one seed per track, but optionnaly, more than one seed can be madefor one track.

Author
Jean-Roch Vlimant

Definition at line 45 of file TSGForRoadSearch.h.

Member Typedef Documentation

Definition at line 47 of file TSGForRoadSearch.h.

Definition at line 48 of file TSGForRoadSearch.h.

Constructor & Destructor Documentation

TSGForRoadSearch::TSGForRoadSearch ( const edm::ParameterSet pset,
edm::ConsumesCollector IC 
)

Definition at line 28 of file TSGForRoadSearch.cc.

References Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, edm::ConsumesCollector::consumes(), edm::ParameterSet::empty(), HLT_2018_cff::errorMatrixPset, edm::ParameterSet::getParameter(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theAdjustAtIp, theCategory, theChi2Estimator, theCopyMuonRecHit, theErrorMatrixAdjuster, theManySeeds, theMeasurementTrackerEvent, theMeasurementTrackerEventTag, theMeasurementTrackerEventToken, theOption, thePropagatorCompatibleName, thePropagatorName, and theUpdator.

28  {
29  theOption = par.getParameter<unsigned int>("option");
30  theCopyMuonRecHit = par.getParameter<bool>("copyMuonRecHit");
31 
32  double Chi2 = par.getParameter<double>("maxChi2");
34 
35  thePropagatorName = par.getParameter<std::string>("propagatorName");
36  thePropagatorCompatibleName = par.getParameter<std::string>("propagatorCompatibleName");
37 
38  theCategory = "TSGForRoadSearch|TrackerSeedGenerator";
39 
40  theManySeeds = par.getParameter<bool>("manySeeds");
41  if (theManySeeds) {
42  theUpdator = new KFUpdator();
43  } else {
44  theUpdator = nullptr;
45  }
46 
47  edm::ParameterSet errorMatrixPset = par.getParameter<edm::ParameterSet>("errorMatrixPset");
48  if (!errorMatrixPset.empty()) {
49  theAdjustAtIp = errorMatrixPset.getParameter<bool>("atIP");
50  theErrorMatrixAdjuster = new MuonErrorMatrix(errorMatrixPset);
51  } else {
52  theAdjustAtIp = false;
53  theErrorMatrixAdjuster = nullptr;
54  }
55 
56  theMeasurementTrackerEventTag = par.getParameter<edm::InputTag>("MeasurementTrackerEvent");
58 
60 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:190
edm::InputTag theMeasurementTrackerEventTag
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
T sqrt(T t)
Definition: SSEVec.h:19
Chi2MeasurementEstimator * theChi2Estimator
const MeasurementTrackerEvent * theMeasurementTrackerEvent
MuonErrorMatrix * theErrorMatrixAdjuster
std::string thePropagatorCompatibleName
std::string thePropagatorName
Definition: Chi2.h:15
unsigned int theOption
TrajectoryStateUpdator * theUpdator
TSGForRoadSearch::~TSGForRoadSearch ( )
override

Definition at line 62 of file TSGForRoadSearch.cc.

References theChi2Estimator, theErrorMatrixAdjuster, and theUpdator.

62  {
63  delete theChi2Estimator;
64  if (theUpdator)
65  delete theUpdator;
68 }
Chi2MeasurementEstimator * theChi2Estimator
MuonErrorMatrix * theErrorMatrixAdjuster
TrajectoryStateUpdator * theUpdator

Member Function Documentation

void TSGForRoadSearch::init ( const MuonServiceProxy service)
overridevirtual

initialize the service

Reimplemented from TrackerSeedGenerator.

Definition at line 70 of file TSGForRoadSearch.cc.

References theProxyService.

70 { theProxyService = service; }
const MuonServiceProxy * theProxyService
bool TSGForRoadSearch::IPfts ( const reco::Track muon,
FreeTrajectoryState fts 
)
private

get the FTS for a Track: adjusting the error matrix if requested

Definition at line 119 of file TSGForRoadSearch.cc.

References MuonErrorMatrix::adjust(), trajectoryStateTransform::initialFreeState(), LogDebug, MuonServiceProxy::magneticField(), theAdjustAtIp, theCategory, theErrorMatrixAdjuster, and theProxyService.

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

119  {
121  LogDebug(theCategory) << "pure L2 state: " << fts;
122  if (fts.position().mag() == 0 && fts.momentum().mag() == 0) {
123  edm::LogError(theCategory) << "initial state of muon is (0,0,0)(0,0,0). no seed.";
124  return false;
125  }
126 
127  //rescale the error at IP
130  LogDebug(theCategory) << "after adjusting the error matrix: " << fts;
131  }
132 
133  return true;
134 }
#define LogDebug(id)
void adjust(FreeTrajectoryState &state)
adjust the error matrix on the state
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
const MuonServiceProxy * theProxyService
MuonErrorMatrix * theErrorMatrixAdjuster
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
void TSGForRoadSearch::makeSeeds_0 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

oseed from inside-out: innermost Strip layer

Definition at line 139 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), TrajectoryStateOnSurface::globalPosition(), SurfaceOrientation::inner, IPfts(), TrajectoryStateOnSurface::isValid(), LogDebug, GeometricSearchTracker::negTecLayers(), GeometricSearchTracker::negTidLayers(), notAtIPtsos(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeometricSearchTracker::posTecLayers(), GeometricSearchTracker::posTidLayers(), Propagator::propagate(), MuonServiceProxy::propagator(), pushTrajectorySeed(), DetLayer::subDetector(), GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeometricSearchTracker::tibLayers(), GeomDetEnumerators::TID, GeomDetEnumerators::TOB, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by makeSeeds_4(), and trackerSeeds().

139  {
140  //get the state at IP
141  FreeTrajectoryState cIPFTS;
142  if (!IPfts(muon, cIPFTS))
143  return;
144 
145  //take state at inner surface and check the first part reached
146  const std::vector<const BarrelDetLayer *> &blc = theGeometricSearchTracker->tibLayers();
148  theProxyService->propagator(thePropagatorName)->propagate(cIPFTS, blc.front()->surface());
149  if (!inner.isValid()) {
150  LogDebug(theCategory) << "inner state is not valid. no seed.";
151  return;
152  }
153 
154  //rescale the error
155  if (!notAtIPtsos(inner))
156  return;
157 
158  double z = inner.globalPosition().z();
159 
160  const std::vector<const ForwardDetLayer *> &ptidc = theGeometricSearchTracker->posTidLayers();
161  const std::vector<const ForwardDetLayer *> &ptecc = theGeometricSearchTracker->posTecLayers();
162  const std::vector<const ForwardDetLayer *> &ntidc = theGeometricSearchTracker->negTidLayers();
163  const std::vector<const ForwardDetLayer *> &ntecc = theGeometricSearchTracker->negTecLayers();
164 
165  const DetLayer *inLayer = nullptr;
166  if (fabs(z) < ptidc.front()->surface().position().z()) {
167  inLayer = blc.front();
168  } else if (fabs(z) < ptecc.front()->surface().position().z()) {
169  inLayer = (z < 0) ? ntidc.front() : ptidc.front();
170  } else {
171  inLayer = (z < 0) ? ntecc.front() : ptecc.front();
172  }
173 
174  //find out at least one compatible detector reached
175  std::vector<DetLayer::DetWithState> compatible;
176  compatible.reserve(10);
177  inLayer->compatibleDetsV(
179 
180  //loop the parts until at least a compatible is found
181  while (compatible.empty()) {
182  switch (GeomDetEnumerators::subDetGeom[inLayer->subDetector()]) {
187  LogDebug(theCategory) << "from inside-out, trying TEC or TOB layers. no seed.";
188  return;
189  break;
191  inLayer = (z < 0) ? ntidc.front() : ptidc.front();
192  break;
194  inLayer = (z < 0) ? ntecc.front() : ptecc.front();
195  break;
196  default:
197  LogDebug(theCategory) << "subdetectorid is not a tracker sub-dectector id. skipping.";
198  return;
199  }
200  inLayer->compatibleDetsV(
202  }
203 
204  pushTrajectorySeed(muon, compatible, alongMomentum, result);
205 
206  return;
207 }
#define LogDebug(id)
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
GlobalPoint globalPosition() const
std::string theCategory
T z() const
Definition: PV3DBase.h:61
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
SubDetector subDetGeom[21]
const MuonServiceProxy * theProxyService
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
std::vector< BarrelDetLayer const * > const & tibLayers() const
std::vector< ForwardDetLayer const * > const & posTecLayers() const
std::string thePropagatorCompatibleName
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
std::vector< ForwardDetLayer const * > const & negTidLayers() const
std::vector< ForwardDetLayer const * > const & posTidLayers() const
std::string thePropagatorName
std::vector< ForwardDetLayer const * > const & negTecLayers() const
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
void TSGForRoadSearch::makeSeeds_1 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 209 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

209  {
210  edm::LogError(theCategory) << "option 1 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
211  return;
212 }
std::string theCategory
void TSGForRoadSearch::makeSeeds_2 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 214 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

214  {
215  edm::LogError(theCategory) << "option 2 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
216  return;
217 }
std::string theCategory
void TSGForRoadSearch::makeSeeds_3 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

outside-in: outermost Strip layer

Definition at line 222 of file TSGForRoadSearch.cc.

References GeometricSearchDet::compatibleDetsV(), IPfts(), LogDebug, LogTrace, GeometricSearchTracker::negTecLayers(), notAtIPtsos(), oppositeToMomentum, SurfaceOrientation::outer, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GloballyPositioned< T >::position(), position, GeometricSearchTracker::posTecLayers(), edm::ESHandle< T >::product(), MuonServiceProxy::propagator(), pushTrajectorySeed(), DetLayer::subDetector(), GeomDetEnumerators::subDetGeom, GeometricSearchDet::surface(), GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, GeometricSearchTracker::tobLayers(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trackerSeeds().

222  {
223  //get the state at IP
224  FreeTrajectoryState cIPFTS;
225  if (!IPfts(muon, cIPFTS))
226  return;
227 
228  //take state at outer surface and check the first part reached
229  const std::vector<const BarrelDetLayer *> &blc = theGeometricSearchTracker->tobLayers();
230 
231  // TrajectoryStateOnSurface outer = theProxyService->propagator(thePropagatorName)->propagate(cIPFTS,blc.back()->surface());
233  TrajectoryStateOnSurface outer = onBounds(cIPFTS);
234 
235  if (!outer.isValid()) {
236  LogDebug(theCategory) << "outer state is not valid. no seed.";
237  return;
238  }
239 
240  //rescale the error
241  if (!notAtIPtsos(outer))
242  return;
243 
244  double z = outer.globalPosition().z();
245 
246  const std::vector<const ForwardDetLayer *> &ptecc = theGeometricSearchTracker->posTecLayers();
247  const std::vector<const ForwardDetLayer *> &ntecc = theGeometricSearchTracker->negTecLayers();
248 
249  LogDebug(theCategory) << "starting looking for a compatible layer from: " << outer << "\nz: " << z
250  << "TEC1 z: " << ptecc.front()->surface().position().z();
251 
252  unsigned int layerShift = 0;
253  const DetLayer *inLayer = nullptr;
254  if (fabs(z) < ptecc.front()->surface().position().z()) {
255  inLayer = *(blc.rbegin() + layerShift);
256  LogTrace(theCategory) << "choosing TOB layer with shift: " << layerShift;
257  } else {
258  unsigned int tecIt = 1;
259  for (; tecIt != ptecc.size(); tecIt++) {
260  LogTrace(theCategory) << "checking surface with shift: " << tecIt
261  << "z: " << ptecc[tecIt]->surface().position().z();
262  if (fabs(z) < ptecc[tecIt]->surface().position().z()) {
263  inLayer = (z < 0) ? ntecc[tecIt - 1] : ptecc[tecIt - 1];
264  layerShift = tecIt - 1;
265  LogTrace(theCategory) << "choosing TEC layer with shift: " << layerShift
266  << " and z: " << inLayer->surface().position().z();
267  break;
268  }
269  }
270  if (!inLayer) {
271  inLayer = (z < 0) ? ntecc.back() : ptecc.back();
272  LogTrace(theCategory) << "choosing last TEC layer with z: " << inLayer->surface().position().z();
273  }
274  }
275 
276  //find out at least one compatible detector reached
277  std::vector<DetLayer::DetWithState> compatible;
278  compatible.reserve(10);
279  inLayer->compatibleDetsV(
281 
282  //loop the parts until at least a compatible is found
283  while (compatible.empty()) {
284  switch (GeomDetEnumerators::subDetGeom[inLayer->subDetector()]) {
290  layerShift++;
291  if (layerShift >= blc.size()) {
292  LogDebug(theCategory) << "all barrel layers are exhausted to find starting state. no seed,";
293  return;
294  }
295  inLayer = *(blc.rbegin() + layerShift);
296  break;
298  if (layerShift == 0) {
299  LogDebug(theCategory) << "failed to get a compatible module on a TEC layer, using the last TOB layer.";
300  inLayer = *(blc.rbegin() + layerShift);
301  } else {
302  layerShift--;
303  LogDebug(theCategory) << "reaching more in with layer " << layerShift << " in TEC";
304  inLayer = (z < 0) ? ntecc[layerShift] : ptecc[layerShift];
305  }
306  break;
307  default:
308  edm::LogError(theCategory) << "subdetectorid is not a tracker sub-dectector id. skipping.";
309  return;
310  }
311  inLayer->compatibleDetsV(
313  }
314 
315  pushTrajectorySeed(muon, compatible, oppositeToMomentum, result);
316 
317  return;
318 }
#define LogDebug(id)
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
std::vector< BarrelDetLayer const * > const & tobLayers() const
std::string theCategory
T z() const
Definition: PV3DBase.h:61
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
SubDetector subDetGeom[21]
#define LogTrace(id)
const MuonServiceProxy * theProxyService
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
std::vector< ForwardDetLayer const * > const & posTecLayers() const
std::string thePropagatorCompatibleName
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::string thePropagatorName
std::vector< ForwardDetLayer const * > const & negTecLayers() const
const PositionType & position() const
T const * product() const
Definition: ESHandle.h:86
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
void TSGForRoadSearch::makeSeeds_4 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

inside-out: innermost Pixel/Strip layer

Definition at line 323 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), TrajectoryStateOnSurface::globalPosition(), SurfaceOrientation::inner, IPfts(), TrajectoryStateOnSurface::isValid(), LogDebug, makeSeeds_0(), GeometricSearchTracker::negPixelForwardLayers(), GeometricSearchTracker::negTecLayers(), GeometricSearchTracker::negTidLayers(), notAtIPtsos(), GeomDetEnumerators::PixelBarrel, GeometricSearchTracker::pixelBarrelLayers(), GeomDetEnumerators::PixelEndcap, position, GeometricSearchTracker::posPixelForwardLayers(), GeometricSearchTracker::posTecLayers(), GeometricSearchTracker::posTidLayers(), Propagator::propagate(), MuonServiceProxy::propagator(), pushTrajectorySeed(), GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trackerSeeds().

323  {
324  //get the state at IP
325  FreeTrajectoryState cIPFTS;
326  if (!IPfts(muon, cIPFTS))
327  return;
328 
329  //take state at inner surface and check the first part reached
330  const std::vector<const BarrelDetLayer *> &blc = theGeometricSearchTracker->pixelBarrelLayers();
331  if (blc.empty()) {
332  edm::LogError(theCategory) << "want to start from pixel layer, but no barrel exists. trying without pixel.";
333  makeSeeds_0(muon, result);
334  return;
335  }
336 
338  theProxyService->propagator(thePropagatorName)->propagate(cIPFTS, blc.front()->surface());
339  if (!inner.isValid()) {
340  LogDebug(theCategory) << "inner state is not valid. no seed.";
341  return;
342  }
343 
344  //rescale the error
345  if (!notAtIPtsos(inner))
346  return;
347 
348  double z = inner.globalPosition().z();
349 
350  const std::vector<const ForwardDetLayer *> &ppxlc = theGeometricSearchTracker->posPixelForwardLayers();
351  const std::vector<const ForwardDetLayer *> &npxlc = theGeometricSearchTracker->negPixelForwardLayers();
352  const std::vector<const ForwardDetLayer *> &ptidc = theGeometricSearchTracker->posTidLayers();
353  const std::vector<const ForwardDetLayer *> &ptecc = theGeometricSearchTracker->posTecLayers();
354  const std::vector<const ForwardDetLayer *> &ntidc = theGeometricSearchTracker->negTidLayers();
355  const std::vector<const ForwardDetLayer *> &ntecc = theGeometricSearchTracker->negTecLayers();
356 
357  if ((ppxlc.empty() || npxlc.empty()) && (ptidc.empty() || ptecc.empty())) {
358  edm::LogError(theCategory) << "want to start from pixel layer, but no forward layer exists. trying without pixel.";
359  makeSeeds_0(muon, result);
360  return;
361  }
362 
363  const DetLayer *inLayer = nullptr;
364  std::vector<const ForwardDetLayer *>::const_iterator layerIt;
365 
366  double fz = fabs(z);
367 
368  //simple way of finding a first layer to try out
369  if (fz < fabs(((z > 0) ? ppxlc : npxlc).front()->surface().position().z())) {
370  inLayer = blc.front();
371  } else if (fz < fabs(((z > 0) ? ppxlc : npxlc).back()->surface().position().z())) {
372  layerIt = ((z > 0) ? ppxlc : npxlc).begin();
373  inLayer = *layerIt;
374  } else if (fz < fabs(((z > 0) ? ptidc : ntidc).front()->surface().position().z())) {
375  layerIt = ((z > 0) ? ppxlc : npxlc).end() - 1;
376  inLayer = *layerIt;
377  } else if (fz < fabs(((z > 0) ? ptecc : ntecc).front()->surface().position().z())) {
378  layerIt = ((z > 0) ? ptidc : ntidc).begin();
379  inLayer = *layerIt;
380  } else if (fz < fabs(((z > 0) ? ptecc : ntecc).back()->surface().position().z())) {
381  layerIt = ((z > 0) ? ptecc : ntecc).begin();
382  inLayer = *layerIt;
383  } else {
384  edm::LogWarning(theCategory) << "the state is not consistent with any tracker layer:\n" << inner;
385  return;
386  }
387 
388  //find out at least one compatible detector reached
389  std::vector<DetLayer::DetWithState> compatible;
390  compatible.reserve(10);
391  inLayer->compatibleDetsV(
393 
394  //if none were found. you should do something more.
395  if (compatible.empty()) {
396  std::vector<const ForwardDetLayer *>::const_iterator pxlEnd = (z > 0) ? ppxlc.end() : npxlc.end();
397  std::vector<const ForwardDetLayer *>::const_iterator tidEnd = (z > 0) ? ptidc.end() : ntidc.end();
398  std::vector<const ForwardDetLayer *>::const_iterator tecEnd = (z > 0) ? ptecc.end() : ntecc.end();
399  std::vector<const ForwardDetLayer *>::const_iterator pxlBegin = (z > 0) ? ppxlc.begin() : npxlc.begin();
400  std::vector<const ForwardDetLayer *>::const_iterator tidBegin = (z > 0) ? ptidc.begin() : ntidc.begin();
401  std::vector<const ForwardDetLayer *>::const_iterator tecBegin = (z > 0) ? ptecc.begin() : ntecc.begin();
402 
403  //go to first disk if not already in a disk situation
404  if (!dynamic_cast<const ForwardDetLayer *>(inLayer))
405  layerIt = pxlBegin--;
406 
407  while (compatible.empty()) {
408  switch (GeomDetEnumerators::subDetGeom[(*layerIt)->subDetector()]) {
410  layerIt++;
411  //if end of list reached. go to the first TID
412  if (layerIt == pxlEnd)
413  layerIt = tidBegin;
414  break;
415  }
417  layerIt++;
418  //if end of list reached. go to the first TEC
419  if (layerIt == tidEnd)
420  layerIt = tecBegin;
421  break;
422  }
424  layerIt++;
425  if (layerIt == tecEnd) {
426  edm::LogWarning(theCategory) << "ran out of layers to find a seed: no seed.";
427  return;
428  }
429  break;
430  }
433  << "this should not happen... ever. Please report. GeomDetEnumerators::PixelBarrel. no seed.";
434  return;
435  }
438  << "this should not happen... ever. Please report. GeomDetEnumerators::TIB. no seed.";
439  return;
440  }
443  << "this should not happen... ever. Please report. GeomDetEnumerators::TOB. no seed.";
444  return;
445  }
446  default: {
447  edm::LogError(theCategory) << "Subdetector id is not a tracker sub-detector id. no seed.";
448  return;
449  }
450  } //switch
451 
452  (*layerIt)->compatibleDetsV(
454  } //while
455  } //if size==0
456 
457  pushTrajectorySeed(muon, compatible, alongMomentum, result);
458 
459  return;
460 }
#define LogDebug(id)
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
GlobalPoint globalPosition() const
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
std::string theCategory
T z() const
Definition: PV3DBase.h:61
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
SubDetector subDetGeom[21]
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
const MuonServiceProxy * theProxyService
void makeSeeds_0(const reco::Track &, std::vector< TrajectorySeed > &)
oseed from inside-out: innermost Strip layer
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
std::vector< ForwardDetLayer const * > const & posTecLayers() const
std::string thePropagatorCompatibleName
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
std::vector< ForwardDetLayer const * > const & negTidLayers() const
std::vector< ForwardDetLayer const * > const & posTidLayers() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::string thePropagatorName
std::vector< ForwardDetLayer const * > const & negTecLayers() const
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
bool TSGForRoadSearch::notAtIPtsos ( TrajectoryStateOnSurface state)
private

make the adjustement away from PCA state if requested

Definition at line 110 of file TSGForRoadSearch.cc.

References MuonErrorMatrix::adjust(), LogDebug, theAdjustAtIp, theCategory, and theErrorMatrixAdjuster.

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

110  {
111  LogDebug(theCategory) << "outer state: " << state;
114  LogDebug(theCategory) << "outer state after rescale: " << state;
115  }
116  return true;
117 }
#define LogDebug(id)
void adjust(FreeTrajectoryState &state)
adjust the error matrix on the state
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
MuonErrorMatrix * theErrorMatrixAdjuster
void TSGForRoadSearch::pushTrajectorySeed ( const reco::Track muon,
std::vector< DetLayer::DetWithState > &  compatible,
PropagationDirection  direction,
std::vector< TrajectorySeed > &  result 
) const
private

add the seed(s) to the collection of seeds

Definition at line 465 of file TSGForRoadSearch.cc.

References edm::OwnVector< T, P >::clear(), MeasurementDetWithData::fastMeasurements(), GeomDet::geographicalId(), MeasurementTrackerEvent::idToDet(), LogDebug, trajectoryStateTransform::persistentState(), MuonServiceProxy::propagator(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), reco::Track::recHitsSize(), theCategory, theChi2Estimator, theCopyMuonRecHit, theManySeeds, theMeasurementTrackerEvent, thePropagatorCompatibleName, theProxyService, theUpdator, createJobs::tmp, and TrajectoryStateUpdator::update().

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

468  {
469  if (compatible.empty()) {
470  LogDebug(theCategory) << "pushTrajectorySeed with no compatible module. 0 seed.";
471  return;
472  }
473 
474  if (theManySeeds) {
475  //finf out every compatible measurements
476  for (std::vector<DetLayer::DetWithState>::iterator DWSit = compatible.begin(); DWSit != compatible.end(); ++DWSit) {
477  bool aBareTS = false;
478  const GeomDet *gd = DWSit->first;
479  if (!gd) {
480  edm::LogError(theCategory) << "GeomDet is not valid.";
481  continue;
482  }
484  std::vector<TrajectoryMeasurement> tmp = md.fastMeasurements(
485  DWSit->second, DWSit->second, *theProxyService->propagator(thePropagatorCompatibleName), *theChi2Estimator);
486  //make a trajectory seed for each of them
487 
488  for (std::vector<TrajectoryMeasurement>::iterator Mit = tmp.begin(); Mit != tmp.end(); ++Mit) {
489  TrajectoryStateOnSurface predState(Mit->predictedState());
492  if (theCopyMuonRecHit) {
493  LogDebug(theCategory) << "copying (" << muon.recHitsSize() << ") muon recHits";
494  //copy the muon rechit into the seed
495  for (trackingRecHit_iterator trit = muon.recHitsBegin(); trit != muon.recHitsEnd(); trit++) {
496  rhContainer.push_back((*trit)->clone());
497  }
498  }
499 
500  if (hit->isValid()) {
501  TrajectoryStateOnSurface upState(theUpdator->update(predState, *hit));
502 
503  PTrajectoryStateOnDet const &PTSOD =
505  LogDebug(theCategory) << "state used to build a trajectory seed: \n"
506  << upState << "on detector: " << gd->geographicalId().rawId();
507  //add the tracking rechit
508  if (theCopyMuonRecHit) {
509  edm::LogError(theCategory) << "not a bare seed and muon hits are copied. dumping the muon hits.";
510  rhContainer.clear();
511  }
512  rhContainer.push_back(hit->hit()->clone());
513 
514  result.push_back(TrajectorySeed(PTSOD, rhContainer, direction));
515  } else {
516  //rec hit is not valid. put a bare TrajectorySeed, only once !
517  if (!aBareTS) {
518  aBareTS = true;
519 
520  PTrajectoryStateOnDet const &PTSOD =
522  LogDebug(theCategory) << "state used to build a bare trajectory seed: \n"
523  << predState << "on detector: " << gd->geographicalId().rawId();
524 
525  result.push_back(TrajectorySeed(PTSOD, rhContainer, direction));
526  }
527  }
528  }
529  }
530  } else {
531  //transform it into a PTrajectoryStateOnDet
532 
534  compatible.front().second, compatible.front().first->geographicalId().rawId());
535  LogDebug(theCategory) << "state used to build a bare trajectory seed: \n"
536  << compatible.front().second
537  << "on detector: " << compatible.front().first->geographicalId().rawId();
538 
540  if (theCopyMuonRecHit) {
541  LogDebug(theCategory) << "copying (" << muon.recHitsSize() << ") muon recHits";
542  //copy the muon rechit into the seed
543  for (trackingRecHit_iterator trit = muon.recHitsBegin(); trit != muon.recHitsEnd(); trit++) {
544  rhContainer.push_back((*trit)->clone());
545  }
546  }
547 
548  //add this seed to the list and return it
549  result.push_back(TrajectorySeed(PTSOD, rhContainer, direction));
550  }
551  return;
552 }
#define LogDebug(id)
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:97
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
std::string theCategory
void push_back(D *&d)
Definition: OwnVector.h:326
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
void clear()
Definition: OwnVector.h:481
Chi2MeasurementEstimator * theChi2Estimator
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
const MuonServiceProxy * theProxyService
const MeasurementTrackerEvent * theMeasurementTrackerEvent
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::string thePropagatorCompatibleName
tmp
align.sh
Definition: createJobs.py:716
TrajectoryStateUpdator * theUpdator
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
void TSGForRoadSearch::setEvent ( const edm::Event event)
overridevirtual

set the event: update the MeasurementTracker

Reimplemented from TrackerSeedGenerator.

Definition at line 72 of file TSGForRoadSearch.cc.

References data, MuonServiceProxy::eventSetup(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), theCategory, theGeometricSearchTracker, theManySeeds, theMeasurementTracker, theMeasurementTrackerEvent, theMeasurementTrackerEventToken, and theProxyService.

72  {
73  //get the measurementtracker
74  if (theManySeeds) {
76  if (!theMeasurementTracker.isValid()) /*abort*/ {
77  edm::LogError(theCategory) << "measurement tracker geometry not found ";
78  }
79  }
81 
83  event.getByToken(theMeasurementTrackerEventToken, data);
85 }
const edm::EventSetup & eventSetup() const
get the whole EventSetup
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
edm::ESHandle< MeasurementTracker > theMeasurementTracker
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
std::string theCategory
const MuonServiceProxy * theProxyService
const MeasurementTrackerEvent * theMeasurementTrackerEvent
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
T get() const
Definition: EventSetup.h:73
bool isValid() const
Definition: ESHandle.h:44
void TSGForRoadSearch::trackerSeeds ( const TrackCand ,
const TrackingRegion ,
const TrackerTopology ,
BTSeedCollection  
)
overridevirtual

generated seed(s) for a track. the tracking region is not used.

Reimplemented from TrackerSeedGenerator.

Definition at line 87 of file TSGForRoadSearch.cc.

References makeSeeds_0(), makeSeeds_1(), makeSeeds_2(), makeSeeds_3(), makeSeeds_4(), and theOption.

90  {
91  switch (theOption) {
92  case 0:
93  makeSeeds_0(*muonTrackCand.second, result);
94  break;
95  case 1:
96  makeSeeds_1(*muonTrackCand.second, result);
97  break;
98  case 2:
99  makeSeeds_2(*muonTrackCand.second, result);
100  break;
101  case 3:
102  makeSeeds_3(*muonTrackCand.second, result);
103  break;
104  case 4:
105  makeSeeds_4(*muonTrackCand.second, result);
106  break;
107  }
108 }
void makeSeeds_2(const reco::Track &, std::vector< TrajectorySeed > &)
not implemented
void makeSeeds_1(const reco::Track &, std::vector< TrajectorySeed > &)
not implemented
void makeSeeds_3(const reco::Track &, std::vector< TrajectorySeed > &)
outside-in: outermost Strip layer
void makeSeeds_0(const reco::Track &, std::vector< TrajectorySeed > &)
oseed from inside-out: innermost Strip layer
void makeSeeds_4(const reco::Track &, std::vector< TrajectorySeed > &)
inside-out: innermost Pixel/Strip layer
unsigned int theOption

Member Data Documentation

bool TSGForRoadSearch::theAdjustAtIp
private

adjust the state at IP or where it is defined for the seed

Definition at line 82 of file TSGForRoadSearch.h.

Referenced by IPfts(), notAtIPtsos(), and TSGForRoadSearch().

std::string TSGForRoadSearch::theCategory
private
Chi2MeasurementEstimator* TSGForRoadSearch::theChi2Estimator
private
edm::ParameterSet TSGForRoadSearch::theConfig
private

Definition at line 89 of file TSGForRoadSearch.h.

bool TSGForRoadSearch::theCopyMuonRecHit
private

Definition at line 102 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), and TSGForRoadSearch().

MuonErrorMatrix* TSGForRoadSearch::theErrorMatrixAdjuster
private

Definition at line 111 of file TSGForRoadSearch.h.

Referenced by IPfts(), notAtIPtsos(), TSGForRoadSearch(), and ~TSGForRoadSearch().

edm::ESHandle<GeometricSearchTracker> TSGForRoadSearch::theGeometricSearchTracker
private

Definition at line 92 of file TSGForRoadSearch.h.

Referenced by makeSeeds_0(), makeSeeds_3(), makeSeeds_4(), and setEvent().

bool TSGForRoadSearch::theManySeeds
private

Definition at line 103 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), setEvent(), and TSGForRoadSearch().

edm::ESHandle<MeasurementTracker> TSGForRoadSearch::theMeasurementTracker
private

Definition at line 91 of file TSGForRoadSearch.h.

Referenced by setEvent().

const MeasurementTrackerEvent* TSGForRoadSearch::theMeasurementTrackerEvent
private

Definition at line 96 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), setEvent(), and TSGForRoadSearch().

edm::InputTag TSGForRoadSearch::theMeasurementTrackerEventTag
private

Definition at line 94 of file TSGForRoadSearch.h.

Referenced by TSGForRoadSearch().

edm::EDGetTokenT<MeasurementTrackerEvent> TSGForRoadSearch::theMeasurementTrackerEventToken
private

Definition at line 95 of file TSGForRoadSearch.h.

Referenced by setEvent(), and TSGForRoadSearch().

unsigned int TSGForRoadSearch::theOption
private

Definition at line 101 of file TSGForRoadSearch.h.

Referenced by trackerSeeds(), and TSGForRoadSearch().

edm::ESHandle<Propagator> TSGForRoadSearch::theProp
private

Definition at line 105 of file TSGForRoadSearch.h.

std::string TSGForRoadSearch::thePropagatorCompatibleName
private
std::string TSGForRoadSearch::thePropagatorName
private

Definition at line 104 of file TSGForRoadSearch.h.

Referenced by makeSeeds_0(), makeSeeds_3(), makeSeeds_4(), and TSGForRoadSearch().

edm::ESHandle<Propagator> TSGForRoadSearch::thePropCompatible
private

Definition at line 107 of file TSGForRoadSearch.h.

const MuonServiceProxy* TSGForRoadSearch::theProxyService
private
TrajectoryStateUpdator* TSGForRoadSearch::theUpdator
private

Definition at line 98 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), TSGForRoadSearch(), and ~TSGForRoadSearch().