CMS 3D CMS Logo

LaserClusterizer.cc

Go to the documentation of this file.
00001 
00009 #include "Alignment/LaserAlignment/plugins/LaserClusterizer.h"
00010 #include "FWCore/Framework/interface/Event.h" 
00011 #include "DataFormats/Common/interface/Handle.h" 
00012 #include "FWCore/Framework/interface/EventSetup.h" 
00013 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" 
00014 #include "DataFormats/Common/interface/DetSetVector.h" 
00015 #include "DataFormats/LaserAlignment/interface/LASBeamProfileFitCollection.h" 
00016 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h" 
00017 
00018 LaserClusterizer::LaserClusterizer(const edm::ParameterSet & theConf) : 
00019   theLaserClusterizerAlgorithm(theConf), theParameterSet(theConf)
00020 {
00021   std::string alias ( theConf.getParameter<std::string>("@module_label") );
00022 
00023   produces<edm::DetSetVector<SiStripCluster> >().setBranchAlias( alias + "siStripClusters" );
00024 }
00025 
00026 // virtual destructor needed
00027 LaserClusterizer::~LaserClusterizer() {}
00028 
00029 void LaserClusterizer::beginJob(const edm::EventSetup& theSetup)
00030 {
00031   // get the geometry of the tracker
00032   theSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
00033 }
00034 
00035 void LaserClusterizer::produce(edm::Event& theEvent, const edm::EventSetup& theSetup)
00036 {
00037   // create empty output collection
00038   std::auto_ptr<edm::DetSetVector<SiStripCluster> > output(new edm::DetSetVector<SiStripCluster>);
00039 
00040   // retrieve producer name of the BeamProfileFitCollection
00041   std::string beamFitProducer = theParameterSet.getParameter<std::string>("BeamFitProducer");
00042 
00043   // get the BeamProfileFitCollection
00044   edm::Handle<LASBeamProfileFitCollection> beamFits;
00045   theEvent.getByLabel(beamFitProducer, beamFits);
00046 
00047   // retrieve producer names of the digis
00048   Parameters DigiProducersList = theParameterSet.getParameter<Parameters>("DigiProducersList");
00049 
00050   // get the digis
00051   edm::Handle<edm::DetSetVector<SiStripDigi> > stripDigis;
00052   for (Parameters::iterator itDigiProducersList = DigiProducersList.begin(); itDigiProducersList != DigiProducersList.end(); ++itDigiProducersList)
00053     {
00054       std::string digiProducer = itDigiProducersList->getParameter<std::string>("DigiProducer");
00055       std::string digiLabel = itDigiProducersList->getParameter<std::string>("DigiLabel");
00056 
00057       theEvent.getByLabel(digiProducer, digiLabel, stripDigis);
00058       
00059 
00060       if ( (stripDigis->size() > 0) && (beamFits->size() > 0) )
00061         {
00062           // invoke the laser beam clusterizer algorithm
00063           theLaserClusterizerAlgorithm.run(*stripDigis,beamFits.product(),*output,theTrackerGeometry);
00064         }
00065     }
00066 
00067   // write the output to the event
00068   theEvent.put(output);
00069 }
00070 // define the SEAL module
00071 #include "FWCore/Framework/interface/MakerMacros.h"
00072 
00073 DEFINE_FWK_MODULE(LaserClusterizer);

Generated on Tue Jun 9 17:24:08 2009 for CMSSW by  doxygen 1.5.4