CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoTracker/MeasurementDet/plugins/MeasurementTrackerImpl.h

Go to the documentation of this file.
00001 #ifndef MeasurementTrackerImpl_H
00002 #define MeasurementTrackerImpl_H
00003 
00004 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
00005 #include "TkMeasurementDetSet.h"
00006 
00007 #include "DataFormats/DetId/interface/DetId.h"
00008 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00009 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00010 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00011 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00012 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00013 
00014 #include "FWCore/Framework/interface/EDProducer.h"
00015 #include "FWCore/Framework/interface/Event.h"
00016 #include "DataFormats/Common/interface/Handle.h"
00017 #include "FWCore/Framework/interface/EventSetup.h"
00018 #include "FWCore/Framework/interface/ESHandle.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 
00021 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00022 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00023 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00024 
00025 #include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h"
00026 
00027 #include <map>
00028 #include <unordered_map>
00029 #include <vector>
00030 
00031 class StrictWeakOrdering{
00032  public:
00033   bool operator() ( uint32_t p,const uint32_t& i) const {return p < i;}
00034 };
00035 
00036 class TkStripMeasurementDet;
00037 class TkPixelMeasurementDet;
00038 class TkGluedMeasurementDet;
00039 class GeometricSearchTracker;
00040 class SiStripRecHitMatcher;
00041 class GluedGeomDet;
00042 class SiPixelFedCabling;
00043 
00044 class MeasurementTrackerImpl : public MeasurementTracker {
00045 public:
00046    enum QualityFlags { BadModules=1, // for everybody
00047                        /* Strips: */ BadAPVFibers=2, BadStrips=4, MaskBad128StripBlocks=8, 
00048                        /* Pixels: */ BadROCs=2 }; 
00049 
00050   MeasurementTrackerImpl(const edm::ParameterSet&              conf,
00051                      const PixelClusterParameterEstimator* pixelCPE,
00052                      const StripClusterParameterEstimator* stripCPE,
00053                      const SiStripRecHitMatcher*  hitMatcher,
00054                      const TrackerGeometry*  trackerGeom,
00055                      const GeometricSearchTracker* geometricSearchTracker,
00056                      const SiStripQuality *stripQuality,
00057                      int   stripQualityFlags,
00058                      int   stripQualityDebugFlags,
00059                      const SiPixelQuality *pixelQuality,
00060                      const SiPixelFedCabling *pixelCabling,
00061                      int   pixelQualityFlags,
00062                      int   pixelQualityDebugFlags,
00063                      bool  isRegional=false);
00064 
00065   virtual ~MeasurementTrackerImpl();
00066  
00067   virtual  void update( const edm::Event&) const;
00068   void updatePixels( const edm::Event&) const;
00069   void updateStrips( const edm::Event&) const;
00070 
00071   const TrackingGeometry* geomTracker() const { return theTrackerGeom;}
00072 
00073   const GeometricSearchTracker* geometricSearchTracker() const {return theGeometricSearchTracker;}
00074 
00076   virtual const MeasurementDet* 
00077   idToDet(const DetId& id) const {
00078     return findDet(id);
00079   }
00080 
00081   const MeasurementDet* 
00082   findDet(const DetId& id) const
00083   {
00084     auto it = theDetMap.find(id);
00085     if(it !=theDetMap.end()) {
00086       return it->second;
00087     }else{
00088       //throw exception;
00089     }
00090     
00091     return 0; //to avoid compile warning
00092   }
00093 
00094 
00095   TkStripMeasurementDet * concreteDetUpdatable(DetId id) const;
00096 
00097   typedef std::unordered_map<unsigned int,MeasurementDet*>   DetContainer;
00098 
00100   const DetContainer& allDets() const {return theDetMap;}
00101   const std::vector<TkStripMeasurementDet>& stripDets() const {return theStripDets;}
00102   const std::vector<TkPixelMeasurementDet*>& pixelDets() const {return thePixelDets;}
00103   const std::vector<TkGluedMeasurementDet>& gluedDets() const {return theGluedDets;}
00104 
00105   void setClusterToSkip(const edm::InputTag & cluster, const edm::Event& event) const;
00106   void unsetClusterToSkip() const;
00107   
00108  protected:
00109   const edm::ParameterSet& pset_;
00110   const std::string name_;
00111 
00112   mutable StMeasurementDetSet theStDets;
00113 
00114   mutable DetContainer                        theDetMap;
00115 
00116 
00117   mutable std::vector<TkPixelMeasurementDet*> thePixelDets;
00118 
00119   mutable std::vector<TkStripMeasurementDet> theStripDets;
00120   mutable std::vector<TkGluedMeasurementDet> theGluedDets;
00121   
00122   mutable std::vector<bool> thePixelsToSkip;
00123 
00124   const PixelClusterParameterEstimator* thePixelCPE;
00125   const SiPixelFedCabling*              thePixelCabling;
00126 
00127   const std::vector<edm::InputTag>      theInactivePixelDetectorLabels;
00128   const std::vector<edm::InputTag>      theInactiveStripDetectorLabels;
00129 
00130   bool selfUpdateSkipClusters_;
00131 
00132   void initialize();
00133 
00134   void addStripDet( const GeomDet* gd);
00135   void addPixelDet( const GeomDet* gd,
00136                     const PixelClusterParameterEstimator* cpe);
00137 
00138   void addGluedDet( const GluedGeomDet* gd);
00139   void initGluedDet( TkGluedMeasurementDet & det);
00140 
00141   void addPixelDets( const TrackingGeometry::DetContainer& dets);
00142 
00143   void addStripDets( const TrackingGeometry::DetContainer& dets);
00144 
00145   void initializeStripStatus (const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags);
00146 
00147   void initializePixelStatus (const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags);
00148 
00149   void getInactiveStrips(const edm::Event& event,std::vector<uint32_t> & rawInactiveDetIds) const;
00150 };
00151 
00152 #endif