Commit a2b4a92e authored by Joseph Reichert's avatar Joseph Reichert Committed by Graeme Stewart
Browse files

Implemented infrastructure for calo only LH; adjusted LH f3 removal threshold...

Implemented infrastructure for calo only LH; adjusted LH f3 removal threshold (ElectronPhotonSelectorTools-00-01-44)

	* Implemented necessary infrastructure for calo only LH,
	in AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool
	* Adjusted threshold for doRemoveF3AtHighEt in TElectronLikelihoodTool
	* Tagging as ElectronPhotonSelectorTools-00-01-44

2014-10-23 Fernando Monticelli <Fernando.Monticelli@cern.ch>
	* Adding a test configuration file versioned in dc14b_0/ for testing.
	It only works for loose
	* tagging ElectronPhotonSelectorTools-00-01-43

2014-10-23 Fernando Monticelli <Fernando.Monticelli@cern.ch>
	* Added config file read for AsgPhotonIsEMSelector
	* Renamed ConfigHelper code files to "ElectronPhoton"
	* A  +    Root/AsgElectronPhotonIsEMSelectorConfigHelper.cxx
	* A  +    ElectronPhotonSelectorTools/AsgElectronPhotonIsEMSelectorConfigHelper.h
	* Not tagging yet

2014-10-23 Christos Anastopoulos <Christos.Anastopoulos@cern.ch>

	* Coverity fixes
...
(Long ChangeLog diff - truncated)
parent 3f842830
......@@ -29,7 +29,7 @@
// Include the return object and the underlying ROOT tool
#include "PATCore/TAccept.h"
#include "ElectronPhotonSelectorTools/TElectronIsEMSelector.h"
#include <string>
class AsgElectronIsEMSelector : virtual public asg::AsgTool,
virtual public IAsgElectronIsEMSelector
......@@ -57,10 +57,21 @@ class AsgElectronIsEMSelector : virtual public asg::AsgTool,
/** The main accept method: the actual cuts are applied here */
const Root::TAccept& accept( const xAOD::Electron* part ) const;
/** The main accept method: the actual cuts are applied here */
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::Electron& part ) const {
return accept (&part);
}
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::IParticle& part ) const {
return accept (&part);
}
/** METHODS FOR THE TRIGGER **/
/*This method is for the trigger */
virtual const Root::TAccept& accept( const xAOD::Electron* part,
double trigEtTh,
bool CaloCutsOnly) const;
bool CaloCutsOnly=true) const;
/** This method is for the trigger, and implies CaloCutsOnly set to true */
virtual const Root::TAccept& accept( const xAOD::Egamma* part,
......@@ -102,9 +113,8 @@ private:
float eta2, double et, double energy,
unsigned int iflag) const;
// unsigned int ambiguitycuts_electrons(const xAOD::Electron* /* eg */,
// unsigned int iflag) const;
/** Config File */
std::string m_configFile;
/** Pointer to the underlying ROOT based tool */
Root::TElectronIsEMSelector* m_rootTool;
......
......@@ -23,7 +23,7 @@
#include "ElectronPhotonSelectorTools/TElectronLikelihoodTool.h"
#include "ElectronPhotonSelectorTools/IAsgElectronLikelihoodTool.h"
#include "xAODEgamma/Electron.h"
#include "xAODEgamma/ElectronFwd.h"
class AsgElectronLikelihoodTool : virtual public asg::AsgTool,
virtual public IAsgElectronLikelihoodTool
......@@ -37,8 +37,6 @@ public:
/** Standard destructor */
virtual ~AsgElectronLikelihoodTool();
public:
/** Gaudi Service Interface method implementations */
virtual StatusCode initialize();
......@@ -54,6 +52,25 @@ public:
/** The main accept method: the actual cuts are applied here */
const Root::TAccept& accept( const xAOD::Electron* eg ) const;
/** Accept method for EFCaloLH in the trigger; do full LH if !CaloCutsOnly **/
const Root::TAccept& accept( const xAOD::Egamma* eg,
bool CaloCutsOnly=true) const;
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::Electron& part ) const {
return accept (&part);
}
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::IParticle& part ) const {
return accept (&part);
}
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::Egamma& part,
bool CaloCutsOnly=true) const {
return accept (&part, CaloCutsOnly);
}
// Main methods for IAsgCalculatorTool interface
public:
......@@ -63,6 +80,9 @@ public:
/** The main result method: the actual likelihood is calculated here */
const Root::TResult& calculate( const xAOD::Electron* eg ) const;
/** Calculate method for EFCaloLH in the trigger; do full LH if !CaloCutsOnly **/
const Root::TResult& calculate( const xAOD::Egamma* eg,
bool CaloCutsOnly=true) const;
/** Method to get the plain TAccept */
inline virtual const Root::TAccept& getTAccept( ) const
......@@ -122,35 +142,6 @@ private:
// Inline methods
inline const Root::TAccept& AsgElectronLikelihoodTool::accept(const xAOD::IParticle* part) const
{
const xAOD::Electron* eg = dynamic_cast<const xAOD::Electron*>(part);
if (eg)
{
return accept(eg);
}
else
{
ATH_MSG_ERROR ( " Could not cast to const electron " );
return m_acceptDummy;
}
}
// Inline methods
inline const Root::TResult& AsgElectronLikelihoodTool::calculate(const xAOD::IParticle* part) const
{
const xAOD::Electron* eg = dynamic_cast<const xAOD::Electron*>(part);
if (eg)
{
return calculate(eg);
}
else
{
ATH_MSG_ERROR ( " Could not cast to const egamma " );
return m_resultDummy;
}
}
#endif
......
......@@ -20,7 +20,6 @@
// Atlas includes
#include "AsgTools/AsgTool.h"
#include "ElectronPhotonSelectorTools/IAsgElectronMultiLeptonSelector.h"
// Include the return object and ROOT tool
......@@ -57,6 +56,16 @@ public:
/** The main accept method: the actual cuts are applied here */
const Root::TAccept& accept( const xAOD::Electron* eg ) const;
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::Electron& part ) const {
return accept (&part);
}
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::IParticle& part ) const {
return accept (&part);
}
/** Method to get the plain TAccept */
inline virtual const Root::TAccept& getTAccept( ) const
{
......@@ -76,20 +85,7 @@ private:
// Inline methods
inline const Root::TAccept& AsgElectronMultiLeptonSelector::accept(const xAOD::IParticle* part) const
{
const xAOD::Electron* eg = dynamic_cast<const xAOD::Electron*>(part);
if (eg)
{
return accept(eg);
}
else
{
ATH_MSG_ERROR ( " Could not cast to const egamma " );
return m_acceptDummy;
}
}
#endif
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Dear emacs, this is -*-c++-*-
#ifndef __ASGELECTRONISEMSELECTRONCONFIGHELPER__
#define __ASGELECTRONISEMSELECTRONCONFIGHELPER__
/**
@brief Tool to simplify the configuration of the cut based IsEM based on TEnv input
@author Christos Anastopoulos
*/
#include <string>
#include <vector>
#include "TEnv.h"
namespace AsgConfigHelper{
std::vector<float> HelperFloat(const std::string& input, TEnv& env);
std::vector<int> HelperInt(const std::string& input, TEnv& env);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef _ASGFUDGEMCTOOL_H
#define _ASGFUDGEMCTOOL_H
/**
@class AsgFudgeMCTool
@brief Tool to fudge photon MC shower shapes.
@author Rob Roy Fletcher (University of Pennsylvania) rob.fletcher@cern.ch
@date August 2014
*/
// Framework include(s):
#include "AsgTools/AsgTool.h"
#include "ElectronPhotonSelectorTools/FudgeMCTool.h"
#include "ElectronPhotonSelectorTools/IAsgFudgeMCTool.h"
#include "xAODEgamma/Photon.h"
class AsgFudgeMCTool : virtual public asg::AsgTool, virtual public IAsgFudgeMCTool
{
/// Declare the interface that the class provides
ASG_TOOL_CLASS(AsgFudgeMCTool, IAsgFudgeMCTool)
public:
/** Standard constructor */
AsgFudgeMCTool( const std::string myname);
/** Standard destructor */
virtual ~AsgFudgeMCTool();
public:
/** Gaudi Service Interface method implementations */
virtual StatusCode initialize();
/** Gaudi Service Interface method implementations */
virtual StatusCode finalize();
public:
/// Apply the correction on a modifyable object
const CP::CorrectionCode applyCorrection( xAOD::Photon* gamma, int isConv, int preselection ) const;
//
const CP::CorrectionCode applyCorrection( xAOD::IParticle* part, int isConv, int preselection ) const;
//
/// Create a corrected copy from a constant muon
// virtual CP::CorrectionCode correctedCopy( const xAOD::Photon* input,
// xAOD::Photon* output ) = 0;
private:
FudgeMCTool* m_rootTool;
}; // class AsgFudgeMCTool
// Inline methods
inline const CP::CorrectionCode AsgFudgeMCTool::applyCorrection( xAOD::IParticle* part, int isConv, int preselection) const
{
xAOD::Photon* gamma = dynamic_cast<xAOD::Photon*>(part);
if (gamma)
{
return applyCorrection(gamma, isConv, preselection);
}
else
{
ATH_MSG_ERROR ( " Could not cast to photon" );
return CP::CorrectionCode::Error;
}
}
#endif // _IFUDGEMCTOOL_H
......@@ -25,6 +25,7 @@
// Include the interfaces
#include "ElectronPhotonSelectorTools/IAsgPhotonIsEMSelector.h"
#include "xAODEgamma/PhotonFwd.h"
#include "xAODTracking/VertexFwd.h"
// Include the return object and the underlying ROOT tool
......@@ -55,6 +56,11 @@ class AsgPhotonIsEMSelector : virtual public asg::AsgTool,
/** The main accept method: the actual cuts are applied here */
const Root::TAccept& accept( const xAOD::Photon* part ) const;
/** Accept using reference **/
virtual const Root::TAccept& accept( const xAOD::Photon& part ) const {
return accept (&part);
}
unsigned int IsemValue() const {return m_rootTool->isEM(); };
// what isEM should be filled
......@@ -77,6 +83,9 @@ private:
double getConversion1OverP(const xAOD::Vertex*) const;
/** Config File */
std::string m_configFile;
/** Pointer to the underlying ROOT based tool */
Root::TPhotonIsEMSelector* m_rootTool;
......
......@@ -16,17 +16,12 @@
*/
#include "ElectronPhotonSelectorTools/egammaPIDdefs.h"
//#include "ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h"
//#include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h"
//#include "ElectronPhotonSelectorTools/AsgElectronMultiLeptonSelector.h"
//#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h"
//#include "ElectronPhotonSelectorTools/AsgElectronIsEMSelectorConfigHelper.h"
#include "ElectronPhotonSelectorTools/TElectronLikelihoodTool.h" //For the LikelihoodEnums
// #include "ElectronPhotonSelectorTools/TElectronIsEMSelector.h"
// #include "ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h"
// #include "ElectronPhotonSelectorTools/TPhotonIsEMSelector.h"
// #include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h"
// #include "ElectronPhotonSelectorTools/TElectronMultiLeptonSelector.h"
// #include "ElectronPhotonSelectorTools/AsgElectronMultiLeptonSelector.h"
#include "ElectronPhotonSelectorTools/TElectronLikelihoodTool.h"
// //#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h"
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FudgeMCTool_h
#define FudgeMCTool_h
/* @author Martin Tripiana <Martin.Tripiana@cern.ch> - IFLP(UNLP-CONICET)
*
* FudgeMCTool provides a collection of fudge factors for different
* preselections and performs the fudge of shower variables for
* any of these sets.
*
* For further details please check README file or go to
* https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhotonFudgeFactors
*
*/
#include <iostream>
#include <stdio.h>
#include <cmath>
using std::abs;
#include "PtEtaCollection.h"
#include "TH1F.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TGraphErrors.h"
//static int m_dummy;
namespace IDVAR
{
const int RHAD1 = 0;
const int RHAD = 1;
const int E277 = 2;
const int RETA = 3;
const int RPHI = 4;
const int WETA2 = 5;
const int F1 = 6;
const int FSIDE = 7;
const int WTOT = 8;
const int W1 = 9;
const int DE = 10;
const int ERATIO = 11;
}
class FudgeMCTool
{
public:
// initialize with pt and eta2 of candidate to be fudged/of FF to be required.
FudgeMCTool( double pt = -999.,
double eta2 = -999.,
int isConv = -1 ,
int preselection = -1 );
~FudgeMCTool();
//fudge shower shapes for preselection chosen.
void FudgeShowers( double pt ,
double eta2 ,
double& rhad1 ,
double& rhad ,
double& e277 ,
double& reta ,
double& rphi ,
double& weta2 ,
double& f1 ,
double& fside ,
double& wtot ,
double& w1 ,
double& deltae ,
double& eratio ,
int isConv ,
int preselection=-999);
//fudge shower shapes for preselection chosen.
void FudgeShowers( float pt ,
float eta2 ,
float& rhad1 ,
float& rhad ,
float& e277 ,
float& reta ,
float& rphi ,
float& weta2 ,
float& f1 ,
float& fside ,
float& wtot ,
float& w1 ,
float& deltae ,
float& eratio ,
int isConv ,
int preselection=-999);
// fudge showers using D3PD vectors (except for eratio)
void FudgeShowers( std::vector<float> clE,
std::vector<float> eta2 ,
std::vector<float>& rhad1 ,
std::vector<float>& rhad ,
std::vector<float>& e277 ,
std::vector<float>& reta ,
std::vector<float>& rphi ,
std::vector<float>& weta2 ,
std::vector<float>& f1 ,
std::vector<float>& fside ,
std::vector<float>& wtot ,
std::vector<float>& w1 ,
std::vector<float>& deltae ,
std::vector<float>& eratio ,
std::vector<int> isConv ,
int preselection=-999);
/** Calculate Eratio (the only variable which is not stored in the egamma/PhotonD3PD)
* given emaxs1 and Emax2. Return a pointer to a vector<float>
**/
static std::vector<float>* getEratio(std::vector<float> emaxs1, std::vector<float> Emax2)
{
std::vector<float> *eratio = new std::vector<float>();
for (unsigned int i = 0; i < emaxs1.size(); ++i)
eratio->push_back(emaxs1[i] + Emax2[i] == 0 ? 0 :
(emaxs1[i] - Emax2[i])/(emaxs1[i] + Emax2[i]));
return eratio;
}
// get fudge factor for predefined preselection
double GetFF_Rhad1 ( double pt, double eta2 ){ return m_rhad1_ff.Get(pt, fabs(eta2)); };
double GetFF_Rhad ( double pt, double eta2 ){ return m_rhad_ff.Get(pt, fabs(eta2)); };
double GetFF_E277 ( double pt, double eta2 ){ return m_e277_ff.Get(pt, fabs(eta2)); };
double GetFF_Reta ( double pt, double eta2 ){ return m_reta_ff.Get(pt, fabs(eta2)); };
double GetFF_Rphi ( double pt, double eta2 ){ return m_rphi_ff.Get(pt, fabs(eta2)); };
double GetFF_Weta2 ( double pt, double eta2 ){ return m_weta2_ff.Get(pt, fabs(eta2)); };
double GetFF_F1 ( double pt, double eta2 ){ return m_f1_ff.Get(pt, fabs(eta2)); };
double GetFF_DE ( double pt, double eta2 ){ return m_deltae_ff.Get(pt, fabs(eta2)); };
double GetFF_Eratio( double pt, double eta2 ){ return m_eratio_ff.Get(pt, fabs(eta2)); };
double GetFF_Fside ( double pt, double eta2 ){ return m_fside_ff.Get(pt, fabs(eta2)); };
double GetFF_Wtot ( double pt, double eta2 ){ return m_wtot_ff.Get(pt, fabs(eta2)); };
double GetFF_W1 ( double pt, double eta2 ){ return m_w1_ff.Get(pt, fabs(eta2)); };
double GetFF_Rhad1 ( double pt, double eta2, int conv, int preselection );
double GetFF_Rhad ( double pt, double eta2, int conv, int preselection );
double GetFF_E277 ( double pt, double eta2, int conv, int preselection );
double GetFF_Reta ( double pt, double eta2, int conv, int preselection );
double GetFF_Rphi ( double pt, double eta2, int conv, int preselection );
double GetFF_Weta2 ( double pt, double eta2, int conv, int preselection );
double GetFF_F1 ( double pt, double eta2, int conv, int preselection );
double GetFF_DE ( double pt, double eta2, int conv, int preselection );
double GetFF_Eratio( double pt, double eta2, int conv, int preselection );
double GetFF_Fside ( double pt, double eta2, int conv, int preselection );
double GetFF_Wtot ( double pt, double eta2, int conv, int preselection );
double GetFF_W1 ( double pt, double eta2, int conv, int preselection );
double GetFF_Rhad1 ();
double GetFF_Rhad ();
double GetFF_E277 ();
double GetFF_Reta ();
double GetFF_Rphi ();
double GetFF_Weta2 ();
double GetFF_F1 ();
double GetFF_DE ();
double GetFF_Eratio();
double GetFF_Fside ();
double GetFF_Wtot ();
double GetFF_W1 ();
double GetFFerr_Rhad1 ( double pt, double eta2 ){ return m_rhad1_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Rhad ( double pt, double eta2 ){ return m_rhad_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_E277 ( double pt, double eta2 ){ return m_e277_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Reta ( double pt, double eta2 ){ return m_reta_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Rphi ( double pt, double eta2 ){ return m_rphi_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Weta2 ( double pt, double eta2 ){ return m_weta2_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_F1 ( double pt, double eta2 ){ return m_f1_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_DE ( double pt, double eta2 ){ return m_deltae_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Eratio( double pt, double eta2 ){ return m_eratio_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Fside ( double pt, double eta2 ){ return m_fside_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Wtot ( double pt, double eta2 ){ return m_wtot_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_W1 ( double pt, double eta2 ){ return m_w1_fferr.Get(pt, fabs(eta2)); };
double GetFFerr_Rhad1 ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Rhad ( double pt, double eta2, int conv, int preselection );
double GetFFerr_E277 ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Reta ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Rphi ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Weta2 ( double pt, double eta2, int conv, int preselection );
double GetFFerr_F1 ( double pt, double eta2, int conv, int preselection );
double GetFFerr_DE ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Eratio( double pt, double eta2, int conv, int preselection );
double GetFFerr_Fside ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Wtot ( double pt, double eta2, int conv, int preselection );
double GetFFerr_W1 ( double pt, double eta2, int conv, int preselection );
double GetFFerr_Rhad1 ();
double GetFFerr_Rhad ();
double GetFFerr_E277 ();
double GetFFerr_Reta ();
double GetFFerr_Rphi ();
double GetFFerr_Weta2 ();
double GetFFerr_F1 ();
double GetFFerr_DE ();
double GetFFerr_Eratio();
double GetFFerr_Fside ();
double GetFFerr_Wtot ();
double GetFFerr_W1 ();