CMS 3D CMS Logo

MuonSeedTrack Class Reference

Make a (fake) reco::Track from a TrajectorySeed. More...

#include <Validation/RecoMuon/src/MuonSeedTrack.h>

Inheritance diagram for MuonSeedTrack:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 MuonSeedTrack (const edm::ParameterSet &)
 constructor with config
 ~MuonSeedTrack ()
 destructor

Private Member Functions

virtual void beginJob (const edm::EventSetup &)
 pre-job booking
std::pair< bool, reco::TrackbuildTrackAtPCA (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
MuonUpdatorAtVertextheUpdatorAtVtx
 the class used for updating a Trajectory State at veretex


Detailed Description

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/RecoTrack MultiTrackValidator.cc

Date
2007/09/27 18:04:38
Revision
1.1

Author:
Adam Everett Purdue University

Definition at line 44 of file MuonSeedTrack.h.


Constructor & Destructor Documentation

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, MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, setAlias(), theAlias, theAllowNoVtxFlag, theSeedsLabel, theService, and theUpdatorAtVtx.

00043 {
00044   // service parameters
00045   ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
00046   theService = new MuonServiceProxy(serviceParameters);
00047   
00048   ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
00049   //theSeedPropagatorName = updatorPar.getParameter<string>("Propagator");
00050   theSeedsLabel = pset.getParameter<InputTag>("MuonSeed");
00051   theUpdatorAtVtx = new MuonUpdatorAtVertex(updatorPar,theService);
00052 
00053   theAllowNoVtxFlag = pset.getUntrackedParameter<bool>("AllowNoVertex",false);
00054 
00055   //register products
00056   setAlias(pset.getParameter<std::string>("@module_label"));
00057   produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
00058 
00059 }

MuonSeedTrack::~MuonSeedTrack (  ) 

destructor

Definition at line 64 of file MuonSeedTrack.cc.

References theService, and theUpdatorAtVtx.

00065 {
00066   if (theService) delete theService;
00067   if (theUpdatorAtVtx) delete theUpdatorAtVtx;
00068 }


Member Function Documentation

void MuonSeedTrack::beginJob ( const edm::EventSetup  )  [private, virtual]

pre-job booking

empty method

Reimplemented from edm::EDProducer.

Definition at line 112 of file MuonSeedTrack.cc.

00113 {
00114 }

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(), getSeedTSOS(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), LogTrace, FreeTrajectoryState::momentum(), p, FreeTrajectoryState::position(), MuonUpdatorAtVertex::propagateToNominalLine(), theAllowNoVtxFlag, theUpdatorAtVtx, track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

00172                                                                                     {
00173 
00174   const string metname = "MuonSeedTrack";
00175 
00176   MuonPatternRecoDumper debug;
00177 
00178   TSOS seedTSOS = getSeedTSOS(seed);
00179   // This is needed to extrapolate the tsos at vertex
00180   LogTrace(metname) << "Propagate to PCA...";
00181   pair<bool,FreeTrajectoryState> 
00182     extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS);
00183   FreeTrajectoryState ftsAtVtx;
00184   
00185   if(extrapolationResult.first) {
00186     ftsAtVtx = extrapolationResult.second;
00187   }  else {    
00188     if(TrackerBounds::isInside(seedTSOS.globalPosition())){
00189       LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
00190       ftsAtVtx = *seedTSOS.freeState();
00191     }
00192     else{
00193       if ( theAllowNoVtxFlag ) {
00194         LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
00195         ftsAtVtx = *seedTSOS.freeState();
00196       } else {
00197         LogWarning(metname) << "Stand Alone track: this track will be rejected";
00198         return pair<bool,reco::Track>(false,reco::Track());
00199       }
00200     }
00201   }
00202     
00203   LogTrace(metname) << "TSOS after the extrapolation at vtx";
00204   LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
00205   
00206   GlobalPoint pca = ftsAtVtx.position();
00207   math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
00208   GlobalVector p = ftsAtVtx.momentum();
00209   math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
00210   
00211   double dummyNDOF = 1.0;
00212   //double ndof = computeNDOF(seed);
00213   double dummyChi2 = 1.0;
00214   
00215   reco::Track track(dummyChi2, 
00216                     dummyNDOF,
00217                     persistentPCA,
00218                     persistentMomentum,
00219                     ftsAtVtx.charge(),
00220                     ftsAtVtx.curvilinearError());
00221   
00222   return pair<bool,reco::Track>(true,track);
00223 }

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, and TrajectorySeed::recHits().

00228                                                                         {
00229   const string metname = "MuonSeedTrack";
00230 
00231   BasicTrajectorySeed::const_iterator recHits1 = (trajectory.recHits().first);
00232   BasicTrajectorySeed::const_iterator recHits2 = (trajectory.recHits().second);
00233   
00234   double ndof = 0.;
00235 
00236   if ((*recHits1).isValid()) ndof += (*recHits1).dimension();
00237   if ((*recHits2).isValid()) ndof += (*recHits2).dimension();
00238 
00239   //const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
00240   //for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
00241   //  rechit != transRecHits.end(); ++rechit)
00242   //if ((*rechit)->isValid()) ndof += (*rechit)->dimension();
00243   
00244   // FIXME! in case of Boff is dof - 4
00245   return max(ndof - 5., 0.);
00246 }

void MuonSeedTrack::endJob ( void   )  [private, virtual]

post-job

empty method

Reimplemented from edm::EDProducer.

Definition at line 121 of file MuonSeedTrack.cc.

00121                       {
00122 }

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(), theService, and TrajectoryStateTransform::transientState().

Referenced by buildTrackAtPCA().

00128                                                                                    {
00129 
00130   // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
00131   PTrajectoryStateOnDet pTSOD = seed.startingState();
00132 
00133   // Transform it in a TrajectoryStateOnSurface
00134   TrajectoryStateTransform tsTransform;
00135 
00136   DetId seedDetId(pTSOD.detId());
00137 
00138   const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
00139 
00140   TrajectoryStateOnSurface initialState = tsTransform.transientState(pTSOD, &(gdet->surface()), &*theService->magneticField());
00141 
00142   /*
00143   // Get the layer on which the seed relies
00144   const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
00145 
00146   PropagationDirection detLayerOrder = oppositeToMomentum;
00147 
00148   // ask for compatible layers
00149   vector<const DetLayer*> detLayers;
00150   detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder);
00151   
00152   TrajectoryStateOnSurface result = initialState;
00153   if(detLayers.size()){
00154     const DetLayer* finalLayer = detLayers.back();
00155     const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
00156     if(propagatedState.isValid())
00157       result = propagatedState;
00158   }
00159   
00160   return result;
00161   */
00162 
00163   return initialState;
00164 
00165 }

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 buildTrackAtPCA(), theSeedsLabel, theService, and track.

00079 {
00080    using namespace edm;
00081 
00082   // Update the services
00083   theService->update(eventSetup);
00084 
00085   // the track collectios; they will be loaded in the event  
00086   auto_ptr<reco::TrackCollection> trackCollection(new reco::TrackCollection());
00087   // ... and its reference into the event
00088   reco::TrackRefProd trackCollectionRefProd = event.getRefBeforePut<reco::TrackCollection>();
00089 
00090 
00091   Handle<TrajectorySeedCollection> seeds;
00092   event.getByLabel(theSeedsLabel, seeds);
00093 
00094   for ( TrajectorySeedCollection::const_iterator iSeed = seeds->begin();
00095         iSeed != seeds->end(); iSeed++ ) {
00096     pair<bool,reco::Track> resultOfTrackExtrapAtPCA = buildTrackAtPCA(*iSeed);
00097     if(!resultOfTrackExtrapAtPCA.first) continue;
00098     // take the "bare" track at PCA
00099     reco::Track &track = resultOfTrackExtrapAtPCA.second;
00100     // fill the TrackCollection
00101     trackCollection->push_back(track);
00102   }
00103   
00104   event.put(trackCollection);
00105 
00106 }

void MuonSeedTrack::setAlias ( std::string  alias  )  [inline, private]

set the Branch alias

Definition at line 66 of file MuonSeedTrack.h.

References theAlias.

Referenced by MuonSeedTrack().

00066                                   {
00067     alias.erase( alias.size() - 1, alias.size() );
00068     theAlias=alias;
00069   }


Member Data Documentation

std::string MuonSeedTrack::theAlias [private]

the Branch alias

Definition at line 86 of file MuonSeedTrack.h.

Referenced by MuonSeedTrack(), and setAlias().

bool MuonSeedTrack::theAllowNoVtxFlag [private]

Definition at line 95 of file MuonSeedTrack.h.

Referenced by buildTrackAtPCA(), and MuonSeedTrack().

edm::InputTag MuonSeedTrack::theSeedsLabel [private]

the propagator used for extracting TSOS from seed

the TrajectorySeed label

Definition at line 92 of file MuonSeedTrack.h.

Referenced by MuonSeedTrack(), and produce().

MuonServiceProxy* MuonSeedTrack::theService [private]

the event setup proxy, it takes care the services update

Definition at line 80 of file MuonSeedTrack.h.

Referenced by getSeedTSOS(), MuonSeedTrack(), produce(), and ~MuonSeedTrack().

MuonUpdatorAtVertex* MuonSeedTrack::theUpdatorAtVtx [private]

the class used for updating a Trajectory State at veretex

Definition at line 83 of file MuonSeedTrack.h.

Referenced by buildTrackAtPCA(), MuonSeedTrack(), and ~MuonSeedTrack().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:48 2009 for CMSSW by  doxygen 1.5.4