00001 // 00002 // Author: Jan Heyninck 00003 // Created: Tue Apr 3 17:33:23 PDT 2007 00004 // 00005 // $Id: TtSemiLRSignalSelCalc.cc,v 1.4 2013/05/28 17:54:37 gartung Exp $ 00006 // 00007 #include "TopQuarkAnalysis/TopEventSelection/interface/TtSemiLRSignalSelCalc.h" 00008 00009 // constructor with path; default should not be used 00010 TtSemiLRSignalSelCalc::TtSemiLRSignalSelCalc(const TString& fitInputPath, const std::vector<int>& observables) 00011 { 00012 std::cout << "=== Constructing a TtSemiLRSignalSelCalc... " << std::endl; 00013 myLR = new LRHelpFunctions(); 00014 addPurity = false; 00015 if(observables[0] == -1) addPurity = true; 00016 myLR -> readObsHistsAndFits(fitInputPath, observables, addPurity); 00017 std::cout << "=== done." << std::endl; 00018 } 00019 00020 TtSemiLRSignalSelCalc::~TtSemiLRSignalSelCalc() 00021 { 00022 delete myLR; 00023 } 00024 00025 void TtSemiLRSignalSelCalc::operator()(TtSemiEvtSolution & sol) 00026 { 00027 // find the used observables 00028 std::vector<double> obsVals; 00029 for(unsigned int o = 0; o<100; o++){ 00030 if( myLR->obsFitIncluded(o) ) obsVals.push_back(sol.getLRSignalEvtObsVal(o)); 00031 } 00032 00033 // calculate the logLR and the purity 00034 double logLR = myLR->calcLRval(obsVals); 00035 double prob = -999.; 00036 if(addPurity) prob = myLR->calcProb(logLR); 00037 00038 // fill these values to the members in the TtSemiEvtSolution 00039 sol.setLRSignalEvtLRval(logLR); 00040 sol.setLRSignalEvtProb(prob); 00041 }