Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-01 22:41:03

0001 #ifndef MultiHitGeneratorFromChi2_H
0002 #define MultiHitGeneratorFromChi2_H
0003 
0004 /** A MultiHitGenerator from HitPairGenerator and vector of
0005     Layers. The HitPairGenerator provides a set of hit pairs.
0006     For each pair the search for compatible hit(s) is done among
0007     provided Layers
0008  */
0009 #include "FWCore/Utilities/interface/Visibility.h"
0010 
0011 #include "RecoTracker/TkSeedGenerator/interface/MultiHitGenerator.h"
0012 #include "CombinedMultiHitGenerator.h"
0013 #include "FWCore/Framework/interface/ConsumesCollector.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/Utilities/interface/ESGetToken.h"
0017 #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h"
0018 #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h"
0019 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
0020 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0021 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0022 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0023 
0024 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0025 #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h"
0026 
0027 #include "MagneticField/Engine/interface/MagneticField.h"
0028 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0029 #include "MagneticField/UniformEngine/interface/UniformMagneticField.h"
0030 
0031 #include <utility>
0032 #include <vector>
0033 
0034 class HitPairGeneratorFromLayerPair;
0035 
0036 class dso_hidden MultiHitGeneratorFromChi2 final : public MultiHitGeneratorFromPairAndLayers {
0037   typedef CombinedMultiHitGenerator::LayerCacheType LayerCacheType;
0038 
0039 public:
0040   MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC)
0041       : MultiHitGeneratorFromChi2(cfg, iC) {}
0042   MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg, edm::ConsumesCollector&);
0043 
0044   ~MultiHitGeneratorFromChi2() override;
0045 
0046   static void fillDescriptions(edm::ParameterSetDescription& desc);
0047   static const char* fillDescriptionsLabel() { return "multiHitFromChi2"; }
0048 
0049   void initES(const edm::EventSetup& es) override;
0050 
0051   void hitSets(const TrackingRegion& region,
0052                OrderedMultiHits& trs,
0053                const edm::Event& ev,
0054                const edm::EventSetup& es,
0055                SeedingLayerSetsHits::SeedingLayerSet pairLayers,
0056                std::vector<SeedingLayerSetsHits::SeedingLayer> thirdLayers) override;
0057 
0058   void hitSets(const TrackingRegion& region,
0059                OrderedMultiHits& trs,
0060                const HitDoublets& doublets,
0061                const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers,
0062                LayerCacheType& layerCache,
0063                cacheHits& refittedHitStorage);
0064 
0065   void hitTriplets(const TrackingRegion& region,
0066                    OrderedMultiHits& result,
0067                    const HitDoublets& doublets,
0068                    const RecHitsSortedInPhi** thirdHitMap,
0069                    const std::vector<const DetLayer*>& thirdLayerDetLayer,
0070                    const int nThirdLayers) override;
0071 
0072   void hitSets(const TrackingRegion& region,
0073                OrderedMultiHits& result,
0074                const HitDoublets& doublets,
0075                const RecHitsSortedInPhi** thirdHitMap,
0076                const std::vector<const DetLayer*>& thirdLayerDetLayer,
0077                const int nThirdLayers,
0078                cacheHits& refittedHitStorage);
0079 
0080 private:
0081   using HitOwnPtr = mayown_ptr<BaseTrackerRecHit>;
0082 
0083   void refit2Hits(HitOwnPtr& hit0,
0084                   HitOwnPtr& hit1,
0085                   TrajectoryStateOnSurface& tsos0,
0086                   TrajectoryStateOnSurface& tsos1,
0087                   const TrackingRegion& region,
0088                   float nomField,
0089                   bool isDebug);
0090   /*
0091   void refit3Hits(HitOwnPtr & hit0,
0092           HitOwnPtr & hit1,
0093           HitOwnPtr & hit2,
0094           TrajectoryStateOnSurface& tsos0,
0095           TrajectoryStateOnSurface& tsos1,
0096           TrajectoryStateOnSurface& tsos2,
0097           float nomField, bool isDebug);
0098   */
0099 private:
0100   const ClusterShapeHitFilter* filter;
0101   TkTransientTrackingRecHitBuilder const* builder;
0102   TkClonerImpl cloner;
0103 
0104   bool useFixedPreFiltering;
0105   float extraHitRZtolerance;
0106   float extraHitRPhitolerance;
0107   float extraZKDBox;
0108   float extraRKDBox;
0109   float extraPhiKDBox;
0110   float dphi;
0111   const MagneticField* bfield;
0112   UniformMagneticField ufield = 0.;
0113   float nomField;
0114   double nSigmaRZ, nSigmaPhi, fnSigmaRZ;
0115   bool chi2VsPtCut;
0116   double maxChi2;
0117   std::vector<double> pt_interv;
0118   std::vector<double> chi2_cuts;
0119   bool refitHits;
0120   std::string filterName_;
0121   std::string builderName_;
0122 
0123   bool useSimpleMF_;
0124   std::string mfName_;
0125 
0126   std::vector<int> detIdsToDebug;
0127 
0128   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldESToken_;
0129   edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterESToken_;
0130   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> transientTrackingRecHitBuilderESToken_;
0131 };
0132 #endif