CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DirectTrackerNavigation.cc
Go to the documentation of this file.
1 
12 
13 //---------------
14 // C++ Headers --
15 //---------------
16 
17 #include <algorithm>
18 
19 //-------------------------------
20 // Collaborating Class Headers --
21 //-------------------------------
22 
28 
29 using namespace std;
30 
31 //
32 // constructor
33 //
35  bool outOnly) :
36  theGeometricSearchTracker(tkLayout), theOutLayerOnlyFlag(outOnly), theEpsilon(-0.01) {
37 
38 }
39 
40 
41 //
42 // return compatible layers for a given trajectory state
43 //
44 vector<const DetLayer*>
46  PropagationDirection dir) const {
47 
48  bool inOut = outward(fts);
49  double eta0 = fts.position().eta();
50 
51  vector<const DetLayer*> output;
52 
53  // check eta of DetLayers for compatibility
54 
55  if (inOut) {
56 
57  if ( !theOutLayerOnlyFlag ) {
58  inOutPx(fts,output);
59 
60  if ( eta0 > 1.55) inOutFPx(fts,output);
61  else if ( eta0 < -1.55 ) inOutBPx(fts,output);
62 
63  if ( fabs(eta0) < 1.67 ) inOutTIB(fts,output);
64 
65  if ( eta0 > 1.17 ) inOutFTID(fts,output);
66  else if ( eta0 < -1.17 ) inOutBTID(fts,output);
67  }
68 
69  if ( fabs(eta0) < 1.35 ) inOutTOB(fts,output);
70 
71  if ( eta0 > 0.97 ) inOutFTEC(fts,output);
72  else if ( eta0 < -0.97 ) inOutBTEC(fts,output);
73 
74  } else {
75  LogTrace("Muon|RecoMuon|DirectionTrackerNavigation")<<"No implementation for inward state at this moment. ";
76  }
77 
78  if ( dir == oppositeToMomentum ) std::reverse(output.begin(),output.end());
79 
80  return output;
81 
82 }
83 
84 
85 //
86 //
87 //
88 void DirectTrackerNavigation::inOutPx(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
89 
90  const vector<BarrelDetLayer*>& barrel = theGeometricSearchTracker->pixelBarrelLayers();
91 
92  for (vector<BarrelDetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++) {
93  if ( checkCompatible(fts,(*iter_B)) ) output.push_back((*iter_B));
94  }
95 
96 }
97 
98 
99 //
100 //
101 //
102 void DirectTrackerNavigation::inOutTIB(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
103 
104  const vector<BarrelDetLayer*>& barrel = theGeometricSearchTracker->tibLayers();
105 
106  for (vector<BarrelDetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++) {
107  if ( checkCompatible(fts,(*iter_B)) ) output.push_back((*iter_B));
108  }
109 
110 }
111 
112 
113 //
114 //
115 //
116 void DirectTrackerNavigation::inOutTOB(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
117 
118  const vector<BarrelDetLayer*>& barrel = theGeometricSearchTracker->tobLayers();
119 
120  for (vector<BarrelDetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++) {
121  if ( checkCompatible(fts,(*iter_B)) ) output.push_back((*iter_B));
122  }
123 
124 }
125 
126 
127 //
128 //
129 //
130 void DirectTrackerNavigation::inOutFPx(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
131 
132  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->posPixelForwardLayers();
133 
134  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
135  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
136  }
137 
138 }
139 
140 
141 //
142 //
143 //
144 void DirectTrackerNavigation::inOutFTID(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
145 
146  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->posTidLayers();
147 
148  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
149  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
150  }
151 
152 }
153 
154 
155 //
156 //
157 //
158 void DirectTrackerNavigation::inOutFTEC(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
159 
160  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->posTecLayers();
161 
162  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
163  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
164  }
165 
166 }
167 
168 
169 //
170 //
171 //
172 void DirectTrackerNavigation::inOutBPx(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
173 
174  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->negPixelForwardLayers();
175 
176  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
177  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
178  }
179 
180 }
181 
182 
183 //
184 //
185 //
186 void DirectTrackerNavigation::inOutBTID(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
187 
188  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->negTidLayers();
189 
190  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
191  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
192  }
193 
194 }
195 
196 
197 //
198 //
199 //
200 void DirectTrackerNavigation::inOutBTEC(const FreeTrajectoryState& fts, vector<const DetLayer*>& output) const {
201 
202  const vector<ForwardDetLayer*>& forward = theGeometricSearchTracker->negTecLayers();
203 
204  for (vector<ForwardDetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
205  if ( checkCompatible(fts,(*iter_E)) ) output.push_back((*iter_E));
206  }
207 
208 }
209 
210 
211 //
212 //
213 //
215 
216  float eta0 = fts.position().eta();
217 
218  const BoundCylinder& bc = dl->specificSurface();
219  float radius = bc.radius();
220  float length = bc.bounds().length()/2.;
221 
222  float eta = calculateEta(radius, length);
223 
224  return ( fabs(eta0) <= (fabs(eta) + theEpsilon) );
225 
226 }
227 
228 
229 //
230 //
231 //
233 
234  float eta0 = fts.position().eta();
235 
236  const BoundDisk& bd = dl->specificSurface();
237 
238  float outRadius = bd.outerRadius();
239  float inRadius = bd.innerRadius();
240  float z = bd.position().z();
241 
242  float etaOut = calculateEta(outRadius, z);
243  float etaIn = calculateEta(inRadius, z);
244 
245  if ( eta0 > 0 ) return ( eta0 > ( etaOut - theEpsilon) && eta0 < (etaIn + theEpsilon) );
246  else return ( eta0 < (etaOut + theEpsilon ) && eta0 > ( etaIn - theEpsilon ) );
247 
248 }
249 
250 
251 //
252 //
253 //
255 
256  return (fts.position().basicVector().dot(fts.momentum().basicVector()) > 0);
257 
258 }
259 
260 
261 //
262 // calculate pseudorapidity from r and z
263 //
264 float DirectTrackerNavigation::calculateEta(float r, float z) const {
265 
266  if ( z > 0 ) return -log((tan(atan(r/z)/2.)));
267  return log(-(tan(atan(r/z)/2.)));
268 
269 }
void inOutPx(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
virtual float length() const =0
void inOutTIB(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void inOutFTID(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void inOutBTID(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
PropagationDirection
T eta() const
double double double z
void inOutTOB(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
DirectTrackerNavigation(const edm::ESHandle< GeometricSearchTracker > &, bool outOnly=true)
constructor
T z() const
Definition: PV3DBase.h:63
virtual const BoundDisk & specificSurface() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
bool checkCompatible(const FreeTrajectoryState &, const BarrelDetLayer *) const
GlobalVector momentum() const
#define LogTrace(id)
void inOutFPx(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
GlobalPoint position() const
float calculateEta(float r, float z) const
const Bounds & bounds() const
Definition: BoundSurface.h:89
void inOutBTEC(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
bool outward(const FreeTrajectoryState &) const
void inOutFTEC(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
T eta() const
Definition: PV3DBase.h:75
float outerRadius() const
The outer radius of the disk.
Definition: BoundDisk.h:75
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
find compatible layers for a given trajectory state
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.h:72
dbl *** dir
Definition: mlp_gen.cc:35
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
const PositionType & position() const
void inOutBPx(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
T dot(const Basic3DVector &rh) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.