CMS 3D CMS Logo

VisPixelDigi Class Reference

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

Inheritance diagram for VisPixelDigi:

edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

edm::InputTag inputTag_


Detailed Description

Definition at line 18 of file VisPixelDigi.h.


Constructor & Destructor Documentation

VisPixelDigi::VisPixelDigi ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 33 of file VisPixelDigi.cc.

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

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

Definition at line 26 of file VisPixelDigi.h.

00026 {}


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 38 of file VisPixelDigi.cc.

References IgCollection::addProperty(), collection, edmplugin::standard::config(), IgCollection::create(), error, Exception, edm::EventSetup::get(), IgDataStorage::getCollection(), inputTag_, edm::InputTag::instance(), edm::Service< T >::isAvailable(), edm::Handle< T >::isValid(), edm::ESHandle< T >::isValid(), edm::InputTag::label(), edm::InputTag::process(), 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             << "VisPixelDigi 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<PixelDigiCollection> 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 &digis = storage->getCollection ("PixelDigis_V1");
00060         IgProperty DET_ID   = digis.addProperty ("detid", int (0)); 
00061         IgProperty POS      = digis.addProperty ("pos", IgV3d());
00062 
00063         IgProperty ADC = digis.addProperty("adc", int(0));
00064         IgProperty ROW = digis.addProperty("row", int(0));
00065         IgProperty COL = digis.addProperty("column", int(0));
00066         
00067         
00068         // Get vector of detIDs in map
00069         const std::vector<unsigned int> detIDs = collection->detIDs ();
00070 
00071         //--- Loop over detunits.
00072         std::vector<unsigned int>::const_iterator detunit_it;
00073         for (detunit_it  = detIDs.begin (); detunit_it != detIDs.end (); 
00074              detunit_it++) 
00075         {
00076             unsigned int detid = *detunit_it;   // return uint, = rawid
00077 
00078             const PixelDigiCollection::Range digiRange = collection->get (detid);
00079             PixelDigiCollection::ContainerIterator di;
00080 
00081             for (di = digiRange.first; di != digiRange.second; ++di)
00082             {
00083                 GlobalPoint pos = (geom->idToDet (detid))->surface ().position ();
00084                 IgCollectionItem item = digis.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                 item[ADC] = static_cast<int>((*di).adc());
00089                 item[ROW] = static_cast<int>((*di).row());
00090                 item[COL] = static_cast<int>((*di).column());
00091                 
00092             }
00093         }
00094         
00095 
00096     }
00097     else 
00098     {
00099         // friendlyName:moduleLabel:instanceName:processName
00100         std::string error = "### Error: Pixel Digis "
00101                             + edm::TypeID (typeid (PixelDigiCollection)).friendlyClassName () + ":" 
00102                             + inputTag_.label() + ":"
00103                             + inputTag_.instance() + ":" 
00104                             + inputTag_.process() + " are not found.";
00105 
00106         IgDataStorage *storage = config->storage ();
00107         IgCollection &collection = storage->getCollection ("Errors_V1");
00108         IgProperty ERROR_MSG = collection.addProperty ("Error", std::string ());
00109         IgCollectionItem item = collection.create ();
00110         item [ERROR_MSG] = error;
00111     }
00112 }


Member Data Documentation

edm::InputTag VisPixelDigi::inputTag_ [private]

Definition at line 31 of file VisPixelDigi.h.

Referenced by analyze().


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