Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:31

0001 #ifndef TrackingTools_DetLayers_PhiBorderFinder_H
0002 #define TrackingTools_DetLayers_PhiBorderFinder_H
0003 
0004 /** \class PhiBorderFinder
0005  *  Find the phi binning of a list of detector according to several 
0006  *  definitions.
0007  *
0008  *  \author N. Amapane - INFN Torino
0009  */
0010 
0011 #include <Geometry/CommonDetUnit/interface/GeomDet.h>
0012 
0013 #include <DataFormats/GeometrySurface/interface/BoundingBox.h>
0014 #include <DataFormats/GeometrySurface/interface/GeometricSorting.h>
0015 
0016 #include <DataFormats/GeometryVector/interface/Pi.h>
0017 #include <Utilities/General/interface/precomputed_value_sort.h>
0018 #include <TrackingTools/DetLayers/interface/simple_stat.h>
0019 #include <TrackingTools/DetLayers/interface/DetRod.h>
0020 #include <FWCore/Utilities/interface/Exception.h>
0021 
0022 // FIXME: remove this include
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 
0025 #include <vector>
0026 
0027 class PhiBorderFinder {
0028 public:
0029   typedef DetRod Det;  //FIXME!!!
0030   typedef geomsort::ExtractPhi<Det, float> DetPhi;
0031 
0032   PhiBorderFinder(const std::vector<const Det*>& utheDets);
0033 
0034   virtual ~PhiBorderFinder(){};
0035 
0036   inline unsigned int nBins() { return theNbins; }
0037 
0038   /// Returns true if the Dets are periodic in phi.
0039   inline bool isPhiPeriodic() const { return isPhiPeriodic_; }
0040 
0041   /// Returns true if any 2 of the Det overlap in phi.
0042   inline bool isPhiOverlapping() const { return isPhiOverlapping_; }
0043 
0044   /// The borders, defined for each det as the middle between its lower
0045   /// edge and the previous Det's upper edge.
0046   inline const std::vector<double>& phiBorders() const { return thePhiBorders; }
0047 
0048   /// The centers of the Dets.
0049   inline const std::vector<double>& phiBins() const { return thePhiBins; }
0050 
0051   //  inline std::vector<double> etaBorders() {}
0052   //  inline std::vector<double> zBorders() {}
0053 
0054 private:
0055   unsigned int theNbins;
0056   bool isPhiPeriodic_;
0057   bool isPhiOverlapping_;
0058   std::vector<double> thePhiBorders;
0059   std::vector<double> thePhiBins;
0060 
0061   inline double positiveRange(double phi) const { return (phi > 0) ? phi : phi + Geom::twoPi(); }
0062 
0063   int binIndex(int i) const {
0064     int ind = i % (int)theNbins;
0065     return (ind < 0) ? ind + theNbins : ind;
0066   }
0067 };
0068 #endif