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

NuMMRun.cxx

Go to the documentation of this file.
00001 #include <cassert>
00002 #include <cmath>
00003 
00004 #include "Rtypes.h"
00005 #include "TH1D.h"
00006 
00007 #include "Conventions/Detector.h"
00008 #include "Conventions/SimFlag.h"
00009 #include "MessageService/MsgService.h"
00010 #include "NtupleUtils/NuCuts.h"
00011 #include "NtupleUtils/NuHistInterpolator.h"
00012 #include "NtupleUtils/NuMMHelperPRL.h"
00013 #include "NtupleUtils/NuMMRun.h"
00014 
00015 ClassImp(NuMMRun)
00016 
00017 CVSID("$Id: NuMMRun.cxx,v 1.16 2010/01/17 18:15:45 bckhouse Exp $");
00018 
00019 //____________________________________________________________________72
00020 NuMMRun::NuMMRun()
00021   : fFakeDataStudy(false),
00022     fQuietMode(false),
00023     fDisappearanceModel(0),
00024     fConstrainEnergy(false),
00025     fMaximumEnergy(0.0)
00026 //    fMaximumBin(0)
00027 {
00028   NuCuts nuCuts;
00029   fNDFidMass = nuCuts.FiducialMass(Detector::kNear,
00030                                    SimFlag::kData,
00031                                    NuCuts::kJJE1);
00032   fFDFidMass = nuCuts.FiducialMass(Detector::kFar,
00033                                    SimFlag::kData,
00034                                    NuCuts::kJJE1);
00035 }
00036 
00037 //____________________________________________________________________72
00038 NuMMRun::NuMMRun(NuMMHelperPRL* helper,
00039                  NuHistInterpolator* ndData,
00040                  NuHistInterpolator* fdData)
00041   : fFakeDataStudy(false),
00042     fQuietMode(false),
00043     fDisappearanceModel(0)
00044 {
00045   NuCuts nuCuts;
00046   fNDFidMass = nuCuts.FiducialMass(Detector::kNear,
00047                                    SimFlag::kData,
00048                                    NuCuts::kJJE1);
00049   fFDFidMass = nuCuts.FiducialMass(Detector::kFar,
00050                                    SimFlag::kData,
00051                                    NuCuts::kJJE1);
00052   fHelper = helper;
00053   fNDData = ndData;
00054   fFDData = fdData;
00055 }
00056 
00057 //____________________________________________________________________72
00058 void NuMMRun::ConfigForDisappearanceModel(int model)
00059 {
00060   assert(model == 0 || model == 1 || model == 2);
00061   fDisappearanceModel = model;
00062 }
00063 
00064 //____________________________________________________________________72
00065 const Double_t NuMMRun::StatsLikelihood(const TH1D* fdPred,
00066                                         const TH1D* fdData) const
00067 {
00068 /*
00069   Bool_t    fConstrainEnergy;
00070   Double_t  fMaximumEnergy;
00071   Int_t     fMaximumBin;*/
00072   Int_t MaximumBin = 0;
00073 
00074   // Are we constraining?
00075   if (fConstrainEnergy) {
00076     // Calculate the upper bin (not sure why using findfixbin... is this old?)
00077     MaximumBin = fdPred->GetXaxis()->FindFixBin(fMaximumEnergy);
00078     MAXMSG("NuMMRun", 5, Msg::kDebug) << "    Calculated highest bin as "
00079       << MaximumBin << endl;
00080   } else {
00081     // In this case, we are not constraining - use the full range!
00082     MAXMSG("NuMMRun", 5, Msg::kDebug) << "    Not constraining bin comparison" << endl;
00083     MaximumBin = fdPred->GetNbinsX();
00084   }
00085 
00086   Double_t like = 0;
00087 
00088   //Aim to minimise -2lnL. That's what I'm returning.
00089   for (Int_t i=1; i<=MaximumBin; ++i){
00090     //Bizarre limits because root histograms are silly
00091     Double_t mnu = fdPred->GetBinContent(i);
00092     Double_t dnu = fdData->GetBinContent(i);
00093 
00094     // Replace the previous Log-likelihood with one that is a bit
00095     // more robust for fringe cases.
00096     like += NuUtilities::LogLikelihood(dnu,mnu);
00097   }
00098   return like;
00099 }

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