Commit f15e15cd authored by Teng Jian Khoo's avatar Teng Jian Khoo Committed by Graeme Stewart
Browse files

'summation over layer energies for emFrac and hecFrac' (JetMomentTools-00-03-45)

	* Fix for JetCaloEnergies
	* JetMomentTools-00-03-45

2016-09-14  TJ Khoo
	* JetCaloEnergies updated to recompute the PF layer energies from scratch
	* Needed in case of rebuilding PF jets from stored PFOs

2016-08-31  scott snyder  <snyder@bnl.gov>

        * Tagging JetMomentTools-00-03-44.
	* cmt/requirements: Small cleanup: no .txt files in the package.
        * Tagging JetMomentTools-00-03-43.
	* endreq -> endmsg.

2016-08-29    <delsart@lpsc1120x.in2p3.fr>

	* Root/LinkDef.h: adding JetCaloEnergies to the dictionnary.
        * Tagging JetMomentTools-00-03-42

2016-08-18 Johannes Elmsheuser <Johannes.Elmsheuser@cern.ch>
...
(Long ChangeLog diff - truncated)
parent 96c20396
# $Id: CMakeLists.txt 757525 2016-06-24 15:23:55Z krasznaa $
# $Id: CMakeLists.txt 771040 2016-08-31 13:46:25Z ssnyder $
################################################################################
# Package: JetMomentTools
################################################################################
......@@ -35,6 +35,16 @@ find_package( Boost )
find_package( ROOT COMPONENTS Core Hist )
# Component(s) in the package:
atlas_add_library( JetMomentToolsLib
JetMomentTools/*.h src/*.h src/*.cxx Root/*.cxx src/components/*.cxx
PUBLIC_HEADERS JetMomentTools
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} CaloDetDescrLib
CaloEvent CaloIdentifier AsgTools AthenaKernel xAODCaloEvent xAODJet
xAODMissingET xAODTracking GaudiKernel JetEDM JetInterface JetRecLib
JetUtils CaloGeoHelpers xAODEventInfo xAODPFlow PathResolver JetRecCaloLib )
atlas_add_component( JetMomentTools
JetMomentTools/*.h src/*.h src/*.cxx Root/*.cxx src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
......@@ -43,6 +53,17 @@ atlas_add_component( JetMomentTools
xAODMissingET xAODTracking GaudiKernel JetEDM JetInterface JetRecLib
JetUtils CaloGeoHelpers xAODEventInfo xAODPFlow PathResolver JetRecCaloLib )
atlas_add_dictionary( JetMomentToolsDict
JetMomentTools/JetMomentToolsDict.h
JetMomentTools/selection.xml
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES}
CaloDetDescrLib CaloEvent CaloIdentifier AsgTools
AthenaKernel xAODCaloEvent xAODJet xAODMissingET
xAODTracking GaudiKernel JetEDM JetInterface JetRecLib
JetUtils CaloGeoHelpers xAODEventInfo xAODPFlow
PathResolver JetRecCaloLib JetMomentToolsLib )
# Install files from the package:
atlas_install_headers( JetMomentTools )
atlas_install_python_modules( python/*.py )
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef JETMOMENTTOOLS_JETMOMENTTOOLSDICT_H
#define JETMOMENTTOOLS_JETMOMENTTOOLSDICT_H
#include "JetMomentTools/JetCaloQualityTool.h"
#include "JetMomentTools/JetClusterMomentsTool.h"
#include "JetMomentTools/JetConstitFourMomTool.h"
#include "JetMomentTools/JetECPSFractionTool.h"
#include "JetMomentTools/JetForwardJvtTool.h"
#include "JetMomentTools/JetLArHVTool.h"
#include "JetMomentTools/JetMuonSegmentMomentsTool.h"
#include "JetMomentTools/JetOriginCorrectionTool.h"
#include "JetMomentTools/JetPtAssociationTool.h"
#include "JetMomentTools/JetTrackMomentsTool.h"
#include "JetMomentTools/JetTrackSumMomentsTool.h"
#include "JetMomentTools/JetVertexFractionTool.h"
#include "JetMomentTools/JetVertexTaggerTool.h"
#include "JetMomentTools/JetWidthTool.h"
#endif
<lcgdict>
<class name="JetCaloQualityTool"/>
<class name="JetClusterMomentsTool"/>
<class name="JetConstitFourMomTool"/>
<class name="JetECPSFractionTool"/>
<class name="JetForwardJvtTool"/>
<class name="JetLArHVTool"/>
<class name="JetMuonSegmentMomentsTool"/>
<class name="JetOriginCorrectionTool"/>
<class name="JetPtAssociationTool"/>
<class name="JetTrackMomentsTool"/>
<class name="JetTrackSumMomentsTool"/>
<class name="JetVertexFractionTool"/>
<class name="JetVertexTaggerTool"/>
<class name="JetWidthTool"/>
</lcgdict>
......@@ -56,7 +56,11 @@ void JetCaloEnergies::fillEperSamplingCluster(xAOD::Jet& jet, std::vector<float>
// loop over raw constituents
size_t numConstit = jet.numConstituents();
for ( size_t i=0; i<numConstit; i++ ) {
const xAOD::CaloCluster* constit = dynamic_cast<const xAOD::CaloCluster*>(jet.rawConstituent(i));
if(jet.rawConstituent(i)->type()!=xAOD::Type::CaloCluster) {
ATH_MSG_WARNING("Tried to call fillEperSamplingCluster with a jet constituent that is not a cluster!");
continue;
}
const xAOD::CaloCluster* constit = static_cast<const xAOD::CaloCluster*>(jet.rawConstituent(i));
for ( size_t s= CaloSampling::PreSamplerB; s< CaloSampling::Unknown; s++ ) {
ePerSampling[s] += constit->eSample( (xAOD::CaloCluster::CaloSample) s );
}
......@@ -66,10 +70,16 @@ void JetCaloEnergies::fillEperSamplingCluster(xAOD::Jet& jet, std::vector<float>
static xAOD::JetAttributeAccessor::AccessorWrapper<float>& hecFracAcc =
*xAOD::JetAttributeAccessor::accessor< float >(xAOD::JetAttribute::HECFrac);
emFracAcc(jet) = jet::JetCaloQualityUtils::emFraction( ePerSampling);
hecFracAcc(jet) = jet::JetCaloQualityUtils::hecF( &jet );
emFracAcc(jet) = jet::JetCaloQualityUtils::emFraction( ePerSampling );
hecFracAcc(jet) = jet::JetCaloQualityUtils::hecF( &jet );
}
#define FillESamplingPFO( LAYERNAME ) \
float E_##LAYERNAME = 0.0; \
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_##LAYERNAME, E_##LAYERNAME)) { \
ePerSampling[CaloSampling::LAYERNAME] += E_##LAYERNAME; \
}
void JetCaloEnergies::fillEperSamplingPFO(xAOD::Jet & jet, std::vector<float> & ePerSampling ) const {
float emTot=0;
......@@ -78,104 +88,56 @@ void JetCaloEnergies::fillEperSamplingPFO(xAOD::Jet & jet, std::vector<float> &
size_t numConstit = jet.numConstituents();
for ( size_t i=0; i<numConstit; i++ ) {
const xAOD::PFO* constit = dynamic_cast<const xAOD::PFO*>(jet.rawConstituent(i));
if (constit){
if (jet.rawConstituent(i)->type()==xAOD::Type::ParticleFlow){
const xAOD::PFO* constit = static_cast<const xAOD::PFO*>(jet.rawConstituent(i));
eTot += constit->eEM();
if (0 == constit->charge()){
float E_PreSamplerB = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_PreSamplerB, E_PreSamplerB)) ePerSampling[CaloSampling::PreSamplerB] += E_PreSamplerB;
float E_EMB1 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EMB1, E_EMB1)) ePerSampling[CaloSampling::EMB1] += E_EMB1;
float E_EMB2 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EMB2, E_EMB2)) ePerSampling[CaloSampling::EMB2] += E_EMB2;
float E_EMB3 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EMB3, E_EMB3)) ePerSampling[CaloSampling::EMB3] += E_EMB3;
float E_PreSamplerE = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_PreSamplerE, E_PreSamplerE)) ePerSampling[CaloSampling::PreSamplerE] += E_PreSamplerE;
float E_EME1 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EME1, E_EME1)) ePerSampling[CaloSampling::EME1] += E_EME1;
float E_EME2 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EME2, E_EME2)) ePerSampling[CaloSampling::EME2] += E_EME2;
float E_EME3 = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EME3, E_EME3)) ePerSampling[CaloSampling::EME3] += E_EME3;
float E_HEC0= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_HEC0, E_HEC0)) ePerSampling[CaloSampling::HEC0] += E_HEC0;
float E_HEC1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_HEC1, E_HEC1)) ePerSampling[CaloSampling::HEC1] += E_HEC1;
float E_HEC2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_HEC2, E_HEC2)) ePerSampling[CaloSampling::HEC2] += E_HEC2;
float E_HEC3= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_HEC3, E_HEC3)) ePerSampling[CaloSampling::HEC3] += E_HEC3;
float E_TileBar0= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileBar0, E_TileBar0)) ePerSampling[CaloSampling::TileBar0] += E_TileBar0;
float E_TileBar1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileBar1, E_TileBar1)) ePerSampling[CaloSampling::TileBar1] += E_TileBar1;
float E_TileBar2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileBar2, E_TileBar2)) ePerSampling[CaloSampling::TileBar2] += E_TileBar2;
float E_TileGap1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileGap1, E_TileGap1)) ePerSampling[CaloSampling::TileGap1] += E_TileGap1;
float E_TileGap2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileGap2, E_TileGap2)) ePerSampling[CaloSampling::TileGap2] += E_TileGap2;
float E_TileGap3= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileGap3, E_TileGap3)) ePerSampling[CaloSampling::TileGap3] += E_TileGap3;
float E_TileExt0= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileExt0, E_TileExt0)) ePerSampling[CaloSampling::TileExt0] += E_TileExt0;
float E_TileExt1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileExt1, E_TileExt1)) ePerSampling[CaloSampling::TileExt1] += E_TileExt1;
float E_TileExt2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_TileExt2, E_TileExt2)) ePerSampling[CaloSampling::TileExt2] += E_TileExt2;
float E_FCAL0= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_FCAL0, E_FCAL0)) ePerSampling[CaloSampling::FCAL0] += E_FCAL0;
float E_FCAL1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_FCAL1, E_FCAL1)) ePerSampling[CaloSampling::FCAL1] += E_FCAL1;
float E_FCAL2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_FCAL2, E_FCAL2)) ePerSampling[CaloSampling::FCAL2] += E_FCAL2;
float E_MINIFCAL0= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_MINIFCAL0, E_MINIFCAL0)) ePerSampling[CaloSampling::MINIFCAL0] += E_MINIFCAL0;
float E_MINIFCAL1= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_MINIFCAL1, E_MINIFCAL1)) ePerSampling[CaloSampling::MINIFCAL1] += E_MINIFCAL1;
float E_MINIFCAL2= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_MINIFCAL2, E_MINIFCAL2)) ePerSampling[CaloSampling::MINIFCAL2] += E_MINIFCAL2;
float E_MINIFCAL3= 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_MINIFCAL3, E_MINIFCAL3)) ePerSampling[CaloSampling::MINIFCAL3] += E_MINIFCAL3;
//We calculate emTot and hecTot from these stored values, because above layer energies are NOT stored in the xAOD/ESD.
float E_EM = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_EM,E_EM)) emTot += E_EM;
FillESamplingPFO(PreSamplerB);
FillESamplingPFO(EMB1);
FillESamplingPFO(EMB2);
FillESamplingPFO(EMB3);
FillESamplingPFO(PreSamplerE);
FillESamplingPFO(EME1);
FillESamplingPFO(EME2);
FillESamplingPFO(EME3);
FillESamplingPFO(HEC0);
FillESamplingPFO(HEC1);
FillESamplingPFO(HEC2);
FillESamplingPFO(HEC3);
FillESamplingPFO(TileBar0);
FillESamplingPFO(TileBar1);
FillESamplingPFO(TileBar2);
FillESamplingPFO(TileGap1);
FillESamplingPFO(TileGap2);
FillESamplingPFO(TileGap3);
FillESamplingPFO(TileExt0);
FillESamplingPFO(TileExt1);
FillESamplingPFO(TileExt2);
FillESamplingPFO(FCAL0);
FillESamplingPFO(FCAL1);
FillESamplingPFO(FCAL2);
FillESamplingPFO(MINIFCAL0);
FillESamplingPFO(MINIFCAL1);
FillESamplingPFO(MINIFCAL2);
FillESamplingPFO(MINIFCAL3);
emTot += ( E_PreSamplerB+E_EMB1+E_EMB2+E_EMB3+
E_PreSamplerE+E_EME1+E_EME2+E_EME3+
E_FCAL0 );
hecTot += ( E_HEC0+E_HEC1+E_HEC2+E_HEC3 );
float E_HEC = 0.0;
if (constit->attribute<float>(xAOD::PFODetails::eflowRec_LAYERENERGY_HEC,E_HEC)) hecTot += E_HEC;
}//only consider neutral PFO
}//if dynamic cast worked
}//only consider neutral PFO
} else {
ATH_MSG_WARNING("Tried to call fillEperSamplingPFlow with a jet constituent that is not a PFO!");
}
}
static xAOD::JetAttributeAccessor::AccessorWrapper<float>& emFracAcc = *xAOD::JetAttributeAccessor::accessor< float >(xAOD::JetAttribute::EMFrac);
......
......@@ -28,7 +28,7 @@ JetCaloQualityTool::JetCaloQualityTool(const std::string& name)
int JetCaloQualityTool::modifyJet( xAOD::Jet& jet ) const
{
if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Inside process() method" << endreq;
if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Inside process() method" << endmsg;
if(m_doFracSamplingMax==true)
{
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "JetMomentTools/JetClusterMomentsTool.h"
#include "JetMomentTools/JetConstitFourMomTool.h"
#include "JetMomentTools/JetECPSFractionTool.h"
#include "JetMomentTools/JetForwardJvtTool.h"
#include "JetMomentTools/JetLArHVTool.h"
#include "JetMomentTools/JetMuonSegmentMomentsTool.h"
#include "JetMomentTools/JetOriginCorrectionTool.h"
#include "JetMomentTools/JetPtAssociationTool.h"
#include "JetMomentTools/JetTrackMomentsTool.h"
#include "JetMomentTools/JetTrackSumMomentsTool.h"
#include "JetMomentTools/JetVertexFractionTool.h"
#include "JetMomentTools/JetVertexTaggerTool.h"
#include "JetMomentTools/JetWidthTool.h"
#include "JetMomentTools/JetCaloEnergies.h"
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclass;
#pragma link C++ class JetClusterMomentsTool+;
#pragma link C++ class JetConstitFourMomTool+;
#pragma link C++ class JetECPSFractionTool+;
#pragma link C++ class JetForwardJvtTool+;
#pragma link C++ class JetLArHVTool+;
#pragma link C++ class JetMuonSegmentMomentsTool+;
#pragma link C++ class JetOriginCorrectionTool+;
#pragma link C++ class JetPtAssociationTool+;
#pragma link C++ class JetTrackMomentsTool+;
#pragma link C++ class JetTrackSumMomentsTool+;
#pragma link C++ class JetVertexFractionTool+;
#pragma link C++ class JetVertexTaggerTool+;
#pragma link C++ class JetWidthTool+;
#pragma link C++ class JetCaloEnergies+;
#endif
......@@ -18,6 +18,7 @@ use AtlasROOT AtlasROOT-* External
use AtlasBoost AtlasBoost-* External
use GaudiInterface GaudiInterface-* External
use AsgTools AsgTools-* Control/AthToolSupport
use AtlasReflex AtlasReflex-* External
use xAODCaloEvent xAODCaloEvent-* Event/xAOD
use xAODJet xAODJet-* Event/xAOD
......@@ -32,10 +33,15 @@ use JetUtils JetUtils-* Reconstruction/Jet
use JetRecCalo JetRecCalo-* Reconstruction/Jet
use JetInterface JetInterface-* Reconstruction/Jet
library JetMomentTools *.cxx ../Root/*.cxx -s=components *.cxx
apply_pattern component_library
apply_pattern declare_runtime files="*.root *.txt"
apply_pattern declare_runtime files="*.root"
apply_pattern declare_calib files="../share/*.root"
apply_pattern declare_python_modules files="*.py"
apply_pattern lcgdict dict=JetMomentToolsDict \
selectionfile=selection.xml \
headerfiles="../JetMomentTools/JetMomentToolsDict.h"
......@@ -75,12 +75,12 @@ StatusCode JetBadChanCorrTool::initialize()
std::string fname = PathResolver::find_file(m_profileName, "DATAPATH");
if(fname==""){
ATH_MSG(ERROR) << "Could not get file " << m_profileName << endreq;
ATH_MSG(ERROR) << "Could not get file " << m_profileName << endmsg;
return StatusCode::FAILURE;
}
TFile tf(fname.c_str());
if(tf.IsOpen()==false){
ATH_MSG( ERROR ) << "Could not open file " << fname << endreq;
ATH_MSG( ERROR ) << "Could not open file " << fname << endmsg;
return StatusCode::FAILURE;
}
// already registered hists
......@@ -101,7 +101,7 @@ StatusCode JetBadChanCorrTool::initialize()
if(find(histsInSvc.begin(),histsInSvc.end(),location)==histsInSvc.end()){
StatusCode sc = m_thistSvc->regHist(location);
if(sc.isFailure()){
ATH_MSG( ERROR ) << "failed to read histo " << location << endreq;
ATH_MSG( ERROR ) << "failed to read histo " << location << endmsg;
return StatusCode::FAILURE;
}
}
......@@ -116,14 +116,14 @@ StatusCode JetBadChanCorrTool::initialize()
&sample,&ptMin,&ptMax,&etaMin,&etaMax,&phiMin,&phiMax);
if(ret<1 || sample<0 || sample>=CaloCell_ID::Unknown) {
ATH_MSG( DEBUG ) << "Could not understand the name of hist " << obj->GetName() << endreq;
ATH_MSG( DEBUG ) << "Could not understand the name of hist " << obj->GetName() << endmsg;
continue;
}
TH1* th=0;
StatusCode sc = m_thistSvc->getHist(location,th);
if(sc.isFailure()){
ATH_MSG( ERROR ) << "failed to get histo " << location << endreq;
ATH_MSG( ERROR ) << "failed to get histo " << location << endmsg;
return StatusCode::FAILURE;
}
m_profileDatas[sample].push_back(ProfileData((TH1D*)th,sample,ptMin,ptMax,etaMin,etaMax,phiMin,phiMax));
......@@ -131,21 +131,21 @@ StatusCode JetBadChanCorrTool::initialize()
<< " tag=" << tag << " sample=" << sample
<< " ptMin=" << ptMin << " ptMax=" << ptMax
<< " etaMin=" << etaMin << " etaMax=" << etaMax
<< " phiMin=" << phiMin << " phiMax=" << phiMax << endreq;
<< " phiMin=" << phiMin << " phiMax=" << phiMax << endmsg;
}
}
// if(m_useCalibScale){
// CHECK( m_calibTool.retrieve() ) ;
// ATH_MSG( DEBUG ) << "use calibration " << m_calibTool << endreq;
// ATH_MSG( DEBUG ) << "use calibration " << m_calibTool << endmsg;
// }
if ( m_useCone) {
// CHECK( detStore()->retrieve(m_caloDDM) );
// m_calo_id = m_caloDDM->getCaloCell_ID();
// ATH_MSG( DEBUG ) << "perform bad cells in cone calculations " << endreq;
// ATH_MSG( DEBUG ) << "perform bad cells in cone calculations " << endmsg;
// if(m_calo_id==0){
// ATH_MSG( ERROR ) << "Could not get CaloCell_ID" << endreq;
// ATH_MSG( ERROR ) << "Could not get CaloCell_ID" << endmsg;
// return StatusCode::FAILURE;
// }
}
......@@ -369,7 +369,7 @@ int JetBadChanCorrTool::correctionFromCellsInJet( xAOD::Jet* jet, const jet::Cal
<< " BCH_CORR_CELL=" << corr_cell
<< " BCH_CORR_DOTX=" << corr_dotx
<< " BCH_CORR_JET=" << corr_jet_associate
<< " BCH_CORR_JET_FORCELL=" << corr_jet_forcell << endreq;
<< " BCH_CORR_JET_FORCELL=" << corr_jet_forcell << endmsg;
jet->setAttribute<float>("BchCorrCell",corr_cell);
jet->setAttribute<float>("BchCorrDotx",corr_dotx);
......
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