00001 #ifndef BEAM_ENERGY_CALCULATOR_H
00002 #define BEAM_ENERGY_CALCULATOR_H
00003
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022 #ifndef __CINT__
00023 #include <ext/hash_map>
00024 #endif
00025 #include <string>
00026
00027
00028 #include "MCReweight/WeightCalculator.h"
00029 #include "Conventions/BeamType.h"
00030 #include "Conventions/Detector.h"
00031
00032 class Registry;
00033 class MCEventInfo;
00034 class NuParent;
00035 class TH1;
00036 class TDirectory;
00037
00038
00039
00040 class BeamEnergyCalculator : public WeightCalculator {
00041 public:
00042 BeamEnergyCalculator(Registry* stdconfig=0);
00043
00044 virtual void Config();
00045 virtual void ReweightConfigReset();
00046 virtual double GetWeight(Registry *eventinfo);
00047 virtual double GetWeight(MCEventInfo *event,NuParent *parent);
00048 virtual double GetWeight(BeamType::BeamType_t bt,
00049 Detector::Detector_t det,
00050 int nu_idhep, double nu_energy,
00051 double high_energy_limit=120.0,
00052 double low_energy_limit=low_energy_cut);
00053
00054 private:
00055 static const double low_energy_cut;
00056 double DeriveWeight(TH1*,double,double,double);
00057 double DeriveInverseEWeight(double,double,double);
00058 static void ConstructName(Detector::Detector_t det,
00059 int nu_idhep, std::string& s);
00060 TH1* GetHist(BeamType::BeamType_t bt,
00061 Detector::Detector_t det, int nu_idhep);
00062
00063 TDirectory* fFluxDir;
00064 std::string fFluxFileName;
00065 bool fFluxFileChanged;
00066
00067 Detector::Detector_t fDetector;
00068 BeamType::BeamType_t fBeam;
00069 double fLowRange;
00070 double fHighRange;
00071
00072
00073 #ifndef __CINT__
00074
00075
00076
00077 struct myhash
00078 {
00079 size_t operator()( const std::string& x ) const
00080 {
00081 return __gnu_cxx::hash< const char* >()( x.c_str() );
00082 }
00083 };
00084
00085 typedef __gnu_cxx::hash_map<std::string, TH1*,myhash> CacheMap;
00086 typedef __gnu_cxx::hash_map<std::string, TH1*,myhash>::iterator CacheMapIter;
00087 CacheMap fCache;
00088 #endif
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 };
00099
00100 #endif