Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:53

0001 #ifndef CSC_WIRE_GEOMETRY_H
0002 #define CSC_WIRE_GEOMETRY_H
0003 
0004 /** \class CSCWireGeometry
0005  * An ABC defining interface for geometry related to angle
0006  * which wires of a detector modelled by a WireTopology
0007  * make with the local x axis.
0008  *
0009  * \author Tim Cox
0010  *
0011  */
0012 
0013 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0014 #include <vector>
0015 #include <utility>  // for std::pair
0016 
0017 class CSCWireGeometry {
0018 public:
0019   virtual ~CSCWireGeometry() {}
0020 
0021   /**
0022    * Constructor from wire spacing (in cm)
0023    */
0024   CSCWireGeometry(
0025       double wireSpacing, double yOfFirstWire, double narrowWidthOfPlane, double wideWidthOfPlane, double lengthOfPlane)
0026       : theWireSpacing(wireSpacing),
0027         theYOfFirstWire(yOfFirstWire),
0028         theNarrowWidthOfPlane(narrowWidthOfPlane),
0029         theWideWidthOfPlane(wideWidthOfPlane),
0030         theLengthOfPlane(lengthOfPlane) {}
0031 
0032   /**
0033    * The spacing between wires (cm)
0034    */
0035   double wireSpacing() const { return theWireSpacing; }
0036 
0037   /** 
0038    * The local y of the first wire
0039    */
0040   double yOfFirstWire() const { return theYOfFirstWire; }
0041 
0042   /** 
0043    * Extent of wire plane at narrow end of trapezoid
0044    */
0045   double narrowWidthOfPlane() const { return theNarrowWidthOfPlane; }
0046 
0047   /** 
0048    * Extent of wire plane at wide end of trapezoid
0049    */
0050   double wideWidthOfPlane() const { return theWideWidthOfPlane; }
0051 
0052   /** 
0053    * Extent of wire plane along long axis of trapezoid
0054    */
0055   double lengthOfPlane() const { return theLengthOfPlane; }
0056 
0057   /**
0058    * The angle of the wires w.r.t local x axis (in radians)
0059    */
0060   virtual float wireAngle() const = 0;
0061 
0062   /**
0063    * The nearest (virtual) wire to a given LocalPoint.
0064    * Beware that this wire might not exist or be read out!
0065    */
0066   virtual int nearestWire(const LocalPoint& lp) const = 0;
0067 
0068   /**
0069    * Local y of a given wire 'number' (float) at given x
0070    */
0071   virtual float yOfWire(float wire, float x = 0.) const = 0;
0072 
0073   /**
0074    * Allow proper copying of derived classes via base pointer
0075    */
0076   virtual CSCWireGeometry* clone() const = 0;
0077 
0078   /** 2D point of intersection of two straight lines defined by <BR>
0079    *  y = m1*x + c1 and y = m2*x + c2 <BR>
0080    *  (in local coordinates x, y)
0081    */
0082   LocalPoint intersection(float m1, float c1, float m2, float c2) const;
0083 
0084   /** Return 2-dim local coords of the two ends of a wire
0085    *
0086    *  The returned value is a pair of LocalPoints. 
0087    */
0088   std::pair<LocalPoint, LocalPoint> wireEnds(float wire) const;
0089 
0090   /** Return mid-point of a wire in local coordinates, and its length
0091    *  across the chamber volume, in a vector as x, y, length
0092    */
0093   std::vector<float> wireValues(float wire) const;
0094 
0095   /**
0096    * Return slope and intercept of straight line representing a wire in 2-dim local coordinates.
0097    *
0098    * The return value is a pair p with p.first = m, p.second = c, where y=mx+c.
0099    */
0100   std::pair<float, float> equationOfWire(float wire) const;
0101 
0102   /**
0103    * Return pair containing y extremes of wire-plane: p.first = low y, p.second= high y
0104    *
0105    * This is supposed to approximate the 'sensitive' region covered by wires (and strips) 
0106    * but there is no sophisticated handling of edge effects, or attempt to estimate a
0107    * precise region overlapped by both wires and strips.
0108    */
0109   std::pair<float, float> yLimitsOfWirePlane() const;
0110 
0111 private:
0112   double theWireSpacing;
0113   double theYOfFirstWire;  // local y
0114   double theNarrowWidthOfPlane;
0115   double theWideWidthOfPlane;
0116   double theLengthOfPlane;
0117 };
0118 
0119 #endif