CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoTracker/MeasurementDet/plugins/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 "CondFormats/DataRecord/interface/SiPixelQualityRcd.h"
00024 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00025 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00026 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
00027 
00028 #include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h"
00029 #include "OnDemandMeasurementTracker.h"
00030 
00031 #include <string>
00032 #include <memory>
00033 
00034 using namespace edm;
00035 
00036 MeasurementTrackerESProducer::MeasurementTrackerESProducer(const edm::ParameterSet & p) 
00037 {  
00038   std::string myname = p.getParameter<std::string>("ComponentName");
00039   pset_ = p;
00040   setWhatProduced(this,myname);
00041 }
00042 
00043 MeasurementTrackerESProducer::~MeasurementTrackerESProducer() {}
00044 
00045 boost::shared_ptr<MeasurementTracker> 
00046 MeasurementTrackerESProducer::produce(const CkfComponentsRecord& iRecord)
00047 { 
00048   std::string pixelCPEName = pset_.getParameter<std::string>("PixelCPE");
00049   std::string stripCPEName = pset_.getParameter<std::string>("StripCPE");
00050   std::string matcherName  = pset_.getParameter<std::string>("HitMatcher");
00051   bool regional            = pset_.getParameter<bool>("Regional");  
00052 
00053   bool onDemand = pset_.getParameter<bool>("OnDemand");
00054 
00055   // ========= SiPixelQuality related tasks =============
00056   const SiPixelQuality    *ptr_pixelQuality = 0;
00057   const SiPixelFedCabling *ptr_pixelCabling = 0;
00058   int   pixelQualityFlags = 0;
00059   int   pixelQualityDebugFlags = 0;
00060   edm::ESHandle<SiPixelQuality>       pixelQuality;
00061   edm::ESHandle<SiPixelFedCablingMap> pixelCabling;
00062 
00063   if (pset_.getParameter<bool>("UsePixelModuleQualityDB")) {
00064     pixelQualityFlags += MeasurementTracker::BadModules;
00065     if (pset_.getUntrackedParameter<bool>("DebugPixelModuleQualityDB", false)) {
00066         pixelQualityDebugFlags += MeasurementTracker::BadModules;
00067     }
00068   }
00069   if (pset_.getParameter<bool>("UsePixelROCQualityDB")) {
00070     pixelQualityFlags += MeasurementTracker::BadROCs;
00071     if (pset_.getUntrackedParameter<bool>("DebugPixelROCQualityDB", false)) {
00072         pixelQualityDebugFlags += MeasurementTracker::BadROCs;
00073     }
00074   }
00075 
00076 
00077   if (pixelQualityFlags != 0) {
00078     iRecord.getRecord<SiPixelQualityRcd>().get(pixelQuality);
00079     ptr_pixelQuality = pixelQuality.product();
00080     iRecord.getRecord<SiPixelFedCablingMapRcd>().get(pixelCabling);
00081     ptr_pixelCabling = pixelCabling.product();
00082   }
00083   
00084   // ========= SiStripQuality related tasks =============
00085   const SiStripQuality *ptr_stripQuality = 0;
00086   int   stripQualityFlags = 0;
00087   int   stripQualityDebugFlags = 0;
00088   edm::ESHandle<SiStripQuality> stripQuality;
00089 
00090   if (pset_.getParameter<bool>("UseStripModuleQualityDB")) {
00091     stripQualityFlags += MeasurementTracker::BadModules;
00092     if (pset_.getUntrackedParameter<bool>("DebugStripModuleQualityDB", false)) {
00093         stripQualityDebugFlags += MeasurementTracker::BadModules;
00094     }
00095   }
00096   if (pset_.getParameter<bool>("UseStripAPVFiberQualityDB")) {
00097     stripQualityFlags += MeasurementTracker::BadAPVFibers;
00098     if (pset_.getUntrackedParameter<bool>("DebugStripAPVFiberQualityDB", false)) {
00099         stripQualityDebugFlags += MeasurementTracker::BadAPVFibers;
00100     }
00101     if (pset_.existsAs<bool>("MaskBadAPVFibers") && pset_.getParameter<bool>("MaskBadAPVFibers")) {
00102         stripQualityFlags += MeasurementTracker::MaskBad128StripBlocks;
00103     }
00104   }
00105   if (pset_.getParameter<bool>("UseStripStripQualityDB")) {
00106     stripQualityFlags += MeasurementTracker::BadStrips;
00107     if (pset_.getUntrackedParameter<bool>("DebugStripStripQualityDB", false)) {
00108         stripQualityDebugFlags += MeasurementTracker::BadStrips;
00109     }
00110   }
00111 
00112   if (stripQualityFlags != 0) {
00113     std::string siStripQualityLabel = pset_.getParameter<std::string>("SiStripQualityLabel");
00114     iRecord.getRecord<SiStripQualityRcd>().get(siStripQualityLabel, stripQuality);
00115     ptr_stripQuality = stripQuality.product();
00116   }
00117   
00118   edm::ESHandle<PixelClusterParameterEstimator> pixelCPE;
00119   edm::ESHandle<StripClusterParameterEstimator> stripCPE;
00120   edm::ESHandle<SiStripRecHitMatcher>           hitMatcher;
00121   edm::ESHandle<TrackerGeometry>                trackerGeom;
00122   edm::ESHandle<GeometricSearchTracker>         geometricSearchTracker;
00123 
00124   
00125   iRecord.getRecord<TkPixelCPERecord>().get(pixelCPEName,pixelCPE);
00126   iRecord.getRecord<TkStripCPERecord>().get(stripCPEName,stripCPE);
00127   iRecord.getRecord<TkStripCPERecord>().get(matcherName,hitMatcher);
00128   iRecord.getRecord<TrackerDigiGeometryRecord>().get(trackerGeom);
00129   iRecord.getRecord<TrackerRecoGeometryRecord>().get(geometricSearchTracker);
00130   
00131   if (!onDemand){
00132   _measurementTracker  = boost::shared_ptr<MeasurementTracker>(new MeasurementTrackerImpl(pset_,
00133                                                                                       pixelCPE.product(),
00134                                                                                       stripCPE.product(),
00135                                                                                       hitMatcher.product(),
00136                                                                                       trackerGeom.product(),
00137                                                                                       geometricSearchTracker.product(),
00138                                                                                       ptr_stripQuality,
00139                                                                                       stripQualityFlags,
00140                                                                                       stripQualityDebugFlags,
00141                                                                                       ptr_pixelQuality,
00142                                                                                       ptr_pixelCabling,
00143                                                                                       pixelQualityFlags,
00144                                                                                       pixelQualityDebugFlags,
00145                                                                                       regional) ); 
00146   }
00147   else{
00148     const SiStripRegionCabling * ptr_stripRegionCabling =0;
00149     //get regional cabling
00150     edm::ESHandle<SiStripRegionCabling> rcabling;
00151     iRecord.getRecord<SiStripRegionCablingRcd>().get(rcabling);
00152     ptr_stripRegionCabling = rcabling.product();
00153 
00154     _measurementTracker  = boost::shared_ptr<MeasurementTracker>( new OnDemandMeasurementTracker(pset_,
00155                                                                                                  pixelCPE.product(),
00156                                                                                                  stripCPE.product(),
00157                                                                                                  hitMatcher.product(),
00158                                                                                                  trackerGeom.product(),
00159                                                                                                  geometricSearchTracker.product(),
00160                                                                                                  ptr_stripQuality,
00161                                                                                                  stripQualityFlags,
00162                                                                                                  stripQualityDebugFlags,
00163                                                                                                  ptr_pixelQuality,
00164                                                                                                  ptr_pixelCabling,
00165                                                                                                  pixelQualityFlags,
00166                                                                                                  pixelQualityDebugFlags,
00167                                                                                                  ptr_stripRegionCabling,
00168                                                                                                  regional) );
00169     
00170   }
00171   return _measurementTracker;
00172 }
00173 
00174