CMS 3D CMS Logo

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< MuonDetLayerGeometrytheMuonDetLayerGeometry
 

Detailed Description

Definition at line 20 of file DirectMuonNavigation.h.

Constructor & Destructor Documentation

◆ DirectMuonNavigation() [1/2]

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

Definition at line 19 of file DirectMuonNavigation.cc.

20  : theMuonDetLayerGeometry(muonLayout), epsilon_(100.), theEndcapFlag(true), theBarrelFlag(true) {}

Referenced by clone().

◆ DirectMuonNavigation() [2/2]

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

Definition at line 22 of file DirectMuonNavigation.cc.

24  : theMuonDetLayerGeometry(muonLayout),
25  epsilon_(100.),
26  theEndcapFlag(par.getParameter<bool>("Endcap")),
27  theBarrelFlag(par.getParameter<bool>("Barrel")) {}

◆ ~DirectMuonNavigation()

DirectMuonNavigation::~DirectMuonNavigation ( )
inline

Definition at line 30 of file DirectMuonNavigation.h.

30 {}

Member Function Documentation

◆ checkCompatible() [1/2]

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

Definition at line 208 of file DirectMuonNavigation.cc.

208  {
209  float z0 = fts.position().z();
210  float r0 = fts.position().perp();
211  float zm = fts.momentum().z();
212  float rm = fts.momentum().perp();
213  float slope = zm / rm;
214  if (!outward(fts))
215  slope = -slope;
216  const BoundCylinder& bc = dl->specificSurface();
217  float radius = bc.radius();
218  float length = bc.bounds().length() / 2.;
219 
220  float z1 = slope * (radius - r0) + z0;
221  return (fabs(z1) <= fabs(length) + epsilon_);
222 }

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

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

◆ checkCompatible() [2/2]

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

Definition at line 224 of file DirectMuonNavigation.cc.

224  {
225  float z0 = fts.position().z();
226  float r0 = fts.position().perp();
227  float zm = fts.momentum().z();
228  float rm = fts.momentum().perp();
229  float slope = rm / zm;
230 
231  if (!outward(fts))
232  slope = -slope;
233 
234  const BoundDisk& bd = dl->specificSurface();
235 
236  float outRadius = bd.outerRadius();
237  float inRadius = bd.innerRadius();
238  float z = bd.position().z();
239 
240  float r1 = slope * (z - z0) + r0;
241  return (r1 >= inRadius - epsilon_ && r1 <= outRadius + epsilon_);
242 }

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

◆ clone()

DirectMuonNavigation* DirectMuonNavigation::clone ( void  ) const
inline

Definition at line 27 of file DirectMuonNavigation.h.

27 { return new DirectMuonNavigation(*this); }

References DirectMuonNavigation().

◆ compatibleEndcapLayers()

vector< const DetLayer * > DirectMuonNavigation::compatibleEndcapLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 93 of file DirectMuonNavigation.cc.

94  {
95  float zm = fts.momentum().z();
96 
97  vector<const DetLayer*> output;
98 
99  // collect all endcap layers on 2 sides
100  outInBackward(fts, output);
101  inOutForward(fts, output);
102 
103  // check direction FTS to get a correct order of DetLayers
104  if ((zm > 0 && dir == oppositeToMomentum) || (zm < 0 && dir == alongMomentum))
105  std::reverse(output.begin(), output.end());
106 
107  return output;
108 }

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

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

◆ compatibleLayers()

vector< const DetLayer * > DirectMuonNavigation::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 30 of file DirectMuonNavigation.cc.

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)
44  inOutBarrel(fts, output);
45  if (theEndcapFlag) {
46  if (z0 >= 0)
47  inOutForward(fts, output);
48  else
49  inOutBackward(fts, output);
50  }
51  } else {
52  if (theEndcapFlag) {
53  if (z0 >= 0)
54  outInForward(fts, output);
55  else
56  outInBackward(fts, output);
57  }
58  if (theBarrelFlag)
59  inOutBarrel(fts, output);
60  }
61  } else {
62  if ((zm * z0) >= 0) {
63  if (theBarrelFlag)
64  outInBarrel(fts, output);
65  if (theEndcapFlag) {
66  if (z0 >= 0)
67  inOutForward(fts, output);
68  else
69  inOutBackward(fts, output);
70  }
71  } else {
72  if (theEndcapFlag) {
73  if (z0 >= 0)
74  outInForward(fts, output);
75  else
76  outInBackward(fts, output);
77  }
78  if (theBarrelFlag)
79  outInBarrel(fts, output);
80  }
81  }
82 
83  if (dir == oppositeToMomentum)
84  std::reverse(output.begin(), output.end());
85 
86  return output;
87 }

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

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

◆ inOutBackward()

void DirectMuonNavigation::inOutBackward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 176 of file DirectMuonNavigation.cc.

176  {
177  bool cont = false;
178  const vector<const DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();
179 
180  for (vector<const DetLayer*>::const_iterator iter_E = backward.begin(); iter_E != backward.end(); iter_E++) {
181  if (cont)
182  output.push_back((*iter_E));
183  else if (checkCompatible(fts, dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
184  output.push_back((*iter_E));
185  cont = true;
186  }
187  }
188 }

References MuonDetLayerGeometry::allBackwardLayers(), checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

◆ inOutBarrel()

void DirectMuonNavigation::inOutBarrel ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 110 of file DirectMuonNavigation.cc.

110  {
111  bool cont = false;
112  const vector<const DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();
113 
114  for (vector<const DetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++) {
115  if (cont)
116  output.push_back((*iter_B));
117  else if (checkCompatible(fts, dynamic_cast<const BarrelDetLayer*>(*iter_B))) {
118  output.push_back((*iter_B));
119  cont = true;
120  }
121  }
122 }

References MuonDetLayerGeometry::allBarrelLayers(), Reference_intrackfit_cff::barrel, checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

◆ inOutForward()

void DirectMuonNavigation::inOutForward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 144 of file DirectMuonNavigation.cc.

144  {
145  const vector<const DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
146  bool cont = false;
147  for (vector<const DetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) {
148  if (cont)
149  output.push_back((*iter_E));
150  else if (checkCompatible(fts, dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
151  output.push_back((*iter_E));
152  cont = true;
153  }
154  }
155 }

References MuonDetLayerGeometry::allForwardLayers(), checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

◆ outInBackward()

void DirectMuonNavigation::outInBackward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 190 of file DirectMuonNavigation.cc.

190  {
191  bool cont = false;
192  const vector<const DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();
193 
194  vector<const DetLayer*>::const_iterator rbegin = backward.end();
195  rbegin--;
196  vector<const DetLayer*>::const_iterator rend = backward.begin();
197  rend--;
198  for (vector<const DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend; iter_E--) {
199  if (cont)
200  output.push_back((*iter_E));
201  else if (checkCompatible(fts, dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
202  output.push_back((*iter_E));
203  cont = true;
204  }
205  }
206 }

References MuonDetLayerGeometry::allBackwardLayers(), checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

◆ outInBarrel()

void DirectMuonNavigation::outInBarrel ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 124 of file DirectMuonNavigation.cc.

124  {
125  // default barrel layers are in out, reverse order
126  const vector<const DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();
127 
128  bool cont = false;
129  vector<const DetLayer*>::const_iterator rbegin = barrel.end();
130  rbegin--;
131  vector<const DetLayer*>::const_iterator rend = barrel.begin();
132  rend--;
133 
134  for (vector<const DetLayer*>::const_iterator iter_B = rbegin; iter_B != rend; iter_B--) {
135  if (cont)
136  output.push_back((*iter_B));
137  else if (checkCompatible(fts, dynamic_cast<const BarrelDetLayer*>(*iter_B))) {
138  output.push_back((*iter_B));
139  cont = true;
140  }
141  }
142 }

References MuonDetLayerGeometry::allBarrelLayers(), Reference_intrackfit_cff::barrel, checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

◆ outInForward()

void DirectMuonNavigation::outInForward ( const FreeTrajectoryState fts,
std::vector< const DetLayer * > &  output 
) const
private

Definition at line 157 of file DirectMuonNavigation.cc.

157  {
158  // default forward layers are in out, reverse order
159 
160  bool cont = false;
161  const vector<const DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
162  vector<const DetLayer*>::const_iterator rbegin = forward.end();
163  rbegin--;
164  vector<const DetLayer*>::const_iterator rend = forward.begin();
165  rend--;
166  for (vector<const DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend; iter_E--) {
167  if (cont)
168  output.push_back((*iter_E));
169  else if (checkCompatible(fts, dynamic_cast<const ForwardDetLayer*>(*iter_E))) {
170  output.push_back((*iter_E));
171  cont = true;
172  }
173  }
174 }

References MuonDetLayerGeometry::allForwardLayers(), checkCompatible(), generateEDF::cont, convertSQLitetoXML_cfg::output, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

◆ outward()

bool DirectMuonNavigation::outward ( const FreeTrajectoryState fts) const
private

Definition at line 244 of file DirectMuonNavigation.cc.

244  {
245  // return (fts.position().basicVector().dot(fts.momentum().basicVector())>0);
246 
247  float x0 = fts.position().x();
248  float y0 = fts.position().y();
249 
250  float xm = fts.momentum().x();
251  float ym = fts.momentum().y();
252 
253  return ((x0 * xm + y0 * ym) > 0);
254 }

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

Referenced by checkCompatible(), and compatibleLayers().

Member Data Documentation

◆ epsilon_

float DirectMuonNavigation::epsilon_
private

Definition at line 53 of file DirectMuonNavigation.h.

Referenced by checkCompatible().

◆ theBarrelFlag

bool DirectMuonNavigation::theBarrelFlag
private

Definition at line 55 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().

◆ theEndcapFlag

bool DirectMuonNavigation::theEndcapFlag
private

Definition at line 54 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().

◆ theMuonDetLayerGeometry

edm::ESHandle<MuonDetLayerGeometry> DirectMuonNavigation::theMuonDetLayerGeometry
private
MuonDetLayerGeometry::allBarrelLayers
const std::vector< const DetLayer * > & allBarrelLayers() const
return all barrel DetLayers (DT+RPC), inside-out
Definition: MuonDetLayerGeometry.cc:189
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
DirectMuonNavigation::theEndcapFlag
bool theEndcapFlag
Definition: DirectMuonNavigation.h:54
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DirectMuonNavigation::inOutBackward
void inOutBackward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:176
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
DirectMuonNavigation::inOutForward
void inOutForward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:144
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
DirectMuonNavigation::epsilon_
float epsilon_
Definition: DirectMuonNavigation.h:53
oppositeToMomentum
Definition: PropagationDirection.h:4
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
DirectMuonNavigation::outInBackward
void outInBackward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:190
BoundDisk
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DirectMuonNavigation::outward
bool outward(const FreeTrajectoryState &fts) const
Definition: DirectMuonNavigation.cc:244
DirectMuonNavigation::theBarrelFlag
bool theBarrelFlag
Definition: DirectMuonNavigation.h:55
DirectMuonNavigation::outInBarrel
void outInBarrel(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:124
DDAxes::z
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
DirectMuonNavigation::theMuonDetLayerGeometry
edm::ESHandle< MuonDetLayerGeometry > theMuonDetLayerGeometry
Definition: DirectMuonNavigation.h:52
DirectMuonNavigation::inOutBarrel
void inOutBarrel(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:110
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MuonDetLayerGeometry::allForwardLayers
const std::vector< const DetLayer * > & allForwardLayers() const
return all forward (+Z) layers (CSC+RPC+GEM+ME0), inside-out
Definition: MuonDetLayerGeometry.cc:193
eostools.rm
def rm(path, rec=False)
Definition: eostools.py:363
DirectMuonNavigation::outInForward
void outInForward(const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
Definition: DirectMuonNavigation.cc:157
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
MuonDetLayerGeometry::allBackwardLayers
const std::vector< const DetLayer * > & allBackwardLayers() const
return all backward (-Z) layers (CSC+RPC+GEM+ME0), inside-out
Definition: MuonDetLayerGeometry.cc:195
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
BoundCylinder
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DirectMuonNavigation::checkCompatible
bool checkCompatible(const FreeTrajectoryState &fts, const BarrelDetLayer *) const
Definition: DirectMuonNavigation.cc:208
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
DirectMuonNavigation::DirectMuonNavigation
DirectMuonNavigation(const edm::ESHandle< MuonDetLayerGeometry > &)
Definition: DirectMuonNavigation.cc:19
BarrelDetLayer::specificSurface
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
Definition: BarrelDetLayer.h:39
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
alongMomentum
Definition: PropagationDirection.h:4
ForwardDetLayer::specificSurface
virtual const BoundDisk & specificSurface() const final
Definition: ForwardDetLayer.h:39
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23