Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:54

0001 #ifndef RecoTracker_TkSeedingLayers_HitExtractor_H
0002 #define RecoTracker_TkSeedingLayers_HitExtractor_H
0003 
0004 #include <vector>
0005 #include <iterator>
0006 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/Utilities/interface/EDGetToken.h"
0009 #include "DataFormats/Common/interface/ContainerMask.h"
0010 
0011 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0012 #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h"
0013 #include <limits>
0014 
0015 namespace edm {
0016   class Event;
0017   class EventSetup;
0018   class ConsumesCollector;
0019 }  // namespace edm
0020 
0021 namespace ctfseeding {
0022 
0023   class HitExtractor {
0024   public:
0025     using TkHit = BaseTrackerRecHit;
0026     using TkHitRef = BaseTrackerRecHit const&;
0027     using HitPointer = mayown_ptr<BaseTrackerRecHit>;
0028     using Hits = std::vector<HitPointer>;
0029 
0030     virtual ~HitExtractor() {}
0031     HitExtractor() {}
0032 
0033     virtual Hits hits(const TkTransientTrackingRecHitBuilder& ttrhBuilder,
0034                       const edm::Event&,
0035                       const edm::EventSetup&) const = 0;
0036     virtual HitExtractor* clone() const = 0;
0037 
0038     //skip clusters
0039     void useSkipClusters(const edm::InputTag& m, edm::ConsumesCollector& iC) {
0040       skipClusters = true;
0041       maskCluster = true;
0042       useSkipClusters_(m, iC);
0043     }
0044     bool skipClusters = false;
0045     bool filterCluster = false;
0046     bool maskCluster = false;
0047     float minGoodCharge = 0;
0048 
0049   protected:
0050     virtual void useSkipClusters_(const edm::InputTag& m, edm::ConsumesCollector& iC) = 0;
0051   };
0052 
0053   template <typename DSTV, typename A, typename B>
0054   inline void range2SeedingHits(DSTV const& dstv, HitExtractor::Hits& v, std::pair<A, B> const& sel) {
0055     typename DSTV::Range range = dstv.equal_range(sel.first, sel.second);
0056     size_t ts = v.size();
0057     for (typename DSTV::const_iterator id = range.first; id != range.second; id++)
0058       ts += std::distance((*id).begin(), (*id).end());
0059     v.reserve(ts);
0060     for (typename DSTV::const_iterator id = range.first; id != range.second; id++) {
0061       for (auto const& h : (*id))
0062         v.emplace_back(h);
0063     }
0064   }
0065 }  // namespace ctfseeding
0066 #endif