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 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 "HLTriggerOffline/Muon/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 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...
 
 PropagateToMuon (const edm::ParameterSet &iConfig)
 
 ~PropagateToMuon ()
 

Private Types

enum  WhichState { AtVertex, Innermost, Outermost }
 
enum  WhichTrack { 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...
 
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...
 

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_
 
edm::ESHandle< MagneticFieldmagfield_
 
edm::ESHandle
< MuonDetLayerGeometry
muonGeometry_
 
edm::ESHandle< Propagatorpropagator_
 
edm::ESHandle< PropagatorpropagatorAny_
 
edm::ESHandle< PropagatorpropagatorOpposite_
 
bool useSimpleGeometry_
 Labels for input collections. More...
 
WhichState whichState_
 
WhichTrack whichTrack_
 

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
Version
Id:
PropagateToMuon.h,v 1.1 2009/08/03 09:57:58 gpetrucc Exp

Definition at line 30 of file PropagateToMuon.h.

Member Enumeration Documentation

Enumerator
AtVertex 
Innermost 
Outermost 

Definition at line 49 of file PropagateToMuon.h.

Enumerator
None 
TrackerTk 
MuonTk 
GlobalTk 

Definition at line 48 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_, edm::hlt::Exception, edm::ParameterSet::getParameter(), GlobalTk, Innermost, MuonTk, None, Outermost, 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_
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:181
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 {}

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 39 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by L1MuonMatcherAlgo::extrapolate(), and extrapolate().

39 { 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 42 of file PropagateToMuon.h.

References extrapolate(), and startingState().

Referenced by extrapolate().

42 { 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 AtVertex, barrelCylinder_, barrelHalfLength_, cosmicPropagation_, Vector3DBase< T, FrameTag >::dot(), endcapDiskNeg_, endcapDiskPos_, endcapRadii_, PV3DBase< T, PVType, FrameType >::eta(), eta(), getBestDet(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), muonGeometry_, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), FreeTrajectoryState::position(), Propagator::propagate(), propagator_, propagatorOpposite_, Cylinder::radius(), 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 }
edm::ESHandle< Propagator > propagator_
const BoundCylinder * barrelCylinder_
const BoundDisk * endcapDiskNeg_
T perp() const
Definition: PV3DBase.h:66
std::pair< float, float > endcapRadii_
WhichState whichState_
Definition: DDAxes.h:10
GlobalPoint globalPosition() const
T eta() const
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...
edm::ESHandle< Propagator > propagatorOpposite_
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
const BoundDisk * endcapDiskPos_
T z() const
Definition: PV3DBase.h:58
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
edm::ESHandle< MuonDetLayerGeometry > muonGeometry_
bool useSimpleGeometry_
Labels for input collections.
double barrelHalfLength_
const PositionType & position() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
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(), propagatorAny_, and runTheMatrix::ret.

Referenced by extrapolate().

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_
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 barrelCylinder_, barrelHalfLength_, BoundSurface::bounds(), endcapDiskNeg_, endcapDiskPos_, endcapRadii_, edm::hlt::Exception, edm::EventSetup::get(), BoundDisk::innerRadius(), Bounds::length(), magfield_, muonGeometry_, BoundDisk::outerRadius(), propagator_, propagatorAny_, propagatorOpposite_, and GeometricSearchDet::surface().

Referenced by L1MuonMatcherAlgo::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_==0 || endcapDiskPos_==0 || endcapDiskNeg_==0) throw cms::Exception("Geometry") << "Bad muon geometry!?";
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 > propagator_
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
const BoundCylinder * barrelCylinder_
const BoundDisk * endcapDiskNeg_
virtual float length() const =0
std::pair< float, float > endcapRadii_
edm::ESHandle< Propagator > propagatorAny_
edm::ESHandle< Propagator > propagatorOpposite_
const BoundDisk * endcapDiskPos_
edm::ESHandle< MagneticField > magfield_
const Bounds & bounds() const
Definition: BoundSurface.h:89
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< MuonDetLayerGeometry > muonGeometry_
float outerRadius() const
The outer radius of the disk.
Definition: BoundDisk.cc:10
double barrelHalfLength_
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.cc:6
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(), edm::hlt::Exception, GlobalTk, edm::Ref< C, T, F >::isNull(), magfield_, MuonTk, None, edm::ESHandle< class >::product(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), dt_dqm_sourceclient_common_cff::reco, runTheMatrix::ret, 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 == 0) 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_
FreeTrajectoryState startingState(const reco::Candidate &reco) const
Starting state for the propagation.
virtual double pz() const =0
z coordinate of momentum vector
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual double vx() const =0
x coordinate of vertex position
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
virtual double vy() const =0
y coordinate of vertex position
virtual reco::TrackRef track() const
reference to a Track
bool isNull() const
Checks for null.
Definition: Ref.h:246
edm::ESHandle< MagneticField > magfield_
virtual int charge() const =0
electric charge
virtual double py() const =0
y coordinate of momentum vector
virtual double px() const =0
x coordinate of momentum vector
T const * product() const
Definition: ESHandle.h:62
virtual double vz() const =0
z coordinate of vertex position
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< class >::product(), evf::utils::state, and whichState_.

92  {
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:47
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field) const
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:42
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field) const
edm::ESHandle< MagneticField > magfield_
bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
T const * product() const
Definition: ESHandle.h:62
char state
Definition: procUtils.cc:75
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field) const

Member Data Documentation

const BoundCylinder* PropagateToMuon::barrelCylinder_
private

Definition at line 64 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

double PropagateToMuon::barrelHalfLength_
private

Definition at line 66 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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 57 of file PropagateToMuon.h.

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

const BoundDisk * PropagateToMuon::endcapDiskNeg_
private

Definition at line 65 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

const BoundDisk* PropagateToMuon::endcapDiskPos_
private

Definition at line 65 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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

Definition at line 67 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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

Definition at line 60 of file PropagateToMuon.h.

Referenced by init(), and startingState().

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

Definition at line 62 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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

Definition at line 61 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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

Definition at line 61 of file PropagateToMuon.h.

Referenced by getBestDet(), and init().

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

Definition at line 61 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

bool PropagateToMuon::useSimpleGeometry_
private

Labels for input collections.

Definition at line 52 of file PropagateToMuon.h.

Referenced by extrapolate().

WhichState PropagateToMuon::whichState_
private

Definition at line 54 of file PropagateToMuon.h.

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

WhichTrack PropagateToMuon::whichTrack_
private

Definition at line 53 of file PropagateToMuon.h.

Referenced by PropagateToMuon(), and startingState().