CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DirectMuonNavigation Class Reference

#include <DirectMuonNavigation.h>

Public Member Functions

DirectMuonNavigationclone () const
 
std::vector< const DetLayer * > compatibleEndcapLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
 
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
 
 DirectMuonNavigation (const edm::ESHandle< MuonDetLayerGeometry > &)
 
 DirectMuonNavigation (const edm::ESHandle< MuonDetLayerGeometry > &, const edm::ParameterSet &)
 
 ~DirectMuonNavigation ()
 

Private Member Functions

bool checkCompatible (const FreeTrajectoryState &fts, const BarrelDetLayer *) const
 
bool checkCompatible (const FreeTrajectoryState &fts, const ForwardDetLayer *) const
 
void inOutBackward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
void inOutBarrel (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
void inOutForward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
void outInBackward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
void outInBarrel (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
void outInForward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
 
bool outward (const FreeTrajectoryState &fts) const
 

Private Attributes

float epsilon_
 
bool theBarrelFlag
 
bool theEndcapFlag
 
edm::ESHandle
< MuonDetLayerGeometry
theMuonDetLayerGeometry
 

Detailed Description

Definition at line 20 of file DirectMuonNavigation.h.

Constructor & Destructor Documentation

DirectMuonNavigation::DirectMuonNavigation ( const edm::ESHandle< MuonDetLayerGeometry > &  muonLayout)

Definition at line 19 of file DirectMuonNavigation.cc.

Referenced by clone().

19  : theMuonDetLayerGeometry(muonLayout), epsilon_(100.), theEndcapFlag(true), theBarrelFlag(true) {
20 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
DirectMuonNavigation::DirectMuonNavigation ( const edm::ESHandle< MuonDetLayerGeometry > &  muonLayout,
const edm::ParameterSet par 
)

Definition at line 22 of file DirectMuonNavigation.cc.

22  : theMuonDetLayerGeometry(muonLayout), epsilon_(100.), theEndcapFlag(par.getParameter<bool>("Endcap")), theBarrelFlag(par.getParameter<bool>("Barrel")) {
23 
24 }
T getParameter(std::string const &) const
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
DirectMuonNavigation::~DirectMuonNavigation ( )
inline

Definition at line 34 of file DirectMuonNavigation.h.

34 {}

Member Function Documentation

bool DirectMuonNavigation::checkCompatible ( const FreeTrajectoryState fts,
const BarrelDetLayer dl 
) const
private

Definition at line 204 of file DirectMuonNavigation.cc.

References epsilon_, FreeTrajectoryState::momentum(), outward(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), CosmicsPD_Skims::radius, submit::rm, slope, BarrelDetLayer::specificSurface(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by inOutBackward(), inOutBarrel(), inOutForward(), outInBackward(), outInBarrel(), and outInForward().

204  {
205 
206  float z0 = fts.position().z();
207  float r0 = fts.position().perp();
208  float zm = fts.momentum().z();
209  float rm = fts.momentum().perp();
210  float slope = zm/rm;
211  if (!outward(fts) ) slope = -slope;
212  const BoundCylinder bc = dl->specificSurface();
213  float radius = bc.radius();
214  float length = bc.bounds().length()/2.;
215 
216  float z1 = slope*(radius - r0) + z0;
217  return ( fabs(z1) <= fabs(length)+epsilon_ );
218 
219 }
T perp() const
Definition: PV3DBase.h:72
static const double slope[3]
bool outward(const FreeTrajectoryState &fts) const
T z() const
Definition: PV3DBase.h:64
string rm
Definition: submit.py:76
GlobalVector momentum() const
GlobalPoint position() const
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
bool DirectMuonNavigation::checkCompatible ( const FreeTrajectoryState fts,
const ForwardDetLayer dl 
) const
private

Definition at line 221 of file DirectMuonNavigation.cc.

References epsilon_, FreeTrajectoryState::momentum(), outward(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), diffTwoXMLs::r1, submit::rm, slope, ForwardDetLayer::specificSurface(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

221  {
222 
223  float z0 = fts.position().z();
224  float r0 = fts.position().perp();
225  float zm = fts.momentum().z();
226  float rm = fts.momentum().perp();
227  float slope = rm/zm;
228 
229  if (!outward(fts) ) slope = -slope;
230 
231  const BoundDisk bd = dl->specificSurface();
232 
233  float outRadius = bd.outerRadius();
234  float inRadius = bd.innerRadius();
235  float z = bd.position().z();
236 
237  float r1 = slope*(z - z0) + r0;
238  return (r1 >= inRadius-epsilon_ && r1 <= outRadius+epsilon_);
239 
240 }
T perp() const
Definition: PV3DBase.h:72
static const double slope[3]
float float float z
bool outward(const FreeTrajectoryState &fts) const
T z() const
Definition: PV3DBase.h:64
string rm
Definition: submit.py:76
GlobalVector momentum() const
GlobalPoint position() const
virtual const BoundDisk & specificSurface() const GCC11_FINAL
DirectMuonNavigation* DirectMuonNavigation::clone ( void  ) const
inline

Definition at line 29 of file DirectMuonNavigation.h.

References DirectMuonNavigation().

29  {
30  return new DirectMuonNavigation(*this);
31  }
DirectMuonNavigation(const edm::ESHandle< MuonDetLayerGeometry > &)
vector< const DetLayer * > DirectMuonNavigation::compatibleEndcapLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 81 of file DirectMuonNavigation.cc.

References alongMomentum, inOutForward(), FreeTrajectoryState::momentum(), oppositeToMomentum, outInBackward(), convertSQLitetoXML_cfg::output, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CosmicMuonTrajectoryBuilder::build(), and CosmicMuonTrajectoryBuilder::trajectories().

82  {
83 
84  float zm = fts.momentum().z();
85 
86  vector<const DetLayer*> output;
87 
88  // collect all endcap layers on 2 sides
89  outInBackward(fts,output);
90  inOutForward(fts,output);
91 
92  // check direction FTS to get a correct order of DetLayers
93  if ( ( zm > 0 && dir == oppositeToMomentum ) ||
94  ( zm < 0 && dir == alongMomentum ) )
95  std::reverse(output.begin(),output.end());
96 
97  return output;
98 }
void inOutForward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
T z() const
Definition: PV3DBase.h:64
void outInBackward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
GlobalVector momentum() const
dbl *** dir
Definition: mlp_gen.cc:35
vector< const DetLayer * > DirectMuonNavigation::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 29 of file DirectMuonNavigation.cc.

References inOutBackward(), inOutBarrel(), inOutForward(), FreeTrajectoryState::momentum(), oppositeToMomentum, outInBackward(), outInBarrel(), outInForward(), convertSQLitetoXML_cfg::output, outward(), FreeTrajectoryState::position(), theBarrelFlag, theEndcapFlag, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CosmicMuonTrajectoryBuilder::build(), DTChamberEfficiency::compatibleLayers(), StandAloneMuonFilter::compatibleLayers(), StandAloneMuonTrajectoryBuilder::propagateTheSeedTSOS(), and CosmicMuonTrajectoryBuilder::trajectories().

30  {
31 
32  float z0 = fts.position().z();
33  float zm = fts.momentum().z();
34 
35  bool inOut = outward(fts);
36 
37  vector<const DetLayer*> output;
38 
39  // check direction and position of FTS to get a correct order of DetLayers
40 
41  if (inOut) {
42  if ((zm * z0) >= 0) {
43  if (theBarrelFlag) inOutBarrel(fts,output);
44  if (theEndcapFlag) {
45  if ( z0 >= 0 ) inOutForward(fts,output);
46  else inOutBackward(fts,output);
47  }
48  } else {
49  if (theEndcapFlag) {
50  if ( z0 >= 0 ) outInForward(fts,output);
51  else outInBackward(fts,output);
52  }
53  if (theBarrelFlag) inOutBarrel(fts,output);
54  }
55  } else {
56  if ((zm * z0) >= 0) {
57  if (theBarrelFlag) outInBarrel(fts,output);
58  if (theEndcapFlag) {
59  if ( z0 >= 0 ) inOutForward(fts,output);
60  else inOutBackward(fts,output);
61  }
62  } else {
63  if (theEndcapFlag) {
64  if ( z0 >= 0 ) outInForward(fts,output);
65  else outInBackward(fts,output);
66  }
67  if (theBarrelFlag) outInBarrel(fts,output);
68  }
69  }
70 
71  if ( dir == oppositeToMomentum ) std::reverse(output.begin(),output.end());
72 
73  return output;
74 }
void inOutBackward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void outInForward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void inOutForward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
bool outward(const FreeTrajectoryState &fts) const
void outInBarrel(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
T z() const
Definition: PV3DBase.h:64
void outInBackward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
GlobalVector momentum() const
GlobalPoint position() const
void inOutBarrel(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
dbl *** dir
Definition: mlp_gen.cc:35
void DirectMuonNavigation::inOutBackward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 169 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

169  {
170  bool cont = false;
171  const vector<const DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();
172 
173  for (vector<const DetLayer*>::const_iterator iter_E = backward.begin(); iter_E != backward.end();
174  iter_E++){
175  if( cont ) output.push_back((*iter_E));
176  else if ( checkCompatible(fts,dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
177  output.push_back((*iter_E));
178  cont = true;
179  }
180  }
181 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
void DirectMuonNavigation::inOutBarrel ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 100 of file DirectMuonNavigation.cc.

References Reference_intrackfit_cff::barrel, checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

100  {
101 
102  bool cont = false;
103  const vector<const DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();
104 
105  for (vector<const DetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++){
106 
107  if( cont ) output.push_back((*iter_B));
108  else if ( checkCompatible(fts,dynamic_cast<const BarrelDetLayer*>(*iter_B))) {
109  output.push_back((*iter_B));
110  cont = true;
111  }
112  }
113 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
void DirectMuonNavigation::inOutForward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 136 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

136  {
137 
138  const vector<const DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
139  bool cont = false;
140  for (vector<const DetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end();
141  iter_E++){
142  if( cont ) output.push_back((*iter_E));
143  else if ( checkCompatible(fts,dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
144  output.push_back((*iter_E));
145  cont = true;
146  }
147  }
148 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
void DirectMuonNavigation::outInBackward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 183 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

183  {
184 
185  bool cont = false;
186  const vector<const DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();
187 
188  vector<const DetLayer*>::const_iterator rbegin = backward.end();
189  rbegin--;
190  vector<const DetLayer*>::const_iterator rend = backward.begin();
191  rend--;
192  for (vector<const DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend;
193  iter_E--){
194  if( cont ) output.push_back((*iter_E));
195  else if ( checkCompatible(fts,dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
196  output.push_back((*iter_E));
197  cont = true;
198  }
199  }
200 
201 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
void DirectMuonNavigation::outInBarrel ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 116 of file DirectMuonNavigation.cc.

References Reference_intrackfit_cff::barrel, checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

116  {
117 
118 // default barrel layers are in out, reverse order
119  const vector<const DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();
120 
121  bool cont = false;
122  vector<const DetLayer*>::const_iterator rbegin = barrel.end();
123  rbegin--;
124  vector<const DetLayer*>::const_iterator rend = barrel.begin();
125  rend--;
126 
127  for (vector<const DetLayer*>::const_iterator iter_B = rbegin; iter_B != rend; iter_B--){
128  if( cont ) output.push_back((*iter_B));
129  else if ( checkCompatible(fts,dynamic_cast<const BarrelDetLayer*>(*iter_B))) {
130  output.push_back((*iter_B));
131  cont = true;
132  }
133  }
134 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
void DirectMuonNavigation::outInForward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 150 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

150  {
151 // default forward layers are in out, reverse order
152 
153  bool cont = false;
154  const vector<const DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
155  vector<const DetLayer*>::const_iterator rbegin = forward.end();
156  rbegin--;
157  vector<const DetLayer*>::const_iterator rend = forward.begin();
158  rend--;
159  for (vector<const DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend;
160  iter_E--){
161  if( cont ) output.push_back((*iter_E));
162  else if ( checkCompatible(fts,dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
163  output.push_back((*iter_E));
164  cont = true;
165  }
166  }
167 }
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
int cont
bool DirectMuonNavigation::outward ( const FreeTrajectoryState fts) const
private

Definition at line 242 of file DirectMuonNavigation.cc.

References FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by checkCompatible(), and compatibleLayers().

242  {
243 
244 // return (fts.position().basicVector().dot(fts.momentum().basicVector())>0);
245 
246  float x0 = fts.position().x();
247  float y0 = fts.position().y();
248 
249  float xm = fts.momentum().x();
250  float ym = fts.momentum().y();
251 
252  return ((x0 * xm + y0 * ym ) > 0);
253 
254 
255 }
T y() const
Definition: PV3DBase.h:63
GlobalVector momentum() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

float DirectMuonNavigation::epsilon_
private

Definition at line 61 of file DirectMuonNavigation.h.

Referenced by checkCompatible().

bool DirectMuonNavigation::theBarrelFlag
private

Definition at line 63 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().

bool DirectMuonNavigation::theEndcapFlag
private

Definition at line 62 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().

edm::ESHandle<MuonDetLayerGeometry> DirectMuonNavigation::theMuonDetLayerGeometry
private