CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/FastSimulation/CaloGeometryTools/interface/CaloSegment.h

Go to the documentation of this file.
00001 #ifndef CaloSegment_h
00002 #define CaloSegment_h
00003 
00009 //FAMOS headers
00010 #include "FastSimulation/CaloGeometryTools/interface/CaloPoint.h"
00011 
00012 #include <string>
00013 
00014 class CaloGeometryHelper;
00015 class CaloSegment 
00016 {
00017 
00018  public: 
00019 
00020   typedef math::XYZVector XYZVector;
00021   typedef math::XYZVector XYZPoint;
00022 
00023   enum Material{PbWO4=0,CRACK=1,GAP=2,PS=3,HCAL=4,ECALHCALGAP=5,PSEEGAP=6};
00024   
00025   CaloSegment(const CaloPoint& in,const CaloPoint& out,double si,double siX0,double liX0,Material mat,
00026               const CaloGeometryHelper * );
00027   ~CaloSegment(){;}
00029   inline double sEntrance() const { return sentrance_;};
00031   inline double sExit() const { return sexit_;};
00033   inline double sX0Entrance() const { return sX0entrance_;};
00035   inline double sX0Exit() const { return sX0exit_;};
00037   inline double sL0Entrance() const { return sL0entrance_;};
00039   inline double sL0Exit() const { return sL0exit_;};  
00041   inline double length() const { return length_;};
00043   inline double X0length() const { return X0length_;};
00045   inline double L0length() const { return L0length_;};
00047   inline const CaloPoint& entrance() const { return entrance_;};
00049   inline const CaloPoint& exit() const { return exit_;};
00050 
00052   inline bool operator<(const CaloSegment & s) const
00053     { return sentrance_<s.sEntrance()&&sexit_<sExit(); }
00055   inline Material material() const { return material_; }; 
00057   inline DetId::Detector whichDetector() const {return detector_;};
00059   XYZPoint positionAtDepthincm(double depth) const ;
00061   XYZPoint positionAtDepthinX0(double depth) const;
00063   XYZPoint positionAtDepthinL0(double depth) const;
00064 
00066   double x0FromCm(double cm) const;
00067 
00068   private:
00069   //  static ECALProperties myCaloProperties;
00070   CaloPoint  entrance_;
00071   CaloPoint  exit_; 
00072   double sentrance_;
00073   double sexit_;
00074   double sX0entrance_;
00075   double sX0exit_;
00076   double length_;
00077   double X0length_;
00078   double sL0entrance_;
00079   double sL0exit_;
00080   double L0length_;
00081   Material material_;
00082   DetId::Detector detector_;
00083 
00084  public:
00086   class inX0Segment
00087     {
00088     public:
00089       //      inSegment(const CaloSegment & ref):segment_(ref){;};
00090       inX0Segment(double depth):ref_(depth)
00091         {
00092           //std::cout << "inSegment " << std::endl;
00093         };
00094       ~inX0Segment(){;};
00095       // in X0 !!!
00096 //      bool operator() (double value) const
00097 //      {
00098 //        return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
00099 //      }
00100       bool operator()(const CaloSegment & segment) const
00101         {
00102           return (ref_>segment.sX0Entrance()&&ref_<segment.sX0Exit());
00103         }
00104     private:
00105       //      const CaloSegment & segment_;
00106       double ref_;
00107     };
00108 
00109   class inL0Segment
00110     {
00111     public:
00112       //      inSegment(const CaloSegment & ref):segment_(ref){;};
00113       inL0Segment(double depth):ref_(depth)
00114         {
00115           //std::cout << "inSegment " << std::endl;
00116         };
00117       ~inL0Segment(){;};
00118       // in X0 !!!
00119 //      bool operator() (double value) const
00120 //      {
00121 //        return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
00122 //      }
00123       bool operator()(const CaloSegment & segment) const
00124         {
00125           return (ref_>segment.sL0Entrance()&&ref_<segment.sL0Exit());
00126         }
00127     private:
00128       //      const CaloSegment & segment_;
00129       double ref_;
00130     };
00131   
00132  class inSegment
00133     {
00134     public:
00135       //      inSegment(const CaloSegment & ref):segment_(ref){;};
00136       inSegment(double depth):ref_(depth)
00137         {
00138           //std::cout << "inSegment " << std::endl;
00139         };
00140       ~inSegment(){;};
00141       // in X0 !!!
00142 //      bool operator() (double value) const
00143 //      {
00144 //        return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
00145 //      }
00146       bool operator()(const CaloSegment & segment) const
00147         {
00148           //      std::cout << " Entrance " << segment.sEntrance() << " Exit " << segment.sExit() << " " << ref_ << " " << segment.whichDetector() << std::endl;
00149           return (ref_>segment.sEntrance()&&ref_<segment.sExit());
00150         }
00151     private:
00152       //      const CaloSegment & segment_;
00153       double ref_;
00154     };
00155 };
00156 #include<iosfwd>
00157 std::ostream& operator <<(std::ostream& o , const CaloSegment& cid);
00158 
00159 #endif