CMS 3D CMS Logo

SiStripHashedDetIdESProducer.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/plugins/stubs/SiStripHashedDetIdESProducer.h"
00002 #include "CalibTracker/Records/interface/SiStripHashedDetIdRcd.h"
00003 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00007 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00008 
00009 using namespace sistrip;
00010 
00011 // -----------------------------------------------------------------------------
00012 //
00013 SiStripHashedDetIdESProducer::SiStripHashedDetIdESProducer( const edm::ParameterSet& pset ) {
00014   setWhatProduced( this, &SiStripHashedDetIdESProducer::produce );
00015 }
00016 
00017 // -----------------------------------------------------------------------------
00018 //
00019 SiStripHashedDetIdESProducer::~SiStripHashedDetIdESProducer() {}
00020 
00021 // -----------------------------------------------------------------------------
00022 //
00023 std::auto_ptr<SiStripHashedDetId> SiStripHashedDetIdESProducer::produce( const SiStripHashedDetIdRcd& rcd ) {
00024 
00025   // Retrieve geometry
00026   edm::ESHandle<TrackerGeometry> geom;
00027   rcd.getRecord<TrackerDigiGeometryRecord>().get( geom );
00028   
00029   // Build list of DetIds
00030   std::vector<uint32_t> dets;
00031   dets.reserve(16000);
00032   TrackerGeometry::DetUnitContainer::const_iterator iter = geom->detUnits().begin();
00033   for( ; iter != geom->detUnits().end(); ++iter ) {
00034     const StripGeomDetUnit* strip = dynamic_cast<StripGeomDetUnit*>(*iter);
00035     if( strip ) {
00036       dets.push_back( (strip->geographicalId()).rawId() );
00037     }
00038   }
00039   edm::LogVerbatim(mlDqmCommon_)
00040     << "[SiStripHashedDetIdESProducer::" << __func__ << "]"
00041     << " Retrieved " << dets.size()
00042     << " sistrip DetIds from geometry!";
00043   
00044   // Create hash map object
00045   SiStripHashedDetId* hash = new SiStripHashedDetId( dets );
00046   LogTrace(mlDqmCommon_)
00047     << "[SiStripHashedDetIdESProducer::" << __func__ << "]"
00048     << " DetId hash map: " << std::endl
00049     << *hash;
00050   
00051   return std::auto_ptr<SiStripHashedDetId>( hash );
00052 
00053 }
00054 

Generated on Tue Jun 9 17:25:51 2009 for CMSSW by  doxygen 1.5.4