CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
PropagateToMuon Class Reference

Propagate an object (usually a track) to the second muon station. Support for other muon stations will be added on request. More...

#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h"

Public Member Functions

TrajectoryStateOnSurface extrapolate (const reco::Track &tk) const
 Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Candidate &tk) const
 Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Track &tk) const
 Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const FreeTrajectoryState &state) const
 Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Candidate &tk) const
 Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const SimTrack &tk, const edm::SimVertexContainer &vtxs) const
 
TrajectoryStateOnSurface extrapolate (const FreeTrajectoryState &state) const
 Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. More...
 
void init (const edm::EventSetup &iSetup)
 Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. More...
 
void init (const edm::EventSetup &iSetup)
 Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. More...
 
 PropagateToMuon (const edm::ParameterSet &iConfig)
 
 PropagateToMuon (const edm::ParameterSet &iConfig)
 
 ~PropagateToMuon ()
 
 ~PropagateToMuon ()
 

Private Types

enum  WhichState {
  AtVertex, Innermost, Outermost, AtVertex,
  Innermost, Outermost
}
 
enum  WhichState {
  AtVertex, Innermost, Outermost, AtVertex,
  Innermost, Outermost
}
 
enum  WhichTrack {
  None, TrackerTk, MuonTk, GlobalTk,
  None, TrackerTk, MuonTk, GlobalTk
}
 
enum  WhichTrack {
  None, TrackerTk, MuonTk, GlobalTk,
  None, TrackerTk, MuonTk, GlobalTk
}
 

Private Member Functions

TrajectoryStateOnSurface getBestDet (const TrajectoryStateOnSurface &tsos, const DetLayer *station) const
 Get the best TSOS on one of the chambres of this DetLayer, or an invalid TSOS if none match. More...
 
TrajectoryStateOnSurface getBestDet (const TrajectoryStateOnSurface &tsos, const DetLayer *station) const
 Get the best TSOS on one of the chambres of this DetLayer, or an invalid TSOS if none match. More...
 
FreeTrajectoryState startingState (const reco::Candidate &reco) const
 Starting state for the propagation. More...
 
FreeTrajectoryState startingState (const reco::Track &tk) const
 Starting state for the propagation. More...
 
FreeTrajectoryState startingState (const reco::Candidate &reco) const
 Starting state for the propagation. More...
 
FreeTrajectoryState startingState (const reco::Track &tk) const
 Starting state for the propagation. More...
 
FreeTrajectoryState startingState (const SimTrack &tk, const edm::SimVertexContainer &vtxs) const
 Starting state for the propagation. More...
 

Private Attributes

const BoundCylinderbarrelCylinder_
 
double barrelHalfLength_
 
bool cosmicPropagation_
 for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states are in-out really More...
 
const BoundDiskendcapDiskNeg_
 
const BoundDiskendcapDiskPos_
 
std::pair< float, float > endcapRadii_
 
bool fallbackToME1_
 Fallback to ME1 if propagation to ME2 fails. More...
 
edm::ESHandle< MagneticFieldmagfield_
 
edm::ESHandle< MuonDetLayerGeometrymuonGeometry_
 
edm::ESHandle< Propagatorpropagator_
 
edm::ESHandle< PropagatorpropagatorAny_
 
edm::ESHandle< PropagatorpropagatorOpposite_
 
bool useMB2_
 Propagate to MB2 (default) instead of MB1. More...
 
bool useMB2InOverlap_
 
bool useSimpleGeometry_
 Labels for input collections. More...
 
WhichState whichState_
 
WhichTrack whichTrack_
 Labels for input collections. More...
 

Detailed Description

Propagate an object (usually a track) to the second muon station. Support for other muon stations will be added on request.

Author
Giovanni Petrucciani
Giovanni Petrucciani
Version
Id
PropagateToMuon.h,v 1.3 2010/07/01 07:41:09 gpetrucc Exp

Definition at line 28 of file PropagateToMuon.h.

Member Enumeration Documentation

Enumerator
AtVertex 
Innermost 
Outermost 
AtVertex 
Innermost 
Outermost 

Definition at line 47 of file PropagateToMuon.h.

Enumerator
AtVertex 
Innermost 
Outermost 
AtVertex 
Innermost 
Outermost 

Definition at line 55 of file PropagateToMuon.h.

Enumerator
None 
TrackerTk 
MuonTk 
GlobalTk 
None 
TrackerTk 
MuonTk 
GlobalTk 

Definition at line 46 of file PropagateToMuon.h.

Enumerator
None 
TrackerTk 
MuonTk 
GlobalTk 
None 
TrackerTk 
MuonTk 
GlobalTk 

Definition at line 54 of file PropagateToMuon.h.

Constructor & Destructor Documentation

PropagateToMuon::PropagateToMuon ( const edm::ParameterSet iConfig)
explicit

Definition at line 18 of file PropagateToMuon.cc.

References AtVertex, cosmicPropagation_, Exception, edm::ParameterSet::getParameter(), GlobalTk, Innermost, MuonTk, None, Outermost, AlCaHLTBitMon_QueryRunRegistry::string, TrackerTk, whichState_, and whichTrack_.

18  :
19  useSimpleGeometry_(iConfig.getParameter<bool>("useSimpleGeometry")),
21  cosmicPropagation_(iConfig.existsAs<bool>("cosmicPropagationHypothesis") ? iConfig.getParameter<bool>("cosmicPropagationHypothesis") : false)
22 {
23  std::string whichTrack = iConfig.getParameter<std::string>("useTrack");
24  if (whichTrack == "none") { whichTrack_ = None; }
25  else if (whichTrack == "tracker") { whichTrack_ = TrackerTk; }
26  else if (whichTrack == "muon") { whichTrack_ = MuonTk; }
27  else if (whichTrack == "global") { whichTrack_ = GlobalTk; }
28  else throw cms::Exception("Configuration") << "Parameter 'useTrack' must be 'none', 'tracker', 'muon', 'global'\n";
29  if (whichTrack_ != None) {
30  std::string whichState = iConfig.getParameter<std::string>("useState");
31  if (whichState == "atVertex") { whichState_ = AtVertex; }
32  else if (whichState == "innermost") { whichState_ = Innermost; }
33  else if (whichState == "outermost") { whichState_ = Outermost; }
34  else throw cms::Exception("Configuration") << "Parameter 'useState' must be 'atVertex', 'innermost', 'outermost'\n";
35  }
37  throw cms::Exception("Configuration") << "When using 'cosmicPropagationHypothesis' useTrack must not be 'none', and the state must not be 'atVertex'\n";
38  }
39 }
WhichTrack whichTrack_
Labels for input collections.
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
WhichState whichState_
bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
bool useSimpleGeometry_
Labels for input collections.
PropagateToMuon::~PropagateToMuon ( )

Definition at line 41 of file PropagateToMuon.cc.

41 {}
PropagateToMuon::PropagateToMuon ( const edm::ParameterSet iConfig)
explicit
PropagateToMuon::~PropagateToMuon ( )

Member Function Documentation

TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const reco::Track tk) const
inline

Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.

Definition at line 37 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by L1MuonMatcherAlgo::extrapolate(), extrapolate(), TriggerMatcherToHLTDebug::produce(), L1Analysis::L1AnalysisRecoMuon2::SetMuon(), and startingState().

37 { return extrapolate(startingState(tk)); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const reco::Candidate tk) const
inline

Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails.

Definition at line 40 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by extrapolate().

40 { return extrapolate(startingState(tk)); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const reco::Track tk) const
inline

Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.

Definition at line 41 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by extrapolate().

41 { return extrapolate(startingState(tk)); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const FreeTrajectoryState state) const

Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails.

Definition at line 114 of file PropagateToMuon.cc.

References MuonDetLayerGeometry::allDTLayers(), AtVertex, MuonDetLayerGeometry::backwardCSCLayers(), barrelCylinder_, barrelHalfLength_, cosmicPropagation_, Vector3DBase< T, FrameTag >::dot(), endcapDiskNeg_, endcapDiskPos_, endcapRadii_, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), MuonDetLayerGeometry::forwardCSCLayers(), getBestDet(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), muonGeometry_, PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), Propagator::propagate(), propagator_, propagatorOpposite_, rho, useSimpleGeometry_, whichState_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

114  {
116  if (start.momentum().mag() == 0) return final;
117  double eta = start.momentum().eta();
118 
119  const Propagator * propagatorBarrel = &*propagator_;
120  const Propagator * propagatorEndcaps = &*propagator_;
121 
122  if (whichState_ != AtVertex) {
123  if (start.position().perp() > barrelCylinder_->radius()) propagatorBarrel = &*propagatorOpposite_;
124  if (fabs(start.position().z()) > endcapDiskPos_->position().z()) propagatorEndcaps = &*propagatorOpposite_;
125  }
126  if (cosmicPropagation_) {
127  if (start.momentum().dot(GlobalVector(start.position().x(), start.position().y(), start.position().z())) < 0) {
128  // must flip the propagations
129  propagatorBarrel = (propagatorBarrel == &*propagator_ ? &*propagatorOpposite_ : &*propagator_);
130  propagatorEndcaps = (propagatorEndcaps == &*propagator_ ? &*propagatorOpposite_ : &*propagator_);
131  }
132  }
133 
134  TrajectoryStateOnSurface tsos = propagatorBarrel->propagate(start, *barrelCylinder_);
135  if (tsos.isValid()) {
136  if (useSimpleGeometry_) {
137  if (fabs(tsos.globalPosition().z()) <= barrelHalfLength_) final = tsos;
138  } else {
139  final = getBestDet(tsos, muonGeometry_->allDTLayers()[1]);
140  }
141  }
142 
143  if (!final.isValid()) {
144  tsos = propagatorEndcaps->propagate(start, (eta > 0 ? *endcapDiskPos_ : *endcapDiskNeg_));
145  if (tsos.isValid()) {
146  if (useSimpleGeometry_) {
147  float rho = tsos.globalPosition().perp();
148  if ((rho >= endcapRadii_.first) && (rho <= endcapRadii_.second)) final = tsos;
149  } else {
150  final = getBestDet(tsos, (eta > 0 ? muonGeometry_->forwardCSCLayers()[2] : muonGeometry_->backwardCSCLayers()[2]));
151  }
152  }
153  }
154  return final;
155 }
Definition: start.py:1
const BoundDisk * endcapDiskNeg_
T perp() const
Definition: PV3DBase.h:72
WhichState whichState_
GlobalPoint globalPosition() const
const BoundDisk * endcapDiskPos_
TrajectoryStateOnSurface getBestDet(const TrajectoryStateOnSurface &tsos, const DetLayer *station) const
Get the best TSOS on one of the chambres of this DetLayer, or an invalid TSOS if none match...
const BoundCylinder * barrelCylinder_
T z() const
Definition: PV3DBase.h:64
edm::ESHandle< Propagator > propagator_
bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
const std::vector< const DetLayer * > & allDTLayers() const
return the DT DetLayers (barrel), inside-out
const std::vector< const DetLayer * > & forwardCSCLayers() const
return the forward (+Z) CSC DetLayers, inside-out
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
bool useSimpleGeometry_
Labels for input collections.
edm::ESHandle< MuonDetLayerGeometry > muonGeometry_
double barrelHalfLength_
const std::vector< const DetLayer * > & backwardCSCLayers() const
return the backward (-Z) CSC DetLayers, inside-out
edm::ESHandle< Propagator > propagatorOpposite_
Global3DVector GlobalVector
Definition: GlobalVector.h:10
std::pair< float, float > endcapRadii_
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const reco::Candidate tk) const
inline

Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails.

Definition at line 44 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by extrapolate().

44 { return extrapolate(startingState(tk)); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const SimTrack tk,
const edm::SimVertexContainer vtxs 
) const
inline

Extrapolate a SimTrack to the muon station 2, return an invalid TSOS if it fails; needs the SimVertices too, to know where to start from Note: it will throw an exception if the SimTrack has no vertex.

Definition at line 49 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by extrapolate().

49 { return extrapolate(startingState(tk, vtxs)); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
TrajectoryStateOnSurface PropagateToMuon::extrapolate ( const FreeTrajectoryState state) const

Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails.

TrajectoryStateOnSurface PropagateToMuon::getBestDet ( const TrajectoryStateOnSurface tsos,
const DetLayer station 
) const
private

Get the best TSOS on one of the chambres of this DetLayer, or an invalid TSOS if none match.

Definition at line 158 of file PropagateToMuon.cc.

References GeometricSearchDet::compatibleDets(), and propagatorAny_.

Referenced by extrapolate(), and startingState().

158  {
159  TrajectoryStateOnSurface ret; // start as null
160  Chi2MeasurementEstimator estimator(1e10, 3.); // require compatibility at 3 sigma
161  std::vector<GeometricSearchDet::DetWithState> dets = layer->compatibleDets(tsos, *propagatorAny_, estimator);
162  if (!dets.empty()) {
163  ret = dets.front().second;
164  }
165  return ret;
166 }
edm::ESHandle< Propagator > propagatorAny_
TrajectoryStateOnSurface PropagateToMuon::getBestDet ( const TrajectoryStateOnSurface tsos,
const DetLayer station 
) const
private

Get the best TSOS on one of the chambres of this DetLayer, or an invalid TSOS if none match.

void PropagateToMuon::init ( const edm::EventSetup iSetup)

Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators.

Definition at line 44 of file PropagateToMuon.cc.

References MuonDetLayerGeometry::allDTLayers(), MuonDetLayerGeometry::backwardCSCLayers(), barrelCylinder_, barrelHalfLength_, endcapDiskNeg_, endcapDiskPos_, endcapRadii_, Exception, MuonDetLayerGeometry::forwardCSCLayers(), edm::EventSetup::get(), magfield_, muonGeometry_, propagator_, propagatorAny_, propagatorOpposite_, and GeometricSearchDet::surface().

Referenced by TriggerMatcherToHLTDebug::beginRun(), L1MuonMatcherAlgo::init(), and L1Analysis::L1AnalysisRecoMuon2::init().

44  {
45  iSetup.get<IdealMagneticFieldRecord>().get(magfield_);
46  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator_);
47  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorOpposite", propagatorOpposite_);
48  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagatorAny_);
50 
51  const DetLayer * dt2 = muonGeometry_->allDTLayers()[1];
52  const DetLayer * csc2Pos = muonGeometry_->forwardCSCLayers()[2];
53  const DetLayer * csc2Neg = muonGeometry_->backwardCSCLayers()[2];
54  barrelCylinder_ = dynamic_cast<const BoundCylinder *>(&dt2->surface());
55  endcapDiskPos_ = dynamic_cast<const BoundDisk *>(& csc2Pos->surface());
56  endcapDiskNeg_ = dynamic_cast<const BoundDisk *>(& csc2Neg->surface());
57  if (barrelCylinder_==nullptr || endcapDiskPos_==nullptr || endcapDiskNeg_==nullptr) throw cms::Exception("Geometry") << "Bad muon geometry!?";
58  barrelHalfLength_ = barrelCylinder_->bounds().length()/2;;
59  endcapRadii_ = std::make_pair(endcapDiskPos_->innerRadius(), endcapDiskPos_->outerRadius());
60  //std::cout << "L1MuonMatcher: barrel radius = " << barrelCylinder_->radius() << ", half length = " << barrelHalfLength_ <<
61  // "; endcap Z = " << endcapDiskPos_->position().z() << ", radii = " << endcapRadii_.first << "," << endcapRadii_.second << std::std::endl;
62 }
edm::ESHandle< Propagator > propagatorAny_
const BoundDisk * endcapDiskNeg_
const BoundDisk * endcapDiskPos_
edm::ESHandle< MagneticField > magfield_
const BoundCylinder * barrelCylinder_
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
edm::ESHandle< Propagator > propagator_
const std::vector< const DetLayer * > & allDTLayers() const
return the DT DetLayers (barrel), inside-out
const std::vector< const DetLayer * > & forwardCSCLayers() const
return the forward (+Z) CSC DetLayers, inside-out
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< MuonDetLayerGeometry > muonGeometry_
double barrelHalfLength_
const std::vector< const DetLayer * > & backwardCSCLayers() const
return the backward (-Z) CSC DetLayers, inside-out
edm::ESHandle< Propagator > propagatorOpposite_
std::pair< float, float > endcapRadii_
void PropagateToMuon::init ( const edm::EventSetup iSetup)

Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators.

FreeTrajectoryState PropagateToMuon::startingState ( const reco::Candidate reco) const
private

Starting state for the propagation.

Definition at line 65 of file PropagateToMuon.cc.

References reco::Candidate::charge(), reco::RecoCandidate::combinedMuon(), Exception, GlobalTk, edm::Ref< C, T, F >::isNull(), magfield_, MuonTk, None, edm::ESHandle< T >::product(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), trackingPlots::reco, reco::RecoCandidate::standAloneMuon(), reco::RecoCandidate::track(), TrackerTk, reco::Candidate::vx(), reco::Candidate::vy(), reco::Candidate::vz(), and whichTrack_.

Referenced by extrapolate().

65  {
67  if (whichTrack_ != None) {
68  const reco::RecoCandidate *rc = dynamic_cast<const reco::RecoCandidate *>(&reco);
69  if (rc == nullptr) throw cms::Exception("Invalid Data") << "Input object is not a RecoCandidate.\n";
70  reco::TrackRef tk;
71  switch (whichTrack_) {
72  case TrackerTk: tk = rc->track(); break;
73  case MuonTk : tk = rc->standAloneMuon(); break;
74  case GlobalTk : tk = rc->combinedMuon(); break;
75  default: break; // just to make gcc happy
76  }
77  if (tk.isNull()) {
78  ret = FreeTrajectoryState();
79  } else {
80  ret = startingState(*tk);
81  }
82  } else {
83  ret = FreeTrajectoryState( GlobalPoint( reco.vx(), reco.vy(), reco.vz()),
84  GlobalVector(reco.px(), reco.py(), reco.pz()),
85  reco.charge(),
86  magfield_.product());
87  }
88  return ret;
89 }
WhichTrack whichTrack_
Labels for input collections.
virtual double pz() const =0
z coordinate of momentum vector
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
virtual double vx() const =0
x coordinate of vertex position
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual double vy() const =0
y coordinate of vertex position
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
virtual reco::TrackRef track() const
reference to a Track
edm::ESHandle< MagneticField > magfield_
virtual double py() const =0
y coordinate of momentum vector
bool isNull() const
Checks for null.
Definition: Ref.h:250
virtual int charge() const =0
electric charge
virtual double vz() const =0
z coordinate of vertex position
virtual double px() const =0
x coordinate of momentum vector
T const * product() const
Definition: ESHandle.h:86
Global3DVector GlobalVector
Definition: GlobalVector.h:10
virtual reco::TrackRef combinedMuon() const
reference to a stand-alone muon Track
FreeTrajectoryState PropagateToMuon::startingState ( const reco::Track tk) const
private

Starting state for the propagation.

Definition at line 92 of file PropagateToMuon.cc.

References AtVertex, cosmicPropagation_, trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerFreeState(), Innermost, reco::Track::innerPosition(), magfield_, trajectoryStateTransform::outerFreeState(), Outermost, reco::Track::outerPosition(), edm::ESHandle< T >::product(), and whichState_.

92  {
93  WhichState state = whichState_;
94  if (cosmicPropagation_) {
95  if (whichState_ == Innermost) {
96  state = tk.innerPosition().Mag2() <= tk.outerPosition().Mag2() ? Innermost : Outermost;
97  } else if (whichState_ == Outermost) {
98  state = tk.innerPosition().Mag2() <= tk.outerPosition().Mag2() ? Outermost : Innermost;
99  }
100  }
101  switch (state) {
104 
105  case AtVertex:
106  default:
108  }
109 
110 }
WhichState whichState_
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
edm::ESHandle< MagneticField > magfield_
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
T const * product() const
Definition: ESHandle.h:86
FreeTrajectoryState PropagateToMuon::startingState ( const reco::Candidate reco) const
private

Starting state for the propagation.

FreeTrajectoryState PropagateToMuon::startingState ( const reco::Track tk) const
private

Starting state for the propagation.

FreeTrajectoryState PropagateToMuon::startingState ( const SimTrack tk,
const edm::SimVertexContainer vtxs 
) const
private

Starting state for the propagation.

Definition at line 123 of file PropagateToMuon.cc.

References MuonDetLayerGeometry::allDTLayers(), AtVertex, MuonDetLayerGeometry::backwardCSCLayers(), barrelCylinder_, barrelHalfLength_, CoreSimTrack::charge(), GeometricSearchDet::compatibleDets(), cosmicPropagation_, Vector3DBase< T, FrameTag >::dot(), endcapDiskNeg_, endcapDiskPos_, endcapRadii_, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), Exception, extrapolate(), fallbackToME1_, plotBeamSpotDB::first, MuonDetLayerGeometry::forwardCSCLayers(), getBestDet(), TrajectoryStateOnSurface::globalPosition(), edm::ESHandleBase::isValid(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), magfield_, CoreSimTrack::momentum(), FreeTrajectoryState::momentum(), muonGeometry_, SimTrack::noVertex(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), position, edm::ESHandle< T >::product(), Propagator::propagate(), propagator_, propagatorAny_, propagatorOpposite_, rho, edm::second(), useMB2_, useSimpleGeometry_, SimTrack::vertIndex(), badGlobalMuonTaggersAOD_cff::vtx, whichState_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

123  {
124  if (!magfield_.isValid()) throw cms::Exception("NotInitialized") << "PropagateToMuon: You must call init(const edm::EventSetup &iSetup) before using this object.\n";
125  if (tk.noVertex()) throw cms::Exception("UnsupportedOperation") << "I can't propagate simtracks without a vertex, I don't know where to start from.\n";
126  const math::XYZTLorentzVectorD & vtx = (vtxs)[tk.vertIndex()].position();
127  return FreeTrajectoryState( GlobalPoint(vtx.X(), vtx.Y(), vtx.Z()),
128  GlobalVector(tk.momentum().X(), tk.momentum().Y(), tk.momentum().Z()),
129  int(tk.charge()),
130  magfield_.product());
131 }
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
float charge() const
charge
Definition: CoreSimTrack.cc:18
edm::ESHandle< MagneticField > magfield_
bool noVertex() const
Definition: SimTrack.h:30
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:29
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:22
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

const BoundCylinder * PropagateToMuon::barrelCylinder_
private

Definition at line 62 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

double PropagateToMuon::barrelHalfLength_
private

Definition at line 64 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

bool PropagateToMuon::cosmicPropagation_
private

for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states are in-out really

Definition at line 55 of file PropagateToMuon.h.

Referenced by extrapolate(), PropagateToMuon(), and startingState().

const BoundDisk * PropagateToMuon::endcapDiskNeg_
private

Definition at line 63 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

const BoundDisk * PropagateToMuon::endcapDiskPos_
private

Definition at line 63 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

std::pair< float, float > PropagateToMuon::endcapRadii_
private

Definition at line 65 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

bool PropagateToMuon::fallbackToME1_
private

Fallback to ME1 if propagation to ME2 fails.

Definition at line 64 of file PropagateToMuon.h.

Referenced by startingState().

edm::ESHandle< MagneticField > PropagateToMuon::magfield_
private

Definition at line 58 of file PropagateToMuon.h.

Referenced by init(), and startingState().

edm::ESHandle< MuonDetLayerGeometry > PropagateToMuon::muonGeometry_
private

Definition at line 60 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

edm::ESHandle< Propagator > PropagateToMuon::propagator_
private

Definition at line 59 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

edm::ESHandle< Propagator > PropagateToMuon::propagatorAny_
private

Definition at line 59 of file PropagateToMuon.h.

Referenced by getBestDet(), init(), and startingState().

edm::ESHandle< Propagator > PropagateToMuon::propagatorOpposite_
private

Definition at line 59 of file PropagateToMuon.h.

Referenced by extrapolate(), init(), and startingState().

bool PropagateToMuon::useMB2_
private

Propagate to MB2 (default) instead of MB1.

Definition at line 61 of file PropagateToMuon.h.

Referenced by startingState().

bool PropagateToMuon::useMB2InOverlap_
private

Definition at line 73 of file PropagateToMuon.h.

bool PropagateToMuon::useSimpleGeometry_
private

Labels for input collections.

Use simplified geometry (cylinders and disks, not individual chambers)

Definition at line 50 of file PropagateToMuon.h.

Referenced by extrapolate(), and startingState().

WhichState PropagateToMuon::whichState_
private

Definition at line 52 of file PropagateToMuon.h.

Referenced by extrapolate(), PropagateToMuon(), and startingState().

WhichTrack PropagateToMuon::whichTrack_
private

Labels for input collections.

Definition at line 51 of file PropagateToMuon.h.

Referenced by PropagateToMuon(), and startingState().