CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void init (const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) final
 
virtual void makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) final
 
 SeedFromConsecutiveHitsCreator (const edm::ParameterSet &cfg)
 
virtual ~SeedFromConsecutiveHitsCreator ()
 
- 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
 
double theBOFFMomentum
 
double theMinOneOverPtError
 
double 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.

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 ( )
virtual

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 160 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

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

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

215 {
216  return (filter ? filter->compatible(tsos,hit) : true);
217 }
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

Definition at line 38 of file SeedFromConsecutiveHitsCreator.h.

38 { return "ConsecutiveHits"; }
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, edm::ESHandle< class >::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);
51  nomField = bfield->nominalValue();
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 }
edm::ESHandle< Propagator > propagatorHandle
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< TrackerGeometry > tracker
edm::ESHandle< MagneticField > bfield
CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError ( float  sin2Theta) const
private

Definition at line 139 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

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

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

111  {
112 
113  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
114  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
115 
116  const GlobalPoint& vertexPos = region->origin();
117 
118  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
119  if (helix.isValid()) {
120  kine = helix.stateAtVertex();
121  } else {
122  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
123  initMomentum *= (100./initMomentum.perp());
124  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
125  }
126 
127  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
128  kine = GlobalTrajectoryParameters(kine.position(),
129  kine.momentum().unit() * theBOFFMomentum,
130  kine.charge(),
131  &*bfield);
132  }
133  return (filter ? filter->compatible(hits, kine, helix) : true);
134 }
GlobalPoint const & origin() const
virtual bool compatible(const SeedingHitSet &hits) 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 
)
finalvirtual

Implements SeedCreator.

Definition at line 61 of file SeedFromConsecutiveHitsCreator.cc.

References buildSeed(), funct::C, FreeTrajectoryState::charge(), spr::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().

62  {
63  if ( hits.size() < 2) return;
64 
66  if (!initialKinematic(kine, hits)) return;
67 
68  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
69 
71  FreeTrajectoryState fts(kine, error);
72  if(region->direction().x()!=0 && forceKinematicWithRegionDirection_) // a direction was given, check if it is an etaPhi region
73  {
74  const RectangularEtaPhiTrackingRegion * etaPhiRegion = dynamic_cast<const RectangularEtaPhiTrackingRegion *>(region);
75  if(etaPhiRegion) {
76 
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  GlobalError vertexErr( sqr(region->originRBound()), 0, sqr(region->originRBound()),
84  0, 0, sqr(region->originZBound()));
85 
86  float ptMin = region->ptMin();
87  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
88 
89  float minC00 = 0.4;
90  C[0][0] = std::max(sin2Theta/sqr(ptMin), minC00);
91  float zErr = vertexErr.czz();
92  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
93  float deltaEta = (etaPhiRegion->etaRange().first-etaPhiRegion->etaRange().second)/2.;
94  float deltaPhi = (etaPhiRegion->phiMargin().right()+etaPhiRegion->phiMargin().left())/2.;
95  C[1][1] = deltaEta*deltaEta*4; //2 sigma of what given in input
96  C[2][2] = deltaPhi*deltaPhi*4;
97  C[3][3] = transverseErr;
98  C[4][4] = zErr*sin2Theta + transverseErr*(1-sin2Theta);
99  CurvilinearTrajectoryError newError(C);
100  fts = FreeTrajectoryState(newKine,newError);
101  }
102  }
103 
104 
105  buildSeed(seedCollection,hits,fts);
106 }
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
static const double deltaEta
Definition: CaloConstants.h:8
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:46
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 205 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
double SeedFromConsecutiveHitsCreator::theBOFFMomentum
protected
double SeedFromConsecutiveHitsCreator::theMinOneOverPtError
protected

Definition at line 77 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

double 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().