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 
27 TrackingRegion::Hits GlobalTrackingRegion::hits(
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 
35 
36 
38 GlobalTrackingRegion::checkRZ(const DetLayer* layer,
39  const Hit& outerHit, const edm::EventSetup& iSetup,
40  const DetLayer* outerlayer, float lr, float gz, float dr, float dz) const
41 {
42 
43  bool isBarrel = layer->isBarrel();
44  bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
45 
46  if unlikely(!outerlayer) {
47  GlobalPoint ohit = outerHit->globalPosition();
48  lr = sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
49  gz = ohit.z();
50  dr = outerHit->errorGlobalR();
51  dz = outerHit->errorGlobalZ();
52  }
53 
54 
55  PixelRecoPointRZ outerred(lr, gz);
56 
57 
58  PixelRecoPointRZ vtxR = (gz > origin().z()+originZBound()) ?
59  PixelRecoPointRZ(-originRBound(), origin().z()+originZBound())
60  : PixelRecoPointRZ( originRBound(), origin().z()+originZBound());
61  PixelRecoPointRZ vtxL = (gz< origin().z()-originZBound()) ?
62  PixelRecoPointRZ(-originRBound(), origin().z()-originZBound())
63  : PixelRecoPointRZ( originRBound(), origin().z()-originZBound());
64 
65  if unlikely((!thePrecise) &&(isPixel )) {
66  double VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
67  double VcotMax = PixelRecoLineRZ( vtxL, outerred).cotLine();
68  return new HitEtaCheck(isBarrel, outerred, VcotMax, VcotMin);
69  }
70 
71  constexpr float nSigmaPhi = 3.;
72 
73  dr *= nSigmaPhi;
74  dz *= nSigmaPhi;
75  PixelRecoPointRZ outerL, outerR;
76 
77  if (layer->isBarrel()) {
78  outerL = PixelRecoPointRZ(lr, gz-dz);
79  outerR = PixelRecoPointRZ(lr, gz+dz);
80  }
81  else if (gz > 0) {
82  outerL = PixelRecoPointRZ(lr+dr, gz);
83  outerR = PixelRecoPointRZ(lr-dr, gz);
84  }
85  else {
86  outerL = PixelRecoPointRZ(lr-dr, gz);
87  outerR = PixelRecoPointRZ(lr+dr, gz);
88  }
89 
90  MultipleScatteringParametrisation iSigma(layer,iSetup);
91  PixelRecoPointRZ vtxMean(0.,origin().z());
92 
93  /*
94  float innerScatt=0;
95  if (outerlayer) {
96  innerScatt = 3.f * iSigma( ptMin(), vtxMean, outerred);
97  float anew = 3.f * iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum());
98  if (std::abs( (innerScatt-anew)/innerScatt) > .05)
99  std::cout << "MS old/new in " << outerlayer->seqNum() << " " << layer->seqNum()
100  << ": " << innerScatt << " / " << anew
101  << std::endl;
102  } else
103  innerScatt = 3.f * iSigma( ptMin(), vtxMean, outerred);
104  */
105 
106 
107  float innerScatt = 3.f * ( outerlayer ?
108  iSigma( ptMin(), vtxMean, outerred, outerlayer->seqNum())
109  : iSigma( ptMin(), vtxMean, outerred) ) ;
110 
111 
112  //
113  //
114  //
115  SimpleLineRZ leftLine( vtxL, outerL);
116  SimpleLineRZ rightLine( vtxR, outerR);
117  HitRZConstraint rzConstraint(leftLine, rightLine);
118  float cotTheta = SimpleLineRZ(vtxMean,outerred).cotLine();
119 
120  if (isBarrel) {
121  float sinTheta = 1/std::sqrt(1+sqr(cotTheta));
122  float corrZ = innerScatt/sinTheta + dz;
123  return new HitZCheck(rzConstraint, HitZCheck::Margin(corrZ,corrZ));
124  } else {
125  float cosTheta = 1/std::sqrt(1+sqr(1/cotTheta));
126  float corrR = innerScatt/cosTheta + dr;
127  return new HitRCheck( rzConstraint, HitRCheck::Margin(corrR,corrR));
128  }
129 }
float cotLine() const
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
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)
float float float z
#define unlikely(x)
Definition: Likely.h:21
int seqNum() const
Definition: DetLayer.h:39
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)
constexpr double nSigmaPhi
void hits(const edm::Event &ev, const edm::EventSetup &es, Hits &) const
bool isBarrel() const
Definition: DetLayer.h:35
std::vector< Hit > Hits
virtual std::string print() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
long double T
T x() const
Definition: PV3DBase.h:62
#define constexpr