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
PixelClusterShapeSeedComparitor Class Reference
Inheritance diagram for PixelClusterShapeSeedComparitor:
SeedComparitor

Public Member Functions

virtual bool compatible (const SeedingHitSet &hits, const TrackingRegion &region) const
 
virtual bool compatible (const TrajectorySeed &seed) const
 
virtual bool compatible (const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit) const
 
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &helixStateAtVertex, const FastHelix &helix, const TrackingRegion &region) const
 
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &straightLineStateAtVertex, const TrackingRegion &region) const
 
virtual void init (const edm::EventSetup &es)
 
 PixelClusterShapeSeedComparitor (const edm::ParameterSet &cfg)
 
virtual ~PixelClusterShapeSeedComparitor ()
 
- Public Member Functions inherited from SeedComparitor
virtual ~SeedComparitor ()
 

Private Member Functions

bool compatibleHit (const TransientTrackingRecHit &hit, const GlobalVector &direction) const
 

Private Attributes

bool filterAtHelixStage_
 
edm::ESHandle
< ClusterShapeHitFilter
filterHandle_
 
std::string filterName_
 
bool filterPixelHits_
 
bool filterStripHits_
 

Detailed Description

Definition at line 17 of file ClusterShapeSeedComparitor.cc.

Constructor & Destructor Documentation

PixelClusterShapeSeedComparitor::PixelClusterShapeSeedComparitor ( const edm::ParameterSet cfg)

Definition at line 44 of file ClusterShapeSeedComparitor.cc.

44  :
45  filterName_(cfg.getParameter<std::string>("ClusterShapeHitFilterName")),
46  filterAtHelixStage_(cfg.getParameter<bool>("FilterAtHelixStage")),
47  filterPixelHits_(cfg.getParameter<bool>("FilterPixelHits")),
48  filterStripHits_(cfg.getParameter<bool>("FilterStripHits"))
49 {
50 }
T getParameter(std::string const &) const
PixelClusterShapeSeedComparitor::~PixelClusterShapeSeedComparitor ( )
virtual

Definition at line 52 of file ClusterShapeSeedComparitor.cc.

53 {
54 }

Member Function Documentation

virtual bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const TrackingRegion region 
) const
inlinevirtual

Implements SeedComparitor.

Definition at line 22 of file ClusterShapeSeedComparitor.cc.

22 { return true; }
virtual bool PixelClusterShapeSeedComparitor::compatible ( const TrajectorySeed seed) const
inlinevirtual

Implements SeedComparitor.

Definition at line 23 of file ClusterShapeSeedComparitor.cc.

23 { return true; }
bool PixelClusterShapeSeedComparitor::compatible ( const TrajectoryStateOnSurface tsos,
const TransientTrackingRecHit::ConstRecHitPointer hit 
) const
virtual

Implements SeedComparitor.

Definition at line 63 of file ClusterShapeSeedComparitor.cc.

References compatibleHit(), filterAtHelixStage_, TrajectoryStateOnSurface::globalDirection(), and TrajectoryStateOnSurface::isValid().

65 {
66  if (filterAtHelixStage_) return true;
67  assert(hit->isValid() && tsos.isValid());
68  return compatibleHit(*hit, tsos.globalDirection());
69 }
bool compatibleHit(const TransientTrackingRecHit &hit, const GlobalVector &direction) const
GlobalVector globalDirection() const
bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const GlobalTrajectoryParameters helixStateAtVertex,
const FastHelix helix,
const TrackingRegion region 
) const
virtual

Implements SeedComparitor.

Definition at line 80 of file ClusterShapeSeedComparitor.cc.

References FastHelix::circle(), compatibleHit(), filterAtHelixStage_, TransientTrackingRecHit::globalPosition(), i, GlobalTrajectoryParameters::momentum(), n, perp2(), pos, GlobalTrajectoryParameters::position(), SeedingHitSet::size(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

84 {
85  if (!filterAtHelixStage_) return true;
86  float xc = helix.circle().x0(), yc = helix.circle().y0();
87 
88  GlobalPoint vertex = helixStateAtVertex.position();
89  GlobalVector momvtx = helixStateAtVertex.momentum();
90  float x0 = vertex.x(), y0 = vertex.y();
91  for (unsigned int i = 0, n = hits.size(); i < n; ++i) {
92  const TransientTrackingRecHit &hit = *hits[i];
94  float x1 = pos.x(), y1 = pos.y(), dx1 = x1 - xc, dy1 = y1 - yc;
95 
96  // now figure out the proper tangent vector
97  float perpx = -dy1, perpy = dx1;
98  if (perpx * (x1-x0) + perpy * (y1 - y0) < 0) {
99  perpy = -perpy; perpx = -perpx;
100  }
101 
102  // now normalize (perpx, perpy, 1.0) to momentum (px, py, pz)
103  float perp2 = perpx*perpx + perpy*perpy;
104  float pmom2 = momvtx.x()*momvtx.x() + momvtx.y()*momvtx.y(), momz2 = momvtx.z()*momvtx.z(), mom2 = pmom2 + momz2;
105  float perpscale = sqrt(pmom2/mom2 / perp2), zscale = sqrt((1-pmom2/mom2));
106  GlobalVector gdir(perpx*perpscale, perpy*perpscale, (momvtx.z() > 0 ? zscale : -zscale));
107 
108  if (!compatibleHit(hit, gdir)) {
109  return false; // not yet
110  }
111  }
112  return true;
113 }
int i
Definition: DBlmapReader.cc:9
double x0() const
Definition: FastCircle.h:50
T y() const
Definition: PV3DBase.h:62
const FastCircle & circle() const
Definition: FastHelix.h:81
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
T perp2() const
Squared magnitude of transverse component.
bool compatibleHit(const TransientTrackingRecHit &hit, const GlobalVector &direction) const
double y0() const
Definition: FastCircle.h:52
virtual GlobalPoint globalPosition() const
unsigned int size() const
Definition: SeedingHitSet.h:31
T x() const
Definition: PV3DBase.h:61
bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const GlobalTrajectoryParameters straightLineStateAtVertex,
const TrackingRegion region 
) const
virtual

Implements SeedComparitor.

Definition at line 72 of file ClusterShapeSeedComparitor.cc.

75 {
76  return true;
77 }
bool PixelClusterShapeSeedComparitor::compatibleHit ( const TransientTrackingRecHit hit,
const GlobalVector direction 
) const
private

Definition at line 116 of file ClusterShapeSeedComparitor.cc.

References edm::hlt::Exception, filterHandle_, filterPixelHits_, filterStripHits_, TrackingRecHit::geographicalId(), TransientTrackingRecHit::hit(), ProjectedSiStripRecHit2D::originalHit(), and DetId::subdetId().

Referenced by compatible().

117 {
118  if (hit.geographicalId().subdetId() <= 2) {
119  if (!filterPixelHits_) return true;
120  const SiPixelRecHit *pixhit = dynamic_cast<const SiPixelRecHit *>(hit.hit());
121  if (pixhit == 0) throw cms::Exception("LogicError", "Found a valid hit on the pixel detector which is not a SiPixelRecHit\n");
122  //printf("Cheching hi hit on detid %10d, local direction is x = %9.6f, y = %9.6f, z = %9.6f\n", hit.geographicalId().rawId(), direction.x(), direction.y(), direction.z());
123  return filterHandle_->isCompatible(*pixhit, direction);
124  } else {
125  if (!filterStripHits_) return true;
126  const std::type_info &tid = typeid(*hit.hit());
127  if (tid == typeid(SiStripMatchedRecHit2D)) {
128  const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D *>(hit.hit());
129  assert(matchedHit != 0);
130  return (filterHandle_->isCompatible(DetId(matchedHit->monoId()), matchedHit->monoCluster(), direction) &&
131  filterHandle_->isCompatible(DetId(matchedHit->stereoId()), matchedHit->stereoCluster(), direction));
132  } else if (tid == typeid(SiStripRecHit2D)) {
133  const SiStripRecHit2D* recHit = dynamic_cast<const SiStripRecHit2D *>(hit.hit());
134  assert(recHit != 0);
135  return filterHandle_->isCompatible(*recHit, direction);
136  } else if (tid == typeid(ProjectedSiStripRecHit2D)) {
137  const ProjectedSiStripRecHit2D* precHit = dynamic_cast<const ProjectedSiStripRecHit2D *>(hit.hit());
138  assert(precHit != 0);
139  return filterHandle_->isCompatible(precHit->originalHit(), direction);
140  } else {
141  //printf("Questo e' un %s, che ci fo?\n", tid.name());
142  return true;
143  }
144  }
145 }
virtual const TrackingRecHit * hit() const =0
edm::ESHandle< ClusterShapeHitFilter > filterHandle_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
Pixel Reconstructed Hit.
void PixelClusterShapeSeedComparitor::init ( const edm::EventSetup es)
virtual

Implements SeedComparitor.

Definition at line 57 of file ClusterShapeSeedComparitor.cc.

References filterHandle_, filterName_, and edm::EventSetup::get().

Member Data Documentation

bool PixelClusterShapeSeedComparitor::filterAtHelixStage_
private

Definition at line 39 of file ClusterShapeSeedComparitor.cc.

Referenced by compatible().

edm::ESHandle<ClusterShapeHitFilter> PixelClusterShapeSeedComparitor::filterHandle_
mutableprivate

Definition at line 38 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit(), and init().

std::string PixelClusterShapeSeedComparitor::filterName_
private

Definition at line 37 of file ClusterShapeSeedComparitor.cc.

Referenced by init().

bool PixelClusterShapeSeedComparitor::filterPixelHits_
private

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().

bool PixelClusterShapeSeedComparitor::filterStripHits_
private

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().