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 
11 #include "MSLayersKeeper.h"
12 #include "MSLayersKeeperX0AtEta.h"
15 #include "MSLayersAtAngle.h"
16 
17 //#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h"
18 
19 #include<iostream>
20 
21 using namespace std;
22 
24 
25 namespace {
26  struct Keepers {
27  MSLayersKeeperX0DetLayer x0DetLayer;
28  MSLayersKeeperX0AtEta x0AtEta;
29  MSLayersKeeperX0Averaged x0Averaged;
30  MSLayersKeeper * keepers[3];// {&x0DetLayer,&x0AtEta,&x0Averaged};
31  bool isInitialised; // =false;
32  MSLayersKeeper const * operator()(int i) const { return keepers[i];}
33  void init(const edm::EventSetup &iSetup) {
34  if (isInitialised) return;
35  for (auto x : keepers) x->init(iSetup);
36  isInitialised=true;
37  }
38  Keepers() : keepers{&x0DetLayer,&x0AtEta,&x0Averaged}, isInitialised(false) {}
39  };
40 
41  const Keepers keepers;
42 
43 }
44 
46  const_cast<Keepers&>(keepers).init(iSetup);
47 }
48 
49 //using namespace PixelRecoUtilities;
50 //----------------------------------------------------------------------
52 MultipleScatteringParametrisation( const DetLayer* layer,const edm::EventSetup &iSetup, X0Source x0Source) :
53  theLayerKeeper(keepers(x0Source))
54 {
55 
56  // FIXME not thread safe: move elsewhere...
57  initKeepers(iSetup);
58 
59  if (!layer) return;
60  theLayer = theLayerKeeper->layer(layer);
61 }
62 
63 //----------------------------------------------------------------------
65  float pT, float cotTheta, float) const
66 {
67  float sumX0D = theLayer.sumX0D(cotTheta);
68  return x0ToSigma * sumX0D /pT;
69 }
70 
71 //----------------------------------------------------------------------
73  float pT, float cotTheta, const PixelRecoPointRZ & pointI, float tip) const
74 {
75 
76  PixelRecoLineRZ lineIO(pointI, cotTheta, tip);
77  PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
78 
79  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
80 
81  float sumX0D = layersAtEta.sumX0D(pointI, pointO);
82  return x0ToSigma * sumX0D /pT;
83 }
84 
85 
86 float
87 MultipleScatteringParametrisation::operator()(float pT, float cotTheta, const PixelRecoPointRZ & pointI, int il) const {
88 
89  PixelRecoLineRZ lineIO(pointI, cotTheta);
90  PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
91 
92  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
93 
94  float sumX0D = layersAtEta.sumX0D(il, theLayer.seqNum(), pointI, pointO);
95  return x0ToSigma * sumX0D /pT;
96 }
97 
98 
99 //----------------------------------------------------------------------
101  float pT,
102  const PixelRecoPointRZ & pointI,
103  const PixelRecoPointRZ & pointO,
104  Consecutive consecutive,
105  float tip) const
106 {
107 
108 
109  PixelRecoLineRZ lineIO(pointI, pointO, tip);
110  PixelRecoPointRZ pointM = theLayer.crossing(lineIO).first;
111  float cotTheta = lineIO.cotLine();
112 
113  if (consecutive==useConsecutive) {
114  float dist = fabs( (pointO.r()-pointM.r())
115  * (pointM.r()-pointI.r())
116  / (pointO.r()-pointI.r()) );
117  return x0ToSigma * sqrt(theLayer.x0(cotTheta)) * dist /pT;
118  } else {
119  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
120  float sumX0D = layersAtEta.sumX0D(pointI, pointM, pointO);
121  return x0ToSigma * sumX0D /pT;
122  }
123 }
124 
126  float pT,
127  const PixelRecoPointRZ & pointV,
128  const PixelRecoPointRZ & pointO,
129  int ol) const
130 {
131 
132  PixelRecoLineRZ lineIO(pointV, pointO);
133  PixelRecoPointRZ pointI = theLayer.crossing(lineIO).first;
134  float cotTheta = lineIO.cotLine();
135 
136  const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
137  float sumX0D = layersAtEta.sumX0D(pointV.z(), theLayer.seqNum(), ol, pointI, pointO);
138  return x0ToSigma * sumX0D /pT;
139 }
int i
Definition: DBlmapReader.cc:9
MultipleScatteringParametrisation(const DetLayer *layer, const edm::EventSetup &iSetup, X0Source x0source=useX0AtEta)
int init
Definition: HydjetWrapper.h:63
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:48
float sumX0D(float cotTheta) const dso_hidden
Definition: MSLayer.cc:152
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
float operator()(float pt, float cotTheta, float transverseIP=0.) const
float z() const
static void initKeepers(const edm::EventSetup &iSetup)
virtual MSLayer layer(const DetLayer *dl) const
std::pair< PixelRecoPointRZ, bool > crossing(const PixelRecoLineRZ &line) const dso_hidden
Definition: MSLayer.cc:90
float r() const
int seqNum() const
Definition: MSLayer.h:41
Square< F >::type sqr(const F &f)
Definition: Square.h:13
float x0(float cotTheta) const dso_hidden
Definition: MSLayer.cc:137
Definition: DDAxes.h:10
long double T