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 &cfg)
 
 ~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

edm::ESHandle< MagneticFieldbfield
 
TkClonerImpl cloner
 
const SeedComparitorfilter = 0
 
bool forceKinematicWithRegionDirection_
 
bool isBOFF = false
 
std::string mfName_
 
float nomField
 
edm::ESHandle< PropagatorpropagatorHandle
 
const TrackingRegionregion = 0
 
float theBOFFMomentum
 
float theMinOneOverPtError
 
float theOriginTransverseErrorMultiplier
 
std::string thePropagatorLabel
 
edm::ESHandle< TrackerGeometrytracker
 
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 23 of file SeedFromConsecutiveHitsCreator.h.

Constructor & Destructor Documentation

SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator ( const edm::ParameterSet cfg)
inline

Definition at line 25 of file SeedFromConsecutiveHitsCreator.h.

References fillDescriptions().

26  : thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
27  theBOFFMomentum(cfg.getParameter<double>("SeedMomentumForBOFF")),
28  theOriginTransverseErrorMultiplier(cfg.getParameter<double>("OriginTransverseErrorMultiplier")),
29  theMinOneOverPtError(cfg.getParameter<double>("MinOneOverPtError")),
30  TTRHBuilder(cfg.getParameter<std::string>("TTRHBuilder")),
31  mfName_(cfg.getParameter<std::string>("magneticField")),
32  forceKinematicWithRegionDirection_(cfg.getParameter<bool>("forceKinematicWithRegionDirection")) {}
T getParameter(std::string const &) const
SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator ( )
override

Definition at line 27 of file SeedFromConsecutiveHitsCreator.cc.

27 {}

Member Function Documentation

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

Definition at line 152 of file SeedFromConsecutiveHitsCreator.cc.

References alongMomentum, checkHit(), TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), TrajectoryStateOnSurface::isValid(), eostools::move(), trajectoryStateTransform::persistentState(), Propagator::propagate(), TrackCandidateProducer_cfi::propagator, edm::OwnVector< T, P >::push_back(), DetId::rawId(), refitHit(), SeedingHitSet::size(), tracker, KFUpdator::update(), TrackInfoProducer_cfi::updatedState, and HLT_2018_cff::updator.

Referenced by makeSeed().

154  {
155  const Propagator* propagator = &(*propagatorHandle);
156 
157  // get updator
159 
160  // Now update initial state track using information from seed hits.
161 
164 
165  const TrackingRecHit* hit = nullptr;
166  for (unsigned int iHit = 0; iHit < hits.size(); iHit++) {
167  hit = hits[iHit]->hit();
169  (iHit == 0) ? propagator->propagate(fts, tracker->idToDet(hit->geographicalId())->surface())
170  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
171  if (!state.isValid())
172  return;
173 
174  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
175 
176  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit(tth, state));
177 
178  if (!checkHit(state, &*newtth))
179  return;
180 
181  updatedState = updator.update(state, *newtth);
182  if (!updatedState.isValid())
183  return;
184 
185  seedHits.push_back(newtth.release());
186  }
187 
188  if (!hit)
189  return;
190 
191  PTrajectoryStateOnDet const& PTraj =
193  seedCollection.emplace_back(PTraj, std::move(seedHits), alongMomentum);
194 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
void push_back(D *&d)
Definition: OwnVector.h:326
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
edm::ESHandle< TrackerGeometry > tracker
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
unsigned int size() const
Definition: SeedingHitSet.h:41
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const
def move(src, dest)
Definition: eostools.py:511
bool checkHit(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface tsos,
SeedingHitSet::ConstRecHitPointer  hit 
) const
private

Definition at line 201 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

202  {
203  return (filter ? filter->compatible(tsos, hit) : true);
204 }
virtual bool compatible(const SeedingHitSet &hits) const =0
void SeedFromConsecutiveHitsCreator::fillDescriptions ( edm::ParameterSetDescription desc)
static

Definition at line 29 of file SeedFromConsecutiveHitsCreator.cc.

References edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SeedFromConsecutiveHitsTripletOnlyCreator::fillDescriptions().

29  {
30  desc.add<std::string>("propagator", "PropagatorWithMaterialParabolicMf");
31  desc.add<double>("SeedMomentumForBOFF", 5.0);
32  desc.add<double>("OriginTransverseErrorMultiplier", 1.0);
33  desc.add<double>("MinOneOverPtError", 1.0);
34  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
35  desc.add<std::string>("magneticField", "ParabolicMf");
36  desc.add<bool>("forceKinematicWithRegionDirection", false);
37 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static const char* SeedFromConsecutiveHitsCreator::fillDescriptionsLabel ( )
inlinestatic
void SeedFromConsecutiveHitsCreator::init ( const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
finalvirtual

Implements SeedCreator.

Definition at line 39 of file SeedFromConsecutiveHitsCreator.cc.

References bfield, cloner, filter, edm::EventSetup::get(), isBOFF, mfName_, nomField, MagneticField::nominalValue(), edm::ESHandle< T >::product(), propagatorHandle, region, thePropagatorLabel, tracker, and TTRHBuilder.

41  {
42  region = &iregion;
43  filter = ifilter;
44  // get tracker
46  // get propagator
48  // mag field
50  // edm::ESInputTag mfESInputTag(mfName_);
51  // es.get<IdealMagneticFieldRecord>().get(mfESInputTag, bfield);
53  isBOFF = (0 == nomField);
54 
56  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
57  auto builder = (TkTransientTrackingRecHitBuilder const*)(builderH.product());
58  cloner = (*builder).cloner();
59 }
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
edm::ESHandle< Propagator > propagatorHandle
edm::ESHandle< TrackerGeometry > tracker
T get() const
Definition: EventSetup.h:73
edm::ESHandle< MagneticField > bfield
T const * product() const
Definition: ESHandle.h:86
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 130 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

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

Reimplemented in SeedFromConsecutiveHitsTripletOnlyCreator, and SeedFromConsecutiveHitsStraightLineCreator.

Definition at line 106 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed(), SeedFromConsecutiveHitsStraightLineCreator::~SeedFromConsecutiveHitsStraightLineCreator(), and SeedFromConsecutiveHitsTripletOnlyCreator::~SeedFromConsecutiveHitsTripletOnlyCreator().

107  {
108  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
109  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
110 
111  const GlobalPoint& vertexPos = region->origin();
112 
113  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &*bfield);
114  if (helix.isValid()) {
115  kine = helix.stateAtVertex();
116  } else {
117  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
118  initMomentum *= (100.f / initMomentum.perp());
119  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
120  }
121 
122  if
123  UNLIKELY(isBOFF && (theBOFFMomentum > 0)) {
125  kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &*bfield);
126  }
127  return (filter ? filter->compatible(hits, kine, helix) : true);
128 }
GlobalPoint const & origin() const
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
virtual bool compatible(const SeedingHitSet &hits) const =0
Vector3DBase unit() const
Definition: Vector3DBase.h:54
#define UNLIKELY(x)
Definition: Likely.h:21
edm::ESHandle< MagneticField > bfield
void SeedFromConsecutiveHitsCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
finalvirtual

Implements SeedCreator.

Definition at line 61 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), gen::C, FreeTrajectoryState::charge(), constexpr, TrackingRegion::direction(), relativeConstraints::error, forceKinematicWithRegionDirection_, 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(), SeedingHitSet::size(), funct::sqr(), RectangularEtaPhiTrackingRegion::tanLambdaRange(), and PV3DBase< T, PVType, FrameType >::x().

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

Definition at line 196 of file SeedFromConsecutiveHitsCreator.cc.

References cloner.

Referenced by buildSeed().

Member Data Documentation

edm::ESHandle<MagneticField> SeedFromConsecutiveHitsCreator::bfield
protected
TkClonerImpl SeedFromConsecutiveHitsCreator::cloner
protected

Definition at line 78 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and refitHit().

const SeedComparitor* SeedFromConsecutiveHitsCreator::filter = 0
protected
bool SeedFromConsecutiveHitsCreator::forceKinematicWithRegionDirection_
protected

Definition at line 76 of file SeedFromConsecutiveHitsCreator.h.

Referenced by makeSeed().

bool SeedFromConsecutiveHitsCreator::isBOFF = false
protected
std::string SeedFromConsecutiveHitsCreator::mfName_
protected

Definition at line 75 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

float SeedFromConsecutiveHitsCreator::nomField
protected
edm::ESHandle<Propagator> SeedFromConsecutiveHitsCreator::propagatorHandle
protected

Definition at line 70 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

const TrackingRegion* SeedFromConsecutiveHitsCreator::region = 0
protected
float SeedFromConsecutiveHitsCreator::theBOFFMomentum
protected
float SeedFromConsecutiveHitsCreator::theMinOneOverPtError
protected

Definition at line 65 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

float SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 64 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 62 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

edm::ESHandle<TrackerGeometry> SeedFromConsecutiveHitsCreator::tracker
protected

Definition at line 69 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 74 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().