Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //
0002 //
0003 // CMSSW File      : interface/EtaDepResolution.h
0004 // Original Author : Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0005 // Purpose         : Hold on to eta-dependent resolution.
0006 //                   Return Vector_Resolution as a function of eta.
0007 //                   Does not assume symmetry between +/- eta.
0008 //                   The interpretation of eta (physics or detector) is
0009 //                   left to user's implementation.
0010 //
0011 
0012 /**
0013 
0014     @file EtaDepResolution.h
0015 
0016     @brief Hold on to \f$\eta\f$-dependent resolution.
0017     This class acts
0018     as a function object and returns Vector_Resolution as a function
0019     of \f$\eta\f$.  It does not assume symmetry between \f$+\eta\f$ and
0020     \f$-\eta\f$.  The interpretation of \f$\eta\f$ as physics \f$\eta\f$
0021     or detector \f$\eta\f$ is left to users's implementation.
0022 
0023     @author
0024     Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0025 
0026     @par Creation date:
0027     June 2009
0028 
0029  */
0030 
0031 #ifndef HITFIT_ETA_DEP_RESOLUTION
0032 #define HITFIT_ETA_DEP_RESOLUTION
0033 
0034 #include "TopQuarkAnalysis/TopHitFit/interface/Defaults_Text.h"
0035 #include "TopQuarkAnalysis/TopHitFit/interface/Vector_Resolution.h"
0036 #include "TopQuarkAnalysis/TopHitFit/interface/EtaDepResElement.h"
0037 
0038 namespace hitfit {
0039 
0040   /**
0041     @class EtaDepResolution
0042 
0043     @brief Hold on to \f$\eta\f$-dependent resolution.  This class acts
0044     as a function object and returns Vector_Resolution as a function
0045     of \f$\eta\f$.  It does not assume symmetry between \f$+\eta\f$ and
0046     \f$-\eta\f$.  The interpretation of \f$\eta\f$ as physics \f$\eta\f$
0047     or detector \f$\eta\f$ is left to users's implementation.
0048 
0049     @par Usage:
0050     Users should write the \f$\eta\f$-dependent resolution in a plain ASCII
0051     text file with the following format:<br>
0052 
0053     etadep_etaminX = etamin
0054 
0055     etadep_etamaxX = etamax
0056 
0057     etadep_vecresX = vecres
0058 
0059     where:
0060 
0061     <b>X</b> is an integer starting from 0 (0, 1, 2, 3, ...).  Users can
0062     write as many resolutions as long as each of them has different
0063     integer, and complete information regarding \f$\eta\f$ range an
0064     resolution.
0065 
0066     <b>etamin</b> is a floating-point number, the lower limit of the valid
0067     \f$\eta\f$ range.
0068 
0069     <b>etamax</b> is a floating-point number, the upper limit of the valid
0070     \f$\eta\f$ range.
0071 
0072     <b>vecres</b> is a string-encoded Vector_Resolution, see the
0073     documentation for Vector_Resolution class for details.
0074 
0075     The constructor will read the ASCII text file and read all resolutions
0076     in the file.  Then it will instantiate the EtaDepResolution and sort
0077     the internal list of EtaDepResElement.
0078 
0079     @author
0080     Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0081 
0082     @par Creation date:
0083     June 2009.
0084 
0085  */
0086   class EtaDepResolution {
0087   private:
0088     /**
0089        List of \f$\eta\f$-dependent resolution elements.
0090      */
0091     std::vector<EtaDepResElement> _EtaDepResElement;
0092 
0093     /**
0094        @brief Internal method to return the corresponding \f$\eta\f$-dependent
0095        resolution element for a given \f$\eta\f$ value.
0096        @param eta The value of \f$\eta\f$ whose corresponding resolution
0097        is to be found.
0098        @par Return:
0099        An iterator (pointer) to the corresponding \f$\eta\f$-dependent
0100        resolution element.
0101      */
0102     std::vector<EtaDepResElement>::const_iterator FindResolution(double& eta) const;
0103 
0104   public:
0105     /**
0106        Sort the internal list of \f$\eta\f$-dependent resolution elements.
0107      */
0108     void sort();
0109 
0110     /**
0111        @brief Default constructor, instantiate an EtaDepResolution
0112        object with empty list of \f$\eta\f$-dependent resolution elements.
0113      */
0114     EtaDepResolution();
0115 
0116     /**
0117        @brief Instantiate an EtaDepResolution
0118        object with a filename which contains information about
0119        \f$\eta\f$-dependent resolution.
0120        @param default_file The input ASCII text file.
0121      */
0122     EtaDepResolution(const std::string& default_file);
0123 
0124     /**
0125        Destructor.
0126      */
0127     ~EtaDepResolution();
0128 
0129     /**
0130        @brief Read the \f$\eta\f$-dependent resolution information
0131        from an ASCII text file.
0132        @param default_file The ASCII text file to read.
0133        @par Return:
0134        The number of \f$\eta\f$-dependent resolution element read from the file.
0135      */
0136     std::vector<EtaDepResElement>::size_type Read(const std::string& default_file);
0137 
0138     /**
0139        @brief Read the \f$\eta\f$-dependent resolution information
0140        from a Defaults_Text object.
0141        @param defs The Defaults_Text object to read.
0142        @par Return:
0143        The number of \f$\eta\f$-dependent resolution element read from the file.
0144      */
0145     std::vector<EtaDepResElement>::size_type Read(const Defaults_Text& defs);
0146 
0147     /**
0148        @brief Check for non-overlapping \f$\eta\f$-range between
0149        \f$\eta\f$-dependent resolution elements in a list.
0150        @param v The list of \f$\eta\f$-dependent resolution elements to check.
0151        @par Return:
0152        <b>true</b> if there is no overlap.<br>
0153        <b>false</b> if there is overlap.
0154      */
0155     bool CheckNoOverlap(const std::vector<EtaDepResElement>& v);
0156 
0157     /**
0158        @brief Return the lower limit of the valid \f$\eta\f$-range.
0159      */
0160     const double EtaMin() const;
0161 
0162     /**
0163        @brief Return the upper limit of the valid \f$\eta\f$-range.
0164      */
0165     const double EtaMax() const;
0166 
0167     /**
0168        @brief Check is an input \f$\eta\f$ value is within the valid \f$\eta\f$-range
0169        of this instance.
0170        @param eta The \f$\eta\f$ value to be check.
0171        @par Return:
0172        <b>true</b> if <i>eta</i> is within the valid \f$\eta\f$-range.<br>
0173        <b>false</b> if is not within the valid \f$\eta\f$-range.
0174      */
0175     const bool CheckEta(double eta) const;
0176 
0177     /**
0178        @brief Allow users to call this instance as a function to access
0179        the corresponding resolution for an input value of \f$\eta\f$.
0180        @param eta The \f$\eta\f$ value for which the corresponding resolution is desired.
0181        @par Return:
0182        The corresponding resolution if the input \f$\eta\f$ value is valid.
0183        Throw a runtime error if the \f$\eta\f$ value is invalid.
0184      */
0185     Vector_Resolution operator()(double& eta);
0186 
0187     /**
0188        @brief Return the corresponding resolution for a value of \f$\eta\f$.
0189        @param eta The \f$\eta\f$ value for which the corresponding resolution is desired.
0190        @par Return:
0191        The corresponding resolution if the input \f$\eta\f$ value is valid.
0192        Throw a runtime error if the \f$\eta\f$ value is invalid.
0193      */
0194     Vector_Resolution GetResolution(double& eta) const;
0195 
0196     /**
0197        @brief Return the corresponding \f$\eta\f$-dependent resolution element
0198        (of type EtaDepResElement)for a value of \f$\eta\f$.
0199        @param eta The \f$\eta\f$ value for which the corresponding element
0200        @par Return:
0201        The corresponding element if the input \f$\eta\f$ value is valid.
0202        Throw a runtime error if the \f$\eta\f$ value is invalid.
0203      */
0204     EtaDepResElement GetEtaDepResElement(double& eta) const;
0205 
0206     /**
0207        @brief Access the internal list of \f$\eta\f$-dependent resolution
0208        elements.
0209        @par Return:
0210        The list of \f$\eta\f$-dependent resolution elements.
0211      */
0212     const std::vector<EtaDepResElement> GetEtaDepResElement() const;
0213   };
0214 
0215 }  // namespace hitfit
0216 #endif  // not #ifndef HITFIT_ETA_DEP_RESOLUTION