Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DTSegment_DTMeantimerPatternReco_h
0002 #define DTSegment_DTMeantimerPatternReco_h
0003 
0004 /** \class DTMeantimerPatternReco
0005  *
0006  * Algo for reconstructing 2d segment in DT using a combinatorial approach with
0007  * a T0 estimation produced along the way
0008  *  
0009  * \author Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
0010  * \author Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>
0011  * \author Piotr Traczyk - SINS Warsaw <ptraczyk@fuw.edu.pl>
0012  *
0013  */
0014 
0015 /* Base Class Headers */
0016 #include "RecoLocalMuon/DTSegment/src/DTRecSegment2DBaseAlgo.h"
0017 
0018 /* Collaborating Class Declarations */
0019 namespace edm {
0020   class ParameterSet;
0021   class EventSetup;
0022   //  class ESHandle;
0023 }  // namespace edm
0024 class DTSegmentUpdator;
0025 class DTSegmentCleaner;
0026 class DTHitPairForFit;
0027 class DTSegmentCand;
0028 class DTLinearFit;
0029 class MuonGeometryRecord;
0030 
0031 /* C++ Headers */
0032 #include <vector>
0033 #include <deque>
0034 #include <utility>
0035 
0036 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0037 #include "FWCore/Framework/interface/ESHandle.h"
0038 #include "FWCore/Utilities/interface/ESGetToken.h"
0039 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0040 #include "RecoLocalMuon/DTSegment/src/DTSegmentCand.h"
0041 
0042 /* ====================================================================== */
0043 
0044 /* Class DTMeantimerPatternReco Interface */
0045 
0046 class DTMeantimerPatternReco : public DTRecSegment2DBaseAlgo {
0047 public:
0048   /// Constructor
0049   DTMeantimerPatternReco(const edm::ParameterSet& pset, edm::ConsumesCollector cc);
0050 
0051   /// Destructor
0052   ~DTMeantimerPatternReco() override;
0053 
0054   /* Operations */
0055 
0056   /// this function is called in the producer
0057   edm::OwnVector<DTSLRecSegment2D> reconstruct(const DTSuperLayer* sl,
0058                                                const std::vector<DTRecHit1DPair>& hits) override;
0059 
0060   /// return the algo name
0061   std::string algoName() const override { return theAlgoName; }
0062 
0063   /// Through this function the EventSetup is percolated to the
0064   /// objs which request it
0065   void setES(const edm::EventSetup& setup) override;
0066 
0067 protected:
0068 private:
0069   DTLinearFit* theFitter;  // the linear fitter
0070 
0071   friend class DTMeantimerPatternReco4D;
0072 
0073   // typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
0074 
0075   // create the DTHitPairForFit from the pairs for easy use
0076   std::vector<std::shared_ptr<DTHitPairForFit>> initHits(const DTSuperLayer* sl,
0077                                                          const std::vector<DTRecHit1DPair>& hits);
0078 
0079   // search for candidate, starting from pairs of hits in different layers
0080   std::vector<DTSegmentCand*> buildSegments(const DTSuperLayer* sl,
0081                                             const std::vector<std::shared_ptr<DTHitPairForFit>>& hits);
0082 
0083   // try adding more hits to a candidate
0084   void addHits(DTSegmentCand* segCand,
0085                const std::vector<std::shared_ptr<DTHitPairForFit>>& hits,
0086                std::vector<DTSegmentCand*>& result);
0087 
0088   // fit a set of left/right hits, calculate t0 and chi^2
0089   DTSegmentCand* fitWithT0(DTSegmentCand* seg, const bool fitdebug);
0090 
0091   // check if two hist can be considered in one segment (come from different layers, not too far away etc.)
0092   bool geometryFilter(const DTWireId first, const DTWireId second) const;
0093 
0094   bool checkDoubleCandidates(std::vector<DTSegmentCand*>& segs, DTSegmentCand* seg);
0095 
0096   void printPattern(std::vector<DTSegmentCand::AssPoint>& assHits, const DTHitPairForFit* hit);
0097 
0098 private:
0099   std::string theAlgoName;
0100   unsigned int theMaxAllowedHits;
0101   double theAlphaMaxTheta;
0102   double theAlphaMaxPhi;
0103   double theMaxChi2;
0104   bool debug;
0105   DTSegmentUpdator* theUpdator;  // the updator and fitter
0106   DTSegmentCleaner* theCleaner;  // the cleaner
0107 
0108   unsigned int maxfound;
0109 
0110   edm::ESHandle<DTGeometry> theDTGeometry;  // the DT geometry
0111   const edm::ESGetToken<DTGeometry, MuonGeometryRecord> theDTGeometryToken;
0112 };
0113 #endif  // DTSegment_DTMeantimerPatternReco_h