CMS 3D CMS Logo

SeedFromConsecutiveHitsCreator.cc
Go to the documentation of this file.
3 
18 
19 namespace {
20 
21  template <class T>
22  inline T sqr(T t) {
23  return t * t;
24  }
25 
26 } // namespace
27 
29 
31  desc.add<std::string>("propagator", "PropagatorWithMaterialParabolicMf");
32  desc.add<double>("SeedMomentumForBOFF", 5.0);
33  desc.add<double>("OriginTransverseErrorMultiplier", 1.0);
34  desc.add<double>("MinOneOverPtError", 1.0);
35  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
36  desc.add<std::string>("magneticField", "ParabolicMf");
37  desc.add<bool>("forceKinematicWithRegionDirection", false);
38 }
39 
41  const edm::EventSetup& es,
42  const SeedComparitor* ifilter) {
43  region = &iregion;
44  filter = ifilter;
45  // get tracker
47  // get propagator
49  // mag field
51  // edm::ESInputTag mfESInputTag(mfName_);
52  // es.get<IdealMagneticFieldRecord>().get(mfESInputTag, bfield);
54  isBOFF = (0 == nomField);
55 
57  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
58  auto builder = (TkTransientTrackingRecHitBuilder const*)(builderH.product());
59  cloner = (*builder).cloner();
60 }
61 
63  if (hits.size() < 2)
64  return;
65 
67  if (!initialKinematic(kine, hits))
68  return;
69 
70  auto sin2Theta = kine.momentum().perp2() / kine.momentum().mag2();
71 
73  FreeTrajectoryState fts(kine, error);
74 
75  if (region->direction().x() != 0 &&
76  forceKinematicWithRegionDirection_) // a direction was given, check if it is an etaPhi region
77  {
78  const RectangularEtaPhiTrackingRegion* etaPhiRegion = dynamic_cast<const RectangularEtaPhiTrackingRegion*>(region);
79  if (etaPhiRegion) {
80  //the following completely reset the kinematics, perhaps it makes no sense and newKine=kine would do better
81  GlobalVector direction = region->direction() / region->direction().mag();
82  GlobalVector momentum = direction * fts.momentum().mag();
83  GlobalPoint position = region->origin() + 5 * direction;
84  GlobalTrajectoryParameters newKine(position, momentum, fts.charge(), &fts.parameters().magneticField());
85 
86  auto ptMin = region->ptMin();
87  CurvilinearTrajectoryError newError; //zeroed
88  auto& C = newError.matrix();
89  constexpr float minC00 = 0.4f;
90  C[0][0] = std::max(sin2Theta / sqr(ptMin), minC00);
91  auto zErr = sqr(region->originZBound());
92  auto transverseErr = sqr(region->originRBound()); // assume equal cxx cyy
93  auto twiceDeltaLambda =
94  std::atan(etaPhiRegion->tanLambdaRange().first) - std::atan(etaPhiRegion->tanLambdaRange().second);
95  auto twiceDeltaPhi = etaPhiRegion->phiMargin().right() + etaPhiRegion->phiMargin().left();
96  C[1][1] = twiceDeltaLambda * twiceDeltaLambda; //2 sigma of what given in input
97  C[2][2] = twiceDeltaPhi * twiceDeltaPhi;
98  C[3][3] = transverseErr;
99  C[4][4] = zErr * sin2Theta + transverseErr * (1.f - sin2Theta);
100  fts = FreeTrajectoryState(newKine, newError);
101  }
102  }
103 
105 }
106 
108  const SeedingHitSet& hits) const {
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 =
126  }
127  return (filter ? filter->compatible(hits, kine, helix) : true);
128 }
129 
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 }
151 
153  const SeedingHitSet& hits,
154  const FreeTrajectoryState& fts) const {
155  const Propagator* propagator = &(*propagatorHandle);
156 
157  // get updator
159 
160  // Now update initial state track using information from seed hits.
161 
162  TrajectoryStateOnSurface updatedState;
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 
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 =
192  trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId());
193  seedCollection.emplace_back(PTraj, std::move(seedHits), alongMomentum);
194 }
195 
197  const TrajectoryStateOnSurface& state) const {
199 }
200 
203  return (filter ? filter->compatible(tsos, hit) : true);
204 }
Vector3DBase
Definition: Vector3DBase.h:8
TrackingRegion::origin
GlobalPoint const & origin() const
Definition: TrackingRegion.h:74
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
Likely.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
TrajectoryStateOnSurface.h
MessageLogger.h
RectangularEtaPhiTrackingRegion
Definition: RectangularEtaPhiTrackingRegion.h:25
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
FastHelix.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingHitSet
Definition: SeedingHitSet.h:6
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
FastHelix
Definition: FastHelix.h:26
SeedFromConsecutiveHitsCreator::init
void init(const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) final
Definition: SeedFromConsecutiveHitsCreator.cc:40
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
TransientRecHitRecord.h
SeedingHitSet::ConstRecHitPointer
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
GlobalTrajectoryParameters::charge
TrackCharge charge() const
Definition: GlobalTrajectoryParameters.h:72
SeedFromConsecutiveHitsCreator.h
SeedFromConsecutiveHitsCreator::theBOFFMomentum
float theBOFFMomentum
Definition: SeedFromConsecutiveHitsCreator.h:64
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
SeedFromConsecutiveHitsCreator::isBOFF
bool isBOFF
Definition: SeedFromConsecutiveHitsCreator.h:74
SeedFromConsecutiveHitsCreator::filter
const SeedComparitor * filter
Definition: SeedFromConsecutiveHitsCreator.h:69
RectangularEtaPhiTrackingRegion::phiMargin
const Margin & phiMargin() const
Definition: RectangularEtaPhiTrackingRegion.h:171
SeedComparitor::compatible
virtual bool compatible(const SeedingHitSet &hits) const =0
SeedFromConsecutiveHitsCreator::thePropagatorLabel
std::string thePropagatorLabel
Definition: SeedFromConsecutiveHitsCreator.h:63
PV3DBase::mag2
T mag2() const
Definition: PV3DBase.h:63
relativeConstraints.error
error
Definition: relativeConstraints.py:53
SeedFromConsecutiveHitsCreator::tracker
edm::ESHandle< TrackerGeometry > tracker
Definition: SeedFromConsecutiveHitsCreator.h:70
TkTransientTrackingRecHitBuilder
Definition: TkTransientTrackingRecHitBuilder.h:15
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
Propagator
Definition: Propagator.h:44
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TkTrackingRegionsMargin::left
const T & left() const
Definition: TkTrackingRegionsMargin.h:18
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
SeedFromConsecutiveHitsCreator::makeSeed
void makeSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) final
Definition: SeedFromConsecutiveHitsCreator.cc:62
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
BaseTrackerRecHit
Definition: BaseTrackerRecHit.h:15
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
SeedComparitor
Definition: SeedComparitor.h:25
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:16
IdealMagneticFieldRecord.h
edm::ESHandle< TransientTrackingRecHitBuilder >
MagneticField::nominalValue
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
SeedFromConsecutiveHitsCreator::bfield
edm::ESHandle< MagneticField > bfield
Definition: SeedFromConsecutiveHitsCreator.h:72
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
SeedFromConsecutiveHitsCreator::buildSeed
void buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts) const
Definition: SeedFromConsecutiveHitsCreator.cc:152
SeedFromConsecutiveHitsCreator::cloner
TkClonerImpl cloner
Definition: SeedFromConsecutiveHitsCreator.h:79
TrackingRegion::ptMin
float ptMin() const
minimal pt of interest
Definition: TrackingRegion.h:83
Point3DBase< float, GlobalTag >
ParameterSetDescription.h
TrackingRegion::originRBound
float originRBound() const
bounds the particle vertex in the transverse plane
Definition: TrackingRegion.h:77
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
SeedFromConsecutiveHitsCreator::checkHit
bool checkHit(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const
Definition: SeedFromConsecutiveHitsCreator.cc:201
SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator
~SeedFromConsecutiveHitsCreator() override
Definition: SeedFromConsecutiveHitsCreator.cc:28
HLT_FULL_cff.updator
updator
Definition: HLT_FULL_cff.py:123
TrackerDigiGeometryRecord.h
KFUpdator.h
SeedFromConsecutiveHitsCreator::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &desc)
Definition: SeedFromConsecutiveHitsCreator.cc:30
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
TrackingRegion::originZBound
float originZBound() const
bounds the particle vertex in the longitudinal plane
Definition: TrackingRegion.h:80
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
TrackingRegion::direction
GlobalVector const & direction() const
the direction around which region is constructed
Definition: TrackingRegion.h:65
FreeTrajectoryState::parameters
const GlobalTrajectoryParameters & parameters() const
Definition: FreeTrajectoryState.h:79
SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
float theOriginTransverseErrorMultiplier
Definition: SeedFromConsecutiveHitsCreator.h:65
SeedFromConsecutiveHitsCreator::region
const TrackingRegion * region
Definition: SeedFromConsecutiveHitsCreator.h:68
RectangularEtaPhiTrackingRegion.h
SeedFromConsecutiveHitsCreator::TTRHBuilder
std::string TTRHBuilder
Definition: SeedFromConsecutiveHitsCreator.h:75
RectangularEtaPhiTrackingRegion::tanLambdaRange
const Range & tanLambdaRange() const
Definition: RectangularEtaPhiTrackingRegion.h:167
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
TkTrackingRegionsMargin::right
const T & right() const
Definition: TkTrackingRegionsMargin.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SeedFromConsecutiveHitsCreator::theMinOneOverPtError
float theMinOneOverPtError
Definition: SeedFromConsecutiveHitsCreator.h:66
SeedFromConsecutiveHitsCreator::refitHit
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
Definition: SeedFromConsecutiveHitsCreator.cc:196
TrackingRecHit
Definition: TrackingRecHit.h:21
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
SeedComparitor.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ESInputTag.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
gen::C
C
Definition: PomwigHadronizer.cc:78
SeedFromConsecutiveHitsCreator::forceKinematicWithRegionDirection_
bool forceKinematicWithRegionDirection_
Definition: SeedFromConsecutiveHitsCreator.h:77
T
long double T
Definition: Basic3DVectorLD.h:48
TrackingComponentsRecord.h
SeedFromConsecutiveHitsCreator::nomField
float nomField
Definition: SeedFromConsecutiveHitsCreator.h:73
SeedFromConsecutiveHitsCreator::initialError
CurvilinearTrajectoryError initialError(float sin2Theta) const
Definition: SeedFromConsecutiveHitsCreator.cc:130
TrajectoryStateTransform.h
GlobalTrajectoryParameters::magneticField
const MagneticField & magneticField() const
Definition: GlobalTrajectoryParameters.h:106
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
TrackingRegion
Definition: TrackingRegion.h:41
TrackingRegion.h
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
SeedFromConsecutiveHitsCreator::initialKinematic
virtual bool initialKinematic(GlobalTrajectoryParameters &kine, const SeedingHitSet &hits) const
Definition: SeedFromConsecutiveHitsCreator.cc:107
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
SeedFromConsecutiveHitsCreator::mfName_
std::string mfName_
Definition: SeedFromConsecutiveHitsCreator.h:76
alongMomentum
Definition: PropagationDirection.h:4
KFUpdator
Definition: KFUpdator.h:32
CurvilinearTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: CurvilinearTrajectoryError.h:61
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
PV3DBase::perp2
T perp2() const
Definition: PV3DBase.h:68
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >
SeedFromConsecutiveHitsCreator::propagatorHandle
edm::ESHandle< Propagator > propagatorHandle
Definition: SeedFromConsecutiveHitsCreator.h:71
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12