Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:19:46

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 namespace edm {
0016   class ConsumesCollector;
0017   class ParameterSet;
0018   class ParameterSetDescription;
0019   class EventSetup;
0020 }  // namespace edm
0021 class TrackerDigiGeometryRecord;
0022 class TkStripCPERecord;
0023 class SiStripQualityRcd;
0024 
0025 class SiStripRecHitConverterAlgorithm {
0026 public:
0027   struct products {
0028     std::unique_ptr<SiStripMatchedRecHit2DCollection> matched;
0029     std::unique_ptr<SiStripRecHit2DCollection> rphi, stereo, rphiUnmatched, stereoUnmatched;
0030     products()
0031         : matched(new SiStripMatchedRecHit2DCollection),
0032           rphi(new SiStripRecHit2DCollection),
0033           stereo(new SiStripRecHit2DCollection),
0034           rphiUnmatched(new SiStripRecHit2DCollection),
0035           stereoUnmatched(new SiStripRecHit2DCollection) {}
0036 
0037     void shrink_to_fit() {
0038       matched->shrink_to_fit();
0039       rphi->shrink_to_fit();
0040       stereo->shrink_to_fit();
0041       rphiUnmatched->shrink_to_fit();
0042       stereoUnmatched->shrink_to_fit();
0043     }
0044   };
0045 
0046   SiStripRecHitConverterAlgorithm(const edm::ParameterSet&, edm::ConsumesCollector);
0047   void initialize(const edm::EventSetup&);
0048   void run(edm::Handle<edmNew::DetSetVector<SiStripCluster> > input, products& output);
0049   void run(edm::Handle<edmNew::DetSetVector<SiStripCluster> > input, products& output, LocalVector trackdirection);
0050 
0051   static void fillPSetDescription(edm::ParameterSetDescription& desc);
0052 
0053 private:
0054   void match(products& output, LocalVector trackdirection) const;
0055   void fillBad128StripBlocks(const uint32_t detid, bool bad128StripBlocks[6]) const;
0056   bool isMasked(const SiStripCluster& cluster, bool bad128StripBlocks[6]) const;
0057   bool useModule(const uint32_t id) const;
0058 
0059   bool useQuality, maskBad128StripBlocks, doMatching;
0060   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerToken;
0061   edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord> cpeToken;
0062   edm::ESGetToken<SiStripRecHitMatcher, TkStripCPERecord> matcherToken;
0063   edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualityToken;
0064   const TrackerGeometry* tracker = nullptr;
0065   const StripClusterParameterEstimator* parameterestimator = nullptr;
0066   const SiStripRecHitMatcher* matcher = nullptr;
0067   const SiStripQuality* quality = nullptr;
0068 
0069   typedef SiStripRecHit2DCollection::FastFiller Collector;
0070 };
0071 
0072 #endif