Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:35

0001 #ifndef MagGeometry_H
0002 #define MagGeometry_H
0003 
0004 /** \class MagGeometry
0005  *  Entry point to the geometry of magnetic volumes.
0006  *
0007  *  \author N. Amapane - INFN Torino
0008  */
0009 
0010 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0011 #include "MagneticField/Layers/interface/MagBinFinders.h"
0012 
0013 #include <vector>
0014 #include <atomic>
0015 
0016 class MagBLayer;
0017 class MagESector;
0018 class MagVolume;
0019 class MagVolume6Faces;
0020 template <class T>
0021 class PeriodicBinFinderInPhi;
0022 
0023 class MagGeometry {
0024 public:
0025   typedef Surface::GlobalVector GlobalVector;
0026   typedef Surface::GlobalPoint GlobalPoint;
0027 
0028   /// Constructor
0029   MagGeometry(int geomVersion,
0030               const std::vector<MagBLayer*>&,
0031               const std::vector<MagESector*>&,
0032               const std::vector<MagVolume6Faces*>&,
0033               const std::vector<MagVolume6Faces*>&);
0034   MagGeometry(int geomVersion,
0035               const std::vector<MagBLayer const*>&,
0036               const std::vector<MagESector const*>&,
0037               const std::vector<MagVolume6Faces const*>&,
0038               const std::vector<MagVolume6Faces const*>&);
0039 
0040   /// Destructor
0041   ~MagGeometry();
0042 
0043   /// Return field vector at the specified global point
0044   GlobalVector fieldInTesla(const GlobalPoint& gp) const;
0045 
0046   /// Find a volume
0047   MagVolume const* findVolume(const GlobalPoint& gp, double tolerance = 0.) const;
0048 
0049   // FIXME: only for temporary tests, should be removed.
0050   const std::vector<MagVolume6Faces const*>& barrelVolumes() const { return theBVolumes; }
0051   const std::vector<MagVolume6Faces const*>& endcapVolumes() const { return theEVolumes; }
0052 
0053 private:
0054   friend class MagGeometryExerciser;  // for debug purposes
0055 
0056   // Linear search (for debug purposes only)
0057   MagVolume const* findVolume1(const GlobalPoint& gp, double tolerance = 0.) const;
0058 
0059   bool inBarrel(const GlobalPoint& gp) const;
0060 
0061   const int me_;  // Instance ID, to trigger cache invalidation at IOV boundaries
0062 
0063   std::vector<MagBLayer const*> theBLayers;
0064   std::vector<MagESector const*> theESectors;
0065 
0066   // FIXME: only for temporary tests, should be removed.
0067   std::vector<MagVolume6Faces const*> theBVolumes;
0068   std::vector<MagVolume6Faces const*> theEVolumes;
0069 
0070   MagBinFinders::GeneralBinFinderInR<double> const* theBarrelBinFinder;
0071   PeriodicBinFinderInPhi<float> const* theEndcapBinFinder;
0072 
0073   bool cacheLastVolume;
0074   int geometryVersion;
0075 
0076   // boundaries of internal barrel-endcap volume separation
0077   double theBarrelRsq1;
0078   double theBarrelRsq2;
0079   double theBarrelZ0;
0080   double theBarrelZ1;
0081   double theBarrelZ2;
0082 };
0083 #endif