diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index bf6780e54b77664f55577eb354d67adfb6119ea8..e889e232ef30f683c50ffc35f5e0cb7ca9ecffc1 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -250,6 +250,8 @@ if jobproperties.eflowRecFlags.usePFEGammaPFOAssoc: PFEGammaPFOAssoc=PFEGammaPFOAssoc("PFEGammaPFOAssoc") topSequence += PFEGammaPFOAssoc +jobproperties.eflowRecFlags.useFlowElements.set_Value_and_Lock(True) +print("RUN_FE_NOW_PLS") #Add new FlowElement creators if jobproperties.eflowRecFlags.useFlowElements: from eflowRec.eflowRecConf import PFChargedFlowElementCreatorAlgorithm @@ -263,3 +265,7 @@ if jobproperties.eflowRecFlags.useFlowElements: from eflowRec.eflowRecConf import PFLCNeutralFlowElementCreatorAlgorithm PFLCNeutralFlowElementCreatorAlgorithm = PFLCNeutralFlowElementCreatorAlgorithm("PFLCNeutralFlowElementCreatorAlgorithm") topSequence += PFLCNeutralFlowElementCreatorAlgorithm + + from eflowRec.eflowRecConf import PFMuonFlowElementAssoc + PFMuonFlowElementAssoc=PFMuonFlowElementAssoc("PFMuonFlowElementAssocAlgorithm") + topSequence += PFMuonFlowElementAssoc diff --git a/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx b/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx index 09a392d73fdf85be5e90c17bbb001b911da26e5b..d20c0f08b45fea3e239693c312293039cf4d1906 100644 --- a/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx +++ b/Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx @@ -8,9 +8,10 @@ #include "xAODMuon/Muon.h" #include "xAODPFlow/FlowElementContainer.h" #include "xAODPFlow/FlowElement.h" +#include <typeinfo> // temp debug to check object typedef ElementLink<xAOD::MuonContainer> MuonLink_t; -typedef ElementLink<xAOD::FlowElement> FlowElementLink_t; +typedef ElementLink<xAOD::FlowElementContainer> FlowElementLink_t; // // Algorithm created by M.T. Anthony // @@ -55,13 +56,16 @@ StatusCode PFMuonFlowElementAssoc::execute() { // Get container for muons SG::WriteDecorHandle<xAOD::MuonContainer,std::vector<FlowElementLink_t> > muonChargedFEWriteDecorHandle (m_muonChargedFEWriteDecorKey); // get container for charged flow elements - SG::WriteDecorHandle<xAOD::FlowElementContainer,std::vector<MuonLink_t> > ChargedFEmuonWriteDecorHandle (m_ChargedFEmuonWriteDecorHandle); + SG::WriteDecorHandle<xAOD::FlowElementContainer,std::vector<MuonLink_t> > ChargedFEmuonWriteDecorHandle (m_ChargedFEmuonWriteDecorKey); //store readhandles for muon and charged flow elements SG::ReadHandle<xAOD::MuonContainer> muonReadHandle (m_muonChargedFEWriteDecorKey.contHandleKey()); // readhandle for muon SG::ReadHandle<xAOD::FlowElementContainer> ChargedFEReadHandle(m_ChargedFEmuonWriteDecorKey.contHandleKey()); + //now init some Flow element link containers + std::vector<std::vector<FlowElementLink_t> > muonChargedFEVec(muonReadHandle->size()); + //Loop over the Flow Elements ////////////////////////////// @@ -77,21 +81,35 @@ StatusCode PFMuonFlowElementAssoc::execute() { for(const xAOD::Muon* muon: *muonChargedFEWriteDecorHandle){ // retrieve a link to an ID track where possible const ElementLink<xAOD::TrackParticleContainer> muonTrackContLink=muon->inDetTrackParticleLink(); - //catch for case where muon does not contain an ID track - if(muonTrackContLink->size()>0){ - // loop over tracks: should be one element at most - for (xAOD::TrackParticle* muontrack: *muonTrackContLink){ - size_t muontrackindex=muontrack->index(); - if(muontrackindex==FETrackIndex){ - - }//end of matching block - }// end of loop over tracks - }// end of size check on muonTrackContLink + const xAOD::TrackParticleContainer* TrkCont=muonTrackContLink.getDataPtr(); + if(TrkCont->size()>0){ + for(const xAOD::TrackParticle* MuonTrkParticle: *TrkCont){ + size_t MuonTrkIndex=MuonTrkParticle->index(); + if(MuonTrkIndex==FETrackIndex){ + // 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())); + // Add flow element link to a vector + // index() is the unique index of the cFlowElement in the cFlowElementcontaine + muonChargedFEVec.at(muon->index()).push_back(FlowElementLink_t(*ChargedFEReadHandle,FE->index())); + } // matching block + } // TrkCont loop + } // Size check }// end of muon loop - + // Add vector of muon element links as decoration to FlowElement container + ChargedFEmuonWriteDecorHandle(*FE) = feMuonLinks; } // end of charged Flow Element loop + + ////////////////////////////////////////////////// + // WRITE OUTPUT: ADD HANDLES TO MUON CONTAINERS + ////////////////////////////////////////////////// + // Add the vectors of the Flow Element Links as decoations to the muon container + for(const xAOD::Muon* muon: *muonChargedFEWriteDecorHandle){ + muonChargedFEWriteDecorHandle(*muon)=muonChargedFEVec.at(muon->index()); + } // end of muon loop + ATH_MSG_DEBUG("Execute completed successfully"); return StatusCode::SUCCESS; diff --git a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx index 3667e06ebd952faaeb247cbb3c36ba60d78f67af..9cbc83a6b94eacfe156de4ebfb9d3985b9e167b4 100644 --- a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx +++ b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx @@ -20,6 +20,7 @@ #include "eflowRec/PFOChargedCreatorAlgorithm.h" #include "eflowRec/PFONeutralCreatorAlgorithm.h" #include "eflowRec/PFEGammaPFOAssoc.h" +#include "eflowRec/PFMuonFlowElementAssoc.h" DECLARE_COMPONENT( eflowOverlapRemoval ) DECLARE_COMPONENT( PFLeptonSelector ) @@ -43,3 +44,4 @@ DECLARE_COMPONENT( PFTrackClusterMatchingTool ) DECLARE_COMPONENT( eflowCellEOverPTool_mc12_JetETMiss) DECLARE_COMPONENT( eflowCellEOverPTool_mc12_HLLHC) DECLARE_COMPONENT( eflowCellEOverPTool_mc12_LC) +DECLARE_COMPONENT( PFMuonFlowElementAssoc )