#include <MuonSeedTrack.h>
Public Member Functions | |
MuonSeedTrack (const edm::ParameterSet &) | |
constructor with config | |
~MuonSeedTrack () | |
destructor | |
Private Member Functions | |
virtual void | beginJob () |
pre-job booking | |
std::pair< bool, reco::Track > | buildTrackAtPCA (const TrajectorySeed &) const |
Build a track at the PCA WITHOUT any vertex constriant. | |
double | computeNDOF (const TrajectorySeed &) const |
compute the TrajectorySeed's degree of freedom | |
virtual void | endJob () |
post-job | |
TrajectoryStateOnSurface | getSeedTSOS (const TrajectorySeed &seed) const |
get the TrajectorySeed's TrajectoryStateOnSurface | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
construct proto-tracks | |
void | setAlias (std::string alias) |
set the Branch alias | |
Private Attributes | |
std::string | theAlias |
the Branch alias | |
bool | theAllowNoVtxFlag |
edm::InputTag | theSeedsLabel |
the propagator used for extracting TSOS from seed | |
MuonServiceProxy * | theService |
the event setup proxy, it takes care the services update | |
MuonUpdatorAtVertex * | theUpdatorAtVtx |
the class used for updating a Trajectory State at veretex |
Make a (fake) reco::Track from a TrajectorySeed. The (fake) track can be associated to a TrackingParticle (SimTrack) using SimTracker/TrackAssociation. The association can then be used in Validation packages, such as Validation/RecoMuon/MuonTrackValidator.cc
Definition at line 43 of file MuonSeedTrack.h.
MuonSeedTrack::MuonSeedTrack | ( | const edm::ParameterSet & | pset | ) | [explicit] |
constructor with config
Definition at line 42 of file MuonSeedTrack.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonServiceProxy_cff::MuonServiceProxy, and MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex.
{ // service parameters ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters"); theService = new MuonServiceProxy(serviceParameters); ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters"); //theSeedPropagatorName = updatorPar.getParameter<string>("Propagator"); theSeedsLabel = pset.getParameter<InputTag>("MuonSeed"); theUpdatorAtVtx = new MuonUpdatorAtVertex(updatorPar,theService); theAllowNoVtxFlag = pset.getUntrackedParameter<bool>("AllowNoVertex",false); //register products setAlias(pset.getParameter<std::string>("@module_label")); produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks"); }
MuonSeedTrack::~MuonSeedTrack | ( | ) |
destructor
Definition at line 64 of file MuonSeedTrack.cc.
{ if (theService) delete theService; if (theUpdatorAtVtx) delete theUpdatorAtVtx; }
void MuonSeedTrack::beginJob | ( | void | ) | [private, virtual] |
pre-job booking
empty method
Reimplemented from edm::EDProducer.
Definition at line 112 of file MuonSeedTrack.cc.
{ }
pair< bool, reco::Track > MuonSeedTrack::buildTrackAtPCA | ( | const TrajectorySeed & | seed | ) | const [private] |
Build a track at the PCA WITHOUT any vertex constriant.
First calls getSeedTSOS, then propagates to the vertex. Creates a reco::Track from the propagated initial FreeTrajectoryState.
Definition at line 172 of file MuonSeedTrack.cc.
References FreeTrajectoryState::charge(), FreeTrajectoryState::curvilinearError(), debug, MuonPatternRecoDumper::dumpFTS(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), LogTrace, metname, FreeTrajectoryState::momentum(), L1TEmulatorMonitor_cff::p, FreeTrajectoryState::position(), ExpressReco_HICollisions_FallBack::track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ const string metname = "MuonSeedTrack"; MuonPatternRecoDumper debug; TSOS seedTSOS = getSeedTSOS(seed); // This is needed to extrapolate the tsos at vertex LogTrace(metname) << "Propagate to PCA..."; pair<bool,FreeTrajectoryState> extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS); FreeTrajectoryState ftsAtVtx; if(extrapolationResult.first) { ftsAtVtx = extrapolationResult.second; } else { if(TrackerBounds::isInside(seedTSOS.globalPosition())){ LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA"; ftsAtVtx = *seedTSOS.freeState(); } else{ if ( theAllowNoVtxFlag ) { LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA"; ftsAtVtx = *seedTSOS.freeState(); } else { LogWarning(metname) << "Stand Alone track: this track will be rejected"; return pair<bool,reco::Track>(false,reco::Track()); } } } LogTrace(metname) << "TSOS after the extrapolation at vtx"; LogTrace(metname) << debug.dumpFTS(ftsAtVtx); GlobalPoint pca = ftsAtVtx.position(); math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z()); GlobalVector p = ftsAtVtx.momentum(); math::XYZVector persistentMomentum(p.x(),p.y(),p.z()); double dummyNDOF = 1.0; //double ndof = computeNDOF(seed); double dummyChi2 = 1.0; reco::Track track(dummyChi2, dummyNDOF, persistentPCA, persistentMomentum, ftsAtVtx.charge(), ftsAtVtx.curvilinearError()); return pair<bool,reco::Track>(true,track); }
double MuonSeedTrack::computeNDOF | ( | const TrajectorySeed & | trajectory | ) | const [private] |
compute the TrajectorySeed's degree of freedom
Calculates number of degrees of freedom for the TrajectorySeed
Definition at line 228 of file MuonSeedTrack.cc.
References max(), metname, and TrajectorySeed::recHits().
{ const string metname = "MuonSeedTrack"; BasicTrajectorySeed::const_iterator recHits1 = (trajectory.recHits().first); BasicTrajectorySeed::const_iterator recHits2 = (trajectory.recHits().second); double ndof = 0.; if ((*recHits1).isValid()) ndof += (*recHits1).dimension(); if ((*recHits2).isValid()) ndof += (*recHits2).dimension(); //const Trajectory::RecHitContainer transRecHits = trajectory.recHits(); //for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin(); // rechit != transRecHits.end(); ++rechit) //if ((*rechit)->isValid()) ndof += (*rechit)->dimension(); // FIXME! in case of Boff is dof - 4 return max(ndof - 5., 0.); }
void MuonSeedTrack::endJob | ( | void | ) | [private, virtual] |
post-job
empty method
Reimplemented from edm::EDProducer.
Definition at line 121 of file MuonSeedTrack.cc.
{ }
TrajectoryStateOnSurface MuonSeedTrack::getSeedTSOS | ( | const TrajectorySeed & | seed | ) | const [private] |
get the TrajectorySeed's TrajectoryStateOnSurface
Get the TrajectoryStateOnSurface from the TrajectorySeed
Definition at line 128 of file MuonSeedTrack.cc.
References PTrajectoryStateOnDet::detId(), TrajectorySeed::startingState(), and TrajectoryStateTransform::transientState().
{ // Get the Trajectory State on Det (persistent version of a TSOS) from the seed PTrajectoryStateOnDet pTSOD = seed.startingState(); // Transform it in a TrajectoryStateOnSurface TrajectoryStateTransform tsTransform; DetId seedDetId(pTSOD.detId()); const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId ); TrajectoryStateOnSurface initialState = tsTransform.transientState(pTSOD, &(gdet->surface()), &*theService->magneticField()); /* // Get the layer on which the seed relies const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId ); PropagationDirection detLayerOrder = oppositeToMomentum; // ask for compatible layers vector<const DetLayer*> detLayers; detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder); TrajectoryStateOnSurface result = initialState; if(detLayers.size()){ const DetLayer* finalLayer = detLayers.back(); const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface()); if(propagatedState.isValid()) result = propagatedState; } return result; */ return initialState; }
void MuonSeedTrack::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [private, virtual] |
construct proto-tracks
For each seed, make a (fake) reco::Track
Implements edm::EDProducer.
Definition at line 78 of file MuonSeedTrack.cc.
References ExpressReco_HICollisions_FallBack::track, and ExpressReco_HICollisions_FallBack::trackCollection.
{ using namespace edm; // Update the services theService->update(eventSetup); // the track collectios; they will be loaded in the event auto_ptr<reco::TrackCollection> trackCollection(new reco::TrackCollection()); // ... and its reference into the event reco::TrackRefProd trackCollectionRefProd = event.getRefBeforePut<reco::TrackCollection>(); Handle<TrajectorySeedCollection> seeds; event.getByLabel(theSeedsLabel, seeds); for ( TrajectorySeedCollection::const_iterator iSeed = seeds->begin(); iSeed != seeds->end(); iSeed++ ) { pair<bool,reco::Track> resultOfTrackExtrapAtPCA = buildTrackAtPCA(*iSeed); if(!resultOfTrackExtrapAtPCA.first) continue; // take the "bare" track at PCA reco::Track &track = resultOfTrackExtrapAtPCA.second; // fill the TrackCollection trackCollection->push_back(track); } event.put(trackCollection); }
void MuonSeedTrack::setAlias | ( | std::string | alias | ) | [inline, private] |
set the Branch alias
Definition at line 65 of file MuonSeedTrack.h.
References ExpressReco_HICollisions_FallBack::alias, and theAlias.
std::string MuonSeedTrack::theAlias [private] |
bool MuonSeedTrack::theAllowNoVtxFlag [private] |
Definition at line 94 of file MuonSeedTrack.h.
edm::InputTag MuonSeedTrack::theSeedsLabel [private] |
the propagator used for extracting TSOS from seed
the TrajectorySeed label
Definition at line 91 of file MuonSeedTrack.h.
MuonServiceProxy* MuonSeedTrack::theService [private] |
the event setup proxy, it takes care the services update
Definition at line 79 of file MuonSeedTrack.h.
the class used for updating a Trajectory State at veretex
Definition at line 82 of file MuonSeedTrack.h.