CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ClusterShapeTrackFilter Class Reference

#include <ClusterShapeTrackFilter.h>

Inheritance diagram for ClusterShapeTrackFilter:
PixelTrackFilter HIPixelTrackFilter

Public Member Functions

 ClusterShapeTrackFilter (const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
 
virtual bool operator() (const reco::Track *, const std::vector< const TrackingRecHit * > &hits, const TrackerTopology *tTopo) const
 
void update (const edm::Event &ev, const edm::EventSetup &es) override
 
virtual ~ClusterShapeTrackFilter ()
 
- Public Member Functions inherited from PixelTrackFilter
virtual bool operator() (const reco::Track *) const
 
virtual bool operator() (const reco::Track *, const Hits &) const
 
virtual bool operator() (const reco::Track *, const Hits &, const TrackerTopology *tTopo) const
 
virtual ~PixelTrackFilter ()
 

Private Member Functions

float areaParallelogram (const Global2DVector &a, const Global2DVector &b) const
 
std::vector< GlobalVectorgetGlobalDirs (const std::vector< GlobalPoint > &globalPoss) const
 
std::vector< GlobalPointgetGlobalPoss (const std::vector< const TrackingRecHit * > &recHits) const
 

Private Attributes

double ptMax
 
double ptMin
 
const SiPixelClusterShapeCachetheClusterShapeCache
 
edm::EDGetTokenT
< SiPixelClusterShapeCache
theClusterShapeCacheToken
 
const ClusterShapeHitFiltertheFilter
 
const TrackerGeometrytheTracker
 

Additional Inherited Members

- Public Types inherited from PixelTrackFilter
typedef std::vector< const
TrackingRecHit * > 
Hits
 

Detailed Description

Definition at line 27 of file ClusterShapeTrackFilter.h.

Constructor & Destructor Documentation

ClusterShapeTrackFilter::ClusterShapeTrackFilter ( const edm::ParameterSet ps,
edm::ConsumesCollector iC 
)

Definition at line 33 of file ClusterShapeTrackFilter.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), ptMax, and ptMin.

33  :
35  theTracker(nullptr),
36  theFilter(nullptr),
37  theClusterShapeCache(nullptr)
38 {
39  // Get ptMin if available
40  ptMin = (ps.exists("ptMin") ? ps.getParameter<double>("ptMin") : 0.);
41  ptMax = (ps.exists("ptMax") ? ps.getParameter<double>("ptMax") : 999999.);
42 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
const TrackerGeometry * theTracker
const ClusterShapeHitFilter * theFilter
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
const SiPixelClusterShapeCache * theClusterShapeCache
ClusterShapeTrackFilter::~ClusterShapeTrackFilter ( )
virtual

Definition at line 45 of file ClusterShapeTrackFilter.cc.

46 {
47 }

Member Function Documentation

float ClusterShapeTrackFilter::areaParallelogram ( const Global2DVector a,
const Global2DVector b 
) const
private

Definition at line 68 of file ClusterShapeTrackFilter.cc.

References PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

69 {
70  return a.x() * b.y() - a.y() * b.x();
71 }
T y() const
Definition: PV2DBase.h:46
T x() const
Definition: PV2DBase.h:45
vector< GlobalVector > ClusterShapeTrackFilter::getGlobalDirs ( const std::vector< GlobalPoint > &  globalPoss) const
private

Definition at line 75 of file ClusterShapeTrackFilter.cc.

References EnergyCorrector::c, CircleFromThreePoints::center(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), dir, mag2(), AlCaHLTBitMon_ParallelJobs::p, slope, funct::sqr(), mathSSE::sqrt(), findQualityFiles::v, PV2DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), PV2DBase< T, PVType, FrameType >::y(), and Basic2DVector< T >::y().

76 {
77  // Get 2d points
78  vector<Global2DVector> p;
79  for(vector<GlobalPoint>::const_iterator ig = g.begin();
80  ig!= g.end(); ig++)
81  p.push_back( Global2DVector(ig->x(), ig->y()) );
82 
83  //
84  vector<GlobalVector> globalDirs;
85 
86  // Determine circle
87  CircleFromThreePoints circle(g[0],g[1],g[2]);
88 
89  if(circle.curvature() != 0.)
90  {
91  Global2DVector c (circle.center().x(), circle.center().y());
92 
93  float rad2 = (p[0] - c).mag2();
94  float a12 = asin(fabsf(areaParallelogram(p[0] - c, p[1] - c)) / rad2);
95 
96  float slope = (g[1].z() - g[0].z()) / a12;
97 
98  float cotTheta = slope * circle.curvature(); // == sinhEta
99  float coshEta = sqrt(1 + sqr(cotTheta)); // == 1/sinTheta
100 
101  // Calculate globalDirs
102  float sinTheta = 1. / coshEta;
103  float cosTheta = cotTheta * sinTheta;
104 
105  int dir;
106  if(areaParallelogram(p[0] - c, p[1] - c) > 0) dir = 1; else dir = -1;
107 
108  float curvature = circle.curvature();
109 
110  for(vector<Global2DVector>::const_iterator ip = p.begin();
111  ip!= p.end(); ip++)
112  {
113  Global2DVector v = (*ip - c)*curvature*dir;
114  globalDirs.push_back(GlobalVector(-v.y()*sinTheta,
115  v.x()*sinTheta,
116  cosTheta));
117  }
118  }
119 
120  return globalDirs;
121 }
T y() const
Definition: PV2DBase.h:46
static const double slope[3]
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
T curvature(T InversePt, const edm::EventSetup &iSetup)
T sqrt(T t)
Definition: SSEVec.h:48
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
float areaParallelogram(const Global2DVector &a, const Global2DVector &b) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV2DBase.h:45
Global3DVector GlobalVector
Definition: GlobalVector.h:10
vector< GlobalPoint > ClusterShapeTrackFilter::getGlobalPoss ( const std::vector< const TrackingRecHit * > &  recHits) const
private

Definition at line 125 of file ClusterShapeTrackFilter.cc.

126 {
127  vector<GlobalPoint> globalPoss;
128 
129  for(vector<const TrackingRecHit *>::const_iterator recHit = recHits.begin();
130  recHit!= recHits.end();
131  recHit++)
132  {
133  DetId detId = (*recHit)->geographicalId();
134 
135  GlobalPoint gpos =
136  theTracker->idToDet(detId)->toGlobal((*recHit)->localPosition());
137 
138  globalPoss.push_back(gpos);
139  }
140 
141  return globalPoss;
142 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
const TrackerGeometry * theTracker
Definition: DetId.h:18
virtual const TrackerGeomDet * idToDet(DetId) const
bool ClusterShapeTrackFilter::operator() ( const reco::Track track,
const std::vector< const TrackingRecHit * > &  hits,
const TrackerTopology tTopo 
) const
virtual

Definition at line 146 of file ClusterShapeTrackFilter.cc.

References HitInfo::getInfo(), i, TrackingRecHit::isValid(), LogTrace, convertSQLiteXML::ok, and PtMinSelector_cfg::ptMin.

Referenced by HIPixelTrackFilter::operator()().

149 {
150  // Do not even look at pairs
151  if(recHits.size() <= 2) return true;
152 
153  // Check pt
154  if(track->pt() < ptMin ||
155  track->pt() > ptMax)
156  {
157  LogTrace("ClusterShapeTrackFilter")
158  << " [ClusterShapeTrackFilter] pt not in range: "
159  << ptMin << " " << track->pt() << " " << ptMax;
160  return false;
161  }
162 
163  // Get global positions
164  vector<GlobalPoint> globalPoss = getGlobalPoss(recHits);
165 
166  // Get global directions
167  vector<GlobalVector> globalDirs = getGlobalDirs(globalPoss);
168 
169  bool ok = true;
170 
171  // Check whether shape of pixel cluster is compatible
172  // with local track direction
173  for(unsigned int i = 0; i < recHits.size(); i++)
174  {
175  const SiPixelRecHit* pixelRecHit =
176  dynamic_cast<const SiPixelRecHit *>(recHits[i]);
177 
178  if(!pixelRecHit->isValid())
179  {
180  ok = false; break;
181  }
182 
183  if(! theFilter->isCompatible(*pixelRecHit, globalDirs[i], *theClusterShapeCache) )
184  {
185  LogTrace("ClusterShapeTrackFilter")
186  << " [ClusterShapeTrackFilter] clusShape problem"
187  << HitInfo::getInfo(*recHits[i],tTopo);
188 
189  ok = false; break;
190  }
191  }
192 
193  return ok;
194 }
int i
Definition: DBlmapReader.cc:9
const ClusterShapeHitFilter * theFilter
double pt() const
track transverse momentum
Definition: TrackBase.h:608
std::vector< GlobalPoint > getGlobalPoss(const std::vector< const TrackingRecHit * > &recHits) const
#define LogTrace(id)
bool isCompatible(const SiPixelRecHit &recHit, const LocalVector &ldir, const SiPixelClusterShapeCache &clusterShapeCache, PixelData const *pd=0) const
bool isValid() const
std::vector< GlobalVector > getGlobalDirs(const std::vector< GlobalPoint > &globalPoss) const
const SiPixelClusterShapeCache * theClusterShapeCache
static std::string getInfo(const DetId &id, const TrackerTopology *tTopo)
Definition: HitInfo.cc:23
Our base class.
Definition: SiPixelRecHit.h:23
void ClusterShapeTrackFilter::update ( const edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements PixelTrackFilter.

Definition at line 50 of file ClusterShapeTrackFilter.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), theClusterShapeCache, theClusterShapeCacheToken, theFilter, theTracker, and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), HIPixelTrackFilter::update(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

50  {
53  theClusterShapeCache = cache.product();
54 
55  // Get tracker geometry
57  es.get<TrackerDigiGeometryRecord>().get(tracker);
58  theTracker = tracker.product();
59 
60  // Get cluster shape hit filter
62  es.get<CkfComponentsRecord>().get("ClusterShapeHitFilter",shape);
63  theFilter = shape.product();
64 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const TrackerGeometry * theTracker
const ClusterShapeHitFilter * theFilter
edm::EDGetTokenT< SiPixelClusterShapeCache > theClusterShapeCacheToken
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
const SiPixelClusterShapeCache * theClusterShapeCache

Member Data Documentation

double ClusterShapeTrackFilter::ptMax
private

Definition at line 53 of file ClusterShapeTrackFilter.h.

Referenced by ClusterShapeTrackFilter().

double ClusterShapeTrackFilter::ptMin
private

Definition at line 52 of file ClusterShapeTrackFilter.h.

Referenced by ClusterShapeTrackFilter().

const SiPixelClusterShapeCache* ClusterShapeTrackFilter::theClusterShapeCache
private

Definition at line 50 of file ClusterShapeTrackFilter.h.

Referenced by update().

edm::EDGetTokenT<SiPixelClusterShapeCache> ClusterShapeTrackFilter::theClusterShapeCacheToken
private

Definition at line 46 of file ClusterShapeTrackFilter.h.

Referenced by update().

const ClusterShapeHitFilter* ClusterShapeTrackFilter::theFilter
private

Definition at line 49 of file ClusterShapeTrackFilter.h.

Referenced by update().

const TrackerGeometry* ClusterShapeTrackFilter::theTracker
private

Definition at line 48 of file ClusterShapeTrackFilter.h.

Referenced by update().