CMS 3D CMS Logo

Public Member Functions | Private Attributes

GsfTrackProducer Class Reference

#include <GsfTrackProducer.h>

Inheritance diagram for GsfTrackProducer:
GsfTrackProducerBase edm::EDProducer TrackProducerBase< reco::GsfTrack > edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 GsfTrackProducer (const edm::ParameterSet &iConfig)
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

TrackProducerAlgorithm
< reco::GsfTrack
theAlgo

Detailed Description

Definition at line 12 of file GsfTrackProducer.h.


Constructor & Destructor Documentation

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

Definition at line 18 of file GsfTrackProducer.cc.

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

                                                                :
  GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
                       iConfig.getParameter<bool>("useHitsSplitting")),
  theAlgo(iConfig)
{
  setConf(iConfig);
  setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
//   string a = alias_;
//   a.erase(a.size()-6,a.size());
  //register your products
  produces<reco::GsfTrackCollection>().setBranchAlias( alias_ + "GsfTracks" );
  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
  produces<reco::GsfTrackExtraCollection>().setBranchAlias( alias_ + "GsfTrackExtras" );
  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
  produces<std::vector<Trajectory> >() ;
  produces<TrajGsfTrackAssociationCollection>();

}

Member Function Documentation

void GsfTrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDProducer.

Definition at line 39 of file GsfTrackProducer.cc.

References ExpressReco_HICollisions_FallBack::e, TrackProducerBase< reco::GsfTrack >::getFromES(), TrackProducerBase< reco::GsfTrack >::getFromEvt(), edm::EventBase::id(), LogDebug, edm::ESHandle< T >::product(), GsfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.

{
  edm::LogInfo("GsfTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
  //
  // create empty output collections
  //
  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
  std::auto_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection);
  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
  std::auto_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection);
  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);

  //
  //declare and get TrackColection to be retrieved from the event
  //
  AlgoProductCollection algoResults;
  reco::BeamSpot bs;
  try{  
    edm::Handle<TrackCandidateCollection> theTCCollection;
    getFromEvt(theEvent,theTCCollection,bs);
    
    //
    //run the algorithm  
    //
    LogDebug("GsfTrackProducer") << "run the algorithm" << "\n";
    theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection, 
                             theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
  } catch (cms::Exception &e){ edm::LogInfo("GsfTrackProducer") << "cms::Exception caught!!!" << "\n" << e << "\n"; throw; }
  //
  //put everything in the event
  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(), outputRHColl, outputTColl, outputTEColl, outputGsfTEColl,
           outputTrajectoryColl, algoResults, bs);
  LogDebug("GsfTrackProducer") << "end" << "\n";
}

Member Data Documentation

Definition at line 21 of file GsfTrackProducer.h.

Referenced by produce().