00001 #ifndef LARTEMPERATURECORRECTIONTOOL_H
00002 #define LARTEMPERATURECORRECTIONTOOL_H
00003
00021 #include <string>
00022 #include <map>
00023 #include <memory>
00024
00025 #include <AsgTools/AsgMessaging.h>
00026
00027 #include <TFile.h>
00028 #include <TTree.h>
00029
00030 class LArTemperatureCorrectionTool : public asg::AsgMessaging
00031 {
00032 public:
00033 struct AllValues { double barrel; double endcapA; double endcapC; };
00034 LArTemperatureCorrectionTool(std::string filename);
00036 AllValues get_corrections(int run) const;
00037 double get_correction_barrel(int run) const { return get_corrections(run).barrel; }
00038 double get_correction_endcapA(int run) const { return get_corrections(run).endcapA; }
00039 double get_correction_endcapC(int run) const { return get_corrections(run).endcapC; }
00040 int get_cache_size() const { return m_cache.size(); }
00041 int get_first_run() const { return m_first_run; }
00042 int get_last_run() const { return m_last_run; }
00043 AllValues base_temperature;
00044 AllValues sensitivity_temperature;
00045 private:
00046 std::unique_ptr<TFile> m_file;
00047 TTree* m_tree;
00048 AllValues search_temperature(int run) const;
00049 AllValues search_correction(int run) const;
00050 mutable std::map<int, AllValues> m_cache;
00051 int m_first_run, m_last_run;
00052 };
00053
00054 #endif