Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:26

0001 #ifndef DataFormats_ParticleFlowReco_PFResolutionMap_h
0002 #define DataFormats_ParticleFlowReco_PFResolutionMap_h
0003 
0004 #include <iostream>
0005 #include <string>
0006 #include <stdexcept>
0007 
0008 #include <TH2.h>
0009 
0010 /// \brief Resolution Map (resolution as a function of eta and E)
0011 ///
0012 /// Basically just a TH2D with text I/O
0013 /// \author Colin Bernet
0014 /// \todo extrapolation
0015 /// \date January 2006
0016 class PFResolutionMap : public TH2D {
0017 public:
0018   /// default constructor
0019   PFResolutionMap() : TH2D() {}
0020 
0021   /// create a map from text file mapfile
0022   PFResolutionMap(const char* name, const char* mapfile);
0023 
0024   /// create an empty map and initialize it
0025   PFResolutionMap(const char* name,
0026                   unsigned nbinseta,
0027                   double mineta,
0028                   double maxeta,
0029                   unsigned nbinse,
0030                   double mine,
0031                   double maxe,
0032                   double value = -1);
0033 
0034   /// create a map from a 2d histogram
0035   PFResolutionMap(const TH2D& h) : TH2D(h) {}
0036 
0037   /// read text file
0038   bool ReadMapFile(const char* mapfile);
0039 
0040   /// write text file
0041   /// is not const because mapFile_ will be updated
0042   bool WriteMapFile(const char* mapfile);
0043 
0044   ///  extrapolation requires overloading of this function
0045   int FindBin(double eta, double e, double z = 0) override;
0046 
0047   double getRes(double eta, double phi, double e, int MapEta = -1);
0048 
0049   const char* GetMapFile() const { return mapFile_.c_str(); }
0050 
0051   /// print this map
0052   friend std::ostream& operator<<(std::ostream& out, const PFResolutionMap& rm);
0053 
0054 private:
0055   bool IsInAPhiCrack(double phi, double eta);
0056   double minimum(double a, double b);
0057   double dCrackPhi(double phi, double eta);
0058   static const unsigned lineSize_;
0059   std::string mapFile_;
0060 };
0061 
0062 #endif