Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DTSegment_DTSegmentUpdator_h
0002 #define DTSegment_DTSegmentUpdator_h
0003 
0004 /** \class DTSegmentUpdator
0005  *
0006  * Perform linear fit and hits update for DT segments.
0007  * Update a segment by improving the hits thanks to the refined knowledge of
0008  * impact angle and position (also along the wire) and perform linear fit on
0009  * improved hits.
0010  *
0011  * \author Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
0012  * \author Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>
0013  * \author M.Meneghelli - INFN BO <marco.meneghelli@cern.ch>
0014  *
0015  */
0016 
0017 /* C++ Headers */
0018 #include <vector>
0019 
0020 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0021 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0022 
0023 #include "FWCore/Framework/interface/ESHandle.h"
0024 #include "FWCore/Framework/interface/ConsumesCollector.h"
0025 
0026 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0027 
0028 /* ====================================================================== */
0029 
0030 /* Collaborating Class Declarations */
0031 class DTSegmentCand;
0032 class DTRecSegment2D;
0033 class DTRecSegment4D;
0034 class DTLinearFit;
0035 class DTRecHitBaseAlgo;
0036 class DTChamberRecSegment2D;
0037 class DTGeometry;
0038 class MuonGeometryRecord;
0039 
0040 namespace edm {
0041   class EventSetup;
0042   class ParameterSet;
0043 }  // namespace edm
0044 
0045 /* Class DTSegmentUpdator Interface */
0046 class DTSegmentUpdator {
0047 public:
0048   /// Constructor
0049   DTSegmentUpdator(const edm::ParameterSet& config, edm::ConsumesCollector);
0050 
0051   /// Destructor
0052   ~DTSegmentUpdator();
0053 
0054   /* Operations */
0055 
0056   /** do the linear fit on the hits of the segment candidate and update it.
0057      * Returns false if the segment candidate is not good() */
0058   bool fit(DTSegmentCand* seg, bool allow3par, const bool fitdebug) const;
0059 
0060   /** ditto for true segment: since the fit is applied on a true segment, by
0061      * definition the segment is "good", while it's not the case for just
0062      * candidates */
0063   void fit(DTRecSegment2D* seg, bool allow3par, bool block3par) const;
0064 
0065   /** ditto for true segment 4D, the fit is done on either projection and then
0066      * the 4D direction and position is built. Since the fit is applied on a
0067      * true segment, by definition the segment is "good", while it's not the
0068      * case for just candidates */
0069   void fit(DTRecSegment4D* seg, bool allow3par) const;
0070 
0071   /// recompute hits position and refit the segment4D
0072   void update(DTRecSegment4D* seg, const bool calcT0, bool allow3par) const;
0073 
0074   /// recompute hits position and refit the segment2D
0075   void update(DTRecSegment2D* seg, bool allow3par) const;
0076 
0077   void calculateT0corr(DTRecSegment2D* seg) const;
0078   void calculateT0corr(DTRecSegment4D* seg) const;
0079 
0080   /// set the setup
0081   void setES(const edm::EventSetup& setup);
0082 
0083 protected:
0084 private:
0085   std::unique_ptr<DTLinearFit> theFitter;     // the linear fitter
0086   std::unique_ptr<DTRecHitBaseAlgo> theAlgo;  // the algo for hit reconstruction
0087   edm::ESHandle<DTGeometry> theGeom;          // the geometry
0088   const edm::ESGetToken<DTGeometry, MuonGeometryRecord> theGeomToken;
0089 
0090   void updateHits(DTRecSegment2D* seg, GlobalPoint& gpos, GlobalVector& gdir, const int step = 2) const;
0091 
0092   //rejects bad hits (due to deltas) for phi segment
0093   void rejectBadHits(DTChamberRecSegment2D*) const;
0094 
0095   /// interface to LinearFit
0096   void fit(const std::vector<float>& x,
0097            const std::vector<float>& y,
0098            const std::vector<int>& lfit,
0099            const std::vector<double>& dist,
0100            const std::vector<float>& sigy,
0101            LocalPoint& pos,
0102            LocalVector& dir,
0103            float& cminf,
0104            float& vminf,
0105            AlgebraicSymMatrix& covMat,
0106            double& chi2,
0107            const bool allow3par = false,
0108            const bool block3par = false) const;
0109 
0110   double intime_cut;
0111   bool vdrift_4parfit;
0112   double T0_hit_resolution;
0113   bool perform_delta_rejecting;
0114   bool debug;
0115 };
0116 
0117 #endif  // DTSegment_DTSegmentUpdator_h