test
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 SeedFromConsecutiveHitsStraightLineCreator SeedFromConsecutiveHitsTripletOnlyCreator

Public Member Functions

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

Protected Attributes

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

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 21 of file SeedFromConsecutiveHitsCreator.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file SeedFromConsecutiveHitsCreator.h.

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

25  : thePropagatorLabel (cfg.getParameter<std::string>("propagator"))
26  , theBOFFMomentum (cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
27  , theOriginTransverseErrorMultiplier(cfg.existsAs<double>("OriginTransverseErrorMultiplier") ? cfg.getParameter<double>("OriginTransverseErrorMultiplier") : 1.0)
28  , theMinOneOverPtError (cfg.existsAs<double>("MinOneOverPtError") ? cfg.getParameter<double>("MinOneOverPtError") : 1.0)
29  , TTRHBuilder (cfg.existsAs<std::string>("TTRHBuilder") ? cfg.getParameter<std::string>("TTRHBuilder") : std::string("WithTrackAngle"))
30  // 2014/02/11 mia:
31  // we should get rid of the boolean parameter useSimpleMF,
32  // and use only a string magneticField [instead of SimpleMagneticField]
33  // or better an edm::ESInputTag (at the moment HLT does not handle ESInputTag)
34  , useSimpleMF_(false)
35  , mfName_("")
36  {
37  if (cfg.exists("SimpleMagneticField")) {
38  useSimpleMF_ = true;
39  mfName_ = cfg.getParameter<std::string>("SimpleMagneticField");
40  }
41  }
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,
const std::string &  bname = "WithTrackAngle" 
)
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 122 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

126 {
127  const Propagator* propagator = &(*propagatorHandle);
128 
129  // get updator
130  KFUpdator updator;
131 
132  // Now update initial state track using information from seed hits.
133 
134  TrajectoryStateOnSurface updatedState;
136 
137  const TrackingRecHit* hit = 0;
138  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
139  hit = hits[iHit]->hit();
140  TrajectoryStateOnSurface state = (iHit==0) ?
141  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
142  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
143  if (!state.isValid()) return;
144 
145  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
146 
147  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit( tth, state));
148 
149  if (!checkHit(state,&*newtth)) return;
150 
151  updatedState = updator.update(state, *newtth);
152  if (!updatedState.isValid()) return;
153 
154  seedHits.push_back(newtth.release());
155 
156  }
157 
158 
159  PTrajectoryStateOnDet const & PTraj =
161  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
162  if ( !filter || filter->compatible(seed)) seedCollection.push_back(std::move(seed));
163 
164 }
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
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:274
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:10
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
edm::ESHandle< TrackerGeometry > tracker
unsigned int size() const
Definition: SeedingHitSet.h:44
DetId geographicalId() const
bool checkHit(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface tsos,
SeedingHitSet::ConstRecHitPointer  hit 
) const
private

Definition at line 174 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

177 {
178  return (filter ? filter->compatible(tsos,hit) : true);
179 }
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, cloner, filter, edm::EventSetup::get(), isBOFF, mfName_, nomField, edm::ESHandle< class >::product(), propagatorHandle, region, thePropagatorLabel, tracker, and TTRHBuilder.

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 
43  try { // one sure we need to propagate the ocnfig to HLT
44  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
45  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
46  cloner = (*builder).cloner();
47  } catch(...) {
48  es.get<TransientRecHitRecord>().get("hltESPTTRHBWithTrackAngle", builderH);
49  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
50  cloner = (*builder).cloner();
51  }
52 
53 }
edm::ESHandle< Propagator > propagatorHandle
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::ESHandle< TrackerGeometry > tracker
edm::ESHandle< MagneticField > bfield
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 101 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

102 {
103  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
104  // information.
105  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
106 
107 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
108 // to avoid instabilities.
109 // N.B. This parameter needs optimising ...
110  // Probably OK based on quick study: KS 22/11/12.
111  float sin2th = sin2Theta;
112  float minC00 = sqr(theMinOneOverPtError);
113  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
114  float zErr = sqr(region->originZBound());
115  float transverseErr = sqr(theOriginTransverseErrorMultiplier*region->originRBound());
116  C[3][3] = transverseErr;
117  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
118 
119  return CurvilinearTrajectoryError(C);
120 }
float originRBound() const
bounds the particle vertex in the transverse plane
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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 SeedFromConsecutiveHitsStraightLineCreator, and SeedFromConsecutiveHitsTripletOnlyCreator.

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

73  {
74 
75  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
76  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
77 
78  const GlobalPoint& vertexPos = region->origin();
79 
80  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
81  if (helix.isValid()) {
82  kine = helix.stateAtVertex();
83  } else {
84  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
85  initMomentum *= (100./initMomentum.perp());
86  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
87  }
88 
89  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
91  kine.momentum().unit() * theBOFFMomentum,
92  kine.charge(),
93  &*bfield);
94  }
95  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
96 }
GlobalPoint const & origin() const
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
#define unlikely(x)
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
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 55 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().

56  {
57  if ( hits.size() < 2) return;
58 
60  if (!initialKinematic(kine, hits)) return;
61 
62  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
63 
65  FreeTrajectoryState fts(kine, error);
66 
67  buildSeed(seedCollection,hits,fts);
68 }
T mag2() const
Definition: PV3DBase.h:66
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:71
CurvilinearTrajectoryError initialError(float sin2Theta) const
unsigned int size() const
Definition: SeedingHitSet.h:44
SeedingHitSet::RecHitPointer SeedFromConsecutiveHitsCreator::refitHit ( SeedingHitSet::ConstRecHitPointer  hit,
const TrajectoryStateOnSurface state 
) const
private

Definition at line 167 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 106 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and refitHit().

const SeedComparitor* SeedFromConsecutiveHitsCreator::filter = 0
protected
bool SeedFromConsecutiveHitsCreator::isBOFF = false
protected
std::string SeedFromConsecutiveHitsCreator::mfName_
protected

Definition at line 104 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and SeedFromConsecutiveHitsCreator().

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

Definition at line 98 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 93 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

double SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 92 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 90 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 97 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 102 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

bool SeedFromConsecutiveHitsCreator::useSimpleMF_
protected

Definition at line 103 of file SeedFromConsecutiveHitsCreator.h.

Referenced by SeedFromConsecutiveHitsCreator().