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. | |
TrajectoryStateOnSurface | extrapolate (const FreeTrajectoryState &state) const |
Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const reco::Candidate &tk) const |
Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const reco::Track &tk) const |
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const reco::Candidate &tk) const |
Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const FreeTrajectoryState &state) const |
Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const SimTrack &tk, const edm::SimVertexContainer &vtxs) const |
void | init (const edm::EventSetup &iSetup) |
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. | |
void | init (const edm::EventSetup &iSetup) |
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. | |
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. | |
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. | |
FreeTrajectoryState | startingState (const SimTrack &tk, const edm::SimVertexContainer &vtxs) const |
Starting state for the propagation. | |
FreeTrajectoryState | startingState (const reco::Track &tk) const |
Starting state for the propagation. | |
FreeTrajectoryState | startingState (const reco::Candidate &reco) const |
Starting state for the propagation. | |
FreeTrajectoryState | startingState (const reco::Candidate &reco) const |
Starting state for the propagation. | |
FreeTrajectoryState | startingState (const reco::Track &tk) const |
Starting state for the propagation. | |
Private Attributes | |
const BoundCylinder * | barrelCylinder_ |
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 | |
const BoundDisk * | endcapDiskNeg_ |
const BoundDisk * | endcapDiskPos_ |
std::pair< float, float > | endcapRadii_ |
bool | fallbackToME1_ |
Fallback to ME1 if propagation to ME2 fails. | |
edm::ESHandle< MagneticField > | magfield_ |
edm::ESHandle < MuonDetLayerGeometry > | muonGeometry_ |
edm::ESHandle< Propagator > | propagator_ |
edm::ESHandle< Propagator > | propagatorAny_ |
edm::ESHandle< Propagator > | propagatorOpposite_ |
bool | useMB2_ |
Propagate to MB2 (default) instead of MB1. | |
bool | useSimpleGeometry_ |
Labels for input collections. | |
WhichState | whichState_ |
WhichTrack | whichTrack_ |
Labels for input collections. |
Propagate an object (usually a track) to the second muon station. Support for other muon stations will be added on request.
Definition at line 30 of file PropagateToMuon.h.
enum PropagateToMuon::WhichState [private] |
Definition at line 49 of file PropagateToMuon.h.
enum PropagateToMuon::WhichState [private] |
Definition at line 56 of file PropagateToMuon.h.
enum PropagateToMuon::WhichTrack [private] |
enum PropagateToMuon::WhichTrack [private] |
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, TrackerTk, whichState_, and whichTrack_.
: useSimpleGeometry_(iConfig.getParameter<bool>("useSimpleGeometry")), whichTrack_(None), whichState_(AtVertex), cosmicPropagation_(iConfig.existsAs<bool>("cosmicPropagationHypothesis") ? iConfig.getParameter<bool>("cosmicPropagationHypothesis") : false) { std::string whichTrack = iConfig.getParameter<std::string>("useTrack"); if (whichTrack == "none") { whichTrack_ = None; } else if (whichTrack == "tracker") { whichTrack_ = TrackerTk; } else if (whichTrack == "muon") { whichTrack_ = MuonTk; } else if (whichTrack == "global") { whichTrack_ = GlobalTk; } else throw cms::Exception("Configuration") << "Parameter 'useTrack' must be 'none', 'tracker', 'muon', 'global'\n"; if (whichTrack_ != None) { std::string whichState = iConfig.getParameter<std::string>("useState"); if (whichState == "atVertex") { whichState_ = AtVertex; } else if (whichState == "innermost") { whichState_ = Innermost; } else if (whichState == "outermost") { whichState_ = Outermost; } else throw cms::Exception("Configuration") << "Parameter 'useState' must be 'atVertex', 'innermost', 'outermost'\n"; } if (cosmicPropagation_ && (whichTrack_ == None || whichState_ == AtVertex)) { throw cms::Exception("Configuration") << "When using 'cosmicPropagationHypothesis' useTrack must not be 'none', and the state must not be 'atVertex'\n"; } }
PropagateToMuon::~PropagateToMuon | ( | ) |
Definition at line 41 of file PropagateToMuon.cc.
{}
PropagateToMuon::PropagateToMuon | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
PropagateToMuon::~PropagateToMuon | ( | ) |
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 extrapolate(), L1MuonMatcherAlgo::extrapolate(), and TriggerMatcherToHLTDebug::produce().
{ return extrapolate(startingState(tk)); }
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_, eta(), PV3DBase< T, PVType, FrameType >::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().
{ TrajectoryStateOnSurface final; if (start.momentum().mag() == 0) return final; double eta = start.momentum().eta(); const Propagator * propagatorBarrel = &*propagator_; const Propagator * propagatorEndcaps = &*propagator_; if (whichState_ != AtVertex) { if (start.position().perp() > barrelCylinder_->radius()) propagatorBarrel = &*propagatorOpposite_; if (fabs(start.position().z()) > endcapDiskPos_->position().z()) propagatorEndcaps = &*propagatorOpposite_; } if (cosmicPropagation_) { if (start.momentum().dot(GlobalVector(start.position().x(), start.position().y(), start.position().z())) < 0) { // must flip the propagations propagatorBarrel = (propagatorBarrel == &*propagator_ ? &*propagatorOpposite_ : &*propagator_); propagatorEndcaps = (propagatorEndcaps == &*propagator_ ? &*propagatorOpposite_ : &*propagator_); } } TrajectoryStateOnSurface tsos = propagatorBarrel->propagate(start, *barrelCylinder_); if (tsos.isValid()) { if (useSimpleGeometry_) { if (fabs(tsos.globalPosition().z()) <= barrelHalfLength_) final = tsos; } else { final = getBestDet(tsos, muonGeometry_->allDTLayers()[1]); } } if (!final.isValid()) { tsos = propagatorEndcaps->propagate(start, (eta > 0 ? *endcapDiskPos_ : *endcapDiskNeg_)); if (tsos.isValid()) { if (useSimpleGeometry_) { float rho = tsos.globalPosition().perp(); if ((rho >= endcapRadii_.first) && (rho <= endcapRadii_.second)) final = tsos; } else { final = getBestDet(tsos, (eta > 0 ? muonGeometry_->forwardCSCLayers()[2] : muonGeometry_->backwardCSCLayers()[2])); } } } return final; }
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 42 of file PropagateToMuon.h.
References extrapolate(), and startingState().
Referenced by extrapolate().
{ return extrapolate(startingState(tk)); }
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 45 of file PropagateToMuon.h.
References extrapolate(), and startingState().
Referenced by extrapolate().
{ return extrapolate(startingState(tk)); }
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 50 of file PropagateToMuon.h.
References extrapolate(), and startingState().
Referenced by extrapolate().
{ return extrapolate(startingState(tk, vtxs)); }
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().
{ return extrapolate(startingState(tk)); }
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.
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 run_regression::ret.
Referenced by extrapolate().
{ TrajectoryStateOnSurface ret; // start as null Chi2MeasurementEstimator estimator(1e10, 3.); // require compatibility at 3 sigma std::vector<GeometricSearchDet::DetWithState> dets = layer->compatibleDets(tsos, *propagatorAny_, estimator); if (!dets.empty()) { ret = dets.front().second; } return ret; }
void PropagateToMuon::init | ( | const edm::EventSetup & | iSetup | ) |
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators.
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_, Exception, edm::EventSetup::get(), BoundDisk::innerRadius(), Bounds::length(), magfield_, muonGeometry_, BoundDisk::outerRadius(), propagator_, propagatorAny_, propagatorOpposite_, and GeometricSearchDet::surface().
Referenced by TriggerMatcherToHLTDebug::beginRun(), and L1MuonMatcherAlgo::init().
{ iSetup.get<IdealMagneticFieldRecord>().get(magfield_); iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator_); iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorOpposite", propagatorOpposite_); iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagatorAny_); iSetup.get<MuonRecoGeometryRecord>().get(muonGeometry_); const DetLayer * dt2 = muonGeometry_->allDTLayers()[1]; const DetLayer * csc2Pos = muonGeometry_->forwardCSCLayers()[2]; const DetLayer * csc2Neg = muonGeometry_->backwardCSCLayers()[2]; barrelCylinder_ = dynamic_cast<const BoundCylinder *>(&dt2->surface()); endcapDiskPos_ = dynamic_cast<const BoundDisk *>(& csc2Pos->surface()); endcapDiskNeg_ = dynamic_cast<const BoundDisk *>(& csc2Neg->surface()); if (barrelCylinder_==0 || endcapDiskPos_==0 || endcapDiskNeg_==0) throw cms::Exception("Geometry") << "Bad muon geometry!?"; barrelHalfLength_ = barrelCylinder_->bounds().length()/2;; endcapRadii_ = std::make_pair(endcapDiskPos_->innerRadius(), endcapDiskPos_->outerRadius()); //std::cout << "L1MuonMatcher: barrel radius = " << barrelCylinder_->radius() << ", half length = " << barrelHalfLength_ << // "; endcap Z = " << endcapDiskPos_->position().z() << ", radii = " << endcapRadii_.first << "," << endcapRadii_.second << std::std::endl; }
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_.
{ WhichState state = whichState_; if (cosmicPropagation_) { if (whichState_ == Innermost) { state = tk.innerPosition().Mag2() <= tk.outerPosition().Mag2() ? Innermost : Outermost; } else if (whichState_ == Outermost) { state = tk.innerPosition().Mag2() <= tk.outerPosition().Mag2() ? Outermost : Innermost; } } switch (state) { case Innermost: return trajectoryStateTransform::innerFreeState( tk, magfield_.product()); case Outermost: return trajectoryStateTransform::outerFreeState( tk, magfield_.product()); case AtVertex: default: return trajectoryStateTransform::initialFreeState(tk, magfield_.product()); } }
FreeTrajectoryState PropagateToMuon::startingState | ( | const reco::Track & | tk | ) | const [private] |
Starting state for the propagation.
FreeTrajectoryState PropagateToMuon::startingState | ( | const reco::Candidate & | reco | ) | const [private] |
Starting state for the propagation.
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(), dt_dqm_sourceclient_common_cff::reco, run_regression::ret, reco::RecoCandidate::standAloneMuon(), reco::RecoCandidate::track(), TrackerTk, reco::Candidate::vx(), reco::Candidate::vy(), reco::Candidate::vz(), and whichTrack_.
Referenced by extrapolate().
{ FreeTrajectoryState ret; if (whichTrack_ != None) { const reco::RecoCandidate *rc = dynamic_cast<const reco::RecoCandidate *>(&reco); if (rc == 0) throw cms::Exception("Invalid Data") << "Input object is not a RecoCandidate.\n"; reco::TrackRef tk; switch (whichTrack_) { case TrackerTk: tk = rc->track(); break; case MuonTk : tk = rc->standAloneMuon(); break; case GlobalTk : tk = rc->combinedMuon(); break; default: break; // just to make gcc happy } if (tk.isNull()) { ret = FreeTrajectoryState(); } else { ret = startingState(*tk); } } else { ret = FreeTrajectoryState( GlobalPoint( reco.vx(), reco.vy(), reco.vz()), GlobalVector(reco.px(), reco.py(), reco.pz()), reco.charge(), magfield_.product()); } return ret; }
FreeTrajectoryState PropagateToMuon::startingState | ( | const SimTrack & | tk, |
const edm::SimVertexContainer & | vtxs | ||
) | const [private] |
Starting state for the propagation.
Definition at line 117 of file PropagateToMuon.cc.
References CoreSimTrack::charge(), edm::ESHandleBase::isValid(), magfield_, CoreSimTrack::momentum(), SimTrack::noVertex(), edm::ESHandle< T >::product(), and SimTrack::vertIndex().
{ if (!magfield_.isValid()) throw cms::Exception("NotInitialized") << "PropagateToMuon: You must call init(const edm::EventSetup &iSetup) before using this object.\n"; if (tk.noVertex()) throw cms::Exception("UnsupportedOperation") << "I can't propagate simtracks without a vertex, I don't know where to start from.\n"; const math::XYZTLorentzVectorD & vtx = (vtxs)[tk.vertIndex()].position(); return FreeTrajectoryState( GlobalPoint(vtx.X(), vtx.Y(), vtx.Z()), GlobalVector(tk.momentum().X(), tk.momentum().Y(), tk.momentum().Z()), int(tk.charge()), magfield_.product()); }
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().
bool PropagateToMuon::fallbackToME1_ [private] |
Fallback to ME1 if propagation to ME2 fails.
Definition at line 65 of file PropagateToMuon.h.
edm::ESHandle< MagneticField > PropagateToMuon::magfield_ [private] |
Definition at line 60 of file PropagateToMuon.h.
Referenced by init(), and startingState().
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::useMB2_ [private] |
Propagate to MB2 (default) instead of MB1.
Definition at line 62 of file PropagateToMuon.h.
bool PropagateToMuon::useSimpleGeometry_ [private] |
Labels for input collections.
Use simplified geometry (cylinders and disks, not individual chambers)
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] |
Labels for input collections.
Definition at line 53 of file PropagateToMuon.h.
Referenced by PropagateToMuon(), and startingState().