Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:17

0001 //
0002 //
0003 // CMSSW File      : interface/EtaDepResElement.h
0004 // Original Author : Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0005 // Purpose         : Hold on to an element of eta-dependent resolution.
0006 //                   A class which holds to the information of resolution
0007 //                   and the eta range in which the resolution is valid.
0008 //
0009 
0010 /**
0011 
0012     @file EtaDepResElement.h
0013     @brief Hold on to an element of  \f$ \eta \f$ -dependent resolution object,
0014     namely a resolution and  \f$ \eta \f$  range in which the resolution is valid.
0015 
0016     @author
0017     Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0018 
0019     @par Creation date:
0020     June 2009
0021 
0022  */
0023 
0024 #ifndef HITFIT_ETA_DEP_RES_ELEMENT
0025 #define HITFIT_ETA_DEP_RES_ELEMENT
0026 
0027 #include <iostream>
0028 
0029 #include "TopQuarkAnalysis/TopHitFit/interface/Defaults_Text.h"
0030 #include "TopQuarkAnalysis/TopHitFit/interface/Vector_Resolution.h"
0031 
0032 namespace hitfit {
0033 
0034   /**
0035     @class EtaDepResElement
0036 
0037     @brief Represent a resolution and an  \f$ \eta \f$  range in which the
0038     resolution is valid.
0039 
0040     @par Usage:
0041     Users instantiate multiple instances of this class.  For each instance
0042     users provide:
0043 
0044     - The lower limit of the valid  \f$ \eta \f$  range.
0045     - The upper limit of the valid  \f$ \eta \f$  range.
0046     - The resolution, in one of the three recognized forms:
0047       - string encoded Vector_Resolution.
0048       - an instance of Vector_Resolution.
0049       - three instances of Resolution which forms a proper Vector_Resolution,
0050 
0051     See the documentation for Vector_Resolution and Resolution classes for
0052     more details.
0053 
0054     @author
0055     Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0056 
0057     @par Creation date:
0058     June 2009
0059 
0060  */
0061   class EtaDepResElement {
0062   private:
0063     /**
0064        Lower limit of the valid  \f$ \eta \f$  range.
0065      */
0066     double _EtaMin;
0067 
0068     /**
0069        Upper limit of the valid  \f$ \eta \f$  range.
0070      */
0071     double _EtaMax;
0072 
0073     /**
0074        Set the lower and upper limit of the valid eta range.
0075        @param eta1 Value of  \f$ \eta \f$  in one end of the valid  \f$ \eta \f$
0076        range.
0077        @param eta2 Value of  \f$ \eta \f$  in the other end of the valid
0078         \f$ \eta \f$  range.
0079      */
0080     void SetEta(double eta1, double eta2);
0081 
0082     /**
0083        The resolution.
0084      */
0085     Vector_Resolution _Vector_Resolution;
0086 
0087   public:
0088     /**
0089        @brief Construct an instance of EtaDepResElement
0090        from the lower limit, upper limit, and the resolution.  The constructor
0091        will determine automatically which one among the two input  \f$ \eta \f$ s
0092        is the lower (upper) limit.
0093 
0094        @param eta1 Value of  \f$ \eta \f$  in one end/edge/boundary of the
0095        valid  \f$ \eta \f$  range.
0096        @param eta2 Value of  \f$ \eta \f$  in the other end/edge/boundary of the
0097        valid  \f$ \eta \f$  range.
0098        @param res The resolution.
0099      */
0100     EtaDepResElement(double eta1, double eta2, const Vector_Resolution& res);
0101 
0102     /**
0103        @brief Construct an instance of EtaDepResElement
0104        from the lower limit, upper limit, and a string which encoded the
0105        resolution.  The constructor
0106        will determine automatically which one among the two input  \f$ \eta \f$ s
0107        is the lower (upper) limit.
0108 
0109        @param eta1 Value of  \f$ \eta \f$  in one end/edge/boundary of the
0110        valid  \f$ \eta \f$  range.
0111        @param eta2 Value of  \f$ \eta \f$  in the other end/edge/boundary of the
0112        valid  \f$ \eta \f$  range.
0113        @param res The resolution encoded in string.
0114      */
0115     EtaDepResElement(double eta1, double eta2, std::string res);
0116 
0117     /**
0118        @brief Construct an instance of EtaDepResElement
0119        from the lower limit, upper limit, and the resolution.  The constructor
0120        will determine automatically which one among the two input  \f$ \eta \f$ s
0121        is the lower (upper) limit.
0122 
0123        @param eta1 Value of  \f$ \eta \f$  in one end of the valid  \f$ \eta \f$
0124        range.
0125        @param eta2 Walue of  \f$ \eta \f$  in the other end of the valid
0126         \f$ \eta \f$  range.
0127        @param p_res The energy/momentum resolution.
0128        @param eta_res The  \f$ \eta \f$  resolution.
0129        @param phi_res The  \f$ \phi \f$  resolution.
0130        @param use_et If true, then the energy/momentum resolution is
0131        for transverse component  \f$ (p_{T}/E_{T}) \f$  instead for
0132        radial  \f$ (p/E) \f$  component.
0133      */
0134     EtaDepResElement(double eta1,
0135                      double eta2,
0136                      const Resolution& p_res,
0137                      const Resolution& eta_res,
0138                      const Resolution& phi_res,
0139                      bool use_et);
0140 
0141     /**
0142        Destructor.
0143      */
0144     ~EtaDepResElement();
0145 
0146     friend bool operator<(const EtaDepResElement& a, const EtaDepResElement& b);
0147 
0148     /**
0149        @brief Return the lower limit of valid  \f$ \eta \f$  range.
0150      */
0151     const double EtaMin() const;
0152 
0153     /**
0154        @brief Return the lower limit of valid  \f$ \eta \f$  range.
0155      */
0156     const double EtaMax() const;
0157 
0158     /**
0159        @brief Check if this instance has overlapping  \f$ \eta \f$  range
0160        with another instance of EtaDepResElement.
0161        @param e The other instance of EtaDepResElement to be checked.
0162        @par Return:
0163        <b>true</b> if this instance has overlapping  \f$ \eta \f$  range
0164        with another instance's  \f$ \eta \f$  range.<br>
0165        <b>false</b> if this instance doesn't have overlapping  \f$ \eta \f$  range
0166        with another instance's  \f$ \eta \f$  range.
0167      */
0168     bool IsOverlap(const EtaDepResElement& e) const;
0169 
0170     /**
0171        @brief Check if this instance does not have overlapping  \f$ \eta \f$  range
0172        with another instance.
0173        @param e The other instance of EtaDepResElement to be checked.
0174        @par Return:
0175        <b>true</b> if this instance does not have overlapping  \f$ \eta \f$  range
0176        with another instance's  \f$ \eta \f$  range.
0177        <b>false</b> if this instance has overlapping  \f$ \eta \f$  range
0178        with another instance's  \f$ \eta \f$  range.
0179      */
0180     bool IsNotOverlap(const EtaDepResElement& e) const;
0181 
0182     /**
0183        @brief Check if an  \f$ \eta \f$  value is within
0184        this instance's  \f$ \eta \f$  range.
0185        @param eta The  \f$ \eta \f$  value to be checked.
0186        @par Return:
0187        <b>true</b> if  \f$ \eta \f$  is within the instance's  \f$ \eta \f$  range.
0188        <b>false</b> if  \f$ \eta \f$  is not within the instnace's  \f$ \eta \f$
0189        range.
0190      */
0191     bool IsInInterval(const double& eta) const;
0192 
0193     /**
0194        @brief Check if an  \f$ \eta \f$  value is at the edge/boundary of
0195        this instance's valid  \f$ \eta \f$  range.
0196        @param eta The  \f$ \eta \f$  value to be checked.
0197      */
0198     bool IsOnEdge(const double& eta) const;
0199 
0200     /**
0201        @brief Check if another instance of EtaDepResElement lies
0202        at the edge/boundary of this instance's  \f$ \eta \f$  range.
0203        this instance's valid  \f$ \eta \f$  range.  A tolerance factor of
0204        1/1000000 is used.
0205        @param e The  \f$ \eta \f$  value to be checked.
0206        @par Return:
0207        <b>true</b> if  \f$ \eta \f$  is at the edge/boundary the instance's
0208         \f$ \eta \f$  range.
0209        <b>false</b> if  \f$ \eta \f$  is not at the edge/boundary
0210        within the instnace's  \f$ \eta \f$  range.
0211      */
0212     bool IsOnEdge(const EtaDepResElement& e) const;
0213 
0214     /**
0215        @brief Access the resolution.
0216        @par Return:
0217        The resolution.
0218 
0219      */
0220     const Vector_Resolution GetResolution() const;
0221 
0222     /**
0223        @brief Output stream operator.
0224        @param s The output stream to write to.
0225        @param e The instance of EtaDepResElement to be printed.
0226        @par Return:
0227        The output stream <i>s</i>
0228      */
0229     friend std::ostream& operator<<(std::ostream& s, const EtaDepResElement& e);
0230 
0231     /**
0232        @brief Constant, the inverse of precision expected.
0233      */
0234     static const int InverseEtaPrecision = 1000000;  // Precision of 1/1000000
0235   };
0236 
0237 }  // namespace hitfit
0238 #endif  // not #ifndef HITFIT_ETA_DEP_RES_ELEMENT