CMS 3D CMS Logo

MeasurementTrackerESProducer.cc

Go to the documentation of this file.
00001 #include "RecoTracker/MeasurementDet/plugins/MeasurementTrackerESProducer.h"
00002 
00003 #include "FWCore/Framework/interface/EventSetup.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/Framework/interface/ModuleFactory.h"
00006 #include "FWCore/Framework/interface/ESProducer.h"
00007 
00008 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00009 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00010 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
00011 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00012 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00013 
00014 #include "RecoLocalTracker/Records/interface/TrackerCPERecord.h"
00015 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00016 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00017 
00018 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00019 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00020 
00021 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00022 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00023 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00024 
00025 #include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h"
00026 #include "RecoTracker/MeasurementDet/interface/OnDemandMeasurementTracker.h"
00027 
00028 #include <string>
00029 #include <memory>
00030 
00031 using namespace edm;
00032 
00033 MeasurementTrackerESProducer::MeasurementTrackerESProducer(const edm::ParameterSet & p) 
00034 {  
00035   std::string myname = p.getParameter<std::string>("ComponentName");
00036   pset_ = p;
00037   setWhatProduced(this,myname);
00038 }
00039 
00040 MeasurementTrackerESProducer::~MeasurementTrackerESProducer() {}
00041 
00042 boost::shared_ptr<MeasurementTracker> 
00043 MeasurementTrackerESProducer::produce(const CkfComponentsRecord& iRecord)
00044 { 
00045   std::string pixelCPEName = pset_.getParameter<std::string>("PixelCPE");
00046   std::string stripCPEName = pset_.getParameter<std::string>("StripCPE");
00047   std::string matcherName  = pset_.getParameter<std::string>("HitMatcher");
00048   bool regional            = pset_.getParameter<bool>("Regional");  
00049 
00050   bool onDemand = pset_.getParameter<bool>("OnDemand");
00051 
00052   /* vvvv LEGACY, WILL BE REMOVED vvvv */
00053   //const SiStripNoises *ptr_stripNoises = 0;
00054   //edm::ESHandle<SiStripNoises>        stripNoises;
00055   //if (pset_.getParameter<bool>("UseStripNoiseDB")) {
00056   //   iRecord.getRecord<SiStripNoisesRcd>().get(stripNoises);
00057   //   ptr_stripNoises = stripNoises.product(); 
00058   //}
00059   /* ^^^^ LEGACY, WILL BE REMOVED ^^^^ */
00060 
00061   const SiStripQuality *ptr_stripQuality = 0;
00062   int   qualityFlags = 0;
00063   int   qualityDebugFlags = 0;
00064   edm::ESHandle<SiStripQuality> stripQuality;
00065 
00066   if (pset_.getParameter<bool>("UseStripModuleQualityDB")) {
00067     qualityFlags += MeasurementTracker::BadModules;
00068     if (pset_.getUntrackedParameter<bool>("DebugStripModuleQualityDB")) {
00069         qualityDebugFlags += MeasurementTracker::BadModules;
00070     }
00071   }
00072   if (pset_.getParameter<bool>("UseStripAPVFiberQualityDB")) {
00073     qualityFlags += MeasurementTracker::BadAPVFibers;
00074     if (pset_.getUntrackedParameter<bool>("DebugStripAPVFiberQualityDB")) {
00075         qualityDebugFlags += MeasurementTracker::BadAPVFibers;
00076     }
00077     if (pset_.existsAs<bool>("MaskBadAPVFibers") && pset_.getParameter<bool>("MaskBadAPVFibers")) {
00078         qualityFlags += MeasurementTracker::MaskBad128StripBlocks;
00079     }
00080   }
00081   if (pset_.getParameter<bool>("UseStripStripQualityDB")) {
00082     qualityFlags += MeasurementTracker::BadStrips;
00083     if (pset_.getUntrackedParameter<bool>("DebugStripStripQualityDB")) {
00084         qualityDebugFlags += MeasurementTracker::BadStrips;
00085     }
00086   }
00087 
00088   if (qualityFlags != 0) {
00089     iRecord.getRecord<SiStripQualityRcd>().get(stripQuality);
00090     ptr_stripQuality = stripQuality.product();
00091   }
00092   
00093   edm::ESHandle<PixelClusterParameterEstimator> pixelCPE;
00094   edm::ESHandle<StripClusterParameterEstimator> stripCPE;
00095   edm::ESHandle<SiStripRecHitMatcher>           hitMatcher;
00096   edm::ESHandle<TrackerGeometry>                trackerGeom;
00097   edm::ESHandle<GeometricSearchTracker>         geometricSearchTracker;
00098 
00099   
00100   iRecord.getRecord<TkPixelCPERecord>().get(pixelCPEName,pixelCPE);
00101   iRecord.getRecord<TkStripCPERecord>().get(stripCPEName,stripCPE);
00102   iRecord.getRecord<TkStripCPERecord>().get(matcherName,hitMatcher);
00103   iRecord.getRecord<TrackerDigiGeometryRecord>().get(trackerGeom);
00104   iRecord.getRecord<TrackerRecoGeometryRecord>().get(geometricSearchTracker);
00105   
00106   if (!onDemand){
00107   _measurementTracker  = boost::shared_ptr<MeasurementTracker>(new MeasurementTracker(pset_,
00108                                                                                       pixelCPE.product(),
00109                                                                                       stripCPE.product(),
00110                                                                                       hitMatcher.product(),
00111                                                                                       trackerGeom.product(),
00112                                                                                       geometricSearchTracker.product(),
00113                                                                                       ptr_stripQuality,
00114                                                                                       qualityFlags,
00115                                                                                       qualityDebugFlags,
00116                                                                                       //ptr_stripNoises,
00117                                                                                       regional) ); 
00118   }
00119   else{
00120     const SiStripRegionCabling * ptr_stripRegionCabling =0;
00121     //get regional cabling
00122     edm::ESHandle<SiStripRegionCabling> rcabling;
00123     iRecord.getRecord<SiStripRegionCablingRcd>().get(rcabling);
00124     ptr_stripRegionCabling = rcabling.product();
00125 
00126     _measurementTracker  = boost::shared_ptr<MeasurementTracker>( new OnDemandMeasurementTracker(pset_,
00127                                                                                                  pixelCPE.product(),
00128                                                                                                  stripCPE.product(),
00129                                                                                                  hitMatcher.product(),
00130                                                                                                  trackerGeom.product(),
00131                                                                                                  geometricSearchTracker.product(),
00132                                                                                                  ptr_stripQuality,
00133                                                                                                  qualityFlags,
00134                                                                                                  qualityDebugFlags,
00135                                                                                                  //ptr_stripNoises,
00136                                                                                                  ptr_stripRegionCabling,
00137                                                                                                  regional) );
00138     
00139   }
00140   return _measurementTracker;
00141 }
00142 
00143 

Generated on Tue Jun 9 17:45:28 2009 for CMSSW by  doxygen 1.5.4