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
 
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecordtheGeometricSearchTrackerToken
 
bool theManySeeds
 
const MeasurementTrackerEventtheMeasurementTrackerEvent
 
edm::InputTag theMeasurementTrackerEventTag
 
edm::EDGetTokenT< MeasurementTrackerEventtheMeasurementTrackerEventToken
 
unsigned int theOption
 
std::string thePropagatorCompatibleName
 
std::string thePropagatorName
 
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 46 of file TSGForRoadSearch.h.

Member Typedef Documentation

◆ BTSeedCollection

Definition at line 48 of file TSGForRoadSearch.h.

◆ TrackCand

Definition at line 49 of file TSGForRoadSearch.h.

Constructor & Destructor Documentation

◆ TSGForRoadSearch()

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

Definition at line 26 of file TSGForRoadSearch.cc.

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

27  : theGeometricSearchTrackerToken(iC.esConsumes()) {
28  theOption = par.getParameter<unsigned int>("option");
29  theCopyMuonRecHit = par.getParameter<bool>("copyMuonRecHit");
30 
31  double Chi2 = par.getParameter<double>("maxChi2");
33 
34  thePropagatorName = par.getParameter<std::string>("propagatorName");
35  thePropagatorCompatibleName = par.getParameter<std::string>("propagatorCompatibleName");
36 
37  theCategory = "TSGForRoadSearch|TrackerSeedGenerator";
38 
39  theManySeeds = par.getParameter<bool>("manySeeds");
40  if (theManySeeds) {
41  theUpdator = new KFUpdator();
42  } else {
43  theUpdator = nullptr;
44  }
45 
46  edm::ParameterSet errorMatrixPset = par.getParameter<edm::ParameterSet>("errorMatrixPset");
47  if (!errorMatrixPset.empty()) {
48  theAdjustAtIp = errorMatrixPset.getParameter<bool>("atIP");
50  } else {
51  theAdjustAtIp = false;
52  theErrorMatrixAdjuster = nullptr;
53  }
54 
55  theMeasurementTrackerEventTag = par.getParameter<edm::InputTag>("MeasurementTrackerEvent");
57 
59 }
edm::InputTag theMeasurementTrackerEventTag
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theGeometricSearchTrackerToken
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::~TSGForRoadSearch ( )
override

Definition at line 61 of file TSGForRoadSearch.cc.

References theChi2Estimator, theErrorMatrixAdjuster, and theUpdator.

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

Member Function Documentation

◆ init()

void TSGForRoadSearch::init ( const MuonServiceProxy service)
overridevirtual

initialize the service

Reimplemented from TrackerSeedGenerator.

Definition at line 69 of file TSGForRoadSearch.cc.

References theProxyService.

const MuonServiceProxy * theProxyService

◆ IPfts()

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 112 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().

112  {
114  LogDebug(theCategory) << "pure L2 state: " << fts;
115  if (fts.position().mag() == 0 && fts.momentum().mag() == 0) {
116  edm::LogError(theCategory) << "initial state of muon is (0,0,0)(0,0,0). no seed.";
117  return false;
118  }
119 
120  //rescale the error at IP
123  LogDebug(theCategory) << "after adjusting the error matrix: " << fts;
124  }
125 
126  return true;
127 }
void adjust(FreeTrajectoryState &state)
adjust the error matrix on the state
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
Log< level::Error, false > LogError
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)
#define LogDebug(id)

◆ makeSeeds_0()

void TSGForRoadSearch::makeSeeds_0 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

oseed from inside-out: innermost Strip layer

Definition at line 132 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), SurfaceOrientation::inner, IPfts(), LogDebug, GeometricSearchTracker::negTecLayers(), GeometricSearchTracker::negTidLayers(), notAtIPtsos(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeometricSearchTracker::posTecLayers(), GeometricSearchTracker::posTidLayers(), Propagator::propagate(), MuonServiceProxy::propagator(), pushTrajectorySeed(), mps_fire::result, DetLayer::subDetector(), GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeometricSearchTracker::tibLayers(), GeomDetEnumerators::TID, GeomDetEnumerators::TOB, and z.

Referenced by makeSeeds_4(), and trackerSeeds().

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

◆ makeSeeds_1()

void TSGForRoadSearch::makeSeeds_1 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 202 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

202  {
203  edm::LogError(theCategory) << "option 1 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
204  return;
205 }
Log< level::Error, false > LogError
std::string theCategory

◆ makeSeeds_2()

void TSGForRoadSearch::makeSeeds_2 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 207 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

207  {
208  edm::LogError(theCategory) << "option 2 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
209  return;
210 }
Log< level::Error, false > LogError
std::string theCategory

◆ makeSeeds_3()

void TSGForRoadSearch::makeSeeds_3 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

outside-in: outermost Strip layer

Definition at line 215 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(), mps_fire::result, 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().

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

◆ makeSeeds_4()

void TSGForRoadSearch::makeSeeds_4 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

inside-out: innermost Pixel/Strip layer

Definition at line 316 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), SurfaceOrientation::inner, IPfts(), 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(), mps_fire::result, GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, and z.

Referenced by trackerSeeds().

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

◆ notAtIPtsos()

bool TSGForRoadSearch::notAtIPtsos ( TrajectoryStateOnSurface state)
private

make the adjustement away from PCA state if requested

Definition at line 103 of file TSGForRoadSearch.cc.

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

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

103  {
104  LogDebug(theCategory) << "outer state: " << state;
107  LogDebug(theCategory) << "outer state after rescale: " << state;
108  }
109  return true;
110 }
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
#define LogDebug(id)

◆ pushTrajectorySeed()

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 458 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(), mps_fire::result, theCategory, theChi2Estimator, theCopyMuonRecHit, theManySeeds, theMeasurementTrackerEvent, thePropagatorCompatibleName, theProxyService, theUpdator, createJobs::tmp, and TrajectoryStateUpdator::update().

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

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

◆ setEvent()

void TSGForRoadSearch::setEvent ( const edm::Event event)
overridevirtual

set the event: update the MeasurementTracker

Reimplemented from TrackerSeedGenerator.

Definition at line 71 of file TSGForRoadSearch.cc.

References data, MuonServiceProxy::eventSetup(), edm::EventSetup::getHandle(), theGeometricSearchTracker, theGeometricSearchTrackerToken, theMeasurementTrackerEvent, theMeasurementTrackerEventToken, and theProxyService.

71  {
72  //get the measurementtracker
74 
76  event.getByToken(theMeasurementTrackerEventToken, data);
78 }
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theGeometricSearchTrackerToken
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const MuonServiceProxy * theProxyService
const MeasurementTrackerEvent * theMeasurementTrackerEvent
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
const edm::EventSetup & eventSetup() const

◆ trackerSeeds()

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 80 of file TSGForRoadSearch.cc.

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

83  {
84  switch (theOption) {
85  case 0:
86  makeSeeds_0(*muonTrackCand.second, result);
87  break;
88  case 1:
89  makeSeeds_1(*muonTrackCand.second, result);
90  break;
91  case 2:
92  makeSeeds_2(*muonTrackCand.second, result);
93  break;
94  case 3:
95  makeSeeds_3(*muonTrackCand.second, result);
96  break;
97  case 4:
98  makeSeeds_4(*muonTrackCand.second, result);
99  break;
100  }
101 }
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

◆ theAdjustAtIp

bool TSGForRoadSearch::theAdjustAtIp
private

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

Definition at line 83 of file TSGForRoadSearch.h.

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

◆ theCategory

std::string TSGForRoadSearch::theCategory
private

◆ theChi2Estimator

Chi2MeasurementEstimator* TSGForRoadSearch::theChi2Estimator
private

◆ theConfig

edm::ParameterSet TSGForRoadSearch::theConfig
private

Definition at line 90 of file TSGForRoadSearch.h.

◆ theCopyMuonRecHit

bool TSGForRoadSearch::theCopyMuonRecHit
private

Definition at line 103 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), and TSGForRoadSearch().

◆ theErrorMatrixAdjuster

MuonErrorMatrix* TSGForRoadSearch::theErrorMatrixAdjuster
private

Definition at line 110 of file TSGForRoadSearch.h.

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

◆ theGeometricSearchTracker

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

Definition at line 92 of file TSGForRoadSearch.h.

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

◆ theGeometricSearchTrackerToken

edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> TSGForRoadSearch::theGeometricSearchTrackerToken
private

Definition at line 93 of file TSGForRoadSearch.h.

Referenced by setEvent().

◆ theManySeeds

bool TSGForRoadSearch::theManySeeds
private

Definition at line 104 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), and TSGForRoadSearch().

◆ theMeasurementTrackerEvent

const MeasurementTrackerEvent* TSGForRoadSearch::theMeasurementTrackerEvent
private

Definition at line 97 of file TSGForRoadSearch.h.

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

◆ theMeasurementTrackerEventTag

edm::InputTag TSGForRoadSearch::theMeasurementTrackerEventTag
private

Definition at line 95 of file TSGForRoadSearch.h.

Referenced by TSGForRoadSearch().

◆ theMeasurementTrackerEventToken

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

Definition at line 96 of file TSGForRoadSearch.h.

Referenced by setEvent(), and TSGForRoadSearch().

◆ theOption

unsigned int TSGForRoadSearch::theOption
private

Definition at line 102 of file TSGForRoadSearch.h.

Referenced by trackerSeeds(), and TSGForRoadSearch().

◆ thePropagatorCompatibleName

std::string TSGForRoadSearch::thePropagatorCompatibleName
private

◆ thePropagatorName

std::string TSGForRoadSearch::thePropagatorName
private

Definition at line 105 of file TSGForRoadSearch.h.

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

◆ theProxyService

const MuonServiceProxy* TSGForRoadSearch::theProxyService
private

◆ theUpdator

TrajectoryStateUpdator* TSGForRoadSearch::theUpdator
private

Definition at line 99 of file TSGForRoadSearch.h.

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