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 override
 
virtual bool compatible (const TrajectorySeed &seed) const override
 
virtual bool compatible (const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit) const override
 
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &helixStateAtVertex, const FastHelix &helix, const TrackingRegion &region) const override
 
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &straightLineStateAtVertex, const TrackingRegion &region) const override
 
virtual void init (const edm::EventSetup &es) override
 
 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 20 of file ClusterShapeSeedComparitor.cc.

Constructor & Destructor Documentation

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

Definition at line 47 of file ClusterShapeSeedComparitor.cc.

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

Definition at line 55 of file ClusterShapeSeedComparitor.cc.

56 {
57 }

Member Function Documentation

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

Implements SeedComparitor.

Definition at line 25 of file ClusterShapeSeedComparitor.cc.

25 { return true; }
virtual bool PixelClusterShapeSeedComparitor::compatible ( const TrajectorySeed seed) const
inlineoverridevirtual

Implements SeedComparitor.

Definition at line 26 of file ClusterShapeSeedComparitor.cc.

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

Implements SeedComparitor.

Definition at line 66 of file ClusterShapeSeedComparitor.cc.

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

68 {
69  if (filterAtHelixStage_) return true;
70  assert(hit->isValid() && tsos.isValid());
71  return compatibleHit(*hit, tsos.globalDirection());
72 }
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
overridevirtual

Implements SeedComparitor.

Definition at line 83 of file ClusterShapeSeedComparitor.cc.

References FastHelix::circle(), compatibleHit(), filterAtHelixStage_, TransientTrackingRecHit::globalPosition(), i, FastHelix::isValid(), GlobalTrajectoryParameters::momentum(), n, perp2(), 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().

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

Implements SeedComparitor.

Definition at line 75 of file ClusterShapeSeedComparitor.cc.

78 {
79  return true;
80 }
bool PixelClusterShapeSeedComparitor::compatibleHit ( const TransientTrackingRecHit hit,
const GlobalVector direction 
) const
private

Definition at line 122 of file ClusterShapeSeedComparitor.cc.

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

Referenced by compatible().

123 {
124  if (hit.geographicalId().subdetId() <= 2) {
125  if (!filterPixelHits_) return true;
126  const SiPixelRecHit *pixhit = dynamic_cast<const SiPixelRecHit *>(hit.hit());
127  if (pixhit == 0) throw cms::Exception("LogicError", "Found a valid hit on the pixel detector which is not a SiPixelRecHit\n");
128  //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());
129  return filterHandle_->isCompatible(*pixhit, direction);
130  } else {
131  if (!filterStripHits_) return true;
132  const std::type_info &tid = typeid(*hit.hit());
133  if (tid == typeid(SiStripMatchedRecHit2D)) {
134  const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D *>(hit.hit());
135  assert(matchedHit != 0);
136  return (filterHandle_->isCompatible(DetId(matchedHit->monoId()), matchedHit->monoCluster(), direction) &&
137  filterHandle_->isCompatible(DetId(matchedHit->stereoId()), matchedHit->stereoCluster(), direction));
138  } else if (tid == typeid(SiStripRecHit2D)) {
139  const SiStripRecHit2D* recHit = dynamic_cast<const SiStripRecHit2D *>(hit.hit());
140  assert(recHit != 0);
141  return filterHandle_->isCompatible(*recHit, direction);
142  } else if (tid == typeid(ProjectedSiStripRecHit2D)) {
143  const ProjectedSiStripRecHit2D* precHit = dynamic_cast<const ProjectedSiStripRecHit2D *>(hit.hit());
144  assert(precHit != 0);
145  return filterHandle_->isCompatible(precHit->originalHit(), direction);
146  } else {
147  //printf("Questo e' un %s, che ci fo?\n", tid.name());
148  return true;
149  }
150  }
151 }
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:37
Definition: DetId.h:18
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
Pixel Reconstructed Hit.
void PixelClusterShapeSeedComparitor::init ( const edm::EventSetup es)
overridevirtual

Implements SeedComparitor.

Definition at line 60 of file ClusterShapeSeedComparitor.cc.

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

Member Data Documentation

bool PixelClusterShapeSeedComparitor::filterAtHelixStage_
private

Definition at line 42 of file ClusterShapeSeedComparitor.cc.

Referenced by compatible().

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

Definition at line 41 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit(), and init().

std::string PixelClusterShapeSeedComparitor::filterName_
private

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by init().

bool PixelClusterShapeSeedComparitor::filterPixelHits_
private

Definition at line 43 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().

bool PixelClusterShapeSeedComparitor::filterStripHits_
private

Definition at line 43 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().