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 
21 std::string GlobalTrackingRegion::print() const {
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 ctfseeding::SeedingLayer* layer) const
31 {
32  return layer->hits(ev,es);
33 }
34 
36  const Hit& outerHit, const edm::EventSetup& iSetup) const
37 {
38 
39  bool isBarrel = (layer->location() == barrel);
40  bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
41 
42 
43  GlobalPoint ohit = outerHit->globalPosition();
44  float outerred_r = sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
45  PixelRecoPointRZ outerred(outerred_r, ohit.z());
46 
47 
48  PixelRecoPointRZ vtxR = (outerred.z() > origin().z()+originZBound()) ?
49  PixelRecoPointRZ(-originRBound(), origin().z()+originZBound())
50  : PixelRecoPointRZ( originRBound(), origin().z()+originZBound());
51  PixelRecoPointRZ vtxL = (outerred.z() < origin().z()-originZBound()) ?
52  PixelRecoPointRZ(-originRBound(), origin().z()-originZBound())
53  : PixelRecoPointRZ( originRBound(), origin().z()-originZBound());
54 
55  if ((!thePrecise) &&(isPixel )) {
56  double VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
57  double VcotMax = PixelRecoLineRZ( vtxL, outerred).cotLine();
58  return new HitEtaCheck(isBarrel, outerred, VcotMax, VcotMin);
59  }
60 
61  float nSigmaPhi = 3.;
62  float errZ = nSigmaPhi*outerHit->errorGlobalZ();
63  float errR = nSigmaPhi*outerHit->errorGlobalR();
64 
65  PixelRecoPointRZ outerL, outerR;
66 
67  if (layer->location() == barrel) {
68  outerL = PixelRecoPointRZ(outerred.r(), outerred.z()-errZ);
69  outerR = PixelRecoPointRZ(outerred.r(), outerred.z()+errZ);
70  }
71  else if (outerred.z() > 0) {
72  outerL = PixelRecoPointRZ(outerred.r()+errR, outerred.z());
73  outerR = PixelRecoPointRZ(outerred.r()-errR, outerred.z());
74  }
75  else {
76  outerL = PixelRecoPointRZ(outerred.r()-errR, outerred.z());
77  outerR = PixelRecoPointRZ(outerred.r()+errR, outerred.z());
78  }
79 
80  MultipleScatteringParametrisation iSigma(layer,iSetup);
81  PixelRecoPointRZ vtxMean(0.,origin().z());
82  float innerScatt = 3 * iSigma( ptMin(), vtxMean, outerred);
83 
84  //
85  //
86  //
87  PixelRecoLineRZ leftLine( vtxL, outerL);
88  PixelRecoLineRZ rightLine( vtxR, outerR);
89  HitRZConstraint rzConstraint(leftLine, rightLine);
90  float cotTheta = PixelRecoLineRZ(vtxMean,outerred).cotLine();
91 
92  if (isBarrel) {
93  float sinTheta = 1/sqrt(1+sqr(cotTheta));
94  float corrZ = innerScatt/sinTheta + errZ;
95  return new HitZCheck(rzConstraint, HitZCheck::Margin(corrZ,corrZ));
96  } else {
97  float cosTheta = 1/sqrt(1+sqr(1/cotTheta));
98  float corrR = innerScatt/cosTheta + errR;
99  return new HitRCheck( rzConstraint, HitRCheck::Margin(corrR,corrR));
100  }
101 }
virtual std::string print() const
virtual HitRZCompatibility * checkRZ(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup) const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
static const double nSigmaPhi
T y() const
Definition: PV3DBase.h:62
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
double double double z
virtual std::string print() const
virtual TrackingRegion::Hits hits(const edm::Event &ev, const edm::EventSetup &es, const ctfseeding::SeedingLayer *layer) const
get hits from layer compatible with region constraints
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
void hits(const edm::Event &ev, const edm::EventSetup &es, Hits &) const
std::vector< Hit > Hits
Square< F >::type sqr(const F &f)
Definition: Square.h:13
long double T
T x() const
Definition: PV3DBase.h:61