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

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

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

Referenced by makeSeed().

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

References SeedComparitor::compatible(), and filter.

Referenced by buildSeed().

205 {
206  return (filter ? filter->compatible(tsos,hit) : true);
207 }
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
void SeedFromConsecutiveHitsCreator::init ( const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
finalvirtual

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.

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  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
45  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
46  cloner = (*builder).cloner();
47 
48 }
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 128 of file SeedFromConsecutiveHitsCreator.cc.

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

Referenced by makeSeed().

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

100  {
101 
102  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
103  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
104 
105  const GlobalPoint& vertexPos = region->origin();
106 
107  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield);
108  if (helix.isValid()) {
109  kine = helix.stateAtVertex();
110  } else {
111  GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
112  initMomentum *= (100./initMomentum.perp());
113  kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield);
114  }
115 
116  if unlikely(isBOFF && (theBOFFMomentum > 0)) {
117  kine = GlobalTrajectoryParameters(kine.position(),
118  kine.momentum().unit() * theBOFFMomentum,
119  kine.charge(),
120  &*bfield);
121  }
122  return (filter ? filter->compatible(hits, kine, helix, *region) : true);
123 }
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 
)
finalvirtual

Implements SeedCreator.

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

51  {
52  if ( hits.size() < 2) return;
53 
55  if (!initialKinematic(kine, hits)) return;
56 
57  float sin2Theta = kine.momentum().perp2()/kine.momentum().mag2();
58 
60  FreeTrajectoryState fts(kine, error);
61  if(region->direction().x()!=0 && forceKinematicWithRegionDirection_) // a direction was given, check if it is an etaPhi region
62  {
63  const RectangularEtaPhiTrackingRegion * etaPhiRegion = dynamic_cast<const RectangularEtaPhiTrackingRegion *>(region);
64  if(etaPhiRegion) {
65 
66  //the following completely reset the kinematics, perhaps it makes no sense and newKine=kine would do better
67  GlobalVector direction=region->direction()/region->direction().mag();
68  GlobalVector momentum=direction*fts.momentum().mag();
69  GlobalPoint position=region->origin()+5*direction;
70  GlobalTrajectoryParameters newKine(position,momentum,fts.charge(),&fts.parameters().magneticField());
71 
72  GlobalError vertexErr( sqr(region->originRBound()), 0, sqr(region->originRBound()),
73  0, 0, sqr(region->originZBound()));
74 
75  float ptMin = region->ptMin();
76  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
77 
78  float minC00 = 0.4;
79  C[0][0] = std::max(sin2Theta/sqr(ptMin), minC00);
80  float zErr = vertexErr.czz();
81  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
82  float deltaEta = (etaPhiRegion->etaRange().first-etaPhiRegion->etaRange().second)/2.;
83  float deltaPhi = (etaPhiRegion->phiMargin().right()+etaPhiRegion->phiMargin().left())/2.;
84  C[1][1] = deltaEta*deltaEta*4; //2 sigma of what given in input
85  C[2][2] = deltaPhi*deltaPhi*4;
86  C[3][3] = transverseErr;
87  C[4][4] = zErr*sin2Theta + transverseErr*(1-sin2Theta);
88  CurvilinearTrajectoryError newError(C);
89  fts = FreeTrajectoryState(newKine,newError);
90  }
91  }
92 
93 
94  buildSeed(seedCollection,hits,fts);
95 }
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 195 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 87 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init(), and refitHit().

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

Definition at line 85 of file SeedFromConsecutiveHitsCreator.h.

Referenced by makeSeed().

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

Definition at line 84 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 79 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 74 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

double SeedFromConsecutiveHitsCreator::theOriginTransverseErrorMultiplier
protected

Definition at line 73 of file SeedFromConsecutiveHitsCreator.h.

Referenced by initialError().

std::string SeedFromConsecutiveHitsCreator::thePropagatorLabel
protected

Definition at line 71 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().

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

Definition at line 78 of file SeedFromConsecutiveHitsCreator.h.

Referenced by buildSeed(), and init().

std::string SeedFromConsecutiveHitsCreator::TTRHBuilder
protected

Definition at line 83 of file SeedFromConsecutiveHitsCreator.h.

Referenced by init().