Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 13:02:39

0001 #ifndef CSC_WIRE_TOPOLOGY_H
0002 #define CSC_WIRE_TOPOLOGY_H
0003 
0004 /** \class CSCWireTopology
0005  * A concrete class derived from WireTopology, to handle
0006  * wire (group) geometry functionality for endcap muon CSCs.
0007  *
0008  * \author Tim Cox
0009  *
0010  */
0011 
0012 #include "Geometry/CSCGeometry/interface/WireTopology.h"
0013 #include "Geometry/CSCGeometry/interface/CSCWireGeometry.h"
0014 #include "Geometry/CSCGeometry/interface/CSCWireGrouping.h"
0015 #include "Geometry/CSCGeometry/interface/CSCWireGroupPackage.h"
0016 #include <utility>  // for std::pair
0017 
0018 class CSCWireTopology : public WireTopology {
0019 public:
0020   ~CSCWireTopology() override;
0021 
0022   /**
0023    * Constructor from endcap muon CSC wire geometry specs
0024    */
0025 
0026   CSCWireTopology(const CSCWireGroupPackage& wg, double yOfFirstWire, float wireAngleInDegrees);
0027   /**
0028    * Copy constructor
0029    */
0030   CSCWireTopology(const CSCWireTopology&);
0031 
0032   /**
0033    * Assignment op
0034    */
0035   CSCWireTopology& operator=(const CSCWireTopology&);
0036 
0037   /** 
0038    * Topology interface, but not implemented for CSCWireTopology (yet!)
0039    */
0040 
0041   LocalPoint localPosition(const MeasurementPoint&) const override;
0042   LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
0043   MeasurementPoint measurementPosition(const LocalPoint&) const override;
0044   MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
0045 
0046   /**
0047    * 'channel' is wire group number from 1 to no. of groups.
0048    * Return 0 if out-of-range or in a dead region
0049    */
0050   int channel(const LocalPoint& p) const override;
0051 
0052   /**
0053    * WireTopology interface
0054    */
0055 
0056   /** 
0057    * The wire spacing (in cm)
0058    */
0059   double wireSpacing() const { return theWireGeometry->wireSpacing(); }
0060 
0061   /**
0062    * The wire pitch. This is the wire spacing but
0063    * old-timers like the word 'pitch'.
0064    */
0065   float wirePitch() const override { return static_cast<float>(wireSpacing()); }
0066 
0067   /**
0068    * The angle of the wires w.r.t local x axis (in radians)
0069    */
0070   float wireAngle() const override { return theWireGeometry->wireAngle(); }
0071 
0072   /**
0073    * The nearest (virtual) wire to a given LocalPoint.
0074    * Beware that this wire might not exist or be read out!
0075    */
0076   int nearestWire(const LocalPoint& lp) const override { return theWireGeometry->nearestWire(lp); }
0077 
0078   /**
0079    * Local y of a given wire 'number' (float) at given x
0080    */
0081   float yOfWire(float wire, float x = 0.) const { return theWireGeometry->yOfWire(wire, x); }
0082 
0083   /**
0084    * Width of wire plane at narrow end of trapezoid
0085    */
0086   double narrowWidthOfPlane() const { return theWireGeometry->narrowWidthOfPlane(); }
0087 
0088   /**
0089    * Width of wire plane at wide end of trapezoid
0090    */
0091   double wideWidthOfPlane() const { return theWireGeometry->wideWidthOfPlane(); }
0092 
0093   /**
0094    * Length/height of wire plane along long axis of trapezoid (local y direction)
0095    */
0096   double lengthOfPlane() const { return theWireGeometry->lengthOfPlane(); }
0097 
0098   /**
0099    * Wire group interface
0100    */
0101 
0102   /**
0103    * Total number of (virtual) wires.
0104    * Some wires may not be implemented in the hardware.
0105    * This is the number which would fill the region covered
0106    * by wires, assuming the constant wire spacing.
0107    */
0108   int numberOfWires() const override { return theWireGrouping->numberOfWires(); }
0109 
0110   /**
0111    * How many wire groups
0112    */
0113   int numberOfWireGroups() const { return theWireGrouping->numberOfWireGroups(); }
0114 
0115   /**
0116    * How many wires in a wiregroup
0117    */
0118   int numberOfWiresPerGroup(int wireGroup) const { return theWireGrouping->numberOfWiresPerGroup(wireGroup); }
0119 
0120   /**
0121    * Wire group containing a given wire
0122    */
0123   int wireGroup(int wire) const { return theWireGrouping->wireGroup(wire); }
0124 
0125   /**
0126    * Middle of wire-group.
0127    * This is the central wire no. for a group with an odd no. of wires.
0128    * This is a pseudo-wire no. for a group with an even no. of wires.
0129    * Accordingly, it is non-integer.
0130    */
0131   float middleWireOfGroup(int wireGroup) const { return theWireGrouping->middleWireOfGroup(wireGroup); }
0132 
0133   /**
0134    * Extended interface which 'mixes' WireGrouping and WireGeometry info
0135    */
0136 
0137   /**
0138    * Local y of a given wire group at given x
0139    */
0140   float yOfWireGroup(int wireGroup, float x = 0.) const;
0141 
0142   /**
0143    * The measurement resolution from wire groups (in cm.)
0144    * This approximates the measurement resolution in the local
0145    * y direction but may be too small by a factor of up to 1.26
0146    * due to stripAngle contributions which are neglected here.
0147    */
0148   float yResolution(int wireGroup = 1) const;
0149 
0150   /** 
0151    * Extent of wire plane (width normal to wire direction). <BR>
0152    * Note that for ME11 this distance is not along local y! <BR>
0153    * cf. lengthOfPlane() which should be the same for all chambers but ME11.
0154    */
0155   double extentOfWirePlane() const { return wireSpacing() * (numberOfWires() - 1); }
0156 
0157   /**
0158    * Return local (x,y) coordinates of the two ends of a wire
0159    * across the extent of the wire plane.
0160    * The returned value is a pair of LocalPoints.
0161    */
0162   std::pair<LocalPoint, LocalPoint> wireEnds(float wire) const { return theWireGeometry->wireEnds(wire); }
0163 
0164   /** Return mid-point of a wire in local coordinates, and its length
0165    *  across the chamber volume, in a vector as x, y, length
0166    */
0167   std::vector<float> wireValues(float wire) const { return theWireGeometry->wireValues(wire); }
0168 
0169   /**
0170    * Return slope and intercept of straight line representing a wire in 2-dim local coordinates.
0171    *
0172    * The return value is a pair p with p.first = m, p.second = c, where y=mx+c.
0173    */
0174   std::pair<float, float> equationOfWire(float wire) const;
0175 
0176   /**
0177    * Reset input y to lie within bounds of wire plane at top and bottom.
0178    */
0179   float restrictToYOfWirePlane(float y) const;
0180 
0181   /** 
0182    * Returns true if arg falls within y limits of wire plane; false otherwise.
0183    */
0184   bool insideYOfWirePlane(float y) const;
0185 
0186 private:
0187   CSCWireGrouping* theWireGrouping;  // handles grouping of wires for read out
0188   CSCWireGeometry* theWireGeometry;  // handles non-zero angle w.r.t x axis
0189 
0190   double theAlignmentPinToFirstWire;  //@@ Not sure this is actually required!
0191 };
0192 
0193 #endif