Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BeamEnergyCalculator.h

Go to the documentation of this file.
00001 #ifndef BEAM_ENERGY_CALCULATOR_H
00002 #define BEAM_ENERGY_CALCULATOR_H
00003 
00005 // BeamEnergyCalculator
00006 // 
00007 // Calculates weights for the different beam energy configurations
00008 // as well as a 1/E flux.  
00009 //
00010 //
00011 // Created: M. Kordosky  -- June 2, 2005
00012 //
00013 // $Author: rhatcher $ 
00014 //
00015 // $Revision: 1.2 $
00016 // 
00017 // $Name:  $
00018 //
00019 // $Id: BeamEnergyCalculator.h,v 1.2 2007/01/30 03:13:14 rhatcher Exp $
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   //  virtual ~BeamEnergyCalculator();
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 // there is no default hashing function for std::string
00075 // but one exists for char*
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   //  Int_t fNuID; // stdhep id of neutrino
00094   //  double fNuEnergy;
00095 
00096 
00097 
00098 };
00099 
00100 #endif

Generated on Mon Feb 15 11:06:24 2010 for loon by  doxygen 1.3.9.1