CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PixelTrackProducer Class Reference

#include <PixelTrackProducer.h>

Inheritance diagram for PixelTrackProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &es) override
virtual void endRun (const edm::Run &run, const edm::EventSetup &es) override
 PixelTrackProducer (const edm::ParameterSet &conf)
virtual void produce (edm::Event &ev, const edm::EventSetup &es) override
 ~PixelTrackProducer ()

Private Member Functions

void store (edm::Event &ev, const pixeltrackfitting::TracksWithTTRHs &selectedTracks)

Private Attributes

PixelTrackReconstruction theReconstruction

Detailed Description

Definition at line 10 of file PixelTrackProducer.h.


Constructor & Destructor Documentation

PixelTrackProducer::PixelTrackProducer ( const edm::ParameterSet conf) [explicit]

Definition at line 18 of file PixelTrackProducer.cc.

  : theReconstruction(cfg)
{
  edm::LogInfo("PixelTrackProducer")<<" construction...";
  produces<reco::TrackCollection>();
  produces<TrackingRecHitCollection>();
  produces<reco::TrackExtraCollection>();
}
PixelTrackProducer::~PixelTrackProducer ( )

Definition at line 27 of file PixelTrackProducer.cc.

{ }

Member Function Documentation

void PixelTrackProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
) [override, virtual]

Reimplemented from edm::EDProducer.

Definition at line 34 of file PixelTrackProducer.cc.

References PixelTrackReconstruction::init(), and theReconstruction.

void PixelTrackProducer::endRun ( const edm::Run run,
const edm::EventSetup es 
) [override, virtual]

Reimplemented from edm::EDProducer.

Definition at line 29 of file PixelTrackProducer.cc.

References PixelTrackReconstruction::halt(), and theReconstruction.

void PixelTrackProducer::produce ( edm::Event ev,
const edm::EventSetup es 
) [override, virtual]

Implements edm::EDProducer.

Definition at line 39 of file PixelTrackProducer.cc.

References edm::EventBase::id(), LogDebug, PixelTrackReconstruction::run(), store(), theReconstruction, and testEve_cfg::tracks.

{
  LogDebug("PixelTrackProducer, produce")<<"event# :"<<ev.id();

  TracksWithTTRHs tracks;
  theReconstruction.run(tracks,ev,es);

  // store tracks
  store(ev, tracks);
}
void PixelTrackProducer::store ( edm::Event ev,
const pixeltrackfitting::TracksWithTTRHs selectedTracks 
) [private]

Definition at line 50 of file PixelTrackProducer.cc.

References reco::TrackExtraBase::add(), i, gen::k, LogDebug, edm::Event::put(), reco::TrackBase::setHitPattern(), SeedingHitSet::size(), and testEve_cfg::tracks.

Referenced by produce().

{
  std::auto_ptr<reco::TrackCollection> tracks(new reco::TrackCollection());
  std::auto_ptr<TrackingRecHitCollection> recHits(new TrackingRecHitCollection());
  std::auto_ptr<reco::TrackExtraCollection> trackExtras(new reco::TrackExtraCollection());

  int cc = 0, nTracks = tracksWithHits.size();

  for (int i = 0; i < nTracks; i++)
  {
    reco::Track* track =  tracksWithHits.at(i).first;
    const SeedingHitSet& hits = tracksWithHits.at(i).second;

    for (unsigned int k = 0; k < hits.size(); k++)
    {
      TrackingRecHit *hit = hits[k]->hit()->clone();

      track->setHitPattern(*hit, k);
      recHits->push_back(hit);
    }
    tracks->push_back(*track);
    delete track;

  }

  LogDebug("TrackProducer") << "put the collection of TrackingRecHit in the event" << "\n";
  edm::OrphanHandle <TrackingRecHitCollection> ohRH = ev.put( recHits );


  for (int k = 0; k < nTracks; k++)
  {
    reco::TrackExtra* theTrackExtra = new reco::TrackExtra();

    //fill the TrackExtra with TrackingRecHitRef
    unsigned int nHits = tracks->at(k).numberOfValidHits();
    for(unsigned int i = 0; i < nHits; ++i) {
      theTrackExtra->add(TrackingRecHitRef(ohRH,cc));
      cc++;
    }

    trackExtras->push_back(*theTrackExtra);
    delete theTrackExtra;
  }

  LogDebug("TrackProducer") << "put the collection of TrackExtra in the event" << "\n";
  edm::OrphanHandle<reco::TrackExtraCollection> ohTE = ev.put(trackExtras);

  for (int k = 0; k < nTracks; k++)
  {
    const reco::TrackExtraRef theTrackExtraRef(ohTE,k);
    (tracks->at(k)).setExtra(theTrackExtraRef);
  }

  ev.put(tracks);

}

Member Data Documentation

Definition at line 23 of file PixelTrackProducer.h.

Referenced by beginRun(), endRun(), and produce().