CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
SeedFromConsecutiveHitsCreator Class Reference

#include <SeedFromConsecutiveHitsCreator.h>

Inheritance diagram for SeedFromConsecutiveHitsCreator:
SeedCreator GCC11_FINAL< T, TOPO > GCC11_FINAL< T, TOPO >

Public Member Functions

virtual void init (const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) GCC11_FINAL
 
virtual void makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) GCC11_FINAL
 
 SeedFromConsecutiveHitsCreator (const edm::ParameterSet &cfg)
 
 SeedFromConsecutiveHitsCreator (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0, double aOriginTransverseErrorMultiplier=1.0, double aMinOneOverPtError=1.0)
 
virtual ~SeedFromConsecutiveHitsCreator ()
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Protected Attributes

edm::ESHandle< MagneticFieldbfield
 
const SeedComparitorfilter = nullptr
 
bool isBOFF = false
 
std::string mfName_
 
float nomField
 
edm::ESHandle< PropagatorpropagatorHandle
 
const TrackingRegionregion = nullptr
 
double theBOFFMomentum
 
double theMinOneOverPtError
 
double theOriginTransverseErrorMultiplier
 
std::string thePropagatorLabel
 
edm::ESHandle< TrackerGeometrytracker
 
bool useSimpleMF_
 

Private Member Functions

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

Detailed Description

Definition at line 15 of file SeedFromConsecutiveHitsCreator.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file SeedFromConsecutiveHitsCreator.h.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), mfName_, AlCaHLTBitMon_QueryRunRegistry::string, and useSimpleMF_.

19  : thePropagatorLabel (cfg.getParameter<std::string>("propagator"))
20  , theBOFFMomentum (cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
21  , theOriginTransverseErrorMultiplier(cfg.existsAs<double>("OriginTransverseErrorMultiplier") ? cfg.getParameter<double>("OriginTransverseErrorMultiplier") : 1.0)
22  , theMinOneOverPtError (cfg.existsAs<double>("MinOneOverPtError") ? cfg.getParameter<double>("MinOneOverPtError") : 1.0)
23  // 2014/02/11 mia:
24  // we should get rid of the boolean parameter useSimpleMF,
25  // and use only a string magneticField [instead of SimpleMagneticField]
26  // or better an edm::ESInputTag (at the moment HLT does not handle ESInputTag)
27  , useSimpleMF_(false)
28  , mfName_("")
29  {
30  if (cfg.exists("SimpleMagneticField")) {
31  useSimpleMF_ = true;
32  mfName_ = cfg.getParameter<std::string>("SimpleMagneticField");
33  }
34  }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
bool exists(std::string const &parameterName) const
checks if a parameter exists
SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0,
double  aOriginTransverseErrorMultiplier = 1.0,
double  aMinOneOverPtError = 1.0 
)
inline
SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator ( )
virtual

Definition at line 24 of file SeedFromConsecutiveHitsCreator.cc.

24 {}

Member Function Documentation

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

Definition at line 110 of file SeedFromConsecutiveHitsCreator.cc.

References alongMomentum, checkHit(), SeedComparitor::compatible(), filter, TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::isValid(), trajectoryStateTransform::persistentState(), Propagator::propagate(), LargeD0_PixelPairStep_cff::propagator, edm::OwnVector< T, P >::push_back(), DetId::rawId(), refitHit(), SeedingHitSet::size(), and tracker.

Referenced by makeSeed().

114 {
115  const Propagator* propagator = &(*propagatorHandle);
116 
117  // get updator
118  KFUpdator updator;
119 
120  // Now update initial state track using information from seed hits.
121 
122  TrajectoryStateOnSurface updatedState;
124 
125  const TrackingRecHit* hit = 0;
126  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
127  hit = hits[iHit]->hit();
128  TrajectoryStateOnSurface state = (iHit==0) ?
129  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
130  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
131  if (!state.isValid()) return;
132 
133  TransientTrackingRecHit::ConstRecHitPointer const & tth = hits[iHit];
134 
135  TransientTrackingRecHit::RecHitPointer const & newtth = refitHit( tth, state);
136 
137  if (!checkHit(state,newtth)) return;
138 
139  updatedState = updator.update(state, *newtth);
140  if (!updatedState.isValid()) return;
141 
142  seedHits.push_back(newtth->hit()->clone());
143 
144  }
145 
146 
147  PTrajectoryStateOnDet const & PTraj =
149  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
150  if ( !filter || filter->compatible(seed)) seedCollection.push_back(seed);
151 
152 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
bool checkHit(const TrajectoryStateOnSurface &tsos, const TransientTrackingRecHit::ConstRecHitPointer &hit) const dso_hidden
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void push_back(D *&d)
Definition: OwnVector.h:273
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
edm::ESHandle< TrackerGeometry > tracker
unsigned int size() const
Definition: SeedingHitSet.h:41
DetId geographicalId() const
TransientTrackingRecHit::RecHitPointer refitHit(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const dso_hidden
bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface tsos,
const TransientTrackingRecHit::ConstRecHitPointer hit 
) const
private

Definition at line 162 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

165 {
166  return (filter ? filter->compatible(tsos,hit) : true);
167 }
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
void SeedFromConsecutiveHitsCreator::init ( const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
virtual

Implements SeedCreator.

Definition at line 26 of file SeedFromConsecutiveHitsCreator.cc.

References bfield, filter, edm::EventSetup::get(), isBOFF, mfName_, nomField, propagatorHandle, region, thePropagatorLabel, and tracker.

Referenced by SeedGeneratorFromProtoTracksEDProducer::produce().

28  {
29  region = &iregion;
30  filter = ifilter;
31  // get tracker
33  // get propagator
35  // mag field
37  // edm::ESInputTag mfESInputTag(mfName_);
38  // es.get<IdealMagneticFieldRecord>().get(mfESInputTag, bfield);
39  nomField = bfield->nominalValue();
40  isBOFF = (0==nomField);
41 }
edm::ESHandle< Propagator > propagatorHandle
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< TrackerGeometry > tracker
edm::ESHandle< MagneticField > bfield
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 89 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

90 {
91  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
92  // information.
93  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
94 
95 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
96 // to avoid instabilities.
97 // N.B. This parameter needs optimising ...
98  // Probably OK based on quick study: KS 22/11/12.
99  float sin2th = sin2Theta;
100  float minC00 = sqr(theMinOneOverPtError);
101  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
102  float zErr = sqr(region->originZBound());
103  float transverseErr = sqr(theOriginTransverseErrorMultiplier*region->originRBound());
104  C[3][3] = transverseErr;
105  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
106 
107  return CurvilinearTrajectoryError(C);
108 }
float originRBound() const
bounds the particle vertex in the transverse plane
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const T & max(const T &a, const T &b)
float originZBound() const
bounds the particle vertex in the longitudinal plane
float ptMin() const
minimal pt of interest
Square< F >::type sqr(const F &f)
Definition: Square.h:13
bool SeedFromConsecutiveHitsCreator::initialKinematic ( GlobalTrajectoryParameters kine,
const SeedingHitSet hits 
) const
privatevirtual

Reimplemented in GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.

Definition at line 60 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().

61  {
62 
65 
66  const GlobalPoint& vertexPos = region->origin();
67 
68  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
69  if (helix.isValid()) {
70  kine = helix.stateAtVertex();
71  } else {
72  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
73  initMomentum *= (100./initMomentum.perp());
74  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
75  }
76 
77  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
79  kine.momentum().unit() * theBOFFMomentum,
80  kine.charge(),
81  &*bfield);
82  }
83  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
84 }
GlobalPoint const & origin() const
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
#define unlikely(x)
Definition: Likely.h:21
Vector3DBase unit() const
Definition: Vector3DBase.h:57
edm::ESHandle< MagneticField > bfield
void SeedFromConsecutiveHitsCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
virtual

Implements SeedCreator.

Definition at line 43 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), relativeConstraints::error, initialError(), initialKinematic(), PV3DBase< T, PVType, FrameType >::mag2(), GlobalTrajectoryParameters::momentum(), PV3DBase< T, PVType, FrameType >::perp2(), and SeedingHitSet::size().

Referenced by SeedGeneratorFromProtoTracksEDProducer::produce().

44  {
45  if ( hits.size() < 2) return;
46 
48  if (!initialKinematic(kine, hits)) return;
49 
50  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
51 
53  FreeTrajectoryState fts(kine, error);
54 
55  buildSeed(seedCollection,hits,fts);
56 }
T mag2() const
Definition: PV3DBase.h:66
virtual bool initialKinematic(GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
T perp2() const
Definition: PV3DBase.h:71
void buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const dso_hidden
CurvilinearTrajectoryError initialError(float sin2Theta) const dso_hidden
unsigned int size() const
Definition: SeedingHitSet.h:41
TransientTrackingRecHit::RecHitPointer SeedFromConsecutiveHitsCreator::refitHit ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrajectoryStateOnSurface state 
) const
private

Definition at line 154 of file SeedFromConsecutiveHitsCreator.cc.

Referenced by buildSeed().

157 {
158  return hit->clone(state);
159 }

Member Data Documentation

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

Definition at line 90 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and initialKinematic().

const SeedComparitor* SeedFromConsecutiveHitsCreator::filter = nullptr
protected
bool SeedFromConsecutiveHitsCreator::isBOFF = false
protected

Definition at line 92 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and initialKinematic().

std::string SeedFromConsecutiveHitsCreator::mfName_
protected

Definition at line 94 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and SeedFromConsecutiveHitsCreator().

float SeedFromConsecutiveHitsCreator::nomField
protected

Definition at line 91 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and initialKinematic().

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

Definition at line 89 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

const TrackingRegion* SeedFromConsecutiveHitsCreator::region = nullptr
protected

Definition at line 86 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), initialError(), and initialKinematic().

double SeedFromConsecutiveHitsCreator::theBOFFMomentum
protected

Definition at line 82 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialKinematic().

double SeedFromConsecutiveHitsCreator::theMinOneOverPtError
protected

Definition at line 84 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

double SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 83 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 81 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 88 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

bool SeedFromConsecutiveHitsCreator::useSimpleMF_
protected

Definition at line 93 of file SeedFromConsecutiveHitsCreator.h.

Referenced by SeedFromConsecutiveHitsCreator().