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

NCExtractionPDF.cxx

Go to the documentation of this file.
00001 
00002 // NCExtractionPDF.cxx
00003 //
00004 // A simple NC/CC separation class - PDFs based on TOm's variables
00005 //
00006 // C. Backhouse 06/2009
00008 
00009 #include "NCUtils/Extraction/NCExtractionPDF.h"
00010 
00011 #include "NCUtils/Cuts/NCAnalysisCutsNC.h"
00012 #include "NCUtils/Extraction/MicroDSTMaker.h"
00013 
00014 #include "MessageService/MsgService.h"
00015 
00016 #include "TH2.h"
00017 
00018 #include <cassert>
00019 
00020 REGISTER_NCEXTRACTION(NCExtractionPDF, PDF)
00021 
00022 ClassImp(NCExtractionPDF)
00023 
00024 CVSID("$Id: NCExtractionPDF.cxx,v 1.2 2009/09/12 16:26:51 rodriges Exp $");
00025 
00026 //----------------------------------------------------------------------
00027 NCExtractionPDF::NCExtractionPDF(NCAnalysisCuts* cuts,
00028                                  const Registry& r)
00029   : NCExtraction(cuts, r)
00030 {
00031   const char* tmps;
00032   TString trainingFilePath;
00033   if(r.Get("ExtractionPDFTrainingFilePath", tmps)) trainingFilePath = tmps;
00034   assert(trainingFilePath != "");
00035 
00036   TFile fin(trainingFilePath, "READ");
00037   fLikelihoodHist = (TH2*)fin.Get("hFrac");
00038   fLikelihoodHist->SetDirectory(0);
00039   fin.Close();
00040 
00041 }
00042 
00043 //----------------------------------------------------------------------
00044 NCExtractionPDF::~NCExtractionPDF()
00045 {
00046   if(fLikelihoodHist) delete fLikelihoodHist;
00047 }
00048 
00049 //----------------------------------------------------------------------
00050 double NCExtractionPDF::GetIdProbability(NCEventInfo& evtInfo,
00051                                          int)
00052 {
00053   assert(evtInfo.reco);
00054   assert(fLikelihoodHist);
00055 
00056   double idProb = 0;
00057 
00058   if(!evtInfo.reco->numberTracks){
00059     idProb = 1;
00060   }
00061   else{
00062     const double ext = evtInfo.reco->showerPlanes - evtInfo.reco->trackPlanes;
00063 
00064     const int bin = fLikelihoodHist->FindBin(evtInfo.reco->planes, ext);
00065     const double lhoodVal = fLikelihoodHist->GetBinContent(bin);
00066 
00067     if(lhoodVal == 0){
00068       idProb = (ext > 0) ? 1 : 0;
00069     }
00070     else{
00071       idProb = lhoodVal;
00072     }
00073   }
00074 
00075   return idProb;
00076 }
00077 

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