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 = 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  double VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
66  double 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  PixelRecoPointRZ outerL, outerR;
75 
76  if (layer->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  MultipleScatteringParametrisation iSigma(layer,iSetup);
90  PixelRecoPointRZ vtxMean(0.,origin().z());
91 
92  /*
93  float innerScatt=0;
94  if (outerlayer) {
95  innerScatt = 3.f * iSigma( ptMin(), vtxMean, outerred);
96  float anew = 3.f * iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum());
97  if (std::abs( (innerScatt-anew)/innerScatt) > .05)
98  std::cout << "MS old/new in " << outerlayer->seqNum() << " " << layer->seqNum()
99  << ": " << innerScatt << " / " << anew
100  << std::endl;
101  } else
102  innerScatt = 3.f * iSigma( ptMin(), vtxMean, outerred);
103  */
104 
105 
106  float innerScatt = 3.f * ( outerlayer ?
107  iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum())
108  : iSigma( ptMin(), vtxMean, outerred) ) ;
109 
110 
111  //
112  //
113  //
114  SimpleLineRZ leftLine( vtxL, outerL);
115  SimpleLineRZ rightLine( vtxR, outerR);
116  HitRZConstraint rzConstraint(leftLine, rightLine);
117  float cotTheta = SimpleLineRZ(vtxMean,outerred).cotLine();
118 
119  if (isBarrel) {
120  float sinTheta = 1/std::sqrt(1+sqr(cotTheta));
121  float corrZ = innerScatt/sinTheta + dz;
122  return new HitZCheck(rzConstraint, HitZCheck::Margin(corrZ,corrZ));
123  } else {
124  float cosTheta = 1/std::sqrt(1+sqr(1/cotTheta));
125  float corrR = innerScatt/cosTheta + dr;
126  return new HitRCheck( rzConstraint, HitRCheck::Margin(corrR,corrR));
127  }
128 }
tuple t
Definition: tree.py:139
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:48
T z() const
Definition: PV3DBase.h:64
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
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