Commit c4677365 authored by Ryan Mackenzie White's avatar Ryan Mackenzie White Committed by Graeme Stewart
Browse files

PhotonContainer for EFCaloHypo (TrigEgammaHypo-01-00-53)

	* Move shower shape calculation to FEX
	* Create dummy photon container for EF Calo Hypo
	* TrigEgammaHypo-01-00-53

2014-10-19 Ryan White <ryan.white@cern.ch>
	* Add tools to EFCaloHypo to apply selection
	* EMFourMomBuilder, EMShowerBuilder, isEMSelector
	* Creates Photon object to apply calo-only selection
	* TrigEgammaHypo-01-00-52

2014-10-18 Ryan White <ryan.white@cern.ch>
	* Adding link to original cluster
	* TrigEgammaHypo-01-00-51

2014-10-18 Ryan White <ryan.white@cern.ch>
	* Fixing the copy of cluster
	* TrigEgammaHypo-01-00-50

2014-10-17 Ryan White <ryan.white@cern.ch>
	* Adding MVACalib tool
...
(Long ChangeLog diff - truncated)
parent bd8e5556
// -*- C++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**************************************************************************
**
** File: Trigger/TrigHypothesis/TrigEgammaHypo/TrigEFCaloCalibFex.h
**
** Description: Fex algo to apply MVA calibration to EF CaloClusters
**
** Authors: R. M. White <ryan.white@cern.ch>
**
** Created: October 2014
**
**************************************************************************/
#ifndef TRIG_TRIGEFCALOCALIBFEX_H
#define TRIG_TRIGEFCALOCALIBFEX_H
// standard stuff
#include <vector>
#include <cmath>
// general athena stuff
#include "GaudiKernel/IToolSvc.h"
// trigger includes
#include "TrigInterfaces/FexAlgo.h"
#include "xAODCaloEvent/CaloClusterContainer.h"
#include "CaloUtils/CaloCellDetPos.h"
//#include "egammaMVACalib/IegammaMVATool.h"
#include "egammaInterfaces/IEMShowerBuilder.h"
#include "egammaInterfaces/IEMFourMomBuilder.h"
class TrigCaloQuality;
class IegammaMVATool;
/**
* \class TrigEFCaloCalibFex
* \brief TrigEFCaloCalibFex is a Trigger Fex Algorithm that retrieves the EF xAODCaloCluster
* deep copies the clusters, applies MVA calibration and Et selection and attaches new container
*
*/
class TrigEFCaloCalibFex : public HLT::FexAlgo {
public:
TrigEFCaloCalibFex(const std::string & name, ISvcLocator* pSvcLocator);
~TrigEFCaloCalibFex();
HLT::ErrorCode hltInitialize();
HLT::ErrorCode hltFinalize();
HLT::ErrorCode hltExecute(const HLT::TriggerElement* inputTE,
HLT::TriggerElement* outputTE);
void fillPositionsInCalo(xAOD::CaloCluster* cluster);
std::string retrieveCellContName (const HLT::TriggerElement *inputTE );
TrigCaloQuality* pTrigCaloQuality;
private:
// to set Accept-All mode
bool m_acceptAll;
bool m_applyMVACalib;
std::string m_egType;
xAOD::CaloClusterContainer* m_pCaloClusterContainer; //!< pointer to CaloClusterContainer
xAOD::PhotonContainer* m_egContainer;
CaloCellDetPos *m_caloCellDetPos;
/** Handle to the MVA calibration Tool **/
ToolHandle<IegammaMVATool> m_MVACalibTool;
ToolHandle<IEMFourMomBuilder> m_fourMomBuilder;
ToolHandle<IEMShowerBuilder> m_showerBuilder;
};
#endif
......@@ -37,7 +37,9 @@
#include "GaudiKernel/IHistogramSvc.h"
#include "AIDA/IHistogram1D.h"
#include "egammaInterfaces/IegammaBaseTool.h"
#include "egammaInterfaces/IegammaShowerShape.h"
#include "ElectronPhotonSelectorTools/IAsgElectronIsEMSelector.h"
class StoreGateSvc;
class TriggerElement;
......@@ -67,7 +69,8 @@ class TrigEFCaloHypo : public HLT::HypoAlgo {
// define the properties:
//----------------------------
bool m_UseShowerShapeTool;
bool m_acceptAll;
// Cuts to be applied:
double m_EtCut;
......@@ -79,6 +82,9 @@ class TrigEFCaloHypo : public HLT::HypoAlgo {
// Switch on Monitoring:
ToolHandle<IegammaShowerShape> m_ShowerShapeTool;
std::string m_SelectorToolName;
ToolHandle<IAsgElectronIsEMSelector> m_SelectorTool;
bool m_doMonitoring;
......
......@@ -91,12 +91,6 @@ class TrigEFElectronHypo : public HLT::HypoAlgo {
bool m_caloCutsOnly;
// Cuts to be applied:
//AT Jan2010:
std::string m_egammaElectronCutIDToolName;
std::string m_athElectronLHIDSelectorToolName;
ToolHandle<IAsgElectronIsEMSelector> m_egammaElectronCutIDTool;
......@@ -106,6 +100,7 @@ class TrigEFElectronHypo : public HLT::HypoAlgo {
unsigned int m_IsEMrequiredBits; //!< isem flag bits required
bool m_applyIsEM; //!< true if isem flag required
double m_emEt; //!< ET cut
bool m_applyEtIsEM; // Use object Et for isEM selection
//Isolation
bool m_applyIsolation;
......@@ -137,7 +132,7 @@ class TrigEFElectronHypo : public HLT::HypoAlgo {
std::vector<double> m_a0;
// egamma container
const xAOD::ElectronContainer* m_EgammaContainer; //!< pointer to EgammaContainer
const xAOD::ElectronContainer* m_EgammaContainer; //!< pointer to ElectronContainer
// Timing:
......@@ -145,230 +140,11 @@ class TrigEFElectronHypo : public HLT::HypoAlgo {
TrigTimer* m_totalTimer;
TrigTimer* m_timerPIDTool;
/** The extrapolator tool */
//AT Jan 2010: ToolHandle<Trk::IExtrapolator> m_extrapolator; //Extrapolator tool
/** The Beam Service **/
//AT Jan 2010: IBeamCondSvc* m_iBeamCondSvc; //pointer to the beam condition service
Amg::Vector3D m_primaryVertex; //AT Jan 2010
/** @brief Tool handle for track extrapolation to vertex */
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool; //AT Jan 2010
void prepareMonitoringVars();
/**
* \brief implements histograms for monitoring
*/
////////////
// Calo and ShowerShape Monitoring accesible via xAOD::Egamma
static inline float getF1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::f1);
return val_float;
}
static inline float getF3 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::f3);
return val_float;
}
static inline double getE237 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::e237);
return val_float;
}
static inline double getE277 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::e277);
return val_float;
}
static inline double getEthad1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::ethad1);
return val_float;
}
static inline double getWeta1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::weta1);
return val_float;
}
static inline double getWeta2 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::weta2);
return val_float;
}
static inline double getWtots1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::wtots1);
return val_float;
}
static inline double getE2tsts1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::e2tsts1);
return val_float;
}
static inline double getEmins1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::emins1);
return val_float;
}
static inline double getfracs1 (const xAOD::Egamma* eg) {
float val_float=-99;
eg->showerShapeValue(val_float,xAOD::EgammaParameters::fracs1);
return val_float;
}
static inline double EtCluster(const xAOD::Egamma* eg){
if(eg && (eg->caloCluster())){
return eg->caloCluster()->et();
}
else return -99.;
}
static inline double EtCluster37(const xAOD::Egamma* eg){
if(eg && (eg->caloCluster())){
const xAOD::CaloCluster* cluster = eg->caloCluster();
double eta2 = fabs(cluster->etaBE(2));
return cluster->e()/cosh(eta2);
}
else return -99.;
}
static inline float getEratio(const xAOD::Egamma* eg) {
if(eg) {
// E of 2nd max between max and min in strips
float emax2 = -99;
eg->showerShapeValue(emax2,xAOD::EgammaParameters::e2tsts1);
// E of 1st max in strips
float emax = -99;
eg->showerShapeValue(emax2,xAOD::EgammaParameters::emaxs1);
// E(min) in strips
float _demaxs1 = fabs(emax+emax2)>0. ? (emax-emax2)/(emax+emax2) : 0.;
return _demaxs1;
}
else {return -99.;}
}
// Track releated Monitoring accesible via xAOD::Electron
static inline double getNbLayer (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfBLayerHits);
return val_uint8;
}
else return -99.;
}
static inline double getNPixel (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfPixelHits);
return val_uint8;
}
else return -99.;
}
static inline double getNSCT (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfSCTHits);
return val_uint8;
}
else return -99.;
}
static inline double getNTRT (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfTRTHits);
return val_uint8;
}
else return -99.;
}
static inline double getNTRThighTh (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfTRTHighThresholdHits);
return val_uint8;
}
else return -99.;
}
static inline double getNTRThighThOutliers (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfTRTHighThresholdOutliers);
return val_uint8;
}
else return -99.;
}
static inline double getNTRTOutliers (const xAOD::Electron* eg) {
uint8_t val_uint8=0;
if(eg && eg->trackParticle()) {
eg->trackParticleSummaryValue(val_uint8,xAOD::numberOfTRTOutliers);
return val_uint8;
}
else return -99.;
}
static inline double PtTrack (const xAOD::Electron* eg) {
if(eg && (eg->trackParticle()))
return eg->trackParticle()->pt();
else return -99.;
}
static inline double dEta (const xAOD::Electron* eg) {
float val_float = -99;
if(eg)
eg->trackCaloMatchValue(val_float,xAOD::EgammaParameters::deltaEta1);
return val_float;
}
static inline double dPhi (const xAOD::Electron* eg) {
float val_float = -99;
if(eg)
eg->trackCaloMatchValue(val_float,xAOD::EgammaParameters::deltaPhi2);
return val_float;
}
static inline double Eoverp(const xAOD::Electron* eg) {
if(eg && (eg->trackParticle()) && (eg->caloCluster())){
return eg->caloCluster()->et()/ eg->trackParticle()->pt();
}
else return -99.;
}
static inline double rTRT (const xAOD::Electron* eg) {
if(eg && eg->trackParticle()){
uint8_t trtHits = 0;
eg->trackParticleSummaryValue(trtHits,xAOD::numberOfTRTHits);
uint8_t trtHTHits = 0;
eg->trackParticleSummaryValue(trtHTHits,xAOD::numberOfTRTHighThresholdHits);
if(trtHits!=0) {
return ( (double)trtHTHits / (double)trtHits );
}
else return -99.;
}
else return -99.;
}
static inline double getEtconeIso(const xAOD::Egamma* eg){
if(eg && eg->caloCluster() ){
const xAOD::CaloCluster* cluster = eg->caloCluster();
float eta2 = fabs(cluster->etaBE(2));
float et_37 = cluster->e()/cosh(eta2);
float val_float = -99;
eg->isolationValue(val_float,xAOD::EgammaParameters::etcone20);
return et_37!=0. ? val_float/et_37 : -99.;
}
else return -99.;
}
static inline double getPtconeIso(const xAOD::Electron* eg){
if(eg && eg->trackParticle() ){
float val_float = -99;
eg->isolationValue(val_float,xAOD::EgammaParameters::ptcone20);
return val_float;
}
else return -99.;
}
};
#endif
......
......@@ -115,7 +115,7 @@ class TrigEFPhotonHypo : public HLT::HypoAlgo {
std::vector<unsigned int> m_IsEMRequiredBits;
std::vector<unsigned int> m_IsEMRequiredBitsAfterCut;
const xAOD::PhotonContainer* m_EgammaContainer; //!< pointer to EgammaContainer
const xAOD::PhotonContainer* m_EgammaContainer; //!< pointer to PhotonContainer
std::vector<IHistogram1D*> nCandHistVector;
......@@ -135,56 +135,6 @@ class TrigEFPhotonHypo : public HLT::HypoAlgo {
void prepareMonitoringVars();
/**
* \brief implements histograms for monitoring
*/
static inline double Et (const xAOD::Egamma* eg) {if(eg && (eg->caloCluster())) return eg->caloCluster()->et(); else return -99.;}
static inline double Eta (const xAOD::Egamma* eg) {if(eg && (eg->caloCluster())) return eg->eta(); else return -99.;}
static inline double Phi (const xAOD::Egamma* eg) {if(eg && (eg->caloCluster())) return eg->phi(); else return -99.;}
static inline double EtCluster37(const xAOD::Egamma* eg){
if(eg && (eg->caloCluster())){
const xAOD::CaloCluster* cluster = eg->caloCluster();
double eta2 = fabs(cluster->etaBE(2));
return cluster->e()/cosh(eta2);
}
else return -99.;
}
static inline float rE37E77 (const xAOD::Egamma* eg) {
float e277=-99;
float e237=-99;
eg->showerShapeValue(e237,xAOD::EgammaParameters::e237);
eg->showerShapeValue(e277,xAOD::EgammaParameters::e277);
float _rE37E77 = (e277 != 0.) ? ( e237 / e277 ) : -99. ;
return _rE37E77;
}
static inline float rE33E77 (const xAOD::Egamma* eg) {
float e277=-99;
float e233=-99;
eg->showerShapeValue(e233,xAOD::EgammaParameters::e233);
eg->showerShapeValue(e277,xAOD::EgammaParameters::e277);
float _rE33E77 = (e277 != 0.) ? ( e233 / e277 ) : -99. ;
return _rE33E77;
}
static inline float Eratio(const xAOD::Egamma* eg) {
if(eg) {
// E of 2nd max between max and min in strips
float emax2 = -99;
eg->showerShapeValue(emax2,xAOD::EgammaParameters::e2tsts1);
// E of 1st max in strips
float emax = -99;
eg->showerShapeValue(emax2,xAOD::EgammaParameters::emaxs1);
// E(min) in strips
float _demaxs1 = fabs(emax+emax2)>0. ? (emax-emax2)/(emax+emax2) : 0.;
return _demaxs1;
}
else {return -99.;}
}
//xAOD, what is in EDM
//TBD
/*static inline int monIsEM(const egamma* eg){
if(eg && eg->isem() ) {
......
......@@ -18,23 +18,31 @@ use TrigSteeringEvent TrigSteeringEvent-* Trigger/TrigEvent
use xAODEgamma xAODEgamma-* Event/xAOD
use PATCore PATCore-* PhysicsAnalysis/AnalysisCommon
use ElectronPhotonSelectorTools ElectronPhotonSelectorTools-* PhysicsAnalysis/ElectronPhotonID
use egammaInterfaces egammaInterfaces-* Reconstruction/egamma
# Tracking
use VxVertex VxVertex-* Tracking/TrkEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
# Calo
use xAODCaloEvent xAODCaloEvent-* Event/xAOD
use CaloUtils CaloUtils-* Calorimeter
private
apply_tag ROOTMathLibs
use egammaEvent egammaEvent-* Reconstruction/egamma
use TrigCaloRec TrigCaloRec-* Trigger/TrigAlgorithms
use CaloEvent CaloEvent-* Calorimeter
use CxxUtils CxxUtils-* Control
use egammaMVACalib egammaMVACalib-* Reconstruction/egamma
use ITrackToVertex ITrackToVertex-* Reconstruction/RecoTools
#use TrigInDetToolInterfaces TrigInDetToolInterfaces-* Trigger/TrigTools
use RecoToolInterfaces RecoToolInterfaces-* Reconstruction/RecoTools
use xAODEgammaCnv xAODEgammaCnv-* Event/xAOD
use TrigMissingEtEvent TrigMissingEtEvent-* Trigger/TrigEvent
use TrigNavigation TrigNavigation-* Trigger/TrigEvent
use TrigMissingEtEvent TrigMissingEtEvent-* Trigger/TrigEvent
use TrigNavigation TrigNavigation-* Trigger/TrigEvent
#need to import egammaPID
use AtlasROOT AtlasROOT-* External
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
""" Photon trigger slice signatures """
__author__ = 'Vu Anh Tuan, P. Urquijo'
__version__=""
__doc__="Implementation of Photon Slice single photon signatures"
from string import atoi
from AthenaCommon.Logging import logging
from TriggerJobOpts.TriggerFlags import TriggerFlags
from TriggerMenuPython.TriggerPythonConfig import *
from TriggerMenuPython.HltConfig import *
if TriggerFlags.doLVL2() or True:
if TriggerFlags.doCalo or True:
from TrigT2CaloEgamma.TrigT2CaloEgammaConfig import T2CaloEgamma_eGamma
theT2CaloEgamma_eGamma = T2CaloEgamma_eGamma()
from TrigEgammaHypo.TrigL2CaloHypoConfig import *
from TrigEgammaHypo.TrigL2PhotonFexConfig import *
from TrigEgammaHypo.TrigL2PhotonHypoConfig import *
from TrigDetCalib.TrigDetCalibConfig import *
theLArL2ROBListWriter = LArL2ROBListWriter()
if TriggerFlags.doEF() or True:
if TriggerFlags.doCalo or True:
from TrigCaloRec.TrigCaloRecConfig import TrigCaloCellMaker_eGamma, TrigCaloTowerMaker_eGamma, TrigCaloClusterMaker_slw
theTrigCaloCellMaker_eGamma = TrigCaloCellMaker_eGamma()
theTrigCaloTowerMaker_eGamma = TrigCaloTowerMaker_eGamma()
theTrigCaloClusterMaker_slw = TrigCaloClusterMaker_slw()
if TriggerFlags.doID or True:
from InDetTrigRecExample.EFInDetConfig import *
from TrigEgammaRec.TrigEgammaRecConfig import *
theTrigEgammaRec_PhotonConversions = TrigEgammaRec_PhotonConversions()
theTrigEgammaRec_NoIDEF_eGamma = TrigEgammaRec_NoIDEF_eGamma()
theTrigEFIDCombined_Photon = TrigEFIDCombined_Photon().getSequence()
from TrigEgammaHypo.TrigEFPhotonHypoConfig import *
##################
#
# L2 & EF Chain configuration
#
##################
# default class, no ID at EF level
#-----------------------------------
class L2EFChain_g(L2EFChainDef):
#-----------------------------------
class L2Config:
def __init__(self, suffix,
TrigL2CaloHypo_1=None, TrigL2PhotonFex_1=None, TrigL2PhotonHypo_1=None):
self.suffix = suffix
self.TrigL2CaloHypo_1 = TrigL2CaloHypo_1 or TrigL2CaloHypo('TrigL2CaloHypo_'+suffix)
self.TrigL2PhotonFex_1 = TrigL2PhotonFex_1 or TrigL2PhotonFex('TrigL2PhotonFex_' + suffix)
self.TrigL2PhotonHypo_1 = TrigL2PhotonHypo_1 or TrigL2PhotonHypo('TrigL2PhotonHypo_' + suffix)
pass
class EFConfig:
def __init__(self, suffix, TrigEFPhotonHypo_1=None):
self.suffix = suffix
self.TrigEFPhotonHypo_1 = TrigEFPhotonHypo_1 or TrigEFPhotonHypo('EFPhotonHypo_' + suffix)
pass
class Config:
def __init__(self, l2config, efconfig):
self.suffix = ''
self.L2Config = l2config
self.EFConfig = efconfig
pass
def __init__(self, sig_id,
l2_chain_name, l2_chain_counter, l2_lower_chain_name,
ef_chain_name, ef_chain_counter,
l2_inputTEs, config):
L2EFChainDef.__init__(self, sig_id,
l2_chain_name, l2_chain_counter, l2_lower_chain_name,
ef_chain_name, ef_chain_counter,
l2_inputTEs, config)
def defineSequences(self, config):
###### L2 ######
# Step 1: Calo Hypo
self.addL2Sequence(self.inputTEs,
[theT2CaloEgamma_eGamma, config.L2Config.TrigL2CaloHypo_1],
'L2_g_step1')
# Step 2: Photon Fex and Hypo
self.addL2Sequence('L2_g_step1',
[config.L2Config.TrigL2PhotonFex_1, config.L2Config.TrigL2PhotonHypo_1],
'L2_g_step2')
###### EF ######