Skip to content
Snippets Groups Projects
Commit 44a65c23 authored by Matthew Thomas Anthony's avatar Matthew Thomas Anthony :speech_balloon:
Browse files

Reworked the cluster matching to be cell based matching if we're not matching...

Reworked the cluster matching to be cell based matching if we're not matching TopoClusters to FE Topoclusters
parent a6d53c6e
No related branches found
No related tags found
7 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!38094Fix muon link to charged flow element,!36273Connect Flow Elements to Muon container
......@@ -49,18 +49,24 @@ private:
SG::ReadHandleKey<xAOD::FlowElementContainer>m_chargedFEReadHandleKey{this,"JetEtMissChargedFlowElementContainer","JetETMissChargedFlowElements","ReadHandleKey for charged FlowElements"};
/* Write key for adding charged Flow Element link decorations to muons */
/** Write key for adding charged Flow Element link decorations to muons **/
SG::WriteDecorHandleKey<xAOD::MuonContainer> m_muonChargedFEWriteDecorKey;
/* Write key for adding Muon link decorations to charged Flow Elements */
/** Write key for adding Muon link decorations to charged Flow Elements **/
SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_ChargedFEmuonWriteDecorKey;
/* Write key for adding neutral Flow Element link decorations to muons */
/* Write key for adding neutral Flow Element link decorations to muons **/
SG::WriteDecorHandleKey<xAOD::MuonContainer> m_muonNeutralFEWriteDecorKey;
/* Write key for adding Muon link decorations to neutral Flow Elements */
/** Write key for adding Muon link decorations to neutral Flow Elements **/
SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_NeutralFEmuonWriteDecorKey;
/***Gaudi Property to configure linkage of Neutral Flow Elements to Muon clusters (EXPERIMENTAL - default = False/OFF) **/
Gaudi::Property<bool> m_LinkNeutralFEClusters{this,"m_LinkNeutralFEClusters",false,"Toggle usage of linkage of Neutral FlowElements - false by default (EXPERIMENTAL)"};
/**
(EXPERIMENTAL) Gaudi Property to configure linkage of Neutral FEs to TopoClusters associated to Muons. Only works with previous option set to True (m_LinkNeutralFEClusters).
True: Link FEs to Topoclusters associated to Muons
False: Link FEs to CaloClusters associated to Muons
**/
Gaudi::Property<bool> m_UseMuonTopoClusters{this,"m_UseMuonTopoClusters",false,"Toggle usage of linker of muon associated topoclusters to flow elements - false by default (EXPERIMENTAL)"};
};
#endif // PFMUONFLOWELEMENTASSOC.H
......@@ -245,7 +245,7 @@ if True == jobproperties.eflowRecFlags.provideShowerSubtractedClusters:
topSequence += PFONeutralCreatorAlgorithm
from eflowRec.eflowRecFlags import jobproperties # set reco flags for eFlowRec algorithms
jobproperties.eflowRecFlags.usePFEGammaPFOAssoc.set_Value_and_Lock(True)
jobproperties.eflowRecFlags.useFlowElements.set_Value_and_Lock(True)
if jobproperties.eflowRecFlags.usePFEGammaPFOAssoc:
......@@ -272,13 +272,13 @@ if jobproperties.eflowRecFlags.useFlowElements:
# Electron/Photon linkers to flow elements
from eflowRec.eflowRecConf import PFEGamFlowElementAssoc
PFEGamFlowElementAssocAlg=PFEGamFlowElementAssoc("PFEGamFlowElementAssoc")
topSequence +=PFEGamFlowElementAssoc
topSequence +=PFEGamFlowElementAssocAlg
# Muon linker to flow elements
from eflowRec.eflowRecConf import PFMuonFlowElementAssoc
PFMuonFlowElementAssocAlg=PFMuonFlowElementAssoc("PFMuonFlowElementAssocAlgorithm")
#Gaudi switch to add the experimental linker between muon clusters and neutral flow elements (FE)
PFMuonFlowElementAssocAlg.m_LinkNeutralFEClusters=False
PFMuonFlowElementAssocAlg.m_LinkNeutralFEClusters=True
PFMuonFlowElementAssocAlg.m_UseMuonTopoClusters=False # second switch combined with first implies Muon topoclusters are linked to neutral Flow Elements
topSequence += PFMuonFlowElementAssocAlg
......
......@@ -9,6 +9,11 @@
#include "xAODPFlow/FlowElementContainer.h"
#include "xAODPFlow/FlowElement.h"
//includes for CaloCluster algo
#include "CaloEvent/CaloCell.h"
#include "xAODCaloEvent/CaloClusterKineHelper.h"
#include "Identifier/Identifier.h"
typedef ElementLink<xAOD::MuonContainer> MuonLink_t;
typedef ElementLink<xAOD::FlowElementContainer> FlowElementLink_t;
//
......@@ -126,6 +131,18 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
//get the index of the cluster corresponding to the Neutral FlowElements
size_t FEclusterindex=FE->otherObjects().at(0)->index();
// FE->otherObjects returns a vector of IParticles. We only want the first one
const xAOD::IParticle* FE_Iparticle=FE->otherObjects().at(0);
//dynamic cast to CaloCluster
const xAOD::CaloCluster* FE_cluster=dynamic_cast<const xAOD::CaloCluster*>(FE_Iparticle); //cast to CaloCluster
// retrieve the link to cells
const CaloClusterCellLink* CellLink = FE_cluster->getCellLinks();
// build the iterator(s) for the looping over the elements inside the CellLink
CaloClusterCellLink::const_iterator FE_FirstCell=CellLink->begin();
CaloClusterCellLink::const_iterator FE_LastCell=CellLink->end();
//design the vector of ElementLinks
std::vector<MuonLink_t> FEMuonLinks;
for (const xAOD::Muon* muon: *muonNeutralFEWriteDecorHandle ){
......@@ -154,14 +171,36 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
} // end of loop over element links
} //end of TopoCluster specific block
else{ // case when we don't use Topoclusters, just match the caloclusters to the flow element
size_t cluster_index=cluster->index();
if(cluster_index==FEclusterindex){
//if we don't match topoclusters, do something more complex:
// Retrieve cells in both the FE cluster and muon cluster
// Define the link as where at least one calo cell is shared between the FE cluster and the Muon Cluster
//retrieve cells associated to Muon cluster
const CaloClusterCellLink* Muon_Clus_CellLink=cluster->getCellLinks();
//get the iterator on the links
CaloClusterCellLink::const_iterator Muon_Clus_FirstCell=Muon_Clus_CellLink->begin();
CaloClusterCellLink::const_iterator Muon_Clus_LastCell=Muon_Clus_CellLink->end();
//Now we check if any match. Current algo allows for at least one match.
bool isCellMatched=false;
for(; Muon_Clus_FirstCell != Muon_Clus_LastCell; ++Muon_Clus_FirstCell){
Identifier index_muoncell=Muon_Clus_FirstCell->ID();
for (; FE_FirstCell != FE_LastCell; FE_FirstCell++){
Identifier index_FEcell=FE_FirstCell->ID();
if(index_FEcell==index_muoncell){
isCellMatched=true;
}
}
} // end of double loop block for cell matching
if(isCellMatched){ // cell matched => Link the two objects.
// Add Muon element link to a vector
// index() is the unique index of the muon in the muon container
FEMuonLinks.push_back(MuonLink_t(*muonReadHandle,muon->index()));
// index() is the unique index of the cFlowElement in the cFlowElementcontaine
muonNeutralFEVec.at(muon->index()).push_back(FlowElementLink_t(*NeutralFEReadHandle,FE->index()));
} // end of matching cluster index block
}
} // end of calocluster specific block
} // loop over caloclusters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment