Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:11

0001 #ifndef CaloSegment_h
0002 #define CaloSegment_h
0003 /** \file FamosGeneric/FamosCalorimeters/interface/CrytalSegment.h 
0004  *
0005  * A segment between two CaloPoints. 
0006  * 
0007  */
0008 
0009 //FAMOS headers
0010 #include "FastSimulation/CaloGeometryTools/interface/CaloPoint.h"
0011 
0012 #include <string>
0013 
0014 class CaloGeometryHelper;
0015 class CaloSegment {
0016 public:
0017   typedef math::XYZVector XYZVector;
0018   typedef math::XYZVector XYZPoint;
0019 
0020   enum Material { PbWO4 = 0, CRACK = 1, GAP = 2, PS = 3, HCAL = 4, ECALHCALGAP = 5, PSEEGAP = 6 };
0021 
0022   CaloSegment(const CaloPoint& in,
0023               const CaloPoint& out,
0024               double si,
0025               double siX0,
0026               double liX0,
0027               Material mat,
0028               const CaloGeometryHelper*);
0029   ~CaloSegment() { ; }
0030   /// absciss of the entrance (in cm)
0031   inline double sEntrance() const { return sentrance_; };
0032   /// absciss of the exit (in cm)
0033   inline double sExit() const { return sexit_; };
0034   /// absciss of the entrance (in X0)
0035   inline double sX0Entrance() const { return sX0entrance_; };
0036   /// absciss of the exit (in X0)
0037   inline double sX0Exit() const { return sX0exit_; };
0038   /// absciss of the entrance (in L0)
0039   inline double sL0Entrance() const { return sL0entrance_; };
0040   /// absciss of the exit (in L0)
0041   inline double sL0Exit() const { return sL0exit_; };
0042   /// length of the segment (in cm)
0043   inline double length() const { return length_; };
0044   /// length of the segment (in X0)
0045   inline double X0length() const { return X0length_; };
0046   /// length of the segment (in L9)
0047   inline double L0length() const { return L0length_; };
0048   /// first point of the segment
0049   inline const CaloPoint& entrance() const { return entrance_; };
0050   /// last point of the segment (there are only two)
0051   inline const CaloPoint& exit() const { return exit_; };
0052 
0053   /// ordering operator wrt to the particle direction
0054   inline bool operator<(const CaloSegment& s) const { return sentrance_ < s.sEntrance() && sexit_ < sExit(); }
0055   /// material
0056   inline Material material() const { return material_; };
0057   /// In which detector
0058   inline DetId::Detector whichDetector() const { return detector_; };
0059   /// space point corresponding to this depth (in cm)
0060   XYZPoint positionAtDepthincm(double depth) const;
0061   /// space point corresponding to this depth (in X0)
0062   XYZPoint positionAtDepthinX0(double depth) const;
0063   /// space point corresponding to this depth (in L0)
0064   XYZPoint positionAtDepthinL0(double depth) const;
0065 
0066   /// cm to X0 conversion
0067   double x0FromCm(double cm) const;
0068 
0069 private:
0070   //  static ECALProperties myCaloProperties;
0071   CaloPoint entrance_;
0072   CaloPoint exit_;
0073   double sentrance_;
0074   double sexit_;
0075   double sX0entrance_;
0076   double sX0exit_;
0077   double length_;
0078   double X0length_;
0079   double sL0entrance_;
0080   double sL0exit_;
0081   double L0length_;
0082   Material material_;
0083   DetId::Detector detector_;
0084 
0085 public:
0086   /// This class is used to determine if a point lies in the segment
0087   class inX0Segment {
0088   public:
0089     //      inSegment(const CaloSegment & ref):segment_(ref){;};
0090     inX0Segment(double depth)
0091         : ref_(depth){
0092               //std::cout << "inSegment " << std::endl;
0093           };
0094     ~inX0Segment() { ; };
0095     // in X0 !!!
0096     //      bool operator() (double value) const
0097     //  {
0098     //    return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
0099     //  }
0100     bool operator()(const CaloSegment& segment) const {
0101       return (ref_ > segment.sX0Entrance() && ref_ < segment.sX0Exit());
0102     }
0103 
0104   private:
0105     //      const CaloSegment & segment_;
0106     double ref_;
0107   };
0108 
0109   class inL0Segment {
0110   public:
0111     //      inSegment(const CaloSegment & ref):segment_(ref){;};
0112     inL0Segment(double depth)
0113         : ref_(depth){
0114               //std::cout << "inSegment " << std::endl;
0115           };
0116     ~inL0Segment() { ; };
0117     // in X0 !!!
0118     //      bool operator() (double value) const
0119     //  {
0120     //    return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
0121     //  }
0122     bool operator()(const CaloSegment& segment) const {
0123       return (ref_ > segment.sL0Entrance() && ref_ < segment.sL0Exit());
0124     }
0125 
0126   private:
0127     //      const CaloSegment & segment_;
0128     double ref_;
0129   };
0130 
0131   class inSegment {
0132   public:
0133     //      inSegment(const CaloSegment & ref):segment_(ref){;};
0134     inSegment(double depth)
0135         : ref_(depth){
0136               //std::cout << "inSegment " << std::endl;
0137           };
0138     ~inSegment() { ; };
0139     // in X0 !!!
0140     //      bool operator() (double value) const
0141     //  {
0142     //    return (value>segment_.sX0Entrance()&&value<segment_.sX0Exit());
0143     //  }
0144     bool operator()(const CaloSegment& segment) const {
0145       //      std::cout << " Entrance " << segment.sEntrance() << " Exit " << segment.sExit() << " " << ref_ << " " << segment.whichDetector() << std::endl;
0146       return (ref_ > segment.sEntrance() && ref_ < segment.sExit());
0147     }
0148 
0149   private:
0150     //      const CaloSegment & segment_;
0151     double ref_;
0152   };
0153 };
0154 #include <iosfwd>
0155 std::ostream& operator<<(std::ostream& o, const CaloSegment& cid);
0156 
0157 #endif