00001
00009 #include "Alignment/LaserAlignment/interface/LaserClusterizerAlgorithm.h"
00010 #include "Alignment/LaserAlignment/interface/LaserBeamClusterizer.h"
00011
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013
00014 LaserClusterizerAlgorithm::LaserClusterizerAlgorithm(const edm::ParameterSet & theConf) :
00015 theConfiguration(theConf),
00016 theClusterMode(theConf.getParameter<std::string>("ClusterMode")),
00017 theClusterWidth(theConf.getParameter<double>("ClusterWidth")),
00018 theValidClusterizer(false)
00019 {
00020 if (theClusterMode == "LaserBeamClusterizer")
00021 {
00022 theBeamClusterizer = new LaserBeamClusterizer();
00023 theValidClusterizer = true;
00024 }
00025 else
00026 {
00027 throw cms::Exception("LaserClusterizerAlgorithm") << "<LaserClusterizerAlgorithm::LaserClusterizerAlgorithm(const edm::Parameterset&)>: No valid clusterizer selected, possible clusterizer: LaserBeamClusterizer";
00028 theValidClusterizer = false;
00029 }
00030 }
00031
00032 LaserClusterizerAlgorithm::~LaserClusterizerAlgorithm()
00033 {
00034 if (theBeamClusterizer != 0) { delete theBeamClusterizer; }
00035 }
00036
00037 void LaserClusterizerAlgorithm::run(const edm::DetSetVector<SiStripDigi>& input, const LASBeamProfileFitCollection* beamFit,
00038 edm::DetSetVector<SiStripCluster>& output, const edm::ESHandle<TrackerGeometry>& theTrackerGeometry)
00039 {
00040 if (theValidClusterizer)
00041 {
00042 int nDetUnits = 0;
00043 int nLocalStripRecHits = 0;
00044
00045
00046 for (edm::DetSetVector<SiStripDigi>::const_iterator DSViter = input.begin(); DSViter != input.end(); DSViter++)
00047 {
00048 unsigned int theDetId = DSViter->id;
00049 ++nDetUnits;
00050
00051
00052 const LASBeamProfileFitCollection::Range beamFitRange = beamFit->get(theDetId);
00053 LASBeamProfileFitCollection::ContainerIterator beamFitRangeIteratorBegin = beamFitRange.first;
00054 LASBeamProfileFitCollection::ContainerIterator beamFitRangeIteratorEnd = beamFitRange.second;
00055
00056 if (theClusterMode == "LaserBeamClusterizer")
00057 {
00058 edm::DetSet<SiStripCluster> theStripCluster(DSViter->id);
00059
00060 theBeamClusterizer->clusterizeDetUnit(*DSViter, theStripCluster,
00061 beamFitRangeIteratorBegin, beamFitRangeIteratorEnd, theDetId, theClusterWidth);
00062
00063
00064 if (theStripCluster.data.size() > 0)
00065 {
00066
00067 output.insert(theStripCluster);
00068 nLocalStripRecHits += theStripCluster.data.size();
00069 }
00070 }
00071 }
00072
00073 edm::LogInfo("LaserClusterizerAlgorithm") << "execution in mode " << theClusterMode << " generating "
00074 << nLocalStripRecHits << " SiStripClusters in " << nDetUnits
00075 << " DetUnits ";
00076 }
00077 }