CMS 3D CMS Logo

VisSiPixelCluster Class Reference

#include <VisReco/Analyzer/interface/VisSiPixelCluster.h>

Inheritance diagram for VisSiPixelCluster:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 VisSiPixelCluster (const edm::ParameterSet &iPSet)
virtual ~VisSiPixelCluster (void)

Private Attributes

edm::InputTag inputTag_


Detailed Description

Definition at line 18 of file VisSiPixelCluster.h.


Constructor & Destructor Documentation

VisSiPixelCluster::VisSiPixelCluster ( const edm::ParameterSet iPSet  )  [explicit]

Definition at line 33 of file VisSiPixelCluster.cc.

00034     : inputTag_ (iConfig.getParameter<edm::InputTag>("visSiPixelClusterTag"))
00035 {}

virtual VisSiPixelCluster::~VisSiPixelCluster ( void   )  [inline, virtual]

Definition at line 26 of file VisSiPixelCluster.h.

00026 {}


Member Function Documentation

void VisSiPixelCluster::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 38 of file VisSiPixelCluster.cc.

References IgCollection::addProperty(), edmNew::DetSetVector< T >::begin(), collection, edmplugin::standard::config(), IgCollection::create(), ds, edmNew::DetSetVector< T >::end(), end, error, Exception, edm::EventSetup::get(), IgDataStorage::getCollection(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), edm::ESHandle< T >::isValid(), it, edm::InputTag::label(), RectangularPixelTopology::localPosition(), edm::InputTag::process(), row, PixelGeomDetUnit::specificTopology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00039 {
00040     edm::Service<IguanaService> config;
00041     if (! config.isAvailable ()) 
00042     {
00043         throw cms::Exception ("Configuration")
00044             << "VisSiPixelCluster requires the IguanaService\n"
00045             "which is not present in the configuration file.\n"
00046             "You must add the service in the configuration file\n"
00047             "or remove the module that requires it";
00048     }
00049     
00050     edm::Handle<edmNew::DetSetVector<SiPixelCluster> > collection;
00051     event.getByLabel (inputTag_, collection);
00052 
00053     edm::ESHandle<TrackerGeometry> geom;
00054     eventSetup.get<TrackerDigiGeometryRecord> ().get (geom);
00055 
00056     if (collection.isValid () && geom.isValid ())
00057     {       
00058         IgDataStorage *storage = config->storage ();
00059         IgCollection &clusters = storage->getCollection ("SiPixelClusters_V1");
00060         IgProperty DET_ID   = clusters.addProperty ("detid", int (0)); 
00061         IgProperty POS      = clusters.addProperty ("pos", IgV3d());
00062 
00063         edmNew::DetSetVector<SiPixelCluster>::const_iterator it = collection->begin ();
00064         edmNew::DetSetVector<SiPixelCluster>::const_iterator end = collection->end ();
00065 
00066         for (; it != end; ++it)
00067         {
00068             edmNew::DetSet<SiPixelCluster> ds = *it;
00069             const uint32_t detID = it->detId ();
00070             DetId detid (detID);
00071 
00072             const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit *>(geom->idToDet (detid));
00073             const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ()));
00074             
00075             edmNew::DetSet<SiPixelCluster>::const_iterator icluster = it->begin ();
00076             edmNew::DetSet<SiPixelCluster>::const_iterator iclusterEnd = it->end ();
00077 
00078             for(; icluster != iclusterEnd; ++icluster)
00079             { 
00080                 int row = (*icluster).minPixelRow ();
00081                 int column = (*icluster).minPixelCol ();
00082 
00083                 GlobalPoint pos = (geom->idToDet (detid))->surface().toGlobal (theTopol->localPosition (MeasurementPoint (row, column)));               
00084                 IgCollectionItem item = clusters.create ();
00085                 item[DET_ID] = static_cast<int> (detID);
00086                 item[POS] = IgV3d(static_cast<double>(pos.x()/100.0), static_cast<double>(pos.y()/100.0), static_cast<double>(pos.z()/100.0));
00087             }
00088         }
00089     }
00090     else 
00091     {
00092         // friendlyName:moduleLabel:instanceName:processName
00093         std::string error = "### Error: SiPixel Clusters "
00094                             + edm::TypeID (typeid (edmNew::DetSetVector<SiPixelCluster>)).friendlyClassName () + ":" 
00095                             + inputTag_.label() + ":"
00096                             + inputTag_.instance() + ":" 
00097                             + inputTag_.process() + " are not found.";
00098 
00099         IgDataStorage *storage = config->storage ();
00100         IgCollection &collection = storage->getCollection ("Error_V1");
00101         IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ());
00102         IgCollectionItem item = collection.create ();
00103         item [ERROR_MSG] = error;
00104     }
00105 }


Member Data Documentation

edm::InputTag VisSiPixelCluster::inputTag_ [private]

Definition at line 31 of file VisSiPixelCluster.h.

Referenced by analyze().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:37 2009 for CMSSW by  doxygen 1.5.4