CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
PixelTripletNoTipGenerator Class Reference

#include <PixelTripletNoTipGenerator.h>

Inheritance diagram for PixelTripletNoTipGenerator:
HitTripletGeneratorFromPairAndLayers

Public Member Functions

void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
 
void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &result, const edm::EventSetup &es, const HitDoublets &doublets, const RecHitsSortedInPhi **thirdHitMap, const std::vector< const DetLayer *> &thirdLayerDetLayer, const int nThirdLayers) override
 
 PixelTripletNoTipGenerator (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 
 ~PixelTripletNoTipGenerator () override
 
- Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
 HitTripletGeneratorFromPairAndLayers (unsigned int maxElement=0)
 
 HitTripletGeneratorFromPairAndLayers (const edm::ParameterSet &pset)
 
void init (std::unique_ptr< HitPairGeneratorFromLayerPair > &&pairs, LayerCacheType *layerCache)
 
const HitPairGeneratorFromLayerPairpairGenerator () const
 
virtual ~HitTripletGeneratorFromPairAndLayers ()
 

Private Types

typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType
 

Private Attributes

float extraHitPhiToleranceForPreFiltering
 
float extraHitRPhitolerance
 
float extraHitRZtolerance
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordfieldToken_
 
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordmsmakerToken_
 
double theChi2Cut
 
double theNSigma
 

Additional Inherited Members

- Public Types inherited from HitTripletGeneratorFromPairAndLayers
typedef LayerHitMapCache LayerCacheType
 
- Static Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
static void fillDescriptions (edm::ParameterSetDescription &desc)
 
- Protected Attributes inherited from HitTripletGeneratorFromPairAndLayers
LayerCacheTypetheLayerCache
 
const unsigned int theMaxElement
 
std::unique_ptr< HitPairGeneratorFromLayerPairthePairGenerator
 

Detailed Description

Definition at line 15 of file PixelTripletNoTipGenerator.h.

Member Typedef Documentation

◆ LayerCacheType

Definition at line 16 of file PixelTripletNoTipGenerator.h.

Constructor & Destructor Documentation

◆ PixelTripletNoTipGenerator()

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

Definition at line 28 of file PixelTripletNoTipGenerator.cc.

30  fieldToken_(iC.esConsumes()),
32  extraHitRZtolerance(cfg.getParameter<double>("extraHitRZtolerance")),
33  extraHitRPhitolerance(cfg.getParameter<double>("extraHitRPhitolerance")),
34  extraHitPhiToleranceForPreFiltering(cfg.getParameter<double>("extraHitPhiToleranceForPreFiltering")),
35  theNSigma(cfg.getParameter<double>("nSigma")),
36  theChi2Cut(cfg.getParameter<double>("chi2Cut")) {}
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_

◆ ~PixelTripletNoTipGenerator()

PixelTripletNoTipGenerator::~PixelTripletNoTipGenerator ( )
override

Definition at line 38 of file PixelTripletNoTipGenerator.cc.

38 {}

Member Function Documentation

◆ hitTriplets() [1/2]

void PixelTripletNoTipGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es,
const SeedingLayerSetsHits::SeedingLayerSet pairLayers,
const std::vector< SeedingLayerSetsHits::SeedingLayer > &  thirdLayers 
)
overridevirtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 40 of file PixelTripletNoTipGenerator.cc.

References GeomDetEnumerators::barrel, Surface::bounds(), PixelTripletNoTipGenerator_cfi::chi2Cut, PixelRecoUtilities::curvature(), l1ctLayer1_cff::dr, makeMEIFBenchmarkPlots::ev, extraHitPhiToleranceForPreFiltering, extraHitRZtolerance, fieldToken_, edm::EventSetup::getData(), RecHitsSortedInPhi::hits(), PixelRecoUtilities::inversePt(), pixelTopology::layer, mps_splice::line, M_PI, msmakerToken_, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeometricSearchDet::position(), jetfilter_cfi::ptCut, CosmicsPD_Skims::radius, HLT_2022v15_cff::region, mps_fire::result, edm::shift, findQualityFiles::size, PixelRecoRange< T >::sort(), BarrelDetLayer::specificSurface(), sqr(), mathSSE::sqrt(), BarrelDetLayer::surface(), ForwardDetLayer::surface(), edm::swap(), theChi2Cut, HitTripletGeneratorFromPairAndLayers::theMaxElement, theNSigma, HitTripletGeneratorFromPairAndLayers::thePairGenerator, Bounds::thickness(), PV3DBase< T, PVType, FrameType >::z(), photonAnalyzer_cfi::zMax, photonAnalyzer_cfi::zMin, and beampixel_dqm_sourceclient-live_cfg::zRange.

45  {
46  //
47  //edm::Handle<reco::BeamSpot> bsHandle;
48  //ev.getByLabel( theBeamSpotTag, bsHandle);
49  //if(!bsHandle.isValid()) return;
50  //const reco::BeamSpot & bs = *bsHandle;
51  //double errorXY = sqrt( sqr(bs.BeamWidthX()) + sqr(bs.BeamWidthY()) );
52  //
53 
54  const GlobalPoint& bsPoint = region.origin();
55  double errorXY = region.originRBound();
56  GlobalVector shift = bsPoint - GlobalPoint(0., 0., 0.);
57 
58  OrderedHitPairs pairs;
59  pairs.reserve(30000);
60  OrderedHitPairs::const_iterator ip;
61  thePairGenerator->hitPairs(region, pairs, ev, es, pairLayers);
62 
63  if (pairs.empty())
64  return;
65 
66  const DetLayer* firstLayer = thePairGenerator->innerLayer(pairLayers).detLayer();
67  const DetLayer* secondLayer = thePairGenerator->outerLayer(pairLayers).detLayer();
68  if (!firstLayer || !secondLayer)
69  return;
70 
71  int size = thirdLayers.size();
72 
73  const RecHitsSortedInPhi** thirdHitMap = new const RecHitsSortedInPhi*[size];
74  for (int il = 0; il <= size - 1; il++) {
75  thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il], region);
76  }
77 
78  const auto& field = es.getData(fieldToken_);
79  const auto& msmaker = es.getData(msmakerToken_);
80 
81  MultipleScatteringParametrisation sigma1RPhi = msmaker.parametrisation(firstLayer);
82  MultipleScatteringParametrisation sigma2RPhi = msmaker.parametrisation(secondLayer);
83 
85  for (ip = pairs.begin(); ip != pairs.end(); ip++) {
86  GlobalPoint p1((*ip).inner()->globalPosition() - shift);
87  GlobalPoint p2((*ip).outer()->globalPosition() - shift);
88 
89  ThirdHitPredictionFromInvLine predictionRPhiTMP(p1, p2);
90  double pt_p1p2 = 1. / PixelRecoUtilities::inversePt(predictionRPhiTMP.curvature(), field);
91 
92  PixelRecoPointRZ point1(p1.perp(), p1.z());
93  PixelRecoPointRZ point2(p2.perp(), p2.z());
94 
95  PixelRecoLineRZ line(point1, point2);
96  double msRPhi1 = sigma1RPhi(pt_p1p2, line.cotLine(), 0.f);
97  double msRPhi2 = sigma2RPhi(pt_p1p2, line.cotLine(), point1);
98  double sinTheta = 1 / sqrt(1 + sqr(line.cotLine()));
99  double cosTheta = fabs(line.cotLine()) / sqrt(1 + sqr(line.cotLine()));
100 
101  double p1_errorRPhi = sqrt(sqr((*ip).inner()->errorGlobalRPhi()) + sqr(msRPhi1) + sqr(errorXY));
102  double p2_errorRPhi = sqrt(sqr((*ip).outer()->errorGlobalRPhi()) + sqr(msRPhi2) + sqr(errorXY));
103 
104  ThirdHitPredictionFromInvLine predictionRPhi(p1, p2, p1_errorRPhi, p2_errorRPhi);
105 
106  for (int il = 0; il <= size - 1; il++) {
107  const DetLayer* layer = thirdLayers[il].detLayer();
108  bool barrelLayer = (layer->location() == GeomDetEnumerators::barrel);
109  MultipleScatteringParametrisation sigma3RPhi = msmaker.parametrisation(layer);
110  double msRPhi3 = sigma3RPhi(pt_p1p2, line.cotLine(), point2);
111 
112  Range rRange;
113  if (barrelLayer) {
114  const BarrelDetLayer& bl = dynamic_cast<const BarrelDetLayer&>(*layer);
115  float halfThickness = bl.surface().bounds().thickness() / 2;
116  float radius = bl.specificSurface().radius();
117  rRange = Range(radius - halfThickness, radius + halfThickness);
118  } else {
119  const ForwardDetLayer& fl = dynamic_cast<const ForwardDetLayer&>(*layer);
120  float halfThickness = fl.surface().bounds().thickness() / 2;
121  float zLayer = fl.position().z();
122  float zMin = zLayer - halfThickness;
123  float zMax = zLayer + halfThickness;
124  GlobalVector dr = p2 - p1;
125  GlobalPoint p3_a = p2 + dr * (zMin - p2.z()) / dr.z();
126  GlobalPoint p3_b = p2 + dr * (zMax - p2.z()) / dr.z();
127  if (zLayer * p3_a.z() < 0)
128  continue;
129  rRange = Range(p3_a.perp(), p3_b.perp());
130  rRange.sort();
131  }
132  double displacment = shift.perp();
133  GlobalPoint crossing1 = predictionRPhi.crossing(rRange.min() - displacment) + shift;
134  GlobalPoint crossing2 = predictionRPhi.crossing(rRange.max() + displacment) + shift;
135  float c1_phi = crossing1.phi();
136  float c2_phi = crossing2.phi();
137  if (c2_phi < c1_phi)
138  swap(c1_phi, c2_phi);
139  if (c2_phi - c1_phi > M_PI) {
140  c2_phi -= 2 * M_PI;
141  swap(c1_phi, c2_phi);
142  }
143  double extraAngle = (displacment + theNSigma * msRPhi3) / rRange.min() + extraHitPhiToleranceForPreFiltering;
144  c1_phi -= extraAngle;
145  c2_phi += extraAngle;
146  vector<Hit> thirdHits = thirdHitMap[il]->hits(c1_phi, c2_phi);
147 
148  typedef vector<Hit>::const_iterator IH;
149  for (IH th = thirdHits.begin(), eh = thirdHits.end(); th < eh; ++th) {
150  GlobalPoint p3((*th)->globalPosition() - shift);
151  double p3_errorRPhi = sqrt(sqr((*th)->errorGlobalRPhi()) + sqr(msRPhi3) + sqr(errorXY));
152 
153  predictionRPhi.add(p3, p3_errorRPhi);
154 
155  double curvature = predictionRPhi.curvature();
156 
157  ThirdHitZPrediction zPrediction((*ip).inner()->globalPosition(),
158  sqrt(sqr((*ip).inner()->errorGlobalR()) + sqr(msRPhi1 / cosTheta)),
159  sqrt(sqr((*ip).inner()->errorGlobalZ()) + sqr(msRPhi1 / sinTheta)),
160  (*ip).outer()->globalPosition(),
161  sqrt(sqr((*ip).outer()->errorGlobalR()) + sqr(msRPhi2 / cosTheta)),
162  sqrt(sqr((*ip).outer()->errorGlobalZ()) + sqr(msRPhi2 / sinTheta)),
163  curvature,
164  theNSigma);
166  zPrediction((*th)->globalPosition(), sqrt(sqr((*th)->errorGlobalR())) + sqr(msRPhi3 / cosTheta));
167 
168  double z3Hit = (*th)->globalPosition().z();
169  double z3HitError =
170  theNSigma * (sqrt(sqr((*th)->errorGlobalZ()) + sqr(msRPhi3 / sinTheta))) + extraHitRZtolerance;
171  Range hitZRange(z3Hit - z3HitError, z3Hit + z3HitError);
172  bool inside = hitZRange.hasIntersection(zRange);
173 
174  double curvatureMS = PixelRecoUtilities::curvature(1. / region.ptMin(), field);
175  bool ptCut = (predictionRPhi.curvature() - theNSigma * predictionRPhi.errorCurvature() < curvatureMS);
176  bool chi2Cut = (predictionRPhi.chi2() < theChi2Cut);
177  if (inside && ptCut && chi2Cut) {
178  if (theMaxElement != 0 && result.size() >= theMaxElement) {
179  result.clear();
180  edm::LogError("TooManyTriplets") << " number of triples exceed maximum. no triplets produced.";
181  delete[] thirdHitMap;
182  return;
183  }
184  result.push_back(OrderedHitTriplet((*ip).inner(), (*ip).outer(), *th));
185  }
186  predictionRPhi.remove(p3, p3_errorRPhi);
187  }
188  }
189  }
190  delete[] thirdHitMap;
191 }
size
Write out results.
virtual const Surface::PositionType & position() const
Returns position of the surface.
T perp() const
Definition: PV3DBase.h:69
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const BoundSurface & surface() const final
GeometricSearchDet interface.
PixelRecoRange< T > & sort()
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Log< level::Error, false > LogError
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
T curvature(T InversePt, const MagneticField &field)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
virtual float thickness() const =0
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_
T sqrt(T t)
Definition: SSEVec.h:19
T inversePt(T curvature, const MagneticField &field)
std::vector< Hit > hits(float phiMin, float phiMax) const
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
#define M_PI
PixelRecoRange< float > Range
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
static unsigned int const shift
const Bounds & bounds() const
Definition: Surface.h:87

◆ hitTriplets() [2/2]

void PixelTripletNoTipGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets result,
const edm::EventSetup es,
const HitDoublets doublets,
const RecHitsSortedInPhi **  thirdHitMap,
const std::vector< const DetLayer *> &  thirdLayerDetLayer,
const int  nThirdLayers 
)
overridevirtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 192 of file PixelTripletNoTipGenerator.cc.

References Exception.

198  {
199  throw cms::Exception("Error") << "PixelTripletNoTipGenerator::hitTriplets is not implemented \n";
200 }

Member Data Documentation

◆ extraHitPhiToleranceForPreFiltering

float PixelTripletNoTipGenerator::extraHitPhiToleranceForPreFiltering
private

Definition at line 42 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().

◆ extraHitRPhitolerance

float PixelTripletNoTipGenerator::extraHitRPhitolerance
private

Definition at line 41 of file PixelTripletNoTipGenerator.h.

◆ extraHitRZtolerance

float PixelTripletNoTipGenerator::extraHitRZtolerance
private

Definition at line 40 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().

◆ fieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> PixelTripletNoTipGenerator::fieldToken_
private

Definition at line 38 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().

◆ msmakerToken_

edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> PixelTripletNoTipGenerator::msmakerToken_
private

Definition at line 39 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().

◆ theChi2Cut

double PixelTripletNoTipGenerator::theChi2Cut
private

Definition at line 44 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().

◆ theNSigma

double PixelTripletNoTipGenerator::theNSigma
private

Definition at line 43 of file PixelTripletNoTipGenerator.h.

Referenced by hitTriplets().