#include #include #include #include "eff_utils/RawEffTool.hpp" #include "eff_utils/EffInfo.hpp" #include "eff_utils/EffVal.hpp" using namespace eff_utils; int main() { try { std::cout << "UseRawTool begins" << std::endl; // first set up the request EffInfo request; request.ObjType("EM"); request.ObjQuality("Tight"); request.ObjVersion(8); request.EffType("Binned"); request.EffVersion(0); request.EffName("gaus"); std::vector< std::string > vars; vars.push_back("eta"); request.EffVarNames( vars ); // RawEffTool effTool( request ); // make sure it found the file if( ! effTool.isValid()) { std::cout << "Is not valid!" << std::endl; return 1; } // get efficiency info const EffInfo info = effTool.Info(); // figure out the variable names int nvars = info.EffNVars(); std::vector< std::string > varNames; varNames = info.EffVarNames(); if( nvars != 1) {// I happen to know this should be 1 ok... std::cout << "NVars != 1" << std::endl; return 2; } if( nvars != varNames.size() ) { std::cout << " NVars not consistent" << std::endl; return 3; } std::string varName = varNames[0]; std::cout << " Var Name is : " << varName << std::endl; // all the stuff before here can be done at initialisation time // in teh event loop the only thing needed to be done is the following // now go get an efficiency value std::vector< float > inputs; inputs.resize(1); inputs[0] = 0.8; EffVal val = effTool.Eff( inputs ); float v = val.val; float el = val.elo; float eh = val.ehi; std::cout << " x = 0.8, Eff = " << v << " + " << eh << " - " << el << std::endl; std::cout << "UseRawTool ends " << std::endl; } catch( const EffException & error) { std::cout << error._message << std::endl; } catch(...) { std::cout << " Some kind of exception was thrown!" << std::endl; } return 0; }