CMS 3D CMS Logo

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>

List of all members.

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 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.
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 ()

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.
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 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
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.
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 2010/04/15 18:37:17 klukas 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_, 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.

{}

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 extrapolate(), and L1MuonMatcherAlgo::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.

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::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::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.

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 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]
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;
}

Member Data Documentation

Definition at line 64 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

Definition at line 66 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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().

Definition at line 65 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

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().

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().

Definition at line 61 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

Definition at line 61 of file PropagateToMuon.h.

Referenced by getBestDet(), and init().

Definition at line 61 of file PropagateToMuon.h.

Referenced by extrapolate(), and init().

Labels for input collections.

Definition at line 52 of file PropagateToMuon.h.

Referenced by extrapolate().

Definition at line 54 of file PropagateToMuon.h.

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

Definition at line 53 of file PropagateToMuon.h.

Referenced by PropagateToMuon(), and startingState().