Commit b3822bb6 authored by Mark Hodgkinson's avatar Mark Hodgkinson
Browse files

Update CMakeLists to add xAODCore which we will need for shallow copying.

Add addMoment function to PFNeutralFlowElementCreatorAlgorithm
parent 442506bd
...@@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC ...@@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC
Control/CxxUtils Control/CxxUtils
DetectorDescription/GeoPrimitives DetectorDescription/GeoPrimitives
Event/xAOD/xAODCaloEvent Event/xAOD/xAODCaloEvent
Event/xAOD/xAODCore
Event/xAOD/xAODEgamma Event/xAOD/xAODEgamma
Event/xAOD/xAODMuon Event/xAOD/xAODMuon
Event/xAOD/xAODPFlow Event/xAOD/xAODPFlow
...@@ -47,7 +48,7 @@ atlas_add_component( eflowRec ...@@ -47,7 +48,7 @@ atlas_add_component( eflowRec
src/*.cxx src/*.cxx
src/components/*.cxx src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives xAODCaloEvent xAODEgamma xAODMuon xAODPFlow xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry TrackVertexAssociationToolLib Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib SGtests FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib AthenaMonitoringKernelLib ) LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives xAODCaloEvent xAODCore xAODEgamma xAODMuon xAODPFlow xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry TrackVertexAssociationToolLib Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib SGtests FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib AthenaMonitoringKernelLib )
# Install files from the package: # Install files from the package:
atlas_install_headers( eflowRec ) atlas_install_headers( eflowRec )
......
...@@ -32,7 +32,7 @@ private: ...@@ -32,7 +32,7 @@ private:
StatusCode createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer) const; StatusCode createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer) const;
/** Function to add cluster moments onto PFO */ /** Function to add cluster moments onto PFO */
void addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::FlowElement& theFE) const; void addMoment(const xAOD::CaloCluster::MomentType& momentType, const std::string& feAttribute, const xAOD::CaloCluster& theCluster, xAOD::FlowElement& theFE) const;
/** Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed */ /** Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed */
Gaudi::Property<bool> m_eOverPMode{this,"EOverPMode",false,"Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"}; Gaudi::Property<bool> m_eOverPMode{this,"EOverPMode",false,"Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"};
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "eflowRec/eflowRecCluster.h" #include "eflowRec/eflowRecCluster.h"
#include "xAODCore/ShallowCopy.h"
#include "xAODPFlow/FlowElementAuxContainer.h" #include "xAODPFlow/FlowElementAuxContainer.h"
PFNeutralFlowElementCreatorAlgorithm::PFNeutralFlowElementCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) : PFNeutralFlowElementCreatorAlgorithm::PFNeutralFlowElementCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :
...@@ -90,31 +91,37 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement(const ...@@ -90,31 +91,37 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement(const
ATH_MSG_VERBOSE(" Sucessfully set cluster link"); ATH_MSG_VERBOSE(" Sucessfully set cluster link");
/*
const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster(); const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster();
ATH_MSG_VERBOSE("Got CaloCluster from EfRecCluster"); ATH_MSG_VERBOSE("Got CaloCluster from EfRecCluster");
//be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy //be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy
if (!m_LCMode) { //we use eta,phi at EM scale for both 4-vectors - standard FE are at EM scale
//in EM->EM/LC mode we use eta,phi at EM scale for both 4-vectors thisFE->setP4(cluster->rawE()/cosh(cluster->rawEta()), cluster->rawEta(),cluster->rawPhi(),cluster->rawM());
thisFE->setP4(cluster->pt(), cluster->rawEta(), cluster->rawPhi(), cluster->m()); //TODO
thisFE->setP4EM(cluster->rawE()/cosh(cluster->rawEta()), cluster->rawEta(),cluster->rawPhi(),cluster->rawM()); //Now we make a shallow copy of the object such that we can have an LC scale version
} //const xAOD::FlowElement* test = const_cast<xAOD::FlowElement*>(thisFE);
else{ //std::pair<xAOD::FlowElement*, xAOD::ShallowAuxInfo*> ret = xAOD::shallowCopyObject(*test);
//in LC-> mode we use the LC 4-vector for the LC scale //thisFE->setP4(cluster->pt(), cluster->rawEta(), cluster->rawPhi(), cluster->m());
thisPFO->setP4(cluster->pt(), cluster->eta(), cluster->phi(), cluster->m()); //thisFE->setP4EM(cluster->rawE()/cosh(cluster->rawEta()), cluster->rawEta(),cluster->rawPhi(),cluster->rawM());
//we cannot access geometric weights for LC clusters, so we make an approximation of the EM energy by looping over the calocells
//Then the EM 4-vector uses the energy/pt at this EM scale + eta,phi from LC 4-vector ATH_MSG_DEBUG("Created neutral FlowElement with E, pt, eta and phi of " << thisFE->e() << ", " << thisFE->pt() << ", " << thisFE->eta() << " and " << thisFE->phi());
const CaloClusterCellLink* theCellLink = cluster->getCellLinks();
float emPt = 0.0; thisFE->setCharge(0);
for (auto thisCaloCell : *theCellLink) emPt += thisCaloCell->e()/cosh(thisCaloCell->eta());
thisPFO->setP4EM(emPt,cluster->eta(),cluster->phi(),0.0);//mass is always zero at EM scale
}
*/
}//cluster loop }//cluster loop
return StatusCode::SUCCESS;
}
void PFNeutralFlowElementCreatorAlgorithm::addMoment(const xAOD::CaloCluster::MomentType& momentType, const std::string& feAttribute, const xAOD::CaloCluster& theCluster, xAOD::FlowElement& theFE) const {
return StatusCode::SUCCESS; double moment = 0.0;
} bool isRetrieved = theCluster.retrieveMoment(momentType, moment);
\ No newline at end of file if (true == isRetrieved) {
float float_moment = static_cast<float>(moment);
const SG::AuxElement::Accessor<float> accFloat(feAttribute);
accFloat(theFE) = float_moment;
}
else ATH_MSG_WARNING(" Could not retrieve moment from the CaloCluster");
}
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