CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalTrackingRegion.cc
Go to the documentation of this file.
2 #include <cmath>
3 #include <sstream>
8 
15 
16 
17 template <class T> T sqr( T t) {return t*t;}
18 
19 using namespace GeomDetEnumerators;
20 
22  std::ostringstream str;
23  str << TrackingRegionBase::print() << "precise: "<<thePrecise;
24  return str.str();
25 }
26 
28  const edm::EventSetup& es,
29  const SeedingLayerSetsHits::SeedingLayer& layer) const {
30  return layer.hits();
31 }
32 
33 
34 
37  const Hit& outerHit, const edm::EventSetup& iSetup,
38  const DetLayer* outerlayer, float lr, float gz, float dr, float dz) const
39 {
40 
41  bool isBarrel = layer->isBarrel();
42  bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
43 
44  if unlikely(!outerlayer) {
45  GlobalPoint ohit = outerHit->globalPosition();
46  lr = std::sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
47  gz = ohit.z();
48  dr = outerHit->errorGlobalR();
49  dz = outerHit->errorGlobalZ();
50  }
51 
52 
53  PixelRecoPointRZ outerred(lr, gz);
54 
55 
56  PixelRecoPointRZ vtxR = (gz > origin().z()+originZBound()) ?
57  PixelRecoPointRZ(-originRBound(), origin().z()+originZBound())
58  : PixelRecoPointRZ( originRBound(), origin().z()+originZBound());
59  PixelRecoPointRZ vtxL = (gz< origin().z()-originZBound()) ?
60  PixelRecoPointRZ(-originRBound(), origin().z()-originZBound())
61  : PixelRecoPointRZ( originRBound(), origin().z()-originZBound());
62 
63  if unlikely((!thePrecise) &&(isPixel )) {
64  auto VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
65  auto VcotMax = PixelRecoLineRZ( vtxL, outerred).cotLine();
66  return new HitEtaCheck(isBarrel, outerred, VcotMax, VcotMin);
67  }
68 
69  constexpr float nSigmaPhi = 3.;
70 
71  dr *= nSigmaPhi;
72  dz *= nSigmaPhi;
73 
74  PixelRecoPointRZ outerL, outerR;
75  if (isBarrel) {
76  outerL = PixelRecoPointRZ(lr, gz-dz);
77  outerR = PixelRecoPointRZ(lr, gz+dz);
78  }
79  else if (gz > 0) {
80  outerL = PixelRecoPointRZ(lr+dr, gz);
81  outerR = PixelRecoPointRZ(lr-dr, gz);
82  }
83  else {
84  outerL = PixelRecoPointRZ(lr-dr, gz);
85  outerR = PixelRecoPointRZ(lr+dr, gz);
86  }
87 
88  auto corr = isBarrel ? dz : dr;
89 
90  SimpleLineRZ leftLine( vtxL, outerL);
91  SimpleLineRZ rightLine( vtxR, outerR);
92  HitRZConstraint rzConstraint(leftLine, rightLine);
93 
94 
95  if unlikely(theUseMS) {
96  MultipleScatteringParametrisation iSigma(layer,iSetup);
97  PixelRecoPointRZ vtxMean(0.,origin().z());
98 
99  float innerScatt = 3.f * ( outerlayer ?
100  iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum())
101  : iSigma( ptMin(), vtxMean, outerred) ) ;
102 
103  float cotTheta = SimpleLineRZ(vtxMean,outerred).cotLine();
104 
105  if (isBarrel) {
106  float sinTheta = 1/std::sqrt(1+sqr(cotTheta));
107  corr = innerScatt/sinTheta + dz;
108  } else {
109  float cosTheta = 1/std::sqrt(1+sqr(1/cotTheta));
110  corr = innerScatt/cosTheta + dr;
111  }
112  }
113 
114  return isBarrel ? (HitRZCompatibility*)(new HitZCheck(rzConstraint, HitZCheck::Margin(corr,corr))) :
115  (HitRZCompatibility*)(new HitRCheck(rzConstraint, HitRCheck::Margin(corr,corr)));
116 }
TrackingRegion::Hits hits(const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const override
get hits from layer compatible with region constraints
float cotLine() const
bool isBarrel(GeomDetEnumerators::SubDetector m)
T y() const
Definition: PV3DBase.h:63
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
#define constexpr
#define unlikely(x)
int seqNum() const
Definition: DetLayer.h:36
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
JetCorrectorParameters corr
Definition: classes.h:5
bool isBarrel() const
Definition: DetLayer.h:32
SeedingLayerSetsHits::Hits Hits
virtual HitRZCompatibility * checkRZ(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer=0, float lr=0, float gz=0, float dr=0, float dz=0) const override
virtual std::string print() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
bool isPixel(HitType hitType)
virtual std::string print() const override
long double T
T x() const
Definition: PV3DBase.h:62