CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackingRecHitTranslator Class Reference

EDProducer to translate RecHits ordered by SimTrackId to RecHits expected by the full pattern recognition. More...

#include <TrackingRecHitTranslator.h>

Inheritance diagram for TrackingRecHitTranslator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 TrackingRecHitTranslator (const edm::ParameterSet &conf)
virtual ~TrackingRecHitTranslator ()

Private Member Functions

void loadRecHits (std::map< DetId, edm::OwnVector< SiTrackerGSRecHit2D > > &theRecHits, SiTrackerFullGSRecHit2DCollection &theRecHitCollection) const

Private Attributes

const TrackerGeometrygeometry

Detailed Description

EDProducer to translate RecHits ordered by SimTrackId to RecHits expected by the full pattern recognition.

Definition at line 27 of file TrackingRecHitTranslator.h.


Constructor & Destructor Documentation

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

TrackingRecHitTranslator.cc -------------------------------------------------------------- Description: see TrackingRecHitTranslator.h Authors: R. Ranieri (CERN) History: Sep 27, 2006 - initial version --------------------------------------------------------------

Definition at line 32 of file TrackingRecHitTranslator.cc.

{
  produces<SiTrackerFullGSRecHit2DCollection>();
}
TrackingRecHitTranslator::~TrackingRecHitTranslator ( ) [virtual]

Definition at line 38 of file TrackingRecHitTranslator.cc.

{}  

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 41 of file TrackingRecHitTranslator.cc.

References geometry, and edm::EventSetup::get().

                                                                         {

  // Initialize the Tracker Geometry
  edm::ESHandle<TrackerGeometry> theGeometry;
  es.get<TrackerDigiGeometryRecord> ().get (theGeometry);
  geometry = &(*theGeometry);

}
void TrackingRecHitTranslator::loadRecHits ( std::map< DetId, edm::OwnVector< SiTrackerGSRecHit2D > > &  theRecHits,
SiTrackerFullGSRecHit2DCollection theRecHitCollection 
) const [private]

Definition at line 93 of file TrackingRecHitTranslator.cc.

References edm::RangeMap< ID, C, P >::put().

Referenced by produce().

{
  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator 
    it = theRecHits.begin();
  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator 
    lastRecHit = theRecHits.end();

  for( ; it != lastRecHit ; ++it ) { 
    theRecHitCollection.put(it->first,it->second.begin(),it->second.end());
  }

}
void TrackingRecHitTranslator::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 50 of file TrackingRecHitTranslator.cc.

References edm::Event::getByType(), loadRecHits(), and edm::Event::put().

{
  // Step A: Get Inputs (FastGSRecHit's)
  edm::Handle<SiTrackerGSRecHit2DCollection> theFastRecHits; 
  e.getByType(theFastRecHits);

  // Step B: fill a temporary full RecHit collection from the fast RecHit collection
  SiTrackerGSRecHit2DCollection::const_iterator aHit = theFastRecHits->begin();
  SiTrackerGSRecHit2DCollection::const_iterator theLastHit = theFastRecHits->end();
  std::map< DetId, edm::OwnVector<SiTrackerGSRecHit2D> > temporaryRecHits;
    
  // loop on Fast GS Hits
  for ( ; aHit != theLastHit; ++aHit ) {

    DetId det = aHit->geographicalId();

    /* 
    const GeomDet* theDet = geometry->idToDet(det);
    unsigned trackID = aHit->simtrackId();

    std::cout << "Track/z/r after : "
              << trackID << " " 
              << theDet->surface().toGlobal(aHit->localPosition()).z() << " " 
              << theDet->surface().toGlobal(aHit->localPosition()).perp() << std::endl;
    */

    // create RecHit
    // Fill the temporary RecHit on the current DetId collection
    temporaryRecHits[det].push_back(aHit->clone());

  }

  // Step C: from the temporary RecHit collection, create the real one.
  std::auto_ptr<SiTrackerFullGSRecHit2DCollection> 
    recHitCollection(new SiTrackerFullGSRecHit2DCollection);
  loadRecHits(temporaryRecHits, *recHitCollection);
  
  // Step D: write output to file
  e.put(recHitCollection);

}

Member Data Documentation

Definition at line 47 of file TrackingRecHitTranslator.h.

Referenced by beginRun().