CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/MakerMacros.h"
00002 #include "RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h"
00003 
00004 void PixelClusterSelectorTopBottom::produce( edm::Event& event, const edm::EventSetup& setup) {
00005 
00006   edm::Handle< SiPixelClusterCollectionNew > input;
00007   event.getByLabel(label_, input);
00008 
00009   edm::ESHandle<TrackerGeometry> geom;
00010   setup.get<TrackerDigiGeometryRecord>().get( geom );
00011   const TrackerGeometry& theTracker( *geom );
00012   
00013   std::auto_ptr<SiPixelClusterCollectionNew> output( new SiPixelClusterCollectionNew() );
00014 
00015   for (SiPixelClusterCollectionNew::const_iterator clustSet = input->begin(); clustSet!=input->end(); ++clustSet) {
00016     edmNew::DetSet<SiPixelCluster>::const_iterator clustIt = clustSet->begin();
00017     edmNew::DetSet<SiPixelCluster>::const_iterator end     = clustSet->end();
00018     
00019     DetId detIdObject( clustSet->detId() );
00020     edmNew::DetSetVector<SiPixelCluster>::FastFiller spc(*output, detIdObject);
00021     const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*> (theTracker.idToDet(detIdObject) );
00022     const PixelTopology * topol = (&(theGeomDet->specificTopology()));
00023     
00024     for(; clustIt!=end;++clustIt) {
00025       LocalPoint  lpclust = topol->localPosition(MeasurementPoint((*clustIt).x(),(*clustIt).y()));
00026       GlobalPoint GPclust = theGeomDet->surface().toGlobal(Local3DPoint(lpclust.x(),lpclust.y(),lpclust.z()));
00027       double clustY = GPclust.y();
00028       if ((clustY * y_) > 0) {
00029         spc.push_back(*clustIt);
00030       }
00031     }
00032   }
00033   event.put( output );  
00034 }
00035 
00036 DEFINE_FWK_MODULE( PixelClusterSelectorTopBottom );