CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PixelClusterShapeSeedComparitor Class Reference
Inheritance diagram for PixelClusterShapeSeedComparitor:
SeedComparitor

Public Member Functions

bool compatible (const SeedingHitSet &hits) const override
 
bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &helixStateAtVertex, const FastHelix &helix) const override
 
bool compatible (const TrajectoryStateOnSurface &, SeedingHitSet::ConstRecHitPointer hit) const override
 
void init (const edm::Event &ev, const edm::EventSetup &es) override
 
 PixelClusterShapeSeedComparitor (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 
 ~PixelClusterShapeSeedComparitor () override
 
- Public Member Functions inherited from SeedComparitor
virtual ~SeedComparitor ()
 

Private Member Functions

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

Private Attributes

const bool filterAtHelixStage_
 
edm::ESHandle< ClusterShapeHitFilterfilterHandle_
 
std::string filterName_
 
const bool filterPixelHits_
 
const bool filterStripHits_
 
const SiPixelClusterShapeCachepixelClusterShapeCache_
 
edm::EDGetTokenT< SiPixelClusterShapeCachepixelClusterShapeCacheToken_
 

Detailed Description

Definition at line 25 of file ClusterShapeSeedComparitor.cc.

Constructor & Destructor Documentation

◆ PixelClusterShapeSeedComparitor()

PixelClusterShapeSeedComparitor::PixelClusterShapeSeedComparitor ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

Definition at line 47 of file ClusterShapeSeedComparitor.cc.

49  : filterName_(cfg.getParameter<std::string>("ClusterShapeHitFilterName")),
50  pixelClusterShapeCache_(nullptr),
51  filterAtHelixStage_(cfg.getParameter<bool>("FilterAtHelixStage")),
52  filterPixelHits_(cfg.getParameter<bool>("FilterPixelHits")),
53  filterStripHits_(cfg.getParameter<bool>("FilterStripHits")) {
54  if (filterPixelHits_) {
56  iC.consumes<SiPixelClusterShapeCache>(cfg.getParameter<edm::InputTag>("ClusterShapeCacheSrc"));
57  }
58 }

References looper::cfg, edm::ConsumesCollector::consumes(), filterPixelHits_, and pixelClusterShapeCacheToken_.

◆ ~PixelClusterShapeSeedComparitor()

PixelClusterShapeSeedComparitor::~PixelClusterShapeSeedComparitor ( )
override

Definition at line 60 of file ClusterShapeSeedComparitor.cc.

60 {}

Member Function Documentation

◆ compatible() [1/3]

bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits) const
inlineoverridevirtual

Implements SeedComparitor.

Definition at line 30 of file ClusterShapeSeedComparitor.cc.

30 { return true; }

◆ compatible() [2/3]

bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const GlobalTrajectoryParameters helixStateAtVertex,
const FastHelix helix 
) const
overridevirtual

Implements SeedComparitor.

Definition at line 79 of file ClusterShapeSeedComparitor.cc.

81  {
83  return true;
84 
85  if (!helix.isValid() //check still if it's a straight line, which are OK
86  && !helix.circle().isLine()) //complain if it's not even a straight line
87  edm::LogWarning("InvalidHelix") << "PixelClusterShapeSeedComparitor helix is not valid, result is bad";
88 
89  float xc = helix.circle().x0(), yc = helix.circle().y0();
90 
91  GlobalPoint vertex = helixStateAtVertex.position();
92  GlobalVector momvtx = helixStateAtVertex.momentum();
93  float x0 = vertex.x(), y0 = vertex.y();
94  for (unsigned int i = 0, n = hits.size(); i < n; ++i) {
95  auto const &hit = *hits[i];
96  GlobalPoint pos = hit.globalPosition();
97  float x1 = pos.x(), y1 = pos.y(), dx1 = x1 - xc, dy1 = y1 - yc;
98 
99  // now figure out the proper tangent vector
100  float perpx = -dy1, perpy = dx1;
101  if (perpx * (x1 - x0) + perpy * (y1 - y0) < 0) {
102  perpy = -perpy;
103  perpx = -perpx;
104  }
105 
106  // now normalize (perpx, perpy, 1.0) to momentum (px, py, pz)
107  float perp2 = perpx * perpx + perpy * perpy;
108  float pmom2 = momvtx.x() * momvtx.x() + momvtx.y() * momvtx.y(), momz2 = momvtx.z() * momvtx.z(),
109  mom2 = pmom2 + momz2;
110  float perpscale = sqrt(pmom2 / mom2 / perp2), zscale = sqrt((1 - pmom2 / mom2));
111  GlobalVector gdir(perpx * perpscale, perpy * perpscale, (momvtx.z() > 0 ? zscale : -zscale));
112 
113  if (!compatibleHit(hit, gdir)) {
114  return false; // not yet
115  }
116  }
117  return true;
118 }

References FastHelix::circle(), compatibleHit(), filterAtHelixStage_, hfClusterShapes_cfi::hits, mps_fire::i, FastCircle::isLine(), FastHelix::isValid(), GlobalTrajectoryParameters::momentum(), dqmiodumpmetadata::n, perp2(), GlobalTrajectoryParameters::position(), mathSSE::sqrt(), bphysicsOniaDQM_cfi::vertex, PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), testProducerWithPsetDescEmpty_cfi::x1, PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), testProducerWithPsetDescEmpty_cfi::y1, and PV3DBase< T, PVType, FrameType >::z().

◆ compatible() [3/3]

bool PixelClusterShapeSeedComparitor::compatible ( const TrajectoryStateOnSurface tsos,
SeedingHitSet::ConstRecHitPointer  hit 
) const
overridevirtual

Implements SeedComparitor.

Definition at line 71 of file ClusterShapeSeedComparitor.cc.

72  {
74  return true;
75  assert(hit->isValid() && tsos.isValid());
76  return compatibleHit(*hit, tsos.globalDirection());
77 }

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

◆ compatibleHit()

bool PixelClusterShapeSeedComparitor::compatibleHit ( const TrackingRecHit hit,
const GlobalVector direction 
) const
private

Definition at line 120 of file ClusterShapeSeedComparitor.cc.

120  {
121  if (hit.geographicalId().subdetId() <= 2) {
122  if (!filterPixelHits_)
123  return true;
124  const SiPixelRecHit *pixhit = dynamic_cast<const SiPixelRecHit *>(&hit);
125  if (pixhit == nullptr)
126  throw cms::Exception("LogicError", "Found a valid hit on the pixel detector which is not a SiPixelRecHit\n");
127  //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());
128  return filterHandle_->isCompatible(*pixhit, direction, *pixelClusterShapeCache_);
129  } else {
130  if (!filterStripHits_)
131  return true;
132  const std::type_info &tid = typeid(*&hit);
133  if (tid == typeid(SiStripMatchedRecHit2D)) {
134  const SiStripMatchedRecHit2D *matchedHit = dynamic_cast<const SiStripMatchedRecHit2D *>(&hit);
135  assert(matchedHit != nullptr);
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);
140  assert(recHit != nullptr);
141  return filterHandle_->isCompatible(*recHit, direction);
142  } else if (tid == typeid(ProjectedSiStripRecHit2D)) {
143  const ProjectedSiStripRecHit2D *precHit = dynamic_cast<const ProjectedSiStripRecHit2D *>(&hit);
144  assert(precHit != nullptr);
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 }

References cms::cuda::assert(), Exception, filterHandle_, filterPixelHits_, filterStripHits_, ClusterShapeHitFilter::isCompatible(), SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoId(), ProjectedSiStripRecHit2D::originalHit(), pixelClusterShapeCache_, rpcPointValidation_cfi::recHit, SiStripMatchedRecHit2D::stereoCluster(), and SiStripMatchedRecHit2D::stereoId().

Referenced by compatible().

◆ init()

void PixelClusterShapeSeedComparitor::init ( const edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Member Data Documentation

◆ filterAtHelixStage_

const bool PixelClusterShapeSeedComparitor::filterAtHelixStage_
private

Definition at line 43 of file ClusterShapeSeedComparitor.cc.

Referenced by compatible().

◆ filterHandle_

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

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit(), and init().

◆ filterName_

std::string PixelClusterShapeSeedComparitor::filterName_
private

Definition at line 39 of file ClusterShapeSeedComparitor.cc.

Referenced by init().

◆ filterPixelHits_

const bool PixelClusterShapeSeedComparitor::filterPixelHits_
private

◆ filterStripHits_

const bool PixelClusterShapeSeedComparitor::filterStripHits_
private

Definition at line 44 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().

◆ pixelClusterShapeCache_

const SiPixelClusterShapeCache* PixelClusterShapeSeedComparitor::pixelClusterShapeCache_
private

Definition at line 42 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit(), and init().

◆ pixelClusterShapeCacheToken_

edm::EDGetTokenT<SiPixelClusterShapeCache> PixelClusterShapeSeedComparitor::pixelClusterShapeCacheToken_
private

Definition at line 41 of file ClusterShapeSeedComparitor.cc.

Referenced by init(), and PixelClusterShapeSeedComparitor().

Vector3DBase
Definition: Vector3DBase.h:8
TrajectoryStateOnSurface::globalDirection
GlobalVector globalDirection() const
Definition: TrajectoryStateOnSurface.h:67
SiStripMatchedRecHit2D::monoId
unsigned int monoId() const
Definition: SiStripMatchedRecHit2D.h:29
PixelClusterShapeSeedComparitor::filterPixelHits_
const bool filterPixelHits_
Definition: ClusterShapeSeedComparitor.cc:44
mps_fire.i
i
Definition: mps_fire.py:428
PixelClusterShapeSeedComparitor::filterAtHelixStage_
const bool filterAtHelixStage_
Definition: ClusterShapeSeedComparitor.cc:43
SiPixelClusterShapeCache
Definition: SiPixelClusterShapeCache.h:43
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::Handle::product
T const * product() const
Definition: Handle.h:70
PixelClusterShapeSeedComparitor::compatibleHit
bool compatibleHit(const TrackingRecHit &hit, const GlobalVector &direction) const
Definition: ClusterShapeSeedComparitor.cc:120
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SiStripMatchedRecHit2D::stereoCluster
SiStripCluster const & stereoCluster() const
Definition: SiStripMatchedRecHit2D.h:40
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
pos
Definition: PixelAliasList.h:18
FastCircle::y0
double y0() const
Definition: FastCircle.h:45
cms::cuda::assert
assert(be >=bs)
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
edm::Handle< SiPixelClusterShapeCache >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
FastCircle::isLine
bool isLine() const
Definition: FastCircle.h:51
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
PixelClusterShapeSeedComparitor::filterName_
std::string filterName_
Definition: ClusterShapeSeedComparitor.cc:39
DetId
Definition: DetId.h:17
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
CkfComponentsRecord
Definition: CkfComponentsRecord.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ProjectedSiStripRecHit2D::originalHit
SiStripRecHit2D originalHit() const
Definition: ProjectedSiStripRecHit2D.h:56
ClusterShapeHitFilter::isCompatible
bool isCompatible(const SiPixelRecHit &recHit, const LocalVector &ldir, const SiPixelClusterShapeCache &clusterShapeCache, PixelData const *pd=nullptr) const
Definition: ClusterShapeHitFilter.cc:283
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
Point3DBase< float, GlobalTag >
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastHelix::circle
const FastCircle & circle() const
Definition: FastHelix.h:61
FastCircle::x0
double x0() const
Definition: FastCircle.h:43
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
SiStripMatchedRecHit2D::stereoId
unsigned int stereoId() const
Definition: SiStripMatchedRecHit2D.h:28
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
perp2
T perp2() const
Squared magnitude of transverse component.
Definition: Basic3DVectorLD.h:130
PixelClusterShapeSeedComparitor::filterStripHits_
const bool filterStripHits_
Definition: ClusterShapeSeedComparitor.cc:44
get
#define get
looper.cfg
cfg
Definition: looper.py:297
FastHelix::isValid
bool isValid() const
Definition: FastHelix.h:57
PixelClusterShapeSeedComparitor::pixelClusterShapeCacheToken_
edm::EDGetTokenT< SiPixelClusterShapeCache > pixelClusterShapeCacheToken_
Definition: ClusterShapeSeedComparitor.cc:41
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
SiStripMatchedRecHit2D::monoCluster
SiStripCluster const & monoCluster() const
Definition: SiStripMatchedRecHit2D.h:41
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:245
PixelClusterShapeSeedComparitor::pixelClusterShapeCache_
const SiPixelClusterShapeCache * pixelClusterShapeCache_
Definition: ClusterShapeSeedComparitor.cc:42
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
PixelClusterShapeSeedComparitor::filterHandle_
edm::ESHandle< ClusterShapeHitFilter > filterHandle_
Definition: ClusterShapeSeedComparitor.cc:40