CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Geometry/CSCGeometry/interface/CSCLayerGeometry.h

Go to the documentation of this file.
00001 #ifndef Geometry_CSCGeometry_CSCLayerGeometry_H
00002 #define Geometry_CSCGeometry_CSCLayerGeometry_H
00003 
00014 #include <Geometry/CSCGeometry/interface/CSCStripTopology.h>
00015 #include <Geometry/CSCGeometry/interface/CSCWireTopology.h>
00016 #include <DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h>
00017 #include <DataFormats/GeometryVector/interface/LocalPoint.h>
00018 #include <DataFormats/GeometrySurface/interface/LocalError.h>
00019 
00020 #include <utility> // for std::pair
00021 
00022 class CSCGeometry;
00023 class CSCWireGroupPackage;
00024 
00025 class CSCLayerGeometry : public TrapezoidalPlaneBounds { 
00026 
00027 public:
00028 
00045   CSCLayerGeometry( const CSCGeometry* geom, int iChamberType,
00046              const TrapezoidalPlaneBounds& bounds,
00047              int nstrips, float stripOffset, float stripPhiPitch, 
00048              float whereStripsMeet, float extentOfStripPlane, float yCentreOfStripPlane,
00049              const CSCWireGroupPackage& wg, float wireAngleInDegrees, double yOfFirstWire, float hThickness );
00050 
00051   CSCLayerGeometry(const CSCLayerGeometry& );
00052 
00053   CSCLayerGeometry& operator=( const CSCLayerGeometry& );
00054 
00055   virtual ~CSCLayerGeometry();
00056 
00060   int numberOfStrips() const { 
00061     return theStripTopology->nstrips(); }
00062      
00066   int numberOfWires() const { 
00067     return theWireTopology->numberOfWires(); }
00068 
00072   int numberOfWireGroups() const {
00073     return theWireTopology->numberOfWireGroups(); }
00074 
00078   int numberOfWiresPerGroup( int wireGroup ) const {
00079     return theWireTopology->numberOfWiresPerGroup( wireGroup ); }
00080 
00084   LocalPoint stripWireIntersection( int strip, float wire) const;
00085 
00089   LocalPoint stripWireGroupIntersection( int strip, int wireGroup) const;
00090   
00094   int nearestStrip(const LocalPoint & lp) const {
00095     return theStripTopology->nearestStrip(lp);
00096   }
00097 
00101   int nearestWire(const LocalPoint & lp) const {
00102     return theWireTopology->nearestWire( lp ); }
00103 
00107   int wireGroup(int wire) const {
00108     return theWireTopology->wireGroup( wire );
00109   }
00110 
00115   int channel(int strip)  const {
00116     return theStripTopology->channel(strip);
00117   }
00118 
00123    float stripOffset( void ) const {return theStripTopology->stripOffset();}
00124 
00129    int stagger() const { return static_cast<int>( 4.1*stripOffset() ); }
00130 
00134   float stripAngle(int strip) const;
00135 
00139   float wireAngle() const {
00140     return theWireTopology->wireAngle(); }
00141   
00145   float wirePitch() const {
00146     return theWireTopology->wirePitch(); }
00147 
00159   float yResolution( int wireGroup = 1 ) const {
00160     return theWireTopology->yResolution( wireGroup ); }
00161 
00165   float stripPhiPitch() const { 
00166     return theStripTopology->phiPitch(); }
00167 
00171   float stripPitch() const { 
00172     //    return theStripTopology->pitch(); }
00173     return stripPitch( LocalPoint(0.,0.) ); }
00174 
00178   float stripPitch(const LocalPoint & lp) const { 
00179     return theStripTopology->localPitch(lp); }
00180   
00184   float xOfStrip(int strip, float y=0.) const { 
00185     return theStripTopology->xOfStrip(strip, y); }
00186 
00193   float strip(const LocalPoint& lp) const { return theStripTopology->strip(lp); }
00194 
00201   float middleWireOfGroup( int wireGroup ) const {
00202     return theWireTopology->middleWireOfGroup( wireGroup ); }
00203 
00207   float yOfWire(float wire, float x=0.) const {
00208     return theWireTopology->yOfWire( wire, x ); }
00209 
00213   float yOfWireGroup(int wireGroup, float x=0.) const {
00214     return theWireTopology->yOfWireGroup( wireGroup, x ); }
00215 
00221   LocalPoint localCenterOfWireGroup( int wireGroup ) const;
00222 
00226   float lengthOfWireGroup( int wireGroup ) const;
00227 
00231   std::pair<float, float> yLimitsOfStripPlane() const {
00232     return theStripTopology->yLimitsOfStripPlane();
00233   }
00234 
00243   bool inside( const Local3DPoint&, const LocalError&, float scale=1.f ) const;
00244   bool inside( const Local3DPoint& ) const;
00245   bool inside( const Local2DPoint& ) const;
00246 
00258   std::pair<LocalPoint, float> possibleRecHitPosition( float s, int w1, int w2 ) const;
00259       
00267   LocalPoint intersectionOfStripAndWire( float s, int w) const;
00268         
00275   LocalPoint intersectionOfTwoLines( std::pair<float, float> p1, std::pair<float, float> p2 ) const;
00276 
00282   LocalError localError( int strip, float sigmaStrip, float sigmaWire ) const;
00283   
00287   const CSCStripTopology* topology() const {
00288     return theStripTopology; 
00289   }
00290 
00294   void setTopology( CSCStripTopology * topology );
00295 
00299   const CSCWireTopology* wireTopology() const {
00300     return theWireTopology; 
00301   }
00302 
00306   virtual Bounds* clone() const { 
00307     return new CSCLayerGeometry(*this);
00308   }
00309 
00313   friend std::ostream & operator<<(std::ostream &, const CSCLayerGeometry &);
00314 
00315 private:
00316 
00317   // The wire information is encapsulated in a CSCWireTopology
00318   // This class is passed the pointer and takes ownership...
00319   // e.g. it destroys it.
00320   
00321   CSCWireTopology* theWireTopology;
00322 
00323   // The strip information is encapsulated in a CSCStripTopology
00324   // This class owns the pointer... so that copying works with
00325   // derived classes, need a clone() method which can be virtual.
00326 
00327   CSCStripTopology* theStripTopology;
00328 
00329   // Cache the trapezoid dimensions even though they could
00330   // be accessed from the TrapezoidalPlaneBounds
00331 
00332   float hBottomEdge;
00333   float hTopEdge;
00334   float apothem;
00335 
00336   const std::string myName;
00337   int chamberType;
00338 };
00339 #endif