CMS 3D CMS Logo

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

DAFTrackProducer Class Reference

#include <DAFTrackProducer.h>

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

List of all members.

Public Types

typedef std::vector< TrajectoryTrajectoryCollection

Public Member Functions

 DAFTrackProducer (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

DAFTrackProducerAlgorithm theAlgo

Detailed Description

Definition at line 8 of file DAFTrackProducer.h.


Member Typedef Documentation

Definition at line 10 of file DAFTrackProducer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 20 of file DAFTrackProducer.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 DAFTrackProducer::getFromEvt ( edm::Event theEvent,
edm::Handle< TrajectoryCollection > &  theTrajectoryCollection,
reco::BeamSpot bs 
) [private]

Definition at line 88 of file DAFTrackProducer.cc.

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

Referenced by produce().

{
  //
  //get the TrajectoryCollection from the event
  //
 
  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 DAFTrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
) [virtual]

Implementation of produce method.

Implements edm::EDProducer.

Definition at line 38 of file DAFTrackProducer.cc.

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

{
  edm::LogInfo("DAFTrackProducer") << "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 DAF 
  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
  edm::ESHandle<SiTrackerMultiRecHitUpdator> 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);
  
  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(), 
           outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults);
  
}

Member Data Documentation

Definition at line 18 of file DAFTrackProducer.h.

Referenced by produce().