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,
24  bool useMultipleScattering,
25  bool useBendingCorrection) {
26 
27  theUseMultipleScattering = useMultipleScattering;
28  theUseBendingCorrection = useBendingCorrection;
29  theLine = line;
30  theMultScattCorrRPhi =0;
31  theMScoeff=0;
32 
33  if (!theUseMultipleScattering && !theUseBendingCorrection) return;
34 
35  theBarrel = (layer->location() == GeomDetEnumerators::barrel);
36 
37  if (theUseMultipleScattering) {
38  MultipleScatteringParametrisation sigmaRPhi(layer, es);
39  theMultScattCorrRPhi = 3.f*sigmaRPhi(pt, line.cotLine(), constraint);
40  float overSinTheta = std::sqrt(1.f+sqr(line.cotLine()));
41  if (theBarrel) {
42  theMScoeff = theMultScattCorrRPhi*overSinTheta;
43  } else {
44  float overCosTheta = std::abs(line.cotLine()) < 1.e-4f ?
45  1.e4f : overSinTheta/std::abs(line.cotLine());
46  theMScoeff = theMultScattCorrRPhi*overCosTheta;
47 
48  }
49  }
50 
51  if (useBendingCorrection) theBendingCorrection.init(pt,es);
52 
53 }
54 
55 
57 {
58  if (theUseMultipleScattering) {
59  range.first -= theMultScattCorrRPhi;
60  range.second += theMultScattCorrRPhi;
61  }
62 }
64 {
65  if (theUseMultipleScattering) {
66  range.first -= theMScoeff;
67  range.second += theMScoeff;
68  }
69 
70  if (theUseBendingCorrection) {
71  if (theBarrel) {
72  float cotTheta = theLine.cotLine();
73  if (cotTheta > 0) {
74  float radius = theLine.rAtZ(range.max());
75  float corr = theBendingCorrection(radius) * cotTheta;
76  range.second += corr;
77  } else {
78  float radius = theLine.rAtZ(range.min());
79  float corr = theBendingCorrection(radius) * std::abs(cotTheta);
80  range.first -= corr;
81  }
82  }
83  else {
84  float radius = range.max();
85  float corr = theBendingCorrection(radius);
86  range.first -= corr;
87  }
88  }
89 }
T max() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
#define abs(x)
Definition: mlp_lapack.h:159
T min() const
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:46
void init(const edm::EventSetup &es, float pt, const DetLayer *layer, const PixelRecoLineRZ &line, const PixelRecoPointRZ &constraint, bool useMultipleScattering, bool useBendingCorrection=false)
void correctRPhiRange(Range &range) const
double f[11][100]
list theLine
Definition: crabWrapper.py:24
JetCorrectorParameters corr
Definition: classes.h:9
Square< F >::type sqr(const F &f)
Definition: Square.h:13
void correctRZRange(Range &range) const
long double T