Commit c51152b7 authored by Ligang Xia's avatar Ligang Xia
Browse files

add client for e->y

parent 045281cc
......@@ -3,32 +3,32 @@
*/
/**
* @file LeptonFakeFactorTools/ApplyE2YFakRate.h
* @file LeptonFakeFactorTools/ApplyE2YFakeRate.h
* @authors Joseph Reichert <Joseph.Reichert@cern.ch>
* @date August 2016
* @brief Tool to read fake factor histograms and return
* the binned fake factor value
**/
#ifndef ApplyE2YFakRate_H
#define ApplyE2YFakRate_H
#ifndef ApplyE2YFakeRate_H
#define ApplyE2YFakeRate_H
#include <FakeBkgTools/BaseLinearFakeBkgTool.h>
namespace CP
{
class ApplyE2YFakRate : public CP::BaseLinearFakeBkgTool
class ApplyE2YFakeRate : public CP::BaseLinearFakeBkgTool
{
ASG_TOOL_CLASS2(ApplyE2YFakRate, ILinearFakeBkgTool, IFakeBkgTool)
ASG_TOOL_CLASS2(ApplyE2YFakeRate, ILinearFakeBkgTool, IFakeBkgTool)
public:
/// Standard constructor
ApplyE2YFakRate(const std::string& name);
ApplyE2YFakeRate(const std::string& name);
/// Standard destructor
~ApplyE2YFakRate();
~ApplyE2YFakeRate();
// Main methods
public:
......
......@@ -140,7 +140,7 @@ private:
enum class Client
{
NONE, MATRIX_METHOD, FAKE_FACTOR, ALL_METHODS
NONE, MATRIX_METHOD, FAKE_FACTOR, E2Y_FAKE, ALL_METHODS
};
inline Uncertainty& Uncertainty::operator+=(const Uncertainty& rhs)
......
......@@ -28,7 +28,7 @@ ApplyE2YFakeRate::~ApplyE2YFakeRate()
FakeBkgTools::Client ApplyE2YFakeRate::clientForDB()
{
return FakeBkgTools::Client::FAKE_FACTOR;
return FakeBkgTools::Client::E2Y_FAKE;
}
StatusCode ApplyE2YFakeRate::initialize()
......@@ -62,8 +62,8 @@ StatusCode ApplyE2YFakeRate::getEventWeightCustom(
// FIXME when we load in the FFs, need to allow for e.g. pT, eta binning and arbitrary parameterizations
float fake_rate = particle.fake_efficiency.nominal;
float fake_rate_sf = particle.fake_efficiency_sf.nominal;
ATH_MSG_INFO("e2y fake rate is " << fake_rate);
ATH_MSG_INFO("e2y fake rate SF is " << fake_rate_sf);
//ATH_MSG_INFO("e2y fake rate is " << fake_rate);
//ATH_MSG_INFO("e2y fake rate SF is " << fake_rate_sf);
if(m_e2y_option == 1)
outputEventWeight.nominal *= fake_rate ;
else
......
......@@ -69,7 +69,9 @@ bool Database::fillEfficiencies(ParticleData& pd, const xAOD::IParticle& p, cons
{
EfficiencyType wantedType = static_cast<EfficiencyType>(wt);
if(!m_typesToFill[wantedType]) continue;
//ATH_MSG_INFO("eff 0");
Efficiency* eff = selectEfficiency(pd, p, wantedType); /// pointer to the proper member of ParticleData that needs to be filled
//ATH_MSG_INFO("eff 1");
if(!eff) continue;
/// The efficiency tables to look for might be for a different type (if a Fake efficiency <--> Fake factor conversion is needed)
......@@ -1046,6 +1048,7 @@ Efficiency* Database::selectEfficiency(ParticleData& pd, const xAOD::IParticle&
if(type==ELECTRON_FAKE_FACTOR) return &pd.fake_factor;
else if(type==ELECTRON_FAKE_EFFICIENCY) return &pd.fake_efficiency;
else if(type==ELECTRON_REAL_EFFICIENCY) return &pd.real_efficiency;
else if(type==PHOTON_electronFAKE_EFFICIENCY) return &pd.fake_efficiency;
break;
case xAOD::Type::Muon:
if(type==MUON_FAKE_FACTOR) return &pd.fake_factor;
......@@ -1058,8 +1061,7 @@ Efficiency* Database::selectEfficiency(ParticleData& pd, const xAOD::IParticle&
else if(type==TAU_REAL_EFFICIENCY) return &pd.real_efficiency;
break;
case xAOD::Type::Photon:
if(type==PHOTON_electronFAKE_EFFICIENCY) return &pd.fake_efficiency;
else if(type==PHOTON_electronFAKE_EFFICIENCY_SF) return &pd.fake_efficiency_sf;
if(type==PHOTON_electronFAKE_EFFICIENCY_SF) return &pd.fake_efficiency_sf;
break;
default:;
}
......@@ -1078,8 +1080,6 @@ auto Database::selectTypesToFill(Client client) -> std::bitset<N_EFFICIENCY_TYPE
result[ELECTRON_FAKE_EFFICIENCY] = true;
result[MUON_FAKE_EFFICIENCY] = true;
result[TAU_FAKE_EFFICIENCY] = true;
result[PHOTON_electronFAKE_EFFICIENCY] = true;
result[PHOTON_electronFAKE_EFFICIENCY_SF] = true;
}
if(client==Client::FAKE_FACTOR || client==Client::ALL_METHODS)
{
......@@ -1087,6 +1087,11 @@ auto Database::selectTypesToFill(Client client) -> std::bitset<N_EFFICIENCY_TYPE
result[MUON_FAKE_FACTOR] = true;
result[TAU_FAKE_FACTOR] = true;
}
if(client==Client::E2Y_FAKE || client==Client::ALL_METHODS)
{
result[PHOTON_electronFAKE_EFFICIENCY] = true;
result[PHOTON_electronFAKE_EFFICIENCY_SF] = true;
}
if(result.none()) throw(GenericError() << "unrecognized client type, implementation incomplete");
return result;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment