CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/MakerMacros.h"
00002 #include "RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h"
00003 
00004 void StripClusterSelectorTopBottom::produce( edm::Event& event, const edm::EventSetup& setup) {
00005 
00006   edm::Handle< edmNew::DetSetVector<SiStripCluster> > 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<edmNew::DetSetVector<SiStripCluster> > output( new edmNew::DetSetVector<SiStripCluster>() );
00014 
00015   for (edmNew::DetSetVector<SiStripCluster>::const_iterator clustSet = input->begin(); clustSet!=input->end(); ++clustSet) {
00016     edmNew::DetSet<SiStripCluster>::const_iterator clustIt = clustSet->begin();
00017     edmNew::DetSet<SiStripCluster>::const_iterator end     = clustSet->end();
00018     
00019     DetId detIdObject( clustSet->detId() );
00020     edmNew::DetSetVector<SiStripCluster>::FastFiller spc(*output, detIdObject.rawId());
00021     const StripGeomDetUnit* theGeomDet = dynamic_cast<const StripGeomDetUnit*> (theTracker.idToDet(detIdObject) );
00022     const StripTopology * topol = dynamic_cast<const StripTopology*>(&(theGeomDet->specificTopology()));
00023     
00024     for(; clustIt!=end;++clustIt) {
00025       LocalPoint lpclust = topol->localPosition(clustIt->barycenter());
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( StripClusterSelectorTopBottom );