Commit 8a6758fd authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

Fix checkreq warnings. (JetRecTools-00-03-18)

2014-12-19  scott snyder  <snyder@bnl.gov>

	* Tagging JetRecTools-00-03-18.
	* Fix checkreq warnings.

2014-12-18 David Quarrie <David.Quarrie@cern.ch>
	* cmt/requirements
		Add cmake-specific explicit dependency against xAODPFlow to avoid indirect dependency from PFlowUtils
		which creates a component library and cmake (correctly) does not propagate such dependencies. This is
		transparent to CMT and checkreq.
	* Tagged as JetRecTools-00-03-17

2014-12-08 David Adams
	* JetRecTools-00-03-16
	* ATLASRECTS-1345
	* Clean up ChangeLog.

2014-12-08 Mark Hodgkinson
	* JetRecTools-00-03-14
	* ATLASRECTS-1345
...
(Long ChangeLog diff - truncated)
parent 35c103fc
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// JetDetailedTrackSelectorTool.h
#ifndef JetDetailedTrackSelectorTool_H
#define JetDetailedTrackSelectorTool_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"
#include "TrkToolInterfaces/ITrackSelectorTool.h"
#include "xAODTracking/TrackParticle.h"
#include "xAODTracking/TrackParticle.h"
#include "xAODTracking/VertexFwd.h"
/**
* @brief TrackSelector that pases all tracks.
*
* Replacement for InDetDetailedTrackSelectorTool that does
* not use track propagation and so does not require magnetic
* field or any other Athena-specific service.
*
* @author David Adams
*/
namespace Trk {
class Track;
class TrackParticleBase;
class Vertex;
}
class JetDetailedTrackSelectorTool : virtual public Trk::ITrackSelectorTool, public AthAlgTool {
public:
StatusCode initialize();
StatusCode finalize();
JetDetailedTrackSelectorTool(const std::string& t, const std::string& n, const IInterface* p);
~JetDetailedTrackSelectorTool();
bool decision(const Trk::Track& track,const Trk::Vertex* vertex) const;
bool decision(const Trk::TrackParticleBase& track,const Trk::Vertex* vertex) const;
bool decision(const xAOD::TrackParticle& track,const xAOD::Vertex* vertex) const;
};
#endif
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// JetTrackSelectionTool.h
/// class JetTrackSelectionTool
///
/// Selects tracks using an InDet selection tool.
#ifndef JETRECTOOLS_JETTRACKSELECTIONTOOL_H
#define JETRECTOOLS_JETTRACKSELECTIONTOOL_H
#include "AsgTools/AsgTool.h"
#include "JetInterface/IJetExecuteTool.h"
#include "JetInterface/IJetTrackSelector.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "TrkToolInterfaces/ITrackSelectorTool.h"
#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "AthContainers/ConstDataVector.h"
class JetTrackSelectionTool
: public asg::AsgTool,
virtual public IJetExecuteTool {
ASG_TOOL_CLASS(JetTrackSelectionTool, IJetExecuteTool)
virtual public IJetExecuteTool,
virtual public IJetTrackSelector {
ASG_TOOL_CLASS2(JetTrackSelectionTool, IJetExecuteTool, IJetTrackSelector)
public:
public:
JetTrackSelectionTool(const std::string &name);
virtual StatusCode initialize() ;
virtual int execute() const ;
// Inherited interface.
StatusCode initialize() ;
int execute() const ;
int keep(const xAOD::TrackParticle& trk) const;
void selectTracks(const xAOD::TrackParticleContainer& inCont, ConstDataVector<xAOD::TrackParticleContainer>& outCont) const;
void selectTracks(const xAOD::TrackParticleContainer& inCont, std::vector<const xAOD::TrackParticle*> outCont) const;
protected:
template<class T>
void selectionLoop(const xAOD::TrackParticleContainer& inCont, T& outCont) const;
ToolHandle<Trk::ITrackSelectorTool> m_selector;
float m_ptMin;
float m_etaMin, m_etaMax;
ToolHandle<InDet::IInDetTrackSelectionTool> m_hidselector;
std::string m_inputContainer;
std::string m_outputContainer;
......
// emacs : this file is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// PFlowPseudoJetGetter.h
#ifndef JETRECTOOLS_PFLOWPSEUDOJETGETTER_H
#define JETRECTOOLS_PFLOWPSEUDOJETGETTER_H
////////////////////////////////////////////
/// \class PFlowPseudoJetGetter
///
/// Specialized PseudoJetGetter for TrackParticle
/// The only thing done here is to specialize the templated append method and
/// define a property for the TrackVertexAssociation
/// \author P-A Delsart
/// PseudoJetGetter for pflow
///
/// Properties:
/// RetrievePFOTool - Tool to fetch the pflow
/// InputIsEM - If true, EM-scale is used for the neutral pflow
/// CalibratePFO - If true the EM-scale pflow is calibrated
/// UseNeutral - If true, the neutral component of pflow is used
/// UseCharged - If true, the charged component of pflow is used
/// \author P-A Delsart, D. Adams
//////////////////////////////////////////////////
#include "JetRec/PseudoJetGetter.h"
......@@ -44,6 +50,8 @@ protected:
ToolHandle<CP::IRetrievePFOTool> m_retrievePFOTool; /// Retrieval tool
bool m_inputIsEM; /// If true EM clusters are used for neutral PFOs.
bool m_calibrate; /// If true, EM PFOs are calibrated to LC.
bool m_useneutral; // IF true, neutral pflow is included.
bool m_usecharged; // IF true, neutral pflow is included.
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// SimpleJetTrackSelectionTool.h
/// class SimpleJetTrackSelectionTool
///
/// Returns all tracks.
#ifndef JETRECTOOLS_SimpleJetTrackSelectionTool_H
#define JETRECTOOLS_SimpleJetTrackSelectionTool_H
#include "AsgTools/AsgTool.h"
#include "JetInterface/IJetExecuteTool.h"
#include "JetInterface/IJetTrackSelector.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "GaudiKernel/ToolHandle.h"
#include "AthContainers/ConstDataVector.h"
class SimpleJetTrackSelectionTool
: public asg::AsgTool,
virtual public IJetExecuteTool,
virtual public IJetTrackSelector {
ASG_TOOL_CLASS2(SimpleJetTrackSelectionTool, IJetExecuteTool, IJetTrackSelector)
public:
SimpleJetTrackSelectionTool(const std::string &name);
// Inherited interface.
StatusCode initialize() ;
int execute() const ;
int keep(const xAOD::TrackParticle& trk) const;
void selectTracks(const xAOD::TrackParticleContainer& inCont, ConstDataVector<xAOD::TrackParticleContainer>& outCont) const;
void selectTracks(const xAOD::TrackParticleContainer& inCont, std::vector<const xAOD::TrackParticle*> outCont) const;
protected:
template<class T>
void selectionLoop(const xAOD::TrackParticleContainer& inCont, T& outCont) const;
float m_ptmin;
std::string m_inputContainer;
std::string m_outputContainer;
};
#endif
// -*- C++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
......@@ -12,31 +14,66 @@
#include "xAODTracking/TrackParticleContainer.h"
#include "xAODTracking/VertexContainer.h"
#include "TrackVertexAssociationTool/ITrackVertexAssociationTool.h"
#include "AsgTools/ToolHandle.h"
#include <string>
///////////////////////////////////////////////
/// \class TrackVertexAssociationTool
/// \brief creates a jet::TrackVertexAssociation object
///
/// Creates a jet::TrackVertexAssociation map.
/// The tool expects a ITrackVertexAssociationTool which it uses to create the map
/// from a TrackParticleContainer and a VertexContainer. The map is recorded in the evtStore.
///
/// Properties :
/// - "TrackParticleContainer" : name of TrackParticleContainer
/// - "VertexContainer" : name of VertexContainer
/// - "TrackVertexAssociation" : name of the output jet::TrackVertexAssociation
/// - "TrackVertexAssoTool" : A ITrackVertexAssociationTool instance
///
/// If the TrackVertexAssoTool is left blank, the old custom method is used to build the code
/// using cuts defined by these properties
/// - "MaxTransverseDistance",
/// - "MaxLongitudinalDistance"
/// - "MaxZ0SinTheta"
/// This old part of the code may disappear in the future.
////////////////////////////////////////////////////////////////////
class TrackVertexAssociationTool : virtual public asg::AsgTool,
virtual public IJetExecuteTool
{
ASG_TOOL_CLASS(TrackVertexAssociationTool,IJetExecuteTool)
ASG_TOOL_CLASS(TrackVertexAssociationTool,IJetExecuteTool)
public:
TrackVertexAssociationTool(const std::string & t);
StatusCode initialize();
// Retrieve necessary inputs, call building function, store result in evtStore
int execute() const;
private:
// Constuct a TrackVertexAssociation using a ITrackVertexAssociationTool object
const jet::TrackVertexAssociation* buildTrackVertexAssociation_withTool(const xAOD::TrackParticleContainer*, const xAOD::VertexContainer*) const;
// Constuct a TrackVertexAssociation using the older custom method
const jet::TrackVertexAssociation* buildTrackVertexAssociation_custom(const xAOD::TrackParticleContainer*, const xAOD::VertexContainer*) const;
public:
TrackVertexAssociationTool(const std::string & t);
// Constuct a TrackVertexAssociation object
const jet::TrackVertexAssociation* buildTrackVertexAssociation(const xAOD::TrackParticleContainer*, const xAOD::VertexContainer*) const;
ToolHandle<CP::ITrackVertexAssociationTool> m_tvaTool;
// Retrieve necessary inputs, call building function, store result in evtStore
int execute() const;
std::string m_trackContainer;
std::string m_vertexContainer;
std::string m_tvaStoreName;
private:
// old Configurable parameters
// Configurable parameters
std::string m_trackContainer;
std::string m_vertexContainer;
std::string m_tvaStoreName;
float m_transDistMax;
float m_longDistMax;
float m_transDistMax;
float m_longDistMax;
float m_maxZ0SinTheta;
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// JetDetailedTrackSelectorTool.cxx
#include "JetRecTools/JetDetailedTrackSelectorTool.h"
JetDetailedTrackSelectorTool::
JetDetailedTrackSelectorTool(const std::string& t, const std::string& n, const IInterface* p)
: AthAlgTool(t,n,p) {
declareInterface<ITrackSelectorTool>(this);
}
JetDetailedTrackSelectorTool::~JetDetailedTrackSelectorTool() { }
StatusCode JetDetailedTrackSelectorTool::initialize() {
return StatusCode::SUCCESS;
}
StatusCode JetDetailedTrackSelectorTool::finalize() {
return StatusCode::SUCCESS;
}
bool JetDetailedTrackSelectorTool::decision(const Trk::Track&, const Trk::Vertex*) const {
return true;
}
bool JetDetailedTrackSelectorTool::decision(const Trk::TrackParticleBase&, const Trk::Vertex*) const {
return true;
}
bool JetDetailedTrackSelectorTool::decision(const xAOD::TrackParticle&,const xAOD::Vertex*) const {
return true;
}
......@@ -5,27 +5,15 @@
#include "JetRecTools/JetTrackSelectionTool.h"
JetTrackSelectionTool::JetTrackSelectionTool(const std::string &name):
asg::AsgTool(name)
, m_selector("InDetDetailedTrackSelectorTool/TrackSelectorForJets")
, m_ptMin(500)
, m_etaMin(-5)
, m_etaMax(5)
, m_inputContainer("InDetTrackParticle")
, m_outputContainer("InDetTrackParticle")
{
declareProperty("Selector",m_selector);
declareProperty("PtMin",m_ptMin= 500);
declareProperty("EtaMin",m_etaMin= -5);
declareProperty("EtaMax",m_etaMax= 5);
asg::AsgTool(name), m_hidselector("") {
declareProperty("Selector", m_hidselector);
declareProperty("InputContainer",m_inputContainer);
declareProperty("OutputContainer",m_outputContainer);
}
StatusCode JetTrackSelectionTool::initialize() {
StatusCode sc = m_selector.retrieve();
if (sc.isFailure()) {ATH_MSG_ERROR("Can't retrieve ITrackSelectorTool "<< m_selector.name() ); return sc;}
StatusCode sc = m_hidselector.retrieve();
if (sc.isFailure()) {ATH_MSG_ERROR("Can't retrieve ITrackSelectorTool "<< m_hidselector.name() ); return sc;}
return StatusCode::SUCCESS;
}
......@@ -33,34 +21,30 @@ int JetTrackSelectionTool::execute() const {
ATH_MSG_DEBUG(" execute() ... ");
const xAOD::TrackParticleContainer* inCont;
StatusCode sc = evtStore()->retrieve(inCont,m_inputContainer);
if( sc.isFailure() ) {ATH_MSG_ERROR("Can't retrieve input track container "<< m_inputContainer); return 1;}
ConstDataVector< xAOD::TrackParticleContainer> *outCont = new ConstDataVector< xAOD::TrackParticleContainer> (SG::VIEW_ELEMENTS);
selectTracks( *inCont, *outCont);
if ( sc.isFailure() ) {ATH_MSG_ERROR("Can't retrieve input track container "<< m_inputContainer); return 1;}
ConstDataVector<xAOD::TrackParticleContainer> *outCont = new ConstDataVector< xAOD::TrackParticleContainer> (SG::VIEW_ELEMENTS);
selectTracks(*inCont, *outCont);
ATH_MSG_DEBUG(" in size = "<< inCont->size() << " outSize="<< outCont->size());
sc = evtStore()->record( outCont, m_outputContainer);
if( sc.isFailure() ) {ATH_MSG_ERROR("Can't record output track container "<< m_outputContainer); return 1;}
if ( sc.isFailure() ) {ATH_MSG_ERROR("Can't record output track container "<< m_outputContainer); return 1;}
return 0;
}
int JetTrackSelectionTool::keep(const xAOD::TrackParticle& trk) const {
return m_hidselector->accept(trk, 0);
}
template<class T>
void JetTrackSelectionTool::selectionLoop(const xAOD::TrackParticleContainer& inCont, T& outCont) const {
outCont.reserve(inCont.size());
for( const xAOD::TrackParticle* trk : inCont) {
if( (trk->pt() > m_ptMin) &&
(trk->eta() > m_etaMin) &&
(trk->eta() < m_etaMax) &&
(m_selector->decision( *trk ) ) ) outCont.push_back(trk) ;
for ( const xAOD::TrackParticle* ptrk : inCont ) {
if ( ptrk != 0 && keep(*ptrk) ) outCont.push_back(ptrk);
}
}
void JetTrackSelectionTool::selectTracks(const xAOD::TrackParticleContainer& inCont, ConstDataVector<xAOD::TrackParticleContainer>& outCont) const {
selectionLoop(inCont, outCont);
}
void JetTrackSelectionTool::selectTracks(const xAOD::TrackParticleContainer& inCont, std::vector<const xAOD::TrackParticle*> outCont) const {
selectionLoop(inCont, outCont);
}
......
......@@ -8,20 +8,21 @@
#include "xAODTracking/VertexContainer.h"
#include <cmath>
//#include "xAODPFlow/PFlowContainer.h"
#include "xAODPFlow/PFO.h"
namespace PFlowPJHelper{
// We can not use the PseudoJetGetter::append method for PFlow object because the neutral component needs to be corrected.
// We can not use the PseudoJetGetter::append method for PFlow object because the neutral component
// needs to be corrected.
// We temporary use this helper object to reproduce the filling code in PseudoJetGetter::append .
// PseudoJetGetter::append can be re-worked and the duplication in this helper class removed
struct PseudoJetFiller {
PseudoJetFiller(jet::PseudoJetVector& psjs, const jet::LabelIndex* pli, const std::string &label, double g, bool skipNegE=true) : m_pjVector(psjs), m_labelMap(pli), m_ghostscale(g>0 ? g : 1), m_skipNegE(skipNegE) {
m_labidx = 0;
if ( pli != 0 ) m_labidx = m_labelMap->index(label);
if ( m_ghostscale!=1 ) m_labidx = -m_labidx;
PseudoJetFiller(jet::PseudoJetVector& psjs, const jet::LabelIndex* pli, const std::string &label,
double g, bool skipNegE=true)
: m_pjVector(psjs), m_labelMap(pli), m_ghostscale(g>0 ? g : 1), m_skipNegE(skipNegE) {
m_labidx = 0;
if ( pli != 0 ) m_labidx = m_labelMap->index(label);
if ( m_ghostscale!=1 ) m_labidx = -m_labidx;
}
......@@ -55,6 +56,8 @@ PFlowPseudoJetGetter::PFlowPseudoJetGetter(const std::string &name)
declareProperty("RetrievePFOTool", m_retrievePFOTool, "Name of tool that builds the PFO collection.");
declareProperty("InputIsEM", m_inputIsEM =false, "True if neutral PFOs are EM scale clusters.");
declareProperty("CalibratePFO", m_calibrate =true, "True if LC calibration should be applied to EM PFOs.");
declareProperty("UseNeutral", m_useneutral =true, "True to use the nuetral component of PFlow.");
declareProperty("UseCharged", m_usecharged =true, "True if use the charged component of PFlow.");
}
int PFlowPseudoJetGetter::appendTo(PseudoJetVector& psjs, const LabelIndex* pli) const {
......@@ -71,42 +74,48 @@ int PFlowPseudoJetGetter::appendTo(PseudoJetVector& psjs, const LabelIndex* pli)
const xAOD::Vertex& vtx = *pvtxs->at(0);
// Get the neutral pflow.
CP::PFO_JetMETConfig_inputScale inscale = m_inputIsEM ? CP::EM : CP::LC;
const xAOD::PFOContainer* pnpfs = m_retrievePFOTool->retrievePFO(inscale, CP::neutral);
if ( pnpfs == 0 || pnpfs->size()==0 ) {
std::string sscale = m_inputIsEM ? "EM" : "LC";
ATH_MSG_WARNING(sscale << " neutral PFOs not found.");
return 1;
}
for ( const xAOD::PFO* ppfo : *pnpfs ) {
if ( ppfo == 0 ) {
ATH_MSG_WARNING("Have NULL pointer to neutral PFO");
continue;
if ( m_useneutral ) {
CP::PFO_JetMETConfig_inputScale inscale = m_inputIsEM ? CP::EM : CP::LC;
const xAOD::PFOContainer* pnpfs = m_retrievePFOTool->retrievePFO(inscale, CP::neutral);
if ( pnpfs == 0 ) {
std::string sscale = m_inputIsEM ? "EM" : "LC";
ATH_MSG_WARNING(sscale << " neutral PFOs not found.");
return 1;
}
if ( !m_inputIsEM || m_calibrate ) {
filler.fill(ppfo, ppfo->GetVertexCorrectedFourVec(vtx));
} else {
filler.fill(ppfo, ppfo->GetVertexCorrectedEMFourVec(vtx));
for ( const xAOD::PFO* ppfo : *pnpfs ) {
if ( ppfo == 0 ) {
ATH_MSG_WARNING("Have NULL pointer to neutral PFO");
continue;
}
if ( !m_inputIsEM || m_calibrate ) {
filler.fill(ppfo, ppfo->GetVertexCorrectedFourVec(vtx));
} else {
filler.fill(ppfo, ppfo->GetVertexCorrectedEMFourVec(vtx));
}
}
delete pnpfs;
}
// Get the charged pflow.
const xAOD::PFOContainer* pcpfs = m_retrievePFOTool->retrievePFO(CP::EM,CP::charged);
for ( const xAOD::PFO* pcpf : *pcpfs ) {
if ( pcpf == 0 ) {
ATH_MSG_WARNING("Have NULL pointer to charged PFO");
continue;
}
const xAOD::TrackParticle* ptrk = pcpf->track(0);
if ( ptrk == 0 ) {
ATH_MSG_WARNING("Skipping charged PFO with null track pointer.");
continue;
if ( m_usecharged ) {
const xAOD::PFOContainer* pcpfs = m_retrievePFOTool->retrievePFO(CP::EM,CP::charged);
for ( const xAOD::PFO* pcpf : *pcpfs ) {
if ( pcpf == 0 ) {
ATH_MSG_WARNING("Have NULL pointer to charged PFO");
continue;
}
const xAOD::TrackParticle* ptrk = pcpf->track(0);
if ( ptrk == 0 ) {
ATH_MSG_WARNING("Skipping charged PFO with null track pointer.");
continue;
}
//vtz.z() provides z of that vertex w.r.t the center of the beamspot (z = 0). Thus we corrext the track z0 to be w.r.t z = 0
float z0 = ptrk->z0() + ptrk->vz() - vtx.z();
float theta = ptrk->theta();
if ( fabs(z0*sin(theta)) < 2.0 ) filler.fill(pcpf, pcpf->p4() );
}
float z0 = ptrk->z0();
float theta = ptrk->theta();
if ( fabs(z0*sin(theta)) < 2.0 ) filler.fill(pcpf, pcpf->p4() );
delete pcpfs;
}
return 0;
}
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "JetRecTools/SimpleJetTrackSelectionTool.h"
SimpleJetTrackSelectionTool::SimpleJetTrackSelectionTool(const std::string &name):
asg::AsgTool(name) {
declareProperty("PtMin", m_ptmin =500.0);
declareProperty("InputContainer", m_inputContainer);
declareProperty("OutputContainer", m_outputContainer);
}
StatusCode SimpleJetTrackSelectionTool::initialize() {
return StatusCode::SUCCESS;
}
int SimpleJetTrackSelectionTool::execute() const {
ATH_MSG_DEBUG(" execute() ... ");
const xAOD::TrackParticleContainer* inCont;
StatusCode sc = evtStore()->retrieve(inCont,m_inputContainer);
if ( sc.isFailure() ) {ATH_MSG_ERROR("Can't retrieve input track container "<< m_inputContainer); return 1;}
ConstDataVector<xAOD::TrackParticleContainer> *outCont = new ConstDataVector< xAOD::TrackParticleContainer> (SG::VIEW_ELEMENTS);
selectTracks(*inCont, *outCont);
ATH_MSG_DEBUG(" in size = "<< inCont->size() << " outSize="<< outCont->size());
sc = evtStore()->record( outCont, m_outputContainer);
if ( sc.isFailure() ) {ATH_MSG_ERROR("Can't record output track container "<< m_outputContainer); return 1;}
return 0;
}
int SimpleJetTrackSelectionTool::keep(const xAOD::TrackParticle& trk) const {
if ( trk.pt() < m_ptmin ) return false;
return true;
}
template<class T>
void SimpleJetTrackSelectionTool::selectionLoop(const xAOD::TrackParticleContainer& inCont, T& outCont) const {
for ( const xAOD::TrackParticle* ptrk : inCont ) {
if ( ptrk != 0 && keep(*ptrk) ) outCont.push_back(ptrk) ;
}
}
void SimpleJetTrackSelectionTool::selectTracks(const xAOD::TrackParticleContainer& inCont, ConstDataVector<xAOD::TrackParticleContainer>& outCont) const {
selectionLoop(inCont, outCont);
}
void SimpleJetTrackSelectionTool::selectTracks(const xAOD::TrackParticleContainer& inCont, std::vector<const xAOD::TrackParticle*> outCont) const {
selectionLoop(inCont, outCont);
}