CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
SeedingOTEDProducer Class Reference
Inheritance diagram for SeedingOTEDProducer:
edm::stream::EDProducer<>

Classes

struct  isInvalid
 

Public Member Functions

AlgebraicSymMatrix55 assign44To55 (const AlgebraicSymMatrix44 &) const
 
const TrajectoryStateOnSurface buildInitialTSOS (const VectorHit *) const
 
unsigned int checkLayer (unsigned int iidd)
 
std::vector< const VectorHit * > collectVHsOnLayer (const edmNew::DetSetVector< VectorHit > &, unsigned int)
 
float computeGlobalThetaError (const VectorHit *vh, const double sigmaZ_beamSpot) const
 
float computeInverseMomentumError (const VectorHit *vh, const float globalTheta, const double sigmaZ_beamSpot, const double transverseMomentum) const
 
TrajectorySeed createSeed (const TrajectoryStateOnSurface &tsos, const edm::OwnVector< TrackingRecHit > &container, const DetId &id, const Propagator &prop) const
 
void printVHsOnLayer (const edmNew::DetSetVector< VectorHit > &, unsigned int)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
std::pair< bool, TrajectoryStateOnSurfacepropagateAndUpdate (const TrajectoryStateOnSurface initialTSOS, const Propagator &, const TrackingRecHit &hit) const
 
TrajectorySeedCollection run (edm::Handle< VectorHitCollection >)
 
 SeedingOTEDProducer (const edm::ParameterSet &)
 
 ~SeedingOTEDProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Attributes

const reco::BeamSpotbeamSpot_
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
const MeasurementEstimatorestimator_
 
edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecordestToken_
 
std::unique_ptr< LayerMeasurementslayerMeasurements_
 
const MagneticFieldmagField_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
const MeasurementTrackermeasurementTracker_
 
edm::ESGetToken< MeasurementTracker, CkfComponentsRecordmeasurementTrackerToken_
 
const Propagatorpropagator_
 
edm::ESGetToken< Propagator, TrackingComponentsRecordpropagatorToken_
 
edm::EDPutTokenT< TrajectorySeedCollectionputToken_
 
const edm::EDGetTokenT< MeasurementTrackerEventtkMeasEventToken_
 
const TrackerTopologytkTopo_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
const TrajectoryStateUpdatorupdator_
 
std::string updatorName_
 
edm::ESGetToken< TrajectoryStateUpdator, TrackingComponentsRecordupdatorToken_
 
edm::EDGetTokenT< VectorHitCollectionvhProducerToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 37 of file SeedingOTEDProducer.cc.

Constructor & Destructor Documentation

◆ SeedingOTEDProducer()

SeedingOTEDProducer::SeedingOTEDProducer ( const edm::ParameterSet conf)
explicit

Definition at line 95 of file SeedingOTEDProducer.cc.

References beamSpotToken_, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, putToken_, AlCaHLTBitMon_QueryRunRegistry::string, updatorName_, and vhProducerToken_.

96  : tkMeasEventToken_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
98  propagatorToken_(esConsumes(edm::ESInputTag("", "PropagatorWithMaterial"))),
100  updatorToken_(esConsumes(edm::ESInputTag("", "KFUpdator"))),
102  estToken_(esConsumes(edm::ESInputTag("", "Chi2"))) {
103  vhProducerToken_ = consumes<VectorHitCollection>(edm::InputTag(conf.getParameter<edm::InputTag>("src")));
104  beamSpotToken_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpotLabel"));
105  updatorName_ = conf.getParameter<std::string>("updator");
106  putToken_ = produces<TrajectorySeedCollection>();
107 }
edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > estToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
edm::ESGetToken< TrajectoryStateUpdator, TrackingComponentsRecord > updatorToken_
edm::EDGetTokenT< VectorHitCollection > vhProducerToken_
edm::EDPutTokenT< TrajectorySeedCollection > putToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const edm::EDGetTokenT< MeasurementTrackerEvent > tkMeasEventToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_

◆ ~SeedingOTEDProducer()

SeedingOTEDProducer::~SeedingOTEDProducer ( )
override

Definition at line 109 of file SeedingOTEDProducer.cc.

109 {}

Member Function Documentation

◆ assign44To55()

AlgebraicSymMatrix55 SeedingOTEDProducer::assign44To55 ( const AlgebraicSymMatrix44 mat44) const

Definition at line 325 of file SeedingOTEDProducer.cc.

References mps_fire::i, dqmiolumiharvest::j, and mps_fire::result.

Referenced by buildInitialTSOS().

325  {
327  for (int i = 1; i < 5; i++) {
328  for (int j = 1; j < 5; j++) {
329  result[i][j] = mat44[i - 1][j - 1];
330  }
331  }
332  return result;
333 }
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55

◆ buildInitialTSOS()

const TrajectoryStateOnSurface SeedingOTEDProducer::buildInitialTSOS ( const VectorHit vHit) const

Definition at line 290 of file SeedingOTEDProducer.cc.

References assign44To55(), beamSpot_, ALCARECOTkAlJpsiMuMu_cff::charge, computeInverseMomentumError(), VectorHit::covMatrix(), TrackingRecHit::det(), PVValHelper::dx, PVValHelper::dy, BaseTrackerRecHit::globalPosition(), MagneticField::inTesla(), VectorHit::localDirection(), VectorHit::localPosition(), magField_, VectorHit::momentum(), funct::pow(), reco::BeamSpot::sigmaZ(), GeomDet::surface(), theta(), GloballyPositioned< T >::toLocal(), VectorHit::transverseMomentum(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by run().

290  {
291  // having fun with theta
292  Global3DVector gv(vHit->globalPosition().x(), vHit->globalPosition().y(), vHit->globalPosition().z());
293  float theta = gv.theta();
294  // gv transform to local (lv)
295  const Local3DVector lv(vHit->det()->surface().toLocal(gv));
296 
297  //FIXME::charge is fine 1 every two times!!
298  GlobalPoint center(0.0, 0.0, 0.0);
299  int charge = 1;
300  // momentum is a signed quantity in this case
301  float mom = vHit->momentum(magField_->inTesla(center).z());
302  float xPos = vHit->localPosition().x();
303  float yPos = vHit->localPosition().y();
304  float dx = vHit->localDirection().x();
305  // for dy use second component of the lv renormalized to the z component
306  float dy = lv.y() / lv.z();
307 
308  // Pz and Dz should have the same sign
309  float signPz = copysign(1.0, vHit->globalPosition().z());
310 
311  LocalTrajectoryParameters ltpar2(charge / mom, dx, dy, xPos, yPos, signPz);
313  // set the error on 1/p
314  mat[0][0] = pow(computeInverseMomentumError(
315  vHit, theta, beamSpot_->sigmaZ(), vHit->transverseMomentum(magField_->inTesla(center).z())),
316  2);
317 
318  //building tsos
319  LocalTrajectoryError lterr(mat);
320  const TrajectoryStateOnSurface tsos(ltpar2, lterr, vHit->det()->surface(), magField_);
321 
322  return tsos;
323 }
virtual LocalVector localDirection() const
Definition: VectorHit.h:75
float transverseMomentum(float magField) const
Definition: VectorHit.cc:156
T z() const
Definition: PV3DBase.h:61
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
float momentum(float magField) const
Definition: VectorHit.cc:161
LocalPoint toLocal(const GlobalPoint &gp) const
const GeomDet * det() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
float computeInverseMomentumError(const VectorHit *vh, const float globalTheta, const double sigmaZ_beamSpot, const double transverseMomentum) const
const MagneticField * magField_
AlgebraicSymMatrix55 assign44To55(const AlgebraicSymMatrix44 &) const
GlobalPoint globalPosition() const final
LocalPoint localPosition() const override
Definition: VectorHit.h:74
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
const AlgebraicSymMatrix44 & covMatrix() const
Definition: VectorHit.cc:171
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const reco::BeamSpot * beamSpot_
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ checkLayer()

unsigned int SeedingOTEDProducer::checkLayer ( unsigned int  iidd)

Definition at line 252 of file SeedingOTEDProducer.cc.

References TrackerTopology::layer(), nano_mu_digi_cff::strip, StripSubdetector::TIB, tkTopo_, and StripSubdetector::TOB.

Referenced by collectVHsOnLayer(), and printVHsOnLayer().

252  {
254  unsigned int subid = strip.subdetId();
255  if (subid == StripSubdetector::TIB || subid == StripSubdetector::TOB) {
256  return tkTopo_->layer(iidd);
257  }
258  return 0;
259 }
unsigned int layer(const DetId &id) const
static constexpr auto TOB
const TrackerTopology * tkTopo_
static constexpr auto TIB

◆ collectVHsOnLayer()

std::vector< const VectorHit * > SeedingOTEDProducer::collectVHsOnLayer ( const edmNew::DetSetVector< VectorHit > &  input,
unsigned int  layerNumber 
)

Definition at line 261 of file SeedingOTEDProducer.cc.

References checkLayer(), and input.

Referenced by run().

262  {
263  std::vector<const VectorHit*> vHsOnLayer;
264  if (!input.empty()) {
265  for (const auto& DSViter : input) {
266  if (checkLayer(DSViter.id()) == layerNumber) {
267  for (const auto& vh : DSViter) {
268  vHsOnLayer.push_back(&vh);
269  }
270  }
271  }
272  }
273 
274  return vHsOnLayer;
275 }
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int checkLayer(unsigned int iidd)

◆ computeGlobalThetaError()

float SeedingOTEDProducer::computeGlobalThetaError ( const VectorHit vh,
const double  sigmaZ_beamSpot 
) const

Definition at line 346 of file SeedingOTEDProducer.cc.

References GlobalErrorBase< T, ErrorWeightType >::czz(), funct::derivative(), BaseTrackerRecHit::globalPosition(), VectorHit::lowerGlobalPosErr(), PV3DBase< T, PVType, FrameType >::mag2(), PV3DBase< T, PVType, FrameType >::perp(), and funct::pow().

Referenced by computeInverseMomentumError().

346  {
347  double derivative = vh->globalPosition().perp() / vh->globalPosition().mag2();
348  double derivative2 = pow(derivative, 2);
349  return pow(derivative2 * vh->lowerGlobalPosErr().czz() + derivative2 * pow(sigmaZ_beamSpot, 2), 0.5);
350 }
T perp() const
Definition: PV3DBase.h:69
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
GlobalError lowerGlobalPosErr() const
Definition: VectorHit.cc:123
T mag2() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const final
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ computeInverseMomentumError()

float SeedingOTEDProducer::computeInverseMomentumError ( const VectorHit vh,
const float  globalTheta,
const double  sigmaZ_beamSpot,
const double  transverseMomentum 
) const

Definition at line 352 of file SeedingOTEDProducer.cc.

References computeGlobalThetaError(), funct::cos(), funct::pow(), and funct::sin().

Referenced by buildInitialTSOS().

355  {
356  //for pT > 2GeV, 1/pT has sigma = 1/sqrt(12)
357  float varianceInverseTransvMomentum = 1. / 12;
358  float derivativeTheta2 = pow(cos(globalTheta) / transverseMomentum, 2);
359  float derivativeInverseTransvMomentum2 = pow(sin(globalTheta), 2);
360  float thetaError = computeGlobalThetaError(vh, sigmaZ_beamSpot);
361  return pow(derivativeTheta2 * pow(thetaError, 2) + derivativeInverseTransvMomentum2 * varianceInverseTransvMomentum,
362  0.5);
363 }
float computeGlobalThetaError(const VectorHit *vh, const double sigmaZ_beamSpot) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ createSeed()

TrajectorySeed SeedingOTEDProducer::createSeed ( const TrajectoryStateOnSurface tsos,
const edm::OwnVector< TrackingRecHit > &  container,
const DetId id,
const Propagator prop 
) const

Definition at line 365 of file SeedingOTEDProducer.cc.

References trajectoryStateTransform::persistentState(), Propagator::propagationDirection(), and nano_mu_digi_cff::rawId.

Referenced by run().

368  {
370  return TrajectorySeed(seedTSOS, container, prop.propagationDirection());
371 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139

◆ fillDescriptions()

void SeedingOTEDProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 111 of file SeedingOTEDProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

111  {
113  desc.add<edm::InputTag>("src", edm::InputTag("siPhase2VectorHits", "accepted"));
114  desc.add<edm::InputTag>("trackerEvent", edm::InputTag("MeasurementTrackerEvent"));
115  desc.add<edm::InputTag>("beamSpotLabel", edm::InputTag("offlineBeamSpot"));
116  desc.add<std::string>("updator", std::string("KFUpdator"));
117  descriptions.add("SeedingOTEDProducer", desc);
118 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ printVHsOnLayer()

void SeedingOTEDProducer::printVHsOnLayer ( const edmNew::DetSetVector< VectorHit > &  input,
unsigned int  layerNumber 
)

Definition at line 277 of file SeedingOTEDProducer.cc.

References checkLayer(), input, and LogTrace.

277  {
278  if (!input.empty()) {
279  for (const auto& DSViter : input) {
280  for (const auto& vh : DSViter) {
281  if (checkLayer(DSViter.id()) == layerNumber)
282  LogTrace("SeedingOTEDProducer") << " VH in layer " << layerNumber << " >> " << vh;
283  }
284  }
285  } else {
286  LogTrace("SeedingOTEDProducer") << " No VHs in layer " << layerNumber << ".";
287  }
288 }
#define LogTrace(id)
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int checkLayer(unsigned int iidd)

◆ produce()

void SeedingOTEDProducer::produce ( edm::Event event,
const edm::EventSetup es 
)
override

Definition at line 120 of file SeedingOTEDProducer.cc.

References beamSpot_, beamSpotToken_, estimator_, estToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), layerMeasurements_, magField_, magFieldToken_, measurementTracker_, HLT_2024v12_cff::measurementTrackerEvent, measurementTrackerToken_, edm::ESHandle< T >::product(), propagator_, propagatorToken_, putToken_, run(), tkMeasEventToken_, tkTopo_, topoToken_, updator_, updatorToken_, and vhProducerToken_.

120  {
121  tkTopo_ = &es.getData(topoToken_);
122 
124  measurementTracker_ = measurementTrackerHandle.product();
125 
126  auto const& measurementTrackerEvent = event.get(tkMeasEventToken_);
127 
128  layerMeasurements_ = std::make_unique<LayerMeasurements>(*measurementTrackerHandle, measurementTrackerEvent);
129 
131 
133 
135 
137 
138  beamSpot_ = &event.get(beamSpotToken_);
139 
140  // Get the vector hits
141  auto vhs = event.getHandle(vhProducerToken_);
142 
143  event.emplace(putToken_, run(vhs));
144 }
edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > estToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
TrajectorySeedCollection run(edm::Handle< VectorHitCollection >)
edm::ESGetToken< TrajectoryStateUpdator, TrackingComponentsRecord > updatorToken_
edm::EDGetTokenT< VectorHitCollection > vhProducerToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const TrackerTopology * tkTopo_
const MagneticField * magField_
const TrajectoryStateUpdator * updator_
const Propagator * propagator_
const MeasurementTracker * measurementTracker_
edm::EDPutTokenT< TrajectorySeedCollection > putToken_
const MeasurementEstimator * estimator_
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const edm::EDGetTokenT< MeasurementTrackerEvent > tkMeasEventToken_
const reco::BeamSpot * beamSpot_
std::unique_ptr< LayerMeasurements > layerMeasurements_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_

◆ propagateAndUpdate()

std::pair< bool, TrajectoryStateOnSurface > SeedingOTEDProducer::propagateAndUpdate ( const TrajectoryStateOnSurface  initialTSOS,
const Propagator prop,
const TrackingRecHit hit 
) const

Definition at line 335 of file SeedingOTEDProducer.cc.

References TrajectoryStateOnSurface::isValid(), Propagator::propagate(), UNLIKELY, TrajectoryStateUpdator::update(), and updator_.

Referenced by run().

336  {
337  TrajectoryStateOnSurface propTSOS = prop.propagate(initialTSOS, hit.det()->surface());
338  if UNLIKELY (!propTSOS.isValid())
339  return std::make_pair(false, propTSOS);
340  TrajectoryStateOnSurface updatedTSOS = updator_->update(propTSOS, hit);
341  if UNLIKELY (!updatedTSOS.isValid())
342  return std::make_pair(false, updatedTSOS);
343  return std::make_pair(true, updatedTSOS);
344 }
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
const TrajectoryStateUpdator * updator_
#define UNLIKELY(x)
Definition: Likely.h:21

◆ run()

TrajectorySeedCollection SeedingOTEDProducer::run ( edm::Handle< VectorHitCollection vHs)

Definition at line 146 of file SeedingOTEDProducer.cc.

References alongMomentum, buildInitialTSOS(), TrackingRecHit::clone(), Propagator::clone(), collectVHsOnLayer(), createSeed(), estimator_, MeasurementTracker::geometricSearchTracker(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), layerMeasurements_, measurementTracker_, oppositeToMomentum, edm::Handle< T >::product(), propagateAndUpdate(), Propagator::propagationDirection(), propagator_, edm::OwnVector< T, P >::push_back(), mps_fire::result, Propagator::setPropagationDirection(), GeometricSearchTracker::tobLayers(), UNLIKELY, TrajectoryStateUpdator::update(), updator_, and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

146  {
148  //check if all the first three layers have VHs
149  std::vector<const VectorHit*> vhSeedsL1 = collectVHsOnLayer(*vHs.product(), 1);
150  std::vector<const VectorHit*> vhSeedsL2 = collectVHsOnLayer(*vHs.product(), 2);
151  std::vector<const VectorHit*> vhSeedsL3 = collectVHsOnLayer(*vHs.product(), 3);
152  if (vhSeedsL1.empty() || vhSeedsL2.empty() || vhSeedsL3.empty()) {
153  return result;
154  }
155 
156  //seeds are built in the L3 of the OT
157  const BarrelDetLayer* barrelOTLayer2 = measurementTracker_->geometricSearchTracker()->tobLayers().at(1);
158 
159  //the search propag directiondepend on the sign of signZ*signPz, while the building is always the contrary
160  Propagator* searchingPropagator = &*propagator_->clone();
161  Propagator* buildingPropagator = &*propagator_->clone();
162  buildingPropagator->setPropagationDirection(alongMomentum);
163 
164  for (const auto& hitL3 : vhSeedsL3) {
165  //building a tsos out of a VectorHit
166  const TrajectoryStateOnSurface initialTSOS = buildInitialTSOS(hitL3);
167  float signZ = copysign(1.0, initialTSOS.globalPosition().z());
168  float signPz = copysign(1.0, initialTSOS.globalMomentum().z());
169 
170  //set the direction of the propagator
171  if (signZ * signPz > 0.0)
172  searchingPropagator->setPropagationDirection(oppositeToMomentum);
173  else
174  searchingPropagator->setPropagationDirection(alongMomentum);
175 
176  //find vHits in layer 2
177  std::vector<TrajectoryMeasurement> measurementsL2 =
178  layerMeasurements_->measurements(*barrelOTLayer2, initialTSOS, *searchingPropagator, *estimator_);
179 
180  std::vector<TrajectoryMeasurement>::iterator measurementsL2end =
181  std::remove_if(measurementsL2.begin(), measurementsL2.end(), isInvalid());
182  measurementsL2.erase(measurementsL2end, measurementsL2.end());
183 
184  if (!measurementsL2.empty()) {
185  //not sure if building it everytime takes time/memory
186  const DetLayer* barrelOTLayer1 = measurementTracker_->geometricSearchTracker()->tobLayers().at(0);
187 
188  for (const auto& mL2 : measurementsL2) {
189  const TrackingRecHit* hitL2 = mL2.recHit().get();
190 
191  //propagate to the L2 and update the TSOS
192  std::pair<bool, TrajectoryStateOnSurface> updatedTSOS =
193  propagateAndUpdate(initialTSOS, *searchingPropagator, *hitL2);
194  if (!updatedTSOS.first)
195  continue;
196 
197  //searching possible VHs in L1
198  std::vector<TrajectoryMeasurement> measurementsL1 =
199  layerMeasurements_->measurements(*barrelOTLayer1, updatedTSOS.second, *searchingPropagator, *estimator_);
200  std::vector<TrajectoryMeasurement>::iterator measurementsL1end =
201  std::remove_if(measurementsL1.begin(), measurementsL1.end(), isInvalid());
202  measurementsL1.erase(measurementsL1end, measurementsL1.end());
203 
204  if (!measurementsL1.empty()) {
205  for (const auto& mL1 : measurementsL1) {
206  const TrackingRecHit* hitL1 = mL1.recHit().get();
207 
208  //propagate to the L1 and update the TSOS
209  std::pair<bool, TrajectoryStateOnSurface> updatedTSOSL1 =
210  propagateAndUpdate(updatedTSOS.second, *searchingPropagator, *hitL1);
211  if (!updatedTSOSL1.first)
212  continue;
213 
214  //building trajectory inside-out
215  if (searchingPropagator->propagationDirection() == alongMomentum) {
216  buildingPropagator->setPropagationDirection(oppositeToMomentum);
217  } else {
218  buildingPropagator->setPropagationDirection(alongMomentum);
219  }
220 
221  updatedTSOSL1.second.rescaleError(100);
222 
223  TrajectoryStateOnSurface updatedTSOSL1_final = updator_->update(updatedTSOSL1.second, *hitL1);
224  if UNLIKELY (!updatedTSOSL1_final.isValid())
225  continue;
226  std::pair<bool, TrajectoryStateOnSurface> updatedTSOSL2_final =
227  propagateAndUpdate(updatedTSOSL1_final, *buildingPropagator, *hitL2);
228  if (!updatedTSOSL2_final.first)
229  continue;
230  std::pair<bool, TrajectoryStateOnSurface> updatedTSOSL3_final =
231  propagateAndUpdate(updatedTSOSL2_final.second, *buildingPropagator, *hitL3);
232  if (!updatedTSOSL3_final.first)
233  continue;
234 
236  container.push_back(hitL1->clone());
237  container.push_back(hitL2->clone());
238  container.push_back(hitL3->clone());
239 
240  TrajectorySeed ts =
241  createSeed(updatedTSOSL3_final.second, container, hitL3->geographicalId(), *buildingPropagator);
242  result.push_back(ts);
243  }
244  }
245  }
246  }
247  }
248  result.shrink_to_fit();
249  return result;
250 }
std::pair< bool, TrajectoryStateOnSurface > propagateAndUpdate(const TrajectoryStateOnSurface initialTSOS, const Propagator &, const TrackingRecHit &hit) const
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
T z() const
Definition: PV3DBase.h:61
T const * product() const
Definition: Handle.h:70
virtual Propagator * clone() const =0
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
const GeometricSearchTracker * geometricSearchTracker() const
void push_back(D *&d)
Definition: OwnVector.h:326
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
GlobalPoint globalPosition() const
std::vector< TrajectorySeed > TrajectorySeedCollection
std::vector< const VectorHit * > collectVHsOnLayer(const edmNew::DetSetVector< VectorHit > &, unsigned int)
virtual TrackingRecHit * clone() const =0
const TrajectoryStateUpdator * updator_
const TrajectoryStateOnSurface buildInitialTSOS(const VectorHit *) const
GlobalVector globalMomentum() const
const Propagator * propagator_
const MeasurementTracker * measurementTracker_
std::vector< BarrelDetLayer const * > const & tobLayers() const
const MeasurementEstimator * estimator_
#define UNLIKELY(x)
Definition: Likely.h:21
std::unique_ptr< LayerMeasurements > layerMeasurements_
TrajectorySeed createSeed(const TrajectoryStateOnSurface &tsos, const edm::OwnVector< TrackingRecHit > &container, const DetId &id, const Propagator &prop) const

Member Data Documentation

◆ beamSpot_

const reco::BeamSpot* SeedingOTEDProducer::beamSpot_
private

Definition at line 83 of file SeedingOTEDProducer.cc.

Referenced by buildInitialTSOS(), and produce().

◆ beamSpotToken_

edm::EDGetTokenT<reco::BeamSpot> SeedingOTEDProducer::beamSpotToken_
private

Definition at line 82 of file SeedingOTEDProducer.cc.

Referenced by produce(), and SeedingOTEDProducer().

◆ estimator_

const MeasurementEstimator* SeedingOTEDProducer::estimator_
private

Definition at line 77 of file SeedingOTEDProducer.cc.

Referenced by produce(), and run().

◆ estToken_

edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> SeedingOTEDProducer::estToken_
private

Definition at line 91 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ layerMeasurements_

std::unique_ptr<LayerMeasurements> SeedingOTEDProducer::layerMeasurements_
private

Definition at line 76 of file SeedingOTEDProducer.cc.

Referenced by produce(), and run().

◆ magField_

const MagneticField* SeedingOTEDProducer::magField_
private

Definition at line 79 of file SeedingOTEDProducer.cc.

Referenced by buildInitialTSOS(), and produce().

◆ magFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SeedingOTEDProducer::magFieldToken_
private

Definition at line 88 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ measurementTracker_

const MeasurementTracker* SeedingOTEDProducer::measurementTracker_
private

Definition at line 75 of file SeedingOTEDProducer.cc.

Referenced by produce(), and run().

◆ measurementTrackerToken_

edm::ESGetToken<MeasurementTracker, CkfComponentsRecord> SeedingOTEDProducer::measurementTrackerToken_
private

Definition at line 90 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ propagator_

const Propagator* SeedingOTEDProducer::propagator_
private

Definition at line 78 of file SeedingOTEDProducer.cc.

Referenced by produce(), and run().

◆ propagatorToken_

edm::ESGetToken<Propagator, TrackingComponentsRecord> SeedingOTEDProducer::propagatorToken_
private

Definition at line 87 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ putToken_

edm::EDPutTokenT<TrajectorySeedCollection> SeedingOTEDProducer::putToken_
private

Definition at line 92 of file SeedingOTEDProducer.cc.

Referenced by produce(), and SeedingOTEDProducer().

◆ tkMeasEventToken_

const edm::EDGetTokenT<MeasurementTrackerEvent> SeedingOTEDProducer::tkMeasEventToken_
private

Definition at line 81 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ tkTopo_

const TrackerTopology* SeedingOTEDProducer::tkTopo_
private

Definition at line 74 of file SeedingOTEDProducer.cc.

Referenced by checkLayer(), and produce().

◆ topoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SeedingOTEDProducer::topoToken_
private

Definition at line 86 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ updator_

const TrajectoryStateUpdator* SeedingOTEDProducer::updator_
private

Definition at line 80 of file SeedingOTEDProducer.cc.

Referenced by produce(), propagateAndUpdate(), and run().

◆ updatorName_

std::string SeedingOTEDProducer::updatorName_
private

Definition at line 84 of file SeedingOTEDProducer.cc.

Referenced by SeedingOTEDProducer().

◆ updatorToken_

edm::ESGetToken<TrajectoryStateUpdator, TrackingComponentsRecord> SeedingOTEDProducer::updatorToken_
private

Definition at line 89 of file SeedingOTEDProducer.cc.

Referenced by produce().

◆ vhProducerToken_

edm::EDGetTokenT<VectorHitCollection> SeedingOTEDProducer::vhProducerToken_
private

Definition at line 73 of file SeedingOTEDProducer.cc.

Referenced by produce(), and SeedingOTEDProducer().