diff --git a/Reconstruction/eflowRec/eflowRec/PFMuonFlowElementAssoc.h b/Reconstruction/eflowRec/eflowRec/PFMuonFlowElementAssoc.h index 6f7d74f4a505b491f51e39f8445bb0ed87f0b294..3c998c3c9c89d091de46718f201e688ace497fd5 100644 --- a/Reconstruction/eflowRec/eflowRec/PFMuonFlowElementAssoc.h +++ b/Reconstruction/eflowRec/eflowRec/PFMuonFlowElementAssoc.h @@ -59,9 +59,8 @@ private: /* Write key for adding Muon link decorations to neutral Flow Elements */ SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_NeutralFEmuonWriteDecorKey; - Gaudi::Property<bool> m_LinkNeutralFEClusters{this,"m_LinkNeutralFEClusters",false,"Toggle usage of linkage of Neutral FlowElements - false by default"}; - + Gaudi::Property<bool> m_LinkNeutralFEClusters{this,"m_LinkNeutralFEClusters",false,"Toggle usage of linkage of Neutral FlowElements - false by default (EXPERIMENTAL)"}; + 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 diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index 37b69be3c0c253810075f549e6e9ddcfccb69146..52ec5cdc541a3616bf10aff3597c4bf82a82aeb5 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -267,9 +267,7 @@ if jobproperties.eflowRecFlags.useFlowElements: topSequence += PFLCNeutralFlowElementCreatorAlgorithm from eflowRec.eflowRecConf import PFMuonFlowElementAssoc - PFMuonFlowElementAssoc=PFMuonFlowElementAssoc("PFMuonFlowElementAssocAlgorithm") + PFMuonFlowElementAssocAlg=PFMuonFlowElementAssoc("PFMuonFlowElementAssocAlgorithm") #Gaudi switch to add the experimental linker between muon clusters and neutral flow elements - print(PFMuonFlowElementAssoc.m_LinkNeutralFEClusters) - - print("RUN_MUONFLOWELEMS_PLS") - topSequence += PFMuonFlowElementAssoc + PFMuonFlowElementAssocAlg.m_LinkNeutralFEClusters=True + topSequence += PFMuonFlowElementAssocAlg diff --git a/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx b/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx index 91858ee5259e89711cbbab4fa7f8d04dfcf3815f..59f59d816aeba8ea576a200c563ccef0933badc3 100644 --- a/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx +++ b/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx @@ -111,6 +111,15 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const ////////////////////////////////////////////////// // Loop over Neutral FlowElements ////////////////////////////////////////////////// + /** + In short, this feature is an experimental linker between neutral FEs and Muons either by the following: + Case 1) Retrieve the CaloCluster(s) from the muon, and get any topocluster(s) associated to those, then link the topoclusters to the neutral FEs + Case 2) Retrieve the CaloCluster(s) from the muon then link to the neutral FEs + + This code is switched using two switches: + m_LinkNeutralFEClusters (turns on the experimental feature) + m_UseMuonTopoClusters (True= Case 1, False = Case 2) + **/ if(m_LinkNeutralFEClusters){ ATH_MSG_DEBUG("Experimental: Cluster Linkers between neutral FEs and Muons are used"); for (const xAOD::FlowElement* FE: *NeutralFEmuonWriteDecorHandle){ @@ -125,16 +134,37 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const //access object from element link const xAOD::CaloClusterContainer* clustercont = ClusterLink.getDataPtr(); + for (const xAOD::CaloCluster* cluster: *clustercont){ - size_t cluster_index=cluster->index(); - if(cluster_index==FEclusterindex){ - // 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 - } // loop over elementlink vector + if(m_UseMuonTopoClusters){ + // get the linker to the topo clusters + std::vector<ElementLink<xAOD::CaloClusterContainer>> linksToTopoClusters=cluster->auxdata<std::vector<ElementLink<xAOD::CaloClusterContainer>> >("constituentClusterLinks"); + for (ElementLink<xAOD::CaloClusterContainer> TopoClusterLink: linksToTopoClusters){ + const xAOD::CaloClusterContainer* MuonTopoClusters=TopoClusterLink.getDataPtr(); + for (const xAOD::CaloCluster* MuonTopoCluster: *MuonTopoClusters){ + size_t MuonTopoCluster_index=MuonTopoCluster->index(); + if(MuonTopoCluster_index==FEclusterindex){ + // 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())); + } // check block of index matching + } // loop over list of topoclusters + } // 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){ + // 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 } // loop over muons NeutralFEmuonWriteDecorHandle(*FE)=FEMuonLinks; } // loop over neutral FE