Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:45

0001 #ifndef L1Trigger_DTTriggerPhase2_HoughGrouping_h
0002 #define L1Trigger_DTTriggerPhase2_HoughGrouping_h
0003 
0004 // System / std headers
0005 #include <memory>
0006 #include <cstdlib>
0007 #include <stdexcept>
0008 #include <iostream>
0009 #include <vector>
0010 
0011 // Other headers
0012 #include "L1Trigger/DTTriggerPhase2/interface/MuonPath.h"
0013 #include "L1Trigger/DTTriggerPhase2/interface/DTprimitive.h"
0014 #include "L1Trigger/DTTriggerPhase2/interface/MotherGrouping.h"
0015 
0016 // ===============================================================================
0017 // Class declarations
0018 // ===============================================================================
0019 struct ProtoCand {
0020   unsigned short int nLayersWithHits_;   // 0: # of layers with hits.
0021   std::vector<bool> isThereHitInLayer_;  // 1: # of hits of high quality (the expected line crosses the cell).
0022   std::vector<bool>
0023       isThereNeighBourHitInLayer_;      // 2: # of hits of low quality (the expected line is in a neighbouring cell).
0024   unsigned short int nHitsDiff_;        // 3: absolute diff. between the number of hits in SL1 and SL3.
0025   std::vector<double> xDistToPattern_;  // 4: absolute distance to all hits of the segment.
0026   DTPrimitives dtHits_;                 // 5: DTPrimitive of the candidate.
0027 };
0028 
0029 typedef std::pair<double, double> PointInPlane;
0030 typedef std::vector<PointInPlane> PointsInPlane;
0031 typedef std::tuple<double, double, unsigned short int> PointTuple;
0032 typedef std::vector<PointTuple> PointTuples;
0033 typedef std::map<unsigned short int, double> PointMap;
0034 
0035 class HoughGrouping : public MotherGrouping {
0036 public:
0037   // Constructors and destructor
0038   HoughGrouping(const edm::ParameterSet& pset, edm::ConsumesCollector& iC);
0039   ~HoughGrouping() override;
0040 
0041   // Main methods
0042   void initialise(const edm::EventSetup& iEventSetup) override;
0043   void run(edm::Event& iEvent,
0044            const edm::EventSetup& iEventSetup,
0045            const DTDigiCollection& digis,
0046            MuonPathPtrs& outMpath) override;
0047   void finish() override;
0048 
0049   // Other public methods
0050   // Public attributes
0051 
0052 private:
0053   // Private methods
0054   void resetAttributes();
0055   void resetPosElementsOfLinespace();
0056 
0057   void obtainGeometricalBorders(const DTLayer* lay);
0058 
0059   void doHoughTransform();
0060 
0061   PointsInPlane getMaximaVector();
0062   PointsInPlane findTheMaxima(PointTuples& inputvec);
0063 
0064   PointInPlane getTwoDelta(const PointTuple& pair1, const PointTuple& pair2);
0065   PointInPlane getAveragePoint(const PointTuples& inputvec,
0066                                unsigned short int firstindex,
0067                                const std::vector<unsigned short int>& indexlist);
0068   PointInPlane transformPair(const PointInPlane& inputpair);
0069 
0070   ProtoCand associateHits(const DTChamber* thechamb, double m, double n);
0071 
0072   void orderAndFilter(std::vector<ProtoCand>& invector, MuonPathPtrs& outMuonPath);
0073 
0074   void setDifferenceBetweenSL(ProtoCand& tupl);
0075   bool areThereEnoughHits(const ProtoCand& tupl);
0076 
0077   // Private attributes
0078   const bool debug_;
0079   bool allowUncorrelatedPatterns_;
0080   unsigned short int minNLayerHits_, minSingleSLHitsMax_, minSingleSLHitsMin_, minUncorrelatedHits_, upperNumber_,
0081       lowerNumber_;
0082   double angletan_, anglebinwidth_, posbinwidth_, maxdeltaAngDeg_, maxdeltaPos_, maxDistanceToWire_;
0083 
0084   DTGeometry const* dtGeo_;
0085   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomH;
0086   DTChamberId TheChambId;
0087 
0088   double maxrads_, minangle_, oneanglebin_;
0089   double xlowlim_, xhighlim_, zlowlim_, zhighlim_;
0090   double maxdeltaAng_;
0091 
0092   unsigned short int anglebins_, halfanglebins_, spacebins_;
0093   unsigned short int idigi_, nhits_;
0094   unsigned short int thestation_, thesector_;
0095   short int thewheel_;
0096 
0097   std::vector<std::vector<unsigned short int>> linespace_;
0098 
0099   PointMap anglemap_;
0100   PointMap posmap_;
0101   std::map<unsigned short int, DTPrimitive> digimap_[8];
0102 
0103   PointsInPlane maxima_;
0104   PointsInPlane hitvec_;
0105 };
0106 
0107 #endif