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 forceKinematicWithRegionDirection_
 
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(), and AlCaHLTBitMon_QueryRunRegistry::string.

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  , forceKinematicWithRegionDirection_(cfg.existsAs<bool>("forceKinematicWithRegionDirection") ? cfg.getParameter<bool>("forceKinematicWithRegionDirection") : false)
37  {
38  if (cfg.exists("SimpleMagneticField")) {
39  useSimpleMF_ = true;
40  mfName_ = cfg.getParameter<std::string>("SimpleMagneticField");
41  }
42  }
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 25 of file SeedFromConsecutiveHitsCreator.cc.

25 {}

Member Function Documentation

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

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

159 {
160  const Propagator* propagator = &(*propagatorHandle);
161 
162  // get updator
163  KFUpdator updator;
164 
165  // Now update initial state track using information from seed hits.
166 
167  TrajectoryStateOnSurface updatedState;
169 
170  const TrackingRecHit* hit = 0;
171  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
172  hit = hits[iHit]->hit();
173  TrajectoryStateOnSurface state = (iHit==0) ?
174  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
175  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
176  if (!state.isValid()) return;
177 
178  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
179 
180  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit( tth, state));
181 
182  if (!checkHit(state,&*newtth)) return;
183 
184  updatedState = updator.update(state, *newtth);
185  if (!updatedState.isValid()) return;
186 
187  seedHits.push_back(newtth.release());
188 
189  }
190 
191 
192  PTrajectoryStateOnDet const & PTraj =
194  TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum);
195  if ( !filter || filter->compatible(seed)) seedCollection.push_back(std::move(seed));
196 
197 }
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:280
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
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 207 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

210 {
211  return (filter ? filter->compatible(tsos,hit) : true);
212 }
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 27 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().

29  {
30  region = &iregion;
31  filter = ifilter;
32  // get tracker
34  // get propagator
36  // mag field
38  // edm::ESInputTag mfESInputTag(mfName_);
39  // es.get<IdealMagneticFieldRecord>().get(mfESInputTag, bfield);
40  nomField = bfield->nominalValue();
41  isBOFF = (0==nomField);
42 
44  try { // one sure we need to propagate the ocnfig to HLT
45  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
46  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
47  cloner = (*builder).cloner();
48  } catch(...) {
49  es.get<TransientRecHitRecord>().get("hltESPTTRHBWithTrackAngle", builderH);
50  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
51  cloner = (*builder).cloner();
52  }
53 
54 }
edm::ESHandle< Propagator > propagatorHandle
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< TrackerGeometry > tracker
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 134 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

135 {
136  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
137  // information.
138  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
139 
140 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
141 // to avoid instabilities.
142 // N.B. This parameter needs optimising ...
143  // Probably OK based on quick study: KS 22/11/12.
144  float sin2th = sin2Theta;
145  float minC00 = sqr(theMinOneOverPtError);
146  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
147  float zErr = sqr(region->originZBound());
148  float transverseErr = sqr(theOriginTransverseErrorMultiplier*region->originRBound());
149  C[3][3] = transverseErr;
150  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
151 
152  return CurvilinearTrajectoryError(C);
153 }
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 105 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().

106  {
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./initMomentum.perp());
119  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
120  }
121 
122  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
123  kine = GlobalTrajectoryParameters(kine.position(),
124  kine.momentum().unit() * theBOFFMomentum,
125  kine.charge(),
126  &*bfield);
127  }
128  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
129 }
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
void SeedFromConsecutiveHitsCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
virtual

Implements SeedCreator.

Definition at line 56 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), funct::C, FreeTrajectoryState::charge(), HLTFastRecoForTau_cff::deltaEta, SiPixelRawToDigiRegional_cfi::deltaPhi, TrackingRegion::direction(), relativeConstraints::error, RectangularEtaPhiTrackingRegion::etaRange(), forceKinematicWithRegionDirection_, initialError(), initialKinematic(), TkTrackingRegionsMargin< T >::left(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::mag2(), GlobalTrajectoryParameters::magneticField(), bookConverter::max, GlobalTrajectoryParameters::momentum(), FreeTrajectoryState::momentum(), TrackingRegion::origin(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), FreeTrajectoryState::parameters(), PV3DBase< T, PVType, FrameType >::perp2(), RectangularEtaPhiTrackingRegion::phiMargin(), position, PtMinSelector_cfg::ptMin, TrackingRegion::ptMin(), region, TkTrackingRegionsMargin< T >::right(), SeedingHitSet::size(), funct::sqr(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by SeedGeneratorFromProtoTracksEDProducer::produce().

57  {
58  if ( hits.size() < 2) return;
59 
61  if (!initialKinematic(kine, hits)) return;
62 
63  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
64 
66  FreeTrajectoryState fts(kine, error);
67  if(region->direction().x()!=0 && forceKinematicWithRegionDirection_) // a direction was given, check if it is an etaPhi region
68  {
69  const RectangularEtaPhiTrackingRegion * etaPhiRegion = dynamic_cast<const RectangularEtaPhiTrackingRegion *>(region);
70  if(etaPhiRegion) {
71 
72  //the following completely reset the kinematics, perhaps it makes no sense and newKine=kine would do better
73  GlobalVector direction=region->direction()/region->direction().mag();
74  GlobalVector momentum=direction*fts.momentum().mag();
75  GlobalPoint position=region->origin()+5*direction;
76  GlobalTrajectoryParameters newKine(position,momentum,fts.charge(),&fts.parameters().magneticField());
77 
78  GlobalError vertexErr( sqr(region->originRBound()), 0, sqr(region->originRBound()),
79  0, 0, sqr(region->originZBound()));
80 
81  float ptMin = region->ptMin();
82  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
83 
84  float minC00 = 0.4;
85  C[0][0] = std::max(sin2Theta/sqr(ptMin), minC00);
86  float zErr = vertexErr.czz();
87  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
88  float deltaEta = (etaPhiRegion->etaRange().first-etaPhiRegion->etaRange().second)/2.;
89  float deltaPhi = (etaPhiRegion->phiMargin().right()+etaPhiRegion->phiMargin().left())/2.;
90  C[1][1] = deltaEta*deltaEta*4; //2 sigma of what given in input
91  C[2][2] = deltaPhi*deltaPhi*4;
92  C[3][3] = transverseErr;
93  C[4][4] = zErr*sin2Theta + transverseErr*(1-sin2Theta);
94  CurvilinearTrajectoryError newError(C);
95  fts = FreeTrajectoryState(newKine,newError);
96  }
97  }
98 
99 
100  buildSeed(seedCollection,hits,fts);
101 }
float originRBound() const
bounds the particle vertex in the transverse plane
T mag2() const
Definition: PV3DBase.h:66
GlobalPoint const & origin() const
void buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const
virtual bool initialKinematic(GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T perp2() const
Definition: PV3DBase.h:71
CurvilinearTrajectoryError initialError(float sin2Theta) const
GlobalVector const & direction() const
the direction around which region is constructed
T mag() const
Definition: PV3DBase.h:67
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
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int size() const
Definition: SeedingHitSet.h:44
T x() const
Definition: PV3DBase.h:62
const Range & etaRange() const
allowed eta range [eta_min, eta_max] interval
SeedingHitSet::RecHitPointer SeedFromConsecutiveHitsCreator::refitHit ( SeedingHitSet::ConstRecHitPointer  hit,
const TrajectoryStateOnSurface state 
) const
private

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

Referenced by init(), and refitHit().

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

Definition at line 108 of file SeedFromConsecutiveHitsCreator.h.

Referenced by makeSeed().

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

Definition at line 107 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 101 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 96 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

double SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 95 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 93 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 100 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 105 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

bool SeedFromConsecutiveHitsCreator::useSimpleMF_
protected

Definition at line 106 of file SeedFromConsecutiveHitsCreator.h.