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

Constructor & Destructor Documentation

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

Definition at line 24 of file SeedFromConsecutiveHitsCreator.h.

References fillDescriptions().

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

Definition at line 26 of file SeedFromConsecutiveHitsCreator.cc.

26 {}

Member Function Documentation

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

Definition at line 158 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

162 {
163  const Propagator* propagator = &(*propagatorHandle);
164 
165  // get updator
167 
168  // Now update initial state track using information from seed hits.
169 
172 
173  const TrackingRecHit* hit = nullptr;
174  for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) {
175  hit = hits[iHit]->hit();
176  TrajectoryStateOnSurface state = (iHit==0) ?
177  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
178  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
179  if (!state.isValid()) return;
180 
181  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
182 
183  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit( tth, state));
184 
185  if (!checkHit(state,&*newtth)) return;
186 
187  updatedState = updator.update(state, *newtth);
188  if (!updatedState.isValid()) return;
189 
190  seedHits.push_back(newtth.release());
191 
192  }
193 
194  if(!hit) return;
195 
196  PTrajectoryStateOnDet const & PTraj =
198  seedCollection.emplace_back(PTraj,std::move(seedHits),alongMomentum);
199 
200 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
void push_back(D *&d)
Definition: OwnVector.h:290
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:169
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
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:53
unsigned int size() const
Definition: SeedingHitSet.h:46
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const
def move(src, dest)
Definition: eostools.py:510
bool checkHit(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
bool SeedFromConsecutiveHitsCreator::checkHit ( const TrajectoryStateOnSurface tsos,
SeedingHitSet::ConstRecHitPointer  hit 
) const
private

Definition at line 210 of file SeedFromConsecutiveHitsCreator.cc.

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

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

Definition at line 28 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by SeedFromConsecutiveHitsTripletOnlyCreator::fillDescriptions().

28  {
29  desc.add<std::string>("propagator", "PropagatorWithMaterialParabolicMf");
30  desc.add<double>("SeedMomentumForBOFF", 5.0);
31  desc.add<double>("OriginTransverseErrorMultiplier", 1.0);
32  desc.add<double>("MinOneOverPtError", 1.0);
33  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
34  desc.add<std::string>("magneticField", "ParabolicMf");
35  desc.add<bool>("forceKinematicWithRegionDirection", false);
36 }
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 38 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.

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

Definition at line 135 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

136 {
137  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
138  // information.
139  CurvilinearTrajectoryError newError; // zeroed
140  auto & C = newError.matrix();
141 
142 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
143 // to avoid instabilities.
144 // N.B. This parameter needs optimising ...
145  // Probably OK based on quick study: KS 22/11/12.
146  auto sin2th = sin2Theta;
147  auto minC00 = sqr(theMinOneOverPtError);
148  C[0][0] = std::max(sin2th/sqr(region->ptMin()), minC00);
149  auto zErr = sqr(region->originZBound());
151  C[1][1] = C[2][2] = 1.; // no good reason. no bad reason....
152  C[3][3] = transverseErr;
153  C[4][4] = zErr*sin2th + transverseErr*(1.f-sin2th);
154 
155  return newError;
156 }
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:13
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 
109  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
110  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
111 
112  const GlobalPoint& vertexPos = region->origin();
113 
114  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
115  if (helix.isValid()) {
116  kine = helix.stateAtVertex();
117  } else {
118  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
119  initMomentum *= (100.f/initMomentum.perp());
120  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
121  }
122 
123  if UNLIKELY(isBOFF && (theBOFFMomentum > 0)) {
124  kine = GlobalTrajectoryParameters(kine.position(),
125  kine.momentum().unit() * theBOFFMomentum,
126  kine.charge(),
127  &*bfield);
128  }
129  return (filter ? filter->compatible(hits, kine, helix) : true);
130 }
GlobalPoint const & origin() const
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
virtual bool compatible(const SeedingHitSet &hits) const =0
Vector3DBase unit() const
Definition: Vector3DBase.h:57
edm::ESHandle< MagneticField > bfield
#define UNLIKELY(x)
void SeedFromConsecutiveHitsCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
finalvirtual

Implements SeedCreator.

Definition at line 61 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), patCaloMETCorrections_cff::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().

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

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

Referenced by init(), and refitHit().

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

Definition at line 88 of file SeedFromConsecutiveHitsCreator.h.

Referenced by makeSeed().

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

Definition at line 87 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 82 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 77 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

float SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 76 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 74 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 81 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 86 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().