CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibTracker/SiStripESProducers/plugins/geom/SiStripHashedDetIdESModule.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/plugins/geom/SiStripHashedDetIdESModule.h"
00002 #include "CalibFormats/SiStripObjects/interface/SiStripHashedDetId.h"
00003 #include "CalibTracker/Records/interface/SiStripHashedDetIdRcd.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 SiStripHashedDetIdESModule::SiStripHashedDetIdESModule( const edm::ParameterSet& pset ) 
00014   : SiStripHashedDetIdESProducer( pset )
00015 {
00016   edm::LogVerbatim("HashedDetId") 
00017     << "[SiStripHashedDetIdESSourceFromGeom::" << __func__ << "]"
00018     << " Constructing object...";
00019 }
00020 
00021 // -----------------------------------------------------------------------------
00022 //
00023 SiStripHashedDetIdESModule::~SiStripHashedDetIdESModule() {
00024   edm::LogVerbatim("HashedDetId")
00025     << "[SiStripHashedDetIdESSourceFromGeom::" << __func__ << "]"
00026     << " Destructing object...";
00027 }
00028 
00029 // -----------------------------------------------------------------------------
00030 //
00031 SiStripHashedDetId* SiStripHashedDetIdESModule::make( const SiStripHashedDetIdRcd& rcd ) {
00032   edm::LogVerbatim("HashedDetId")
00033     << "[SiStripHashedDetIdFakeESSource::" << __func__ << "]"
00034     << " Building \"fake\" hashed DetId map from geometry";
00035   
00036   edm::ESHandle<TrackerGeometry> geom;
00037   rcd.getRecord<TrackerDigiGeometryRecord>().get( geom );
00038   
00039   std::vector<uint32_t> dets;
00040   dets.reserve(16000);
00041 
00042   TrackerGeometry::DetUnitContainer::const_iterator iter = geom->detUnits().begin();
00043   for( ; iter != geom->detUnits().end(); ++iter ) {
00044     const StripGeomDetUnit* strip = dynamic_cast<StripGeomDetUnit*>(*iter);
00045     if ( strip ) { dets.push_back( (strip->geographicalId()).rawId() ); }
00046   }
00047   edm::LogVerbatim(mlDqmCommon_)
00048     << "[SiStripHashedDetIdESModule::" << __func__ << "]"
00049     << " Retrieved " << dets.size()
00050     << " sistrip DetIds from geometry!";
00051   
00052   // Create hash map object
00053   SiStripHashedDetId* hash = new SiStripHashedDetId( dets );
00054   LogTrace(mlDqmCommon_)
00055     << "[SiStripHashedDetIdESModule::" << __func__ << "]"
00056     << " DetId hash map: " << std::endl
00057     << *hash;
00058   
00059   return hash;
00060 
00061 }
00062