Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoTracker_PixelLowPtUtilities_StripSubClusterShapeTrajectoryFilter_h
0002 #define RecoTracker_PixelLowPtUtilities_StripSubClusterShapeTrajectoryFilter_h
0003 
0004 #include <vector>
0005 #include <unordered_map>
0006 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
0007 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "FWCore/Utilities/interface/EDGetToken.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h"
0013 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0014 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0015 
0016 class ClusterShapeHitFilter;
0017 class TrackerTopology;
0018 class TrackerGeometry;
0019 class TrajectoryMeasurement;
0020 class TrajectoryStateOnSurface;
0021 class MeasurementTrackerEvent;
0022 class SiStripNoises;
0023 class TTree;
0024 namespace edm {
0025   class Event;
0026   class EventSetup;
0027   class ConsumesCollector;
0028 }  // namespace edm
0029 
0030 //#define StripSubClusterShapeFilterBase_COUNTERS
0031 
0032 class StripSubClusterShapeFilterBase {
0033 public:
0034   StripSubClusterShapeFilterBase(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC);
0035   virtual ~StripSubClusterShapeFilterBase();
0036 
0037   static void fillPSetDescription(edm::ParameterSetDescription &iDesc);
0038 
0039 protected:
0040   void setEventBase(const edm::Event &, const edm::EventSetup &);
0041 
0042   bool testLastHit(const TrackingRecHit *hit, const TrajectoryStateOnSurface &tsos, bool mustProject = false) const;
0043   bool testLastHit(const TrackingRecHit *hit,
0044                    const GlobalPoint &gpos,
0045                    const GlobalVector &gdir,
0046                    bool mustProject = false) const;
0047 
0048   // esConsumes tokens
0049   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0050   edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> csfToken_;
0051   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0052   edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> stripNoiseToken_;
0053 
0054   // who am i
0055   std::string label_;
0056 
0057   // pass-through of clusters with too many consecutive saturated strips
0058   uint32_t maxNSat_;
0059 
0060   // trimming parameters
0061   uint8_t trimMaxADC_;
0062   float trimMaxFracTotal_, trimMaxFracNeigh_;
0063 
0064   // maximum difference after peak finding
0065   float maxTrimmedSizeDiffPos_, maxTrimmedSizeDiffNeg_;
0066 
0067   // peak finding parameters
0068   float subclusterWindow_;
0069   float seedCutMIPs_, seedCutSN_;
0070   float subclusterCutMIPs_, subclusterCutSN_;
0071 
0072   // layers in which to apply the filter
0073   std::array<std::array<uint8_t, 10>, 7> layerMask_;
0074 
0075 #ifdef StripSubClusterShapeFilterBase_COUNTERS
0076   mutable uint64_t called_, saturated_, test_, passTrim_, failTooLarge_, passSC_, failTooNarrow_;
0077 #endif
0078 
0079   edm::ESHandle<TrackerGeometry> theTracker;
0080   edm::ESHandle<ClusterShapeHitFilter> theFilter;
0081   edm::ESHandle<SiStripNoises> theNoise;
0082   edm::ESHandle<TrackerTopology> theTopology;
0083 };
0084 
0085 class StripSubClusterShapeTrajectoryFilter : public StripSubClusterShapeFilterBase, public TrajectoryFilter {
0086 public:
0087   StripSubClusterShapeTrajectoryFilter(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
0088       : StripSubClusterShapeFilterBase(iConfig, iC) {}
0089 
0090   ~StripSubClusterShapeTrajectoryFilter() override {}
0091 
0092   static void fillPSetDescription(edm::ParameterSetDescription &iDesc) {
0093     StripSubClusterShapeFilterBase::fillPSetDescription(iDesc);
0094   }
0095 
0096   bool qualityFilter(const TempTrajectory &) const override;
0097   bool qualityFilter(const Trajectory &) const override;
0098 
0099   bool toBeContinued(TempTrajectory &) const override;
0100   bool toBeContinued(Trajectory &) const override;
0101 
0102   std::string name() const override { return "StripSubClusterShapeTrajectoryFilter"; }
0103 
0104   void setEvent(const edm::Event &e, const edm::EventSetup &es) override { setEventBase(e, es); }
0105 
0106 protected:
0107   using StripSubClusterShapeFilterBase::testLastHit;
0108   bool testLastHit(const TrajectoryMeasurement &last) const;
0109 };
0110 
0111 class StripSubClusterShapeSeedFilter : public StripSubClusterShapeFilterBase, public SeedComparitor {
0112 public:
0113   StripSubClusterShapeSeedFilter(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC);
0114 
0115   ~StripSubClusterShapeSeedFilter() override {}
0116 
0117   void init(const edm::Event &ev, const edm::EventSetup &es) override { setEventBase(ev, es); }
0118   // implemented
0119   bool compatible(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const override;
0120   // not implemented
0121   bool compatible(const SeedingHitSet &hits) const override { return true; }
0122   bool compatible(const SeedingHitSet &hits,
0123                   const GlobalTrajectoryParameters &helixStateAtVertex,
0124                   const FastHelix &helix) const override;
0125 
0126 protected:
0127   bool filterAtHelixStage_;
0128 };
0129 
0130 #endif