CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThirdHitCorrection.cc
Go to the documentation of this file.
1 #include "ThirdHitCorrection.h"
2 
5 
6 using namespace pixelrecoutilities;
7 
8 namespace {
9  template <class T> inline T sqr( T t) {return t*t;}
10 }
11 
12 //namespace pixelrecoutilities { class LongitudinalBendingCorrection; }
13 //class MultipleScatteringParametrisation;
14 // const MultipleScatteringParametrisation * theScattering;
15 // const pixelrecoutilities::LongitudinalBendingCorrection * theBenging;
16 
18 
20  float pt,
21  const DetLayer * layer,
22  const PixelRecoLineRZ & line,
23  const PixelRecoPointRZ & constraint, int il,
24  bool useMultipleScattering,
25  bool useBendingCorrection) {
26 
27  theUseMultipleScattering = useMultipleScattering;
28  theUseBendingCorrection = useBendingCorrection;
29  theLine = line;
30  theMultScattCorrRPhi =0;
31  theMScoeff=0;
32 
33  theBarrel = layer->isBarrel();
34 
35  if (theUseMultipleScattering) {
36  MultipleScatteringParametrisation sigmaRPhi(layer, es);
37  theMultScattCorrRPhi = 3.f*sigmaRPhi(pt, line.cotLine(), constraint, il);
38  float overSinTheta = std::sqrt(1.f+sqr(line.cotLine()));
39  if (theBarrel) {
40  theMScoeff = theMultScattCorrRPhi*overSinTheta;
41  } else {
42  float overCosTheta = std::abs(line.cotLine()) < 1.e-4f ?
43  1.e4f : overSinTheta/std::abs(line.cotLine());
44  theMScoeff = theMultScattCorrRPhi*overCosTheta;
45 
46  }
47  }
48 
49  if (useBendingCorrection) theBendingCorrection.init(pt,es);
50 
51 }
52 
53 
55 {
56  range.first -= theMScoeff;
57  range.second += theMScoeff;
58 
59 
60  if (theUseBendingCorrection) {
61  if (theBarrel) {
62  float cotTheta = theLine.cotLine();
63  if (cotTheta > 0) {
64  float radius = theLine.rAtZ(range.max());
65  float corr = theBendingCorrection(radius) * cotTheta;
66  range.second += corr;
67  } else {
68  float radius = theLine.rAtZ(range.min());
69  float corr = theBendingCorrection(radius) * std::abs(cotTheta);
70  range.first -= corr;
71  }
72  }
73  else {
74  float radius = range.max();
75  float corr = theBendingCorrection(radius);
76  range.first -= corr;
77  }
78  }
79 }
T max() const
T min() const
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
list theLine
Definition: crabWrapper.py:24
JetCorrectorParameters corr
Definition: classes.h:5
bool isBarrel() const
Definition: DetLayer.h:32
Square< F >::type sqr(const F &f)
Definition: Square.h:13
void init(const edm::EventSetup &es, float pt, const DetLayer *layer, const PixelRecoLineRZ &line, const PixelRecoPointRZ &constraint, int ol, bool useMultipleScattering, bool useBendingCorrection=false)
void correctRZRange(Range &range) const
long double T