Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:49

0001 #ifndef HitPairGeneratorFromLayerPair_h
0002 #define HitPairGeneratorFromLayerPair_h
0003 
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "RecoTracker/TkHitPairs/interface/OrderedHitPairs.h"
0006 #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h"
0007 #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h"
0008 
0009 #include <optional>
0010 
0011 class DetLayer;
0012 class IdealMagneticFieldRecord;
0013 class MagneticField;
0014 class MultipleScatteringParametrisationMaker;
0015 class TrackerMultipleScatteringRecord;
0016 class TrackingRegion;
0017 
0018 class HitPairGeneratorFromLayerPair {
0019 public:
0020   typedef LayerHitMapCache LayerCacheType;
0021   typedef SeedingLayerSetsHits::SeedingLayerSet Layers;
0022   typedef SeedingLayerSetsHits::SeedingLayer Layer;
0023 
0024   HitPairGeneratorFromLayerPair(edm::ConsumesCollector iC,
0025                                 unsigned int inner,
0026                                 unsigned int outer,
0027                                 LayerCacheType* layerCache,
0028                                 unsigned int max = 0);
0029 
0030   ~HitPairGeneratorFromLayerPair();
0031 
0032   std::optional<HitDoublets> doublets(const TrackingRegion& reg,
0033                                       const edm::Event& ev,
0034                                       const edm::EventSetup& es,
0035                                       Layers layers) {
0036     assert(theLayerCache);
0037     return doublets(reg, ev, es, layers, *theLayerCache);
0038   }
0039   std::optional<HitDoublets> doublets(const TrackingRegion& reg,
0040                                       const edm::Event& ev,
0041                                       const edm::EventSetup& es,
0042                                       const Layer& innerLayer,
0043                                       const Layer& outerLayer) {
0044     assert(theLayerCache);
0045     return doublets(reg, ev, es, innerLayer, outerLayer, *theLayerCache);
0046   }
0047   std::optional<HitDoublets> doublets(const TrackingRegion& reg,
0048                                       const edm::Event& ev,
0049                                       const edm::EventSetup& es,
0050                                       Layers layers,
0051                                       LayerCacheType& layerCache) {
0052     Layer innerLayerObj = innerLayer(layers);
0053     Layer outerLayerObj = outerLayer(layers);
0054     return doublets(reg, ev, es, innerLayerObj, outerLayerObj, layerCache);
0055   }
0056   std::optional<HitDoublets> doublets(const TrackingRegion& reg,
0057                                       const edm::Event& ev,
0058                                       const edm::EventSetup& es,
0059                                       const Layer& innerLayer,
0060                                       const Layer& outerLayer,
0061                                       LayerCacheType& layerCache);
0062 
0063   bool hitPairs(
0064       const TrackingRegion& reg, OrderedHitPairs& prs, const edm::Event& ev, const edm::EventSetup& es, Layers layers);
0065   static bool doublets(const TrackingRegion& region,
0066                        const DetLayer& innerHitDetLayer,
0067                        const DetLayer& outerHitDetLayer,
0068                        const RecHitsSortedInPhi& innerHitsMap,
0069                        const RecHitsSortedInPhi& outerHitsMap,
0070                        const MagneticField& field,
0071                        const MultipleScatteringParametrisationMaker& msmaker,
0072                        const unsigned int theMaxElement,
0073                        HitDoublets& result);
0074 
0075   Layer innerLayer(const Layers& layers) const { return layers[theInnerLayer]; }
0076   Layer outerLayer(const Layers& layers) const { return layers[theOuterLayer]; }
0077 
0078 private:
0079   LayerCacheType* theLayerCache;
0080   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theFieldToken;
0081   const edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> theMSMakerToken;
0082   const unsigned int theOuterLayer;
0083   const unsigned int theInnerLayer;
0084   const unsigned int theMaxElement;
0085 };
0086 
0087 #endif