Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:14

0001 #ifndef DTRecHit_DTRecHit1DPair_H
0002 #define DTRecHit_DTRecHit1DPair_H
0003 
0004 /** \class DTRecHit1DPair
0005  *
0006  *  Composed recHit representing a pair of reconstructed hits
0007  *
0008  *  For each signal theLeftHit in the DT wire, two hits can be constructed, due to the
0009  *  Left/Right ambiguity, which can be solved only associating several hits
0010  *  together. This class describes the pair of points associated to a single
0011  *  TDC signal. The two hits can be accessed via recHits()
0012  *  method. The position is the average of the theLeftHit and theRightHit hits, namely the
0013  *  wire position.
0014  *
0015  *  \author S. Lacaprara & G. Cerminara
0016  */
0017 
0018 #include "DataFormats/DTRecHit/interface/DTRecHit1D.h"
0019 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0020 
0021 #include <utility>
0022 
0023 class DTLayer;
0024 class DTDigi;
0025 
0026 class DTRecHit1DPair : public RecHit1D {
0027 public:
0028   /// Constructor without components: must use setPos and Err!
0029   DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi);
0030 
0031   /// Default constructor. Needed to write the RecHit into a STL container.
0032   DTRecHit1DPair();
0033 
0034   /// Destructor
0035   ~DTRecHit1DPair() override;
0036 
0037   // Operations
0038 
0039   DTRecHit1DPair* clone() const override;
0040 
0041   /// Return the 3-dimensional local position.
0042   /// The average theLeftHit/theRightHit hits position, namely the wire position
0043   /// is returned.
0044   LocalPoint localPosition() const override;
0045 
0046   /// Return the 3-dimensional error on the local position.
0047   /// The error is defiened as half
0048   /// the distance between theLeftHit and theRightHit pos
0049   LocalError localPositionError() const override;
0050 
0051   /// Access to component RecHits.
0052   /// Return the two recHits (L/R)
0053   std::vector<const TrackingRecHit*> recHits() const override;
0054 
0055   /// Non-const access to component RecHits.
0056   /// Return the two recHits (L/R)
0057   std::vector<TrackingRecHit*> recHits() override;
0058 
0059   /// Return the detId of the Det (a DTLayer).
0060   virtual DetId geographicalId() const;
0061 
0062   /// Return the digi time (ns) used to build the rechits
0063   float digiTime() const { return theLeftHit.digiTime(); }
0064 
0065   /// Comparison operator, based on the wireId and the digi time
0066   bool operator==(const DTRecHit1DPair& hit) const;
0067 
0068   /// Inequality operator, defined as the mirror image of the comparions
0069   /// operator
0070   bool operator!=(const DTRecHit1DPair& hit) const { return !(*this == hit); }
0071 
0072   /// Return position in the local (layer) coordinate system for a
0073   /// certain hypothesis about the L/R cell side
0074   LocalPoint localPosition(DTEnums::DTCellSide lrside) const;
0075 
0076   /// Return position error in the local (layer) coordinate system for a
0077   /// certain hypothesis about the L/R cell side
0078   LocalError localPositionError(DTEnums::DTCellSide lrside) const;
0079 
0080   /// Set the 3-dimensional local position for the component hit
0081   /// corresponding to the given cell side. Default value is assumed for the error.
0082   void setPosition(DTEnums::DTCellSide lrside, const LocalPoint& point);
0083 
0084   /// Set the 3-dimensional local position and error for the component hit
0085   /// corresponding to the given cell side. Default value is assumed for the error.
0086   void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint& point, const LocalError& err);
0087 
0088   // Return the wireId
0089   DTWireId wireId() const { return theLeftHit.wireId(); }
0090 
0091   /// Return the left/right DTRecHit1D
0092   const DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide) const;
0093 
0094   /// Get the left and right 1D rechits (first and second respectively).
0095   std::pair<const DTRecHit1D*, const DTRecHit1D*> componentRecHits() const;
0096 
0097 private:
0098   /// Non const access to left/right DTRecHit1D
0099   DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide);
0100 
0101   // The two rechits
0102   DTRecHit1D theLeftHit;
0103   DTRecHit1D theRightHit;
0104 };
0105 
0106 /// Ostream operator
0107 std::ostream& operator<<(std::ostream& os, const DTRecHit1DPair& hit);
0108 
0109 #endif