Commit 442506bd authored by Mark Hodgkinson's avatar Mark Hodgkinson
Browse files

Remove LC mode (whereby we used LC scale topoclusters as input to particle...

Remove LC mode (whereby we used LC scale topoclusters as input to particle flow) from the PFNeutralFlowElementCreatorAlgorithm.
Add some of the needed code in createNeutralFlowElement and change its argument list in light of the above.
parent c6790e21
......@@ -29,7 +29,7 @@ public:
private:
/** Create the chargedneutral PFO */
StatusCode createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer, xAOD::FlowElementContainer* neutralFEContainer_nonModified) const;
StatusCode createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer) const;
/** 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;
......@@ -37,9 +37,6 @@ private:
/** 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"};
/** Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */
Gaudi::Property<bool> m_LCMode{this,"LCMode",false,"Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input"};
/** Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */
Gaudi::Property<bool> m_doClusterMoments{this,"DoClusterMoments",true,"Bool to toggle whether cluster moments are added to the PFOs"};
......@@ -55,9 +52,5 @@ private:
/** WriteHandleKey for neutral PFO */
SG::WriteHandleKey<xAOD::FlowElementContainer> m_neutralFEContainerWriteHandleKey{this,"FEOutputName","JetETMissNeutralFlowElements","WriteHandleKey for neutral FlowElements"};
/** WriteHandleKey for non-modified neutral PFO - only used in LC mode */
SG::WriteHandleKey<xAOD::FlowElementContainer> m_neutralFEContainerWriteHandleKey_nonModified{this,"FEOutputName_nonModified","JetETMissNeutralFlowElements_nonModified"," WriteHandleKey for non-modified neutral FlowElements - only used in LC mode"};
};
#endif
#include "eflowRec/PFNeutralFlowElementCreatorAlgorithm.h"
#include "eflowRec/eflowRecCluster.h"
#include "xAODPFlow/FlowElementAuxContainer.h"
PFNeutralFlowElementCreatorAlgorithm::PFNeutralFlowElementCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :
......@@ -10,11 +12,8 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::initialize(){
ATH_CHECK(m_eflowCaloObjectContainerReadHandleKey.initialize());
ATH_CHECK(m_neutralFEContainerWriteHandleKey.initialize());
if(!m_LCMode) {
ATH_CHECK(m_neutralFEContainerWriteHandleKey_nonModified.initialize());
}
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
StatusCode PFNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx) const {
......@@ -28,19 +27,11 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx
auto neutralFEContainer = std::make_unique<xAOD::FlowElementContainer>();
auto neutralFEContainerAux = std::make_unique<xAOD::FlowElementAuxContainer>();
neutralFEContainer->setStore(neutralFEContainerAux.get());
// The non-modified container is only used for LC FlowElements
std::unique_ptr<xAOD::FlowElementContainer> neutralFEContainer_nonModified(nullptr);
std::unique_ptr<xAOD::FlowElementAuxContainer> neutralFEContainerAux_nonModified(nullptr);
if(m_LCMode) {
neutralFEContainer_nonModified = std::make_unique<xAOD::FlowElementContainer>();
neutralFEContainerAux_nonModified = std::make_unique<xAOD::FlowElementAuxContainer>();
neutralFEContainer->setStore(neutralFEContainerAux_nonModified.get());
}
ATH_MSG_DEBUG("Looping over eflowCaloObjects");
// Create FlowElements and fill the containers
for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) {
if( createNeutralFlowElement(*thisEflowCaloObject, neutralFEContainer.get(), neutralFEContainer_nonModified.get()).isFailure() ) {
if( createNeutralFlowElement(*thisEflowCaloObject, neutralFEContainer.get()).isFailure()) {
ATH_MSG_WARNING("Problem encountered while creating neutral FlowElements");
return StatusCode::SUCCESS;
}
......@@ -50,17 +41,80 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx
SG::WriteHandle<xAOD::FlowElementContainer> neutralFEContainerWriteHandle(m_neutralFEContainerWriteHandleKey,ctx);
std::sort(neutralFEContainer->begin(), neutralFEContainer->end(), [] (const xAOD::FlowElement* fe1, const xAOD::FlowElement* fe2) {return fe1->pt()>fe2->pt();});
ATH_CHECK( neutralFEContainerWriteHandle.record(std::move(neutralFEContainer),std::move(neutralFEContainerAux)) );
if(m_LCMode) {
std::sort(neutralFEContainer_nonModified->begin(), neutralFEContainer_nonModified->end(), [] (const xAOD::FlowElement* fe1, const xAOD::FlowElement* fe2) {return fe1->pt()>fe2->pt();});
SG::WriteHandle<xAOD::FlowElementContainer> neutralFEContainerWriteHandle_nonModified(m_neutralFEContainerWriteHandleKey,ctx);
ATH_CHECK( neutralFEContainerWriteHandle_nonModified.record(std::move(neutralFEContainer_nonModified),std::move(neutralFEContainerAux_nonModified)) );
}
return StatusCode::SUCCESS;
}
StatusCode PFNeutralFlowElementCreatorAlgorithm::finalize(){ return StatusCode::SUCCESS;}
StatusCode PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer, xAOD::FlowElementContainer* neutralFEContainer_nonModified) const {
StatusCode PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement(const eflowCaloObject& energyFlowCaloObject, xAOD::FlowElementContainer* neutralFEContainer) const {
unsigned int nClusters = energyFlowCaloObject.nClusters();
ATH_MSG_VERBOSE(" eflowCaloObject with " << nClusters << " clusters");
for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster){
eflowRecCluster* thisEfRecCluster = energyFlowCaloObject.efRecCluster(iCluster);
/* Skip empty clusters (presumably subtraction remnants) */
const CaloClusterCellLink* theCellLink = energyFlowCaloObject.efRecCluster(iCluster)->getCluster()->getCellLinks();
CaloClusterCellLink::const_iterator it=theCellLink->begin();
CaloClusterCellLink::const_iterator it_e=theCellLink->end();
if (it == it_e) {
continue;
}
//this vetoes rare examples where only two cells are left, and they have equal and opposite energy
if (0.0 == energyFlowCaloObject.efRecCluster(iCluster)->getCluster()->e() ) continue;
/* Create the FlowElement, add the cluster and set the four-momentum, charge and type */
ATH_MSG_VERBOSE("Creating FlowElement");
xAOD::FlowElement* thisFE = new xAOD::FlowElement();
neutralFEContainer->push_back(thisFE);
ATH_MSG_VERBOSE("Get original cluster link");
ElementLink<xAOD::CaloClusterContainer> theOriginalClusterLink = thisEfRecCluster->getOriginalClusElementLink();
ATH_MSG_VERBOSE("Get sister cluster link");
ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink();
std::vector<ElementLink<xAOD::IParticleContainer> > theClusters;
ElementLink< xAOD::IParticleContainer > theIParticleTrackLink;
if (theSisterClusterLink.isValid()) theIParticleTrackLink.resetWithKeyAndIndex(theSisterClusterLink.persKey(),theSisterClusterLink.persIndex());
else theIParticleTrackLink.resetWithKeyAndIndex(theOriginalClusterLink.persKey(),theOriginalClusterLink.persIndex());
theClusters.push_back(theIParticleTrackLink);
thisFE->setOtherObjectLinks(theClusters);
if (true == m_addShowerSubtractedClusters){
const SG::AuxElement::Accessor<ElementLink<xAOD::CaloClusterContainer> > accShowerSubtractedClusterLink("FEShowerSubtractedClusterLink");
accShowerSubtractedClusterLink(*thisFE) = thisEfRecCluster->getClusElementLink();
}
ATH_MSG_VERBOSE(" Sucessfully set cluster link");
/*
const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster();
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
if (!m_LCMode) {
//in EM->EM/LC mode we use eta,phi at EM scale for both 4-vectors
thisFE->setP4(cluster->pt(), cluster->rawEta(), cluster->rawPhi(), cluster->m());
thisFE->setP4EM(cluster->rawE()/cosh(cluster->rawEta()), cluster->rawEta(),cluster->rawPhi(),cluster->rawM());
}
else{
//in LC-> mode we use the LC 4-vector for the LC scale
thisPFO->setP4(cluster->pt(), cluster->eta(), cluster->phi(), cluster->m());
//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
const CaloClusterCellLink* theCellLink = cluster->getCellLinks();
float emPt = 0.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
return StatusCode::SUCCESS;
}
\ No newline at end of file
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