CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

MTFTrackProducer Class Reference

#include <MTFTrackProducer.h>

Inheritance diagram for MTFTrackProducer:
KfTrackProducerBase edm::EDProducer TrackProducerBase< reco::Track > edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector< TrajectoryTrajectoryCollection

Public Member Functions

 MTFTrackProducer (const edm::ParameterSet &iConfig)
 Constructor.
virtual void produce (edm::Event &, const edm::EventSetup &)
 Implementation of produce method.

Private Member Functions

void getFromEvt (edm::Event &, edm::Handle< TrajectoryCollection > &, reco::BeamSpot &)

Private Attributes

MTFTrackProducerAlgorithm theAlgo

Detailed Description

Definition at line 8 of file MTFTrackProducer.h.


Member Typedef Documentation

Definition at line 10 of file MTFTrackProducer.h.


Constructor & Destructor Documentation

MTFTrackProducer::MTFTrackProducer ( const edm::ParameterSet iConfig) [explicit]

Constructor.

Definition at line 18 of file MTFTrackProducer.cc.

References TrackProducerBase< reco::Track >::alias_, edm::ParameterSet::getParameter(), TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setConf(), and TrackProducerBase< reco::Track >::setSrc().

                                                                :
  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),false),
  theAlgo(iConfig)
{
  setConf(iConfig);
  setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
  //register your products
  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
  produces<std::vector<Trajectory> >() ;
  produces<TrajTrackAssociationCollection>();
}

Member Function Documentation

void MTFTrackProducer::getFromEvt ( edm::Event theEvent,
edm::Handle< TrajectoryCollection > &  theTrajectoryCollection,
reco::BeamSpot bs 
) [private]

Definition at line 87 of file MTFTrackProducer.cc.

References TrackProducerBase< reco::Track >::bsSrc_, edm::Event::getByLabel(), TrackProducerBase< reco::Track >::getConf(), edm::ParameterSet::getParameter(), and TrackProducerBase< reco::Track >::src_.

Referenced by produce().

{

  edm::InputTag src_=getConf().getParameter<edm::InputTag>( "src" );
  theEvent.getByLabel(src_,theTrajectoryCollection );  
  
  //get the BeamSpot
  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
  theEvent.getByLabel(bsSrc_,recoBeamSpotHandle);
  bs = *recoBeamSpotHandle;
}
void MTFTrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
) [virtual]

Implementation of produce method.

Implements edm::EDProducer.

Definition at line 34 of file MTFTrackProducer.cc.

References edm::EventSetup::get(), TrackProducerBase< reco::Track >::getConf(), TrackProducerBase< reco::Track >::getFromES(), getFromEvt(), edm::ParameterSet::getParameter(), edm::EventBase::id(), LogDebug, edm::ESHandle< T >::product(), KfTrackProducerBase::putInEvt(), MTFTrackProducerAlgorithm::runWithCandidate(), and theAlgo.

{
  edm::LogInfo("MTFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
  //
  // create empty output collections
  //
  std::auto_ptr<TrackingRecHitCollection>    outputRHColl (new TrackingRecHitCollection);
  std::auto_ptr<reco::TrackCollection>       outputTColl(new reco::TrackCollection);
  std::auto_ptr<reco::TrackExtraCollection>  outputTEColl(new reco::TrackExtraCollection);
  std::auto_ptr<std::vector<Trajectory> >    outputTrajectoryColl(new std::vector<Trajectory>);

  //
  //declare and get stuff to be retrieved from ES
  //
  edm::ESHandle<TrackerGeometry> theG;
  edm::ESHandle<MagneticField> theMF;
  edm::ESHandle<TrajectoryFitter> theFitter;
  edm::ESHandle<Propagator> thePropagator;
  edm::ESHandle<MeasurementTracker>  theMeasTk;
  edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder;
  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
  //get additional es_modules needed by the MTF 
  edm::ESHandle<MultiTrackFilterHitCollector> measurementCollectorHandle;
  edm::ESHandle<SiTrackerMultiRecHitUpdatorMTF> updatorHandle;  
  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
  std::string  updatorName = getConf().getParameter<std::string>("UpdatorName");        
  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);        

  AlgoProductCollection algoResults;

  edm::Handle<std::vector<Trajectory> > theTrajectoryCollection;

  reco::BeamSpot bs;


  getFromEvt(theEvent,theTrajectoryCollection,bs);

  measurementCollectorHandle->updateEvent(theEvent);    
  //
  //run the algorithm  
    //

  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTrajectoryCollection,
                           theFitter.product(), theBuilder.product(), measurementCollectorHandle.product(), updatorHandle.product(),bs,algoResults);
  //
  //put everything in the event
  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(), 
           outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults);
  LogDebug("MTFTrackProducer") << "end" << "\n";
}

Member Data Documentation

Definition at line 18 of file MTFTrackProducer.h.

Referenced by produce().