Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:16

0001 //
0002 // Author:  Jan Heyninck
0003 // Created: Tue Apr  3 17:33:23 PDT 2007
0004 //
0005 //
0006 #include "TopQuarkAnalysis/TopEventSelection/interface/TtSemiLRSignalSelCalc.h"
0007 
0008 // constructor with path; default should not be used
0009 TtSemiLRSignalSelCalc::TtSemiLRSignalSelCalc(const TString& fitInputPath, const std::vector<int>& observables) {
0010   std::cout << "=== Constructing a TtSemiLRSignalSelCalc... " << std::endl;
0011   myLR = new LRHelpFunctions();
0012   addPurity = false;
0013   if (observables[0] == -1)
0014     addPurity = true;
0015   myLR->readObsHistsAndFits(fitInputPath, observables, addPurity);
0016   std::cout << "=== done." << std::endl;
0017 }
0018 
0019 TtSemiLRSignalSelCalc::~TtSemiLRSignalSelCalc() { delete myLR; }
0020 
0021 void TtSemiLRSignalSelCalc::operator()(TtSemiEvtSolution& sol) {
0022   // find the used observables
0023   std::vector<double> obsVals;
0024   for (unsigned int o = 0; o < 100; o++) {
0025     if (myLR->obsFitIncluded(o))
0026       obsVals.push_back(sol.getLRSignalEvtObsVal(o));
0027   }
0028 
0029   // calculate the logLR and the purity
0030   double logLR = myLR->calcLRval(obsVals);
0031   double prob = -999.;
0032   if (addPurity)
0033     prob = myLR->calcProb(logLR);
0034 
0035   // fill these values to the members in the TtSemiEvtSolution
0036   sol.setLRSignalEvtLRval(logLR);
0037   sol.setLRSignalEvtProb(prob);
0038 }