CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

Private Attributes

const TrackerGeometrygeometry
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

33 {
34  produces<SiTrackerFullGSRecHit2DCollection>();
35 }
TrackingRecHitTranslator::~TrackingRecHitTranslator ( )
virtual

Definition at line 38 of file TrackingRecHitTranslator.cc.

38 {}

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().

41  {
42 
43  // Initialize the Tracker Geometry
45  es.get<TrackerDigiGeometryRecord> ().get (theGeometry);
46  geometry = &(*theGeometry);
47 
48 }
const TrackerGeometry * geometry
const T & get() const
Definition: EventSetup.h:55
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().

96 {
97  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator
98  it = theRecHits.begin();
99  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator
100  lastRecHit = theRecHits.end();
101 
102  for( ; it != lastRecHit ; ++it ) {
103  theRecHitCollection.put(it->first,it->second.begin(),it->second.end());
104  }
105 
106 }
void put(ID id, CI begin, CI end)
insert an object range with specified identifier
Definition: RangeMap.h:119
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().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

51 {
52  // Step A: Get Inputs (FastGSRecHit's)
54  e.getByType(theFastRecHits);
55 
56  // Step B: fill a temporary full RecHit collection from the fast RecHit collection
57  SiTrackerGSRecHit2DCollection::const_iterator aHit = theFastRecHits->begin();
58  SiTrackerGSRecHit2DCollection::const_iterator theLastHit = theFastRecHits->end();
59  std::map< DetId, edm::OwnVector<SiTrackerGSRecHit2D> > temporaryRecHits;
60 
61  // loop on Fast GS Hits
62  for ( ; aHit != theLastHit; ++aHit ) {
63 
64  DetId det = aHit->geographicalId();
65 
66  /*
67  const GeomDet* theDet = geometry->idToDet(det);
68  unsigned trackID = aHit->simtrackId();
69 
70  std::cout << "Track/z/r after : "
71  << trackID << " "
72  << theDet->surface().toGlobal(aHit->localPosition()).z() << " "
73  << theDet->surface().toGlobal(aHit->localPosition()).perp() << std::endl;
74  */
75 
76  // create RecHit
77  // Fill the temporary RecHit on the current DetId collection
78  temporaryRecHits[det].push_back(aHit->clone());
79 
80  }
81 
82  // Step C: from the temporary RecHit collection, create the real one.
83  std::auto_ptr<SiTrackerFullGSRecHit2DCollection>
84  recHitCollection(new SiTrackerFullGSRecHit2DCollection);
85  loadRecHits(temporaryRecHits, *recHitCollection);
86 
87  // Step D: write output to file
88  e.put(recHitCollection);
89 
90 }
void loadRecHits(std::map< DetId, edm::OwnVector< SiTrackerGSRecHit2D > > &theRecHits, SiTrackerFullGSRecHit2DCollection &theRecHitCollection) const
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
Definition: DetId.h:20

Member Data Documentation

const TrackerGeometry* TrackingRecHitTranslator::geometry
private