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::Event& ev,
29  const edm::EventSetup& es,
30  const SeedingLayerSetsHits::SeedingLayer& layer) const {
31  return layer.hits();
32 }
33 
34 
35 
38  const Hit& outerHit, const edm::EventSetup& iSetup,
39  const DetLayer* outerlayer, float lr, float gz, float dr, float dz) const
40 {
41 
42  bool isBarrel = layer->isBarrel();
43  bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
44 
45  if unlikely(!outerlayer) {
46  GlobalPoint ohit = outerHit->globalPosition();
47  lr = std::sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
48  gz = ohit.z();
49  dr = outerHit->errorGlobalR();
50  dz = outerHit->errorGlobalZ();
51  }
52 
53 
54  PixelRecoPointRZ outerred(lr, gz);
55 
56 
57  PixelRecoPointRZ vtxR = (gz > origin().z()+originZBound()) ?
58  PixelRecoPointRZ(-originRBound(), origin().z()+originZBound())
59  : PixelRecoPointRZ( originRBound(), origin().z()+originZBound());
60  PixelRecoPointRZ vtxL = (gz< origin().z()-originZBound()) ?
61  PixelRecoPointRZ(-originRBound(), origin().z()-originZBound())
62  : PixelRecoPointRZ( originRBound(), origin().z()-originZBound());
63 
64  if unlikely((!thePrecise) &&(isPixel )) {
65  auto VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
66  auto VcotMax = PixelRecoLineRZ( vtxL, outerred).cotLine();
67  return new HitEtaCheck(isBarrel, outerred, VcotMax, VcotMin);
68  }
69 
70  constexpr float nSigmaPhi = 3.;
71 
72  dr *= nSigmaPhi;
73  dz *= nSigmaPhi;
74 
75  PixelRecoPointRZ outerL, outerR;
76  if (isBarrel) {
77  outerL = PixelRecoPointRZ(lr, gz-dz);
78  outerR = PixelRecoPointRZ(lr, gz+dz);
79  }
80  else if (gz > 0) {
81  outerL = PixelRecoPointRZ(lr+dr, gz);
82  outerR = PixelRecoPointRZ(lr-dr, gz);
83  }
84  else {
85  outerL = PixelRecoPointRZ(lr-dr, gz);
86  outerR = PixelRecoPointRZ(lr+dr, gz);
87  }
88 
89  auto corr = isBarrel ? dz : dr;
90 
91  SimpleLineRZ leftLine( vtxL, outerL);
92  SimpleLineRZ rightLine( vtxR, outerR);
93  HitRZConstraint rzConstraint(leftLine, rightLine);
94 
95 
96  if unlikely(theUseMS) {
97  MultipleScatteringParametrisation iSigma(layer,iSetup);
98  PixelRecoPointRZ vtxMean(0.,origin().z());
99 
100  float innerScatt = 3.f * ( outerlayer ?
101  iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum())
102  : iSigma( ptMin(), vtxMean, outerred) ) ;
103 
104  float cotTheta = SimpleLineRZ(vtxMean,outerred).cotLine();
105 
106  if (isBarrel) {
107  float sinTheta = 1/std::sqrt(1+sqr(cotTheta));
108  corr = innerScatt/sinTheta + dz;
109  } else {
110  float cosTheta = 1/std::sqrt(1+sqr(1/cotTheta));
111  corr = innerScatt/cosTheta + dr;
112  }
113  }
114 
115  return isBarrel ? (HitRZCompatibility*)(new HitZCheck(rzConstraint, HitZCheck::Margin(corr,corr))) :
116  (HitRZCompatibility*)(new HitRCheck(rzConstraint, HitRCheck::Margin(corr,corr)));
117 }
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)
bool ev
TrackingRegion::Hits hits(const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const override
get hits from layer compatible with region constraints
#define constexpr
#define unlikely(x)
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
int seqNum() const
Definition: DetLayer.h:36
virtual std::string print() const
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 std::string print() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
bool isPixel(HitType hitType)
long double T
T x() const
Definition: PV3DBase.h:62