Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:24

0001 #ifndef JetResolution_h
0002 #define JetResolution_h
0003 
0004 // If you want to use the JER code in standalone mode, you'll need to create a new define named 'STANDALONE'. If you use gcc for compiling, you'll need to add
0005 // -DSTANDALONE to the command line
0006 // In standalone mode, no reference to CMSSW exists, so the only way to retrieve resolutions and scale factors are from text files.
0007 
0008 #include <CondFormats/JetMETObjects/interface/JetResolutionObject.h>
0009 
0010 #ifndef STANDALONE
0011 #include "FWCore/Utilities/interface/ESGetToken.h"
0012 namespace edm {
0013   class EventSetup;
0014 }
0015 class JetResolutionObject;
0016 class JetResolutionRcd;
0017 class JetResolutionScaleFactorRcd;
0018 #endif
0019 
0020 namespace JME {
0021   class JetResolution {
0022   public:
0023     JetResolution(const std::string& filename);
0024     JetResolution(const JetResolutionObject& object);
0025     JetResolution() {
0026       // Empty
0027     }
0028 
0029 #ifndef STANDALONE
0030     using Token = edm::ESGetToken<JetResolutionObject, JetResolutionRcd>;
0031     static const JetResolution get(const edm::EventSetup&, const Token&);
0032 #endif
0033 
0034     float getResolution(const JetParameters& parameters) const;
0035 
0036     void dump() const { m_object->dump(); }
0037 
0038     // Advanced usage
0039     const JetResolutionObject* getResolutionObject() const { return m_object.get(); }
0040 
0041   private:
0042     std::shared_ptr<JetResolutionObject> m_object;
0043   };
0044 
0045   class JetResolutionScaleFactor {
0046   public:
0047     JetResolutionScaleFactor(const std::string& filename);
0048     JetResolutionScaleFactor(const JetResolutionObject& object);
0049     JetResolutionScaleFactor() {
0050       // Empty
0051     }
0052 
0053 #ifndef STANDALONE
0054     using Token = edm::ESGetToken<JetResolutionObject, JetResolutionScaleFactorRcd>;
0055     static const JetResolutionScaleFactor get(const edm::EventSetup&, const Token&);
0056 #endif
0057 
0058     float getScaleFactor(const JetParameters& parameters,
0059                          Variation variation = Variation::NOMINAL,
0060                          std::string uncertaintySource = "") const;
0061 
0062     void dump() const { m_object->dump(); }
0063 
0064     // Advanced usage
0065     const JetResolutionObject* getResolutionObject() const { return m_object.get(); }
0066 
0067   private:
0068     std::shared_ptr<JetResolutionObject> m_object;
0069   };
0070 
0071 };  // namespace JME
0072 
0073 #endif