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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &run, const edm::EventSetup &es) override
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
 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 &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

const TrackerGeometrygeometry
 
edm::InputTag hitCollectionInputTag_
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

Definition at line 28 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 33 of file TrackingRecHitTranslator.cc.

33  :
34  hitCollectionInputTag_(conf.getParameter<edm::InputTag>("hitCollectionInputTag"))
35 {
36  produces<SiTrackerFullGSRecHit2DCollection>();
37 }
T getParameter(std::string const &) const
TrackingRecHitTranslator::~TrackingRecHitTranslator ( )
virtual

Definition at line 40 of file TrackingRecHitTranslator.cc.

40 {}

Member Function Documentation

void TrackingRecHitTranslator::beginRun ( edm::Run const &  run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 43 of file TrackingRecHitTranslator.cc.

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

43  {
44 
45  // Initialize the Tracker Geometry
47  es.get<TrackerDigiGeometryRecord> ().get (theGeometry);
48  geometry = &(*theGeometry);
49 
50 }
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 95 of file TrackingRecHitTranslator.cc.

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

Referenced by produce().

98 {
99  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator
100  it = theRecHits.begin();
101  std::map<DetId,edm::OwnVector<SiTrackerGSRecHit2D> >::const_iterator
102  lastRecHit = theRecHits.end();
103 
104  for( ; it != lastRecHit ; ++it ) {
105  theRecHitCollection.put(it->first,it->second.begin(),it->second.end());
106  }
107 
108 }
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 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 52 of file TrackingRecHitTranslator.cc.

References edm::Event::getByLabel(), hitCollectionInputTag_, loadRecHits(), and edm::Event::put().

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

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

Member Data Documentation

const TrackerGeometry* TrackingRecHitTranslator::geometry
private
edm::InputTag TrackingRecHitTranslator::hitCollectionInputTag_
private

Definition at line 49 of file TrackingRecHitTranslator.h.

Referenced by produce().