Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef SiStripRecHitConverterAlgorithm_h
0002 #define SiStripRecHitConverterAlgorithm_h
0003 
0004 #include "FWCore/Utilities/interface/ESGetToken.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
0007 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
0008 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0009 
0010 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0011 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
0012 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
0013 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0014 
0015 #include <memory>
0016 
0017 namespace edm {
0018   class ConsumesCollector;
0019   class ParameterSet;
0020   class ParameterSetDescription;
0021   class EventSetup;
0022 }  // namespace edm
0023 class TrackerDigiGeometryRecord;
0024 class TkStripCPERecord;
0025 class SiStripQualityRcd;
0026 
0027 class SiStripRecHitConverterAlgorithm {
0028 public:
0029   struct products {
0030     std::unique_ptr<SiStripMatchedRecHit2DCollection> matched;
0031     std::unique_ptr<SiStripRecHit2DCollection> rphi, stereo, rphiUnmatched, stereoUnmatched;
0032     products()
0033         : matched(new SiStripMatchedRecHit2DCollection),
0034           rphi(new SiStripRecHit2DCollection),
0035           stereo(new SiStripRecHit2DCollection),
0036           rphiUnmatched(new SiStripRecHit2DCollection),
0037           stereoUnmatched(new SiStripRecHit2DCollection) {}
0038 
0039     void shrink_to_fit() {
0040       matched->shrink_to_fit();
0041       rphi->shrink_to_fit();
0042       stereo->shrink_to_fit();
0043       rphiUnmatched->shrink_to_fit();
0044       stereoUnmatched->shrink_to_fit();
0045     }
0046   };
0047 
0048   SiStripRecHitConverterAlgorithm(const edm::ParameterSet&, edm::ConsumesCollector);
0049   void initialize(const edm::EventSetup&);
0050   void run(edm::Handle<edmNew::DetSetVector<SiStripCluster> > input, products& output);
0051   void run(edm::Handle<edmNew::DetSetVector<SiStripCluster> > input, products& output, LocalVector trackdirection);
0052 
0053   static void fillPSetDescription(edm::ParameterSetDescription& desc);
0054 
0055 private:
0056   void match(products& output, LocalVector trackdirection) const;
0057   void fillBad128StripBlocks(const uint32_t detid, bool bad128StripBlocks[6]) const;
0058   bool isMasked(const SiStripCluster& cluster, bool bad128StripBlocks[6]) const;
0059   bool useModule(const uint32_t id) const;
0060 
0061   bool useQuality, maskBad128StripBlocks, doMatching;
0062   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerToken;
0063   edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord> cpeToken;
0064   edm::ESGetToken<SiStripRecHitMatcher, TkStripCPERecord> matcherToken;
0065   edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualityToken;
0066   const TrackerGeometry* tracker = nullptr;
0067   const StripClusterParameterEstimator* parameterestimator = nullptr;
0068   const SiStripRecHitMatcher* matcher = nullptr;
0069   const SiStripQuality* quality = nullptr;
0070 
0071   typedef SiStripRecHit2DCollection::FastFiller Collector;
0072 };
0073 
0074 #endif