CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultipleScatteringParametrisation.cc
Go to the documentation of this file.
1 
2 #include <vector>
7 
8 
9 template <class T> inline T sqr( T t) {return t*t;}
10 
16 
17 //#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h"
18 
19 #include<iostream>
20 
21 using namespace std;
22 
24 
25 //using namespace PixelRecoUtilities;
26 //----------------------------------------------------------------------
29 
30 {
31  switch (x0Source) {
32  case useX0AtEta: {
33  static MSLayersKeeperX0AtEta x0AtEta;
34  theLayerKeeper = &x0AtEta;
35  break;
36  }
37  case useX0DataAveraged: {
38  static MSLayersKeeperX0Averaged x0Averaged;
39  theLayerKeeper = &x0Averaged;
40  break;
41  }
42 
43  case useDetLayer: {
44  static MSLayersKeeperX0DetLayer x0DetLayer;
45  theLayerKeeper = &x0DetLayer;
46  break;
47  }
48  default:
49  //FIXME should throw or similar
50  cout << "** MultipleScatteringParametrisation ** wrong x0Source"<<endl;
51  return;
52  }
53  theLayerKeeper->init(iSetup);
54  if (!layer) return;
55  theLayer = theLayerKeeper->layer(layer);
56 }
57 
58 //----------------------------------------------------------------------
60  float pT, float cotTheta, float tip) const
61 {
62  float sumX0D = theLayer.sumX0D(cotTheta);
63  return x0ToSigma * sumX0D /pT;
64 }
65 
66 //----------------------------------------------------------------------
68  float pT, float cotTheta, const PixelRecoPointRZ & pointI, float tip) const
69 {
70 
71  PixelRecoLineRZ lineIO(pointI, cotTheta, tip);
72  PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
73 
74  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
75 
76  float sumX0D = layersAtEta.sumX0D(pointI, pointO);
77  return x0ToSigma * sumX0D /pT;
78 }
79 
80 //----------------------------------------------------------------------
82  float pT,
83  const PixelRecoPointRZ & pointI,
84  const PixelRecoPointRZ & pointO,
85  Consecutive consecutive,
86  float tip) const
87 {
88 
89 
90  PixelRecoLineRZ lineIO(pointI, pointO, tip);
91  PixelRecoPointRZ pointM = theLayer.crossing(lineIO).first;
92  float cotTheta = lineIO.cotLine();
93 
94  if (consecutive==useConsecutive) {
95  float dist = fabs( (pointO.r()-pointM.r())
96  * (pointM.r()-pointI.r())
97  / (pointO.r()-pointI.r()) );
98  return x0ToSigma * sqrt(theLayer.x0(cotTheta)) * dist /pT;
99  } else {
100  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
101  float sumX0D = layersAtEta.sumX0D(pointI, pointM, pointO);
102  return x0ToSigma * sumX0D /pT;
103  }
104 }
MultipleScatteringParametrisation(const DetLayer *layer, const edm::EventSetup &iSetup, X0Source x0source=useX0AtEta)
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:46
float operator()(float pt, float cotTheta, float transverseIP=0.) const
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO, float tip=0.) const
float r() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
tuple cout
Definition: gather_cfg.py:121
long double T