Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-23 03:25:32

0001 #ifndef TkSeedingLayers_SeedingLayerSetsBuilder_H
0002 #define TkSeedingLayers_SeedingLayerSetsBuilder_H
0003 
0004 #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h"
0005 #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsLooper.h"
0006 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0009 #include "FWCore/Utilities/interface/InputTag.h"
0010 #include "FWCore/Framework/interface/ESWatcher.h"
0011 #include "FWCore/Utilities/interface/EDGetToken.h"
0012 #include "Geometry/CommonDetUnit/interface/GeomDetEnumerators.h"
0013 #include "DataFormats/TrackerCommon/interface/TrackerDetSide.h"
0014 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
0015 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHitCollection.h"
0016 #include <string>
0017 #include <vector>
0018 namespace edm {
0019   class Event;
0020   class EventSetup;
0021   class ConsumesCollector;
0022 }  // namespace edm
0023 namespace ctfseeding {
0024   class HitExtractor;
0025 }
0026 class TrackerRecoGeometryRecord;
0027 class TransientRecHitRecord;
0028 class TransientTrackingRecHitBuilder;
0029 class DetLayer;
0030 class TrackerTopology;
0031 class TrackerTopologyRcd;
0032 class GeometricSearchTracker;
0033 class TrackerRecoGeometryRecord;
0034 
0035 class SeedingLayerSetsBuilder {
0036 public:
0037   using SeedingLayerId = std::tuple<GeomDetEnumerators::SubDetector, TrackerDetSide, int>;
0038 
0039   SeedingLayerSetsBuilder(const edm::ParameterSet& cfg,
0040                           edm::ConsumesCollector& iC,
0041                           const edm::InputTag& fastsimHitTag);  //FastSim specific constructor
0042   SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC);
0043   SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC);
0044   ~SeedingLayerSetsBuilder();
0045 
0046   static void fillDescriptions(edm::ParameterSetDescription& desc);
0047 
0048   unsigned short numberOfLayers() const { return theLayers.size(); }
0049   unsigned short numberOfLayerSets() const {
0050     return theNumberOfLayersInSet > 0 ? theLayerSetIndices.size() / theNumberOfLayersInSet : 0;
0051   }
0052   std::vector<SeedingLayerId> layers() const;  // please call at most once per job per client
0053   SeedingLayerSetsLooper seedingLayerSetsLooper() const {
0054     return SeedingLayerSetsLooper(theNumberOfLayersInSet, &theLayerSetIndices);
0055   }
0056 
0057   const std::vector<SeedingLayerSetsHits::LayerSetIndex>& layerSetIndices() const { return theLayerSetIndices; }
0058 
0059   std::unique_ptr<SeedingLayerSetsHits> hits(const edm::Event& ev, const edm::EventSetup& es);
0060   //new function for FastSim only
0061   std::unique_ptr<SeedingLayerSetsHits> makeSeedingLayerSetsHitsforFastSim(const edm::Event& ev,
0062                                                                            const edm::EventSetup& es);
0063 
0064   static SeedingLayerId nameToEnumId(const std::string& name);
0065   static std::vector<std::vector<std::string> > layerNamesInSets(const std::vector<std::string>& namesPSet);
0066 
0067 private:
0068   edm::ParameterSet layerConfig(const std::string& nameLayer, const edm::ParameterSet& cfg) const;
0069   void updateEventSetup(const edm::EventSetup& es);
0070 
0071   edm::ESWatcher<TrackerRecoGeometryRecord> geometryWatcher_;
0072   edm::ESWatcher<TransientRecHitRecord> trhWatcher_;
0073   edm::EDGetTokenT<FastTrackerRecHitCollection> fastSimrecHitsToken_;
0074   const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> trackerToken_;
0075   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyToken_;
0076   struct LayerSpec {
0077     LayerSpec(unsigned short index,
0078               const std::string& layerName,
0079               const edm::ParameterSet& cfgLayer,
0080               edm::ConsumesCollector& iC);
0081     ~LayerSpec() = default;
0082     LayerSpec(const LayerSpec&) = delete;
0083     LayerSpec& operator=(const LayerSpec&) = delete;
0084     LayerSpec(LayerSpec&&) = default;
0085     LayerSpec& operator=(LayerSpec&&) = delete;
0086     const unsigned short nameIndex;
0087     std::string pixelHitProducer;
0088     bool usePixelHitProducer;
0089     const std::string hitBuilder;
0090     const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> hitBuilderToken;
0091 
0092     GeomDetEnumerators::SubDetector subdet;
0093     TrackerDetSide side;
0094     int idLayer;
0095     std::unique_ptr<ctfseeding::HitExtractor> extractor;
0096 
0097     std::string print(const std::vector<std::string>& names) const;
0098   };
0099   unsigned short theNumberOfLayersInSet;
0100   std::vector<SeedingLayerSetsHits::LayerSetIndex> theLayerSetIndices;  // indices to theLayers to form the layer sets
0101   std::vector<std::string> theLayerNames;
0102   std::vector<const DetLayer*> theLayerDets;
0103   std::vector<const TransientTrackingRecHitBuilder*> theTTRHBuilders;
0104   std::vector<LayerSpec> theLayers;
0105 };
0106 
0107 #endif