CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h

Go to the documentation of this file.
00001 
00002 
00003 #include <memory>
00004 #include <vector>
00005 #include <functional>
00006 
00007 #include "FWCore/Framework/interface/Frameworkfwd.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 
00012 #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h"
00013 //#include "RecoPixelVertexing/PixelTriplets/plugins/LayerTriplets.h"
00014 
00015 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00016 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00017 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00018 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00019 
00020 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00021 
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "FWCore/Framework/interface/EventSetup.h"
00024 
00025 #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSets.h"
00026 #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h"
00027 #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h"
00028 #include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
00029 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00030 #include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h"
00031 
00032 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
00033 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
00034 
00035 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00036 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00037 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00038 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00039 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00040 
00041 #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h"
00042 
00043 class TrackerTopology;
00044 
00049 class SeedMergerPixelLayer {
00050 
00051  public:
00052   enum Side{ Minus=1, Plus=2, Undefined, SideError }; // Changed to correspond with PXFDetId ...
00053 
00054   SeedMergerPixelLayer( const std::string& );
00055   unsigned getLayerNumber( void ) const { return layer_; }
00056   Side getSide( void ) const { return side_;}
00057   PixelSubdetector::SubDetector getSubdet( void ) const { return subdet_; }
00058   std::string getName( void ) const { return name_; }
00059   bool isContainsDetector( const DetId&, const TrackerTopology *tTopo ) const;
00060 
00061  private:
00062   bool isValidName( const std::string& );
00063   bool isValid_;
00064   std::string name_;
00065   PixelSubdetector::SubDetector subdet_;
00066   unsigned layer_;
00067   SeedMergerPixelLayer::Side side_;
00068 
00069 };
00070 
00071 
00072 
00076 class QuadrupletSeedMerger {
00077 
00078  public:
00079 
00080   QuadrupletSeedMerger( );
00081   ~QuadrupletSeedMerger();
00082 
00083   void update(const edm::EventSetup& );
00084   //const std::vector<SeedingHitSet> mergeTriplets( const OrderedSeedingHits&, const edm::EventSetup& );
00085   const OrderedSeedingHits& mergeTriplets( const OrderedSeedingHits&, const edm::EventSetup& );
00086   const TrajectorySeedCollection mergeTriplets( const TrajectorySeedCollection&, const TrackingRegion&, const edm::EventSetup&, const edm::ParameterSet& );
00087   bool isEqual( const TrackingRecHit*, const TrackingRecHit* ) const;
00088   std::pair<double,double> calculatePhiEta( SeedingHitSet const& ) const;
00089   void printHit( const TrackingRecHit* ) const;
00090   void printHit( const  TransientTrackingRecHit::ConstRecHitPointer& ) const;
00091   void printNtuplet( const SeedingHitSet& ) const;
00092   void setLayerListName( std::string );
00093   void setMergeTriplets( bool );
00094   void setAddRemainingTriplets( bool );
00095   void setTTRHBuilderLabel( std::string );
00096 
00097  private:
00098 
00099   std::vector<TransientTrackingRecHit::ConstRecHitPointer> mySort(TransientTrackingRecHit::ConstRecHitPointer &h1,
00100                                                                   TransientTrackingRecHit::ConstRecHitPointer &h2,
00101                                                                   TransientTrackingRecHit::ConstRecHitPointer &h3,
00102                                                                   TransientTrackingRecHit::ConstRecHitPointer &h4);
00103     
00104 
00105   bool isValidQuadruplet( std::vector<TransientTrackingRecHit::ConstRecHitPointer> &quadruplet, const std::vector<SeedMergerPixelLayer>& layers,
00106                           const TrackerTopology *tTopo) const; 
00107 
00108     // bool isValidQuadruplet( const SeedingHitSet&, const std::vector<SeedMergerPixelLayer>& ) const;
00109 
00110 bool isTripletsShareHitsOnLayers( const SeedingHitSet& firstTriplet, const SeedingHitSet& secondTriplet, 
00111                                   const SeedMergerPixelLayer &share1, const SeedMergerPixelLayer &share2,
00112                                   std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer>& hits,
00113                                   const TrackerTopology *tTopo) const;
00114 
00115 //bool isTripletsShareHitsOnLayers( const SeedingHitSet&, const SeedingHitSet&, 
00116 //   const std::pair<SeedMergerPixelLayer, SeedMergerPixelLayer>&,
00117 //  std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer>& ) const;
00118 //
00119 //  bool isMergeableHitsInTriplets( const SeedingHitSet&, const SeedingHitSet&, 
00120 //    const std::pair<SeedMergerPixelLayer, SeedMergerPixelLayer>&,
00121 //    std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer>& ) const;
00122 
00123 bool isMergeableHitsInTriplets( const SeedingHitSet& firstTriplet, const SeedingHitSet& secondTriplet, 
00124                                 const SeedMergerPixelLayer &nonShared1, const SeedMergerPixelLayer &nonShared2,
00125                                 std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer>& hits,
00126                                 const TrackerTopology *tTopo) const;
00127 
00128 
00129 
00130   ctfseeding::SeedingLayerSets theLayerSets_;
00131   edm::ESHandle<TrackerGeometry> theTrackerGeometry_;
00132   edm::ESHandle<TransientTrackingRecHitBuilder> theTTRHBuilder_;
00133   std::string layerListName_;
00134   bool isMergeTriplets_;
00135   bool isAddRemainingTriplets_;
00136   std::string theTTRHBuilderLabel_;
00137   OrderedHitSeeds quads_; 
00138 };