CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
SeedFromConsecutiveHitsCreator Class Reference

#include <SeedFromConsecutiveHitsCreator.h>

Inheritance diagram for SeedFromConsecutiveHitsCreator:
SeedCreator SeedFromConsecutiveHitsStraightLineCreator SeedFromConsecutiveHitsTripletOnlyCreator

Public Member Functions

void init (const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) final
 
void makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) final
 
 SeedFromConsecutiveHitsCreator (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
 ~SeedFromConsecutiveHitsCreator () override
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &desc)
 
static const char * fillDescriptionsLabel ()
 

Protected Attributes

TkClonerImpl cloner
 
const SeedComparitorfilter = nullptr
 
bool forceKinematicWithRegionDirection_
 
bool isBOFF = false
 
MagneticField const * magneticField_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldESToken_
 
std::string mfName_
 
float nomField
 
Propagator const * propagator_
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordpropagatorESToken_
 
const TrackingRegionregion = nullptr
 
float theBOFFMomentum
 
float theMinOneOverPtError
 
float theOriginTransverseErrorMultiplier
 
std::string thePropagatorLabel
 
TrackerGeometry const * trackerGeometry_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryESToken_
 
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordtransientTrackingRecHitBuilderESToken_
 
std::string TTRHBuilder
 

Private Member Functions

void buildSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const
 
bool checkHit (const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
 
CurvilinearTrajectoryError initialError (float sin2Theta) const
 
virtual bool initialKinematic (GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
 
SeedingHitSet::RecHitPointer refitHit (SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
 

Detailed Description

Definition at line 25 of file SeedFromConsecutiveHitsCreator.h.

Constructor & Destructor Documentation

◆ SeedFromConsecutiveHitsCreator()

SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)

Definition at line 26 of file SeedFromConsecutiveHitsCreator.cc.

28  : thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
29  theBOFFMomentum(cfg.getParameter<double>("SeedMomentumForBOFF")),
30  theOriginTransverseErrorMultiplier(cfg.getParameter<double>("OriginTransverseErrorMultiplier")),
31  theMinOneOverPtError(cfg.getParameter<double>("MinOneOverPtError")),
32  TTRHBuilder(cfg.getParameter<std::string>("TTRHBuilder")),
33  mfName_(cfg.getParameter<std::string>("magneticField")),
34  forceKinematicWithRegionDirection_(cfg.getParameter<bool>("forceKinematicWithRegionDirection")),
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > transientTrackingRecHitBuilderESToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldESToken_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorESToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryESToken_

◆ ~SeedFromConsecutiveHitsCreator()

SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator ( )
override

Definition at line 40 of file SeedFromConsecutiveHitsCreator.cc.

40 {}

Member Function Documentation

◆ buildSeed()

void SeedFromConsecutiveHitsCreator::buildSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const FreeTrajectoryState fts 
) const
private

Definition at line 159 of file SeedFromConsecutiveHitsCreator.cc.

References alongMomentum, checkHit(), hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), TrajectoryStateOnSurface::isValid(), eostools::move(), trajectoryStateTransform::persistentState(), Propagator::propagate(), propagator_, edm::OwnVector< T, P >::push_back(), refitHit(), ElectronSeedTrackRefFix_cfi::seedCollection, trackerGeometry_, and HLT_2022v15_cff::updator.

Referenced by makeSeed().

161  {
162  // get updator
164 
165  // Now update initial state track using information from seed hits.
166 
167  TrajectoryStateOnSurface updatedState;
169 
170  const TrackingRecHit* hit = nullptr;
171  for (unsigned int iHit = 0; iHit < hits.size(); iHit++) {
172  hit = hits[iHit]->hit();
174  (iHit == 0) ? propagator_->propagate(fts, trackerGeometry_->idToDet(hit->geographicalId())->surface())
175  : propagator_->propagate(updatedState, trackerGeometry_->idToDet(hit->geographicalId())->surface());
176  if (!state.isValid())
177  return;
178 
180 
181  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit(tth, state));
182 
183  if (!checkHit(state, &*newtth))
184  return;
185 
186  updatedState = updator.update(state, *newtth);
187  if (!updatedState.isValid())
188  return;
189 
190  seedHits.push_back(newtth.release());
191  }
192 
193  if (!hit)
194  return;
195 
196  PTrajectoryStateOnDet const& PTraj =
197  trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId());
198  seedCollection.emplace_back(PTraj, std::move(seedHits), alongMomentum);
199 }
bool checkHit(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
void push_back(D *&d)
Definition: OwnVector.h:326
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
const TrackerGeomDet * idToDet(DetId) const override
def move(src, dest)
Definition: eostools.py:511
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const

◆ checkHit()

bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface tsos,
SeedingHitSet::ConstRecHitPointer  hit 
) const
private

Definition at line 206 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

207  {
208  return (filter ? filter->compatible(tsos, hit) : true);
209 }
virtual bool compatible(const SeedingHitSet &hits) const =0

◆ fillDescriptions()

void SeedFromConsecutiveHitsCreator::fillDescriptions ( edm::ParameterSetDescription desc)
static

Definition at line 42 of file SeedFromConsecutiveHitsCreator.cc.

References submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SeedFromConsecutiveHitsTripletOnlyCreator::fillDescriptions().

42  {
43  desc.add<std::string>("propagator", "PropagatorWithMaterialParabolicMf");
44  desc.add<double>("SeedMomentumForBOFF", 5.0);
45  desc.add<double>("OriginTransverseErrorMultiplier", 1.0);
46  desc.add<double>("MinOneOverPtError", 1.0);
47  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
48  desc.add<std::string>("magneticField", "ParabolicMf");
49  desc.add<bool>("forceKinematicWithRegionDirection", false);
50 }

◆ fillDescriptionsLabel()

static const char* SeedFromConsecutiveHitsCreator::fillDescriptionsLabel ( )
inlinestatic

Definition at line 32 of file SeedFromConsecutiveHitsCreator.h.

32 { return "ConsecutiveHits"; }

◆ init()

void SeedFromConsecutiveHitsCreator::init ( const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
finalvirtual

Implements SeedCreator.

Definition at line 52 of file SeedFromConsecutiveHitsCreator.cc.

References cloner, filter, edm::EventSetup::getData(), isBOFF, magneticField_, magneticFieldESToken_, nomField, MagneticField::nominalValue(), propagator_, propagatorESToken_, region, trackerGeometry_, trackerGeometryESToken_, and transientTrackingRecHitBuilderESToken_.

54  {
55  region = &iregion;
56  filter = ifilter;
61  isBOFF = (0 == nomField);
62 
63  TransientTrackingRecHitBuilder const* transientTrackingRecHitBuilder =
65  auto builder = (TkTransientTrackingRecHitBuilder const*)(transientTrackingRecHitBuilder);
66  cloner = (*builder).cloner();
67 }
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > transientTrackingRecHitBuilderESToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldESToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorESToken_
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryESToken_

◆ initialError()

CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 137 of file SeedFromConsecutiveHitsCreator.cc.

References correctionTermsCaloMet_cff::C, CurvilinearTrajectoryError::matrix(), SiStripPI::max, TrackingRegion::originRBound(), TrackingRegion::originZBound(), TrackingRegion::ptMin(), region, funct::sqr(), theMinOneOverPtError, and theOriginTransverseErrorMultiplier.

Referenced by makeSeed().

137  {
138  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
139  // information.
140  CurvilinearTrajectoryError newError; // zeroed
141  auto& C = newError.matrix();
142 
143  // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
144  // to avoid instabilities.
145  // N.B. This parameter needs optimising ...
146  // Probably OK based on quick study: KS 22/11/12.
147  auto sin2th = sin2Theta;
148  auto minC00 = sqr(theMinOneOverPtError);
149  C[0][0] = std::max(sin2th / sqr(region->ptMin()), minC00);
150  auto zErr = sqr(region->originZBound());
151  auto transverseErr = sqr(theOriginTransverseErrorMultiplier * region->originRBound());
152  C[1][1] = C[2][2] = 1.; // no good reason. no bad reason....
153  C[3][3] = transverseErr;
154  C[4][4] = zErr * sin2th + transverseErr * (1.f - sin2th);
155 
156  return newError;
157 }
float ptMin() const
minimal pt of interest
float originRBound() const
bounds the particle vertex in the transverse plane
const AlgebraicSymMatrix55 & matrix() const
float originZBound() const
bounds the particle vertex in the longitudinal plane
Square< F >::type sqr(const F &f)
Definition: Square.h:14

◆ initialKinematic()

bool SeedFromConsecutiveHitsCreator::initialKinematic ( GlobalTrajectoryParameters kine,
const SeedingHitSet hits 
) const
privatevirtual

Reimplemented in SeedFromConsecutiveHitsTripletOnlyCreator, and SeedFromConsecutiveHitsStraightLineCreator.

Definition at line 114 of file SeedFromConsecutiveHitsCreator.cc.

References GlobalTrajectoryParameters::charge(), SeedComparitor::compatible(), filter, hfClusterShapes_cfi::hits, isBOFF, magneticField_, GlobalTrajectoryParameters::momentum(), nomField, TrackingRegion::origin(), GlobalTrajectoryParameters::position(), region, theBOFFMomentum, Vector3DBase< T, FrameTag >::unit(), and UNLIKELY.

Referenced by makeSeed().

115  {
118 
119  const GlobalPoint& vertexPos = region->origin();
120 
121  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, magneticField_);
122  if (helix.isValid()) {
123  kine = helix.stateAtVertex();
124  } else {
125  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
126  initMomentum *= (100.f / initMomentum.perp());
127  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, magneticField_);
128  }
129 
130  if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) {
132  kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_);
133  }
134  return (filter ? filter->compatible(hits, kine, helix) : true);
135 }
GlobalPoint const & origin() const
virtual bool compatible(const SeedingHitSet &hits) const =0
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
Vector3DBase unit() const
Definition: Vector3DBase.h:54
#define UNLIKELY(x)
Definition: Likely.h:21

◆ makeSeed()

void SeedFromConsecutiveHitsCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
finalvirtual

Implements SeedCreator.

Definition at line 69 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), correctionTermsCaloMet_cff::C, FreeTrajectoryState::charge(), TrackingRegion::direction(), relativeConstraints::error, forceKinematicWithRegionDirection_, hfClusterShapes_cfi::hits, initialError(), initialKinematic(), TkTrackingRegionsMargin< T >::left(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::mag2(), GlobalTrajectoryParameters::magneticField(), CurvilinearTrajectoryError::matrix(), SiStripPI::max, GlobalTrajectoryParameters::momentum(), FreeTrajectoryState::momentum(), TrackingRegion::origin(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), FreeTrajectoryState::parameters(), PV3DBase< T, PVType, FrameType >::perp2(), RectangularEtaPhiTrackingRegion::phiMargin(), position, TrackingRegion::ptMin(), ptMin, region, TkTrackingRegionsMargin< T >::right(), ElectronSeedTrackRefFix_cfi::seedCollection, funct::sqr(), RectangularEtaPhiTrackingRegion::tanLambdaRange(), and PV3DBase< T, PVType, FrameType >::x().

69  {
70  if (hits.size() < 2)
71  return;
72 
74  if (!initialKinematic(kine, hits))
75  return;
76 
77  auto sin2Theta = kine.momentum().perp2() / kine.momentum().mag2();
78 
80  FreeTrajectoryState fts(kine, error);
81 
82  if (region->direction().x() != 0 &&
83  forceKinematicWithRegionDirection_) // a direction was given, check if it is an etaPhi region
84  {
85  const RectangularEtaPhiTrackingRegion* etaPhiRegion = dynamic_cast<const RectangularEtaPhiTrackingRegion*>(region);
86  if (etaPhiRegion) {
87  //the following completely reset the kinematics, perhaps it makes no sense and newKine=kine would do better
88  GlobalVector direction = region->direction() / region->direction().mag();
89  GlobalVector momentum = direction * fts.momentum().mag();
90  GlobalPoint position = region->origin() + 5 * direction;
91  GlobalTrajectoryParameters newKine(position, momentum, fts.charge(), &fts.parameters().magneticField());
92 
93  auto ptMin = region->ptMin();
94  CurvilinearTrajectoryError newError; //zeroed
95  auto& C = newError.matrix();
96  constexpr float minC00 = 0.4f;
97  C[0][0] = std::max(sin2Theta / sqr(ptMin), minC00);
98  auto zErr = sqr(region->originZBound());
99  auto transverseErr = sqr(region->originRBound()); // assume equal cxx cyy
100  auto twiceDeltaLambda =
101  std::atan(etaPhiRegion->tanLambdaRange().first) - std::atan(etaPhiRegion->tanLambdaRange().second);
102  auto twiceDeltaPhi = etaPhiRegion->phiMargin().right() + etaPhiRegion->phiMargin().left();
103  C[1][1] = twiceDeltaLambda * twiceDeltaLambda; //2 sigma of what given in input
104  C[2][2] = twiceDeltaPhi * twiceDeltaPhi;
105  C[3][3] = transverseErr;
106  C[4][4] = zErr * sin2Theta + transverseErr * (1.f - sin2Theta);
107  fts = FreeTrajectoryState(newKine, newError);
108  }
109  }
110 
112 }
GlobalPoint const & origin() const
constexpr float ptMin
void buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const
T mag2() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:59
float ptMin() const
minimal pt of interest
T mag() const
Definition: PV3DBase.h:64
float originRBound() const
bounds the particle vertex in the transverse plane
virtual bool initialKinematic(GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
CurvilinearTrajectoryError initialError(float sin2Theta) const
const AlgebraicSymMatrix55 & matrix() const
GlobalVector const & direction() const
the direction around which region is constructed
T perp2() const
Definition: PV3DBase.h:68
float originZBound() const
bounds the particle vertex in the longitudinal plane
Square< F >::type sqr(const F &f)
Definition: Square.h:14
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ refitHit()

SeedingHitSet::RecHitPointer SeedFromConsecutiveHitsCreator::refitHit ( SeedingHitSet::ConstRecHitPointer  hit,
const TrajectoryStateOnSurface state 
) const
private

Member Data Documentation

◆ cloner

TkClonerImpl SeedFromConsecutiveHitsCreator::cloner
protected

Definition at line 72 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and refitHit().

◆ filter

const SeedComparitor* SeedFromConsecutiveHitsCreator::filter = nullptr
protected

◆ forceKinematicWithRegionDirection_

bool SeedFromConsecutiveHitsCreator::forceKinematicWithRegionDirection_
protected

Definition at line 70 of file SeedFromConsecutiveHitsCreator.h.

Referenced by makeSeed().

◆ isBOFF

bool SeedFromConsecutiveHitsCreator::isBOFF = false
protected

◆ magneticField_

MagneticField const* SeedFromConsecutiveHitsCreator::magneticField_
protected

◆ magneticFieldESToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SeedFromConsecutiveHitsCreator::magneticFieldESToken_
protected

Definition at line 76 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

◆ mfName_

std::string SeedFromConsecutiveHitsCreator::mfName_
protected

Definition at line 69 of file SeedFromConsecutiveHitsCreator.h.

◆ nomField

float SeedFromConsecutiveHitsCreator::nomField
protected

◆ propagator_

Propagator const* SeedFromConsecutiveHitsCreator::propagator_
protected

Definition at line 64 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

◆ propagatorESToken_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> SeedFromConsecutiveHitsCreator::propagatorESToken_
protected

Definition at line 75 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

◆ region

const TrackingRegion* SeedFromConsecutiveHitsCreator::region = nullptr
protected

◆ theBOFFMomentum

float SeedFromConsecutiveHitsCreator::theBOFFMomentum
protected

◆ theMinOneOverPtError

float SeedFromConsecutiveHitsCreator::theMinOneOverPtError
protected

Definition at line 59 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

◆ theOriginTransverseErrorMultiplier

float SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 58 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

◆ thePropagatorLabel

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 56 of file SeedFromConsecutiveHitsCreator.h.

◆ trackerGeometry_

TrackerGeometry const* SeedFromConsecutiveHitsCreator::trackerGeometry_
protected

Definition at line 63 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

◆ trackerGeometryESToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SeedFromConsecutiveHitsCreator::trackerGeometryESToken_
protected

Definition at line 74 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

◆ transientTrackingRecHitBuilderESToken_

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> SeedFromConsecutiveHitsCreator::transientTrackingRecHitBuilderESToken_
protected

Definition at line 77 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

◆ TTRHBuilder

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 68 of file SeedFromConsecutiveHitsCreator.h.