diff --git a/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.cxx b/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.cxx index 27db49b0f5f807f4cbcf0595024745a1e519c318..43237978149088a6a146fc36a433737fffa145f8 100644 --- a/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.cxx +++ b/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.cxx @@ -32,6 +32,7 @@ TrackParticleClusterAssociationAlg::TrackParticleClusterAssociationAlg(const std declareProperty("TrackVertexAssoTool" , m_trackvertexassoTool); declareProperty("VertexContainerName", m_vertexContname ); + declareProperty("UseDetectorEta", m_useDetectorEta = false); } TrackParticleClusterAssociationAlg::~TrackParticleClusterAssociationAlg() @@ -66,7 +67,14 @@ StatusCode TrackParticleClusterAssociationAlg::execute() cl->retrieveMoment(xAOD::CaloCluster::SECOND_R,rad); double cent; cl->retrieveMoment(xAOD::CaloCluster::CENTER_MAG,cent); - double sigmaWidth = atan(sqrt(rad)/cent)*cosh(cl->eta()); + double cleta = cl->eta(); + if (m_useDetectorEta) + { + static SG::AuxElement::ConstAccessor<float> acc_det_eta ("DetectorEta"); + if (acc_det_eta.isAvailable(*cl)) + cleta = acc_det_eta(*cl); + } + double sigmaWidth = atan(sqrt(rad)/cent)*cosh(cleta); sig_dec(*cl) = sigmaWidth; } diff --git a/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.h b/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.h index 921d5f792a7693f6c6b026beee1c963c50ea0d4f..458e2f98a380e88f9b7c41b5f934566aede0bff3 100644 --- a/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.h +++ b/Reconstruction/RecoAlgs/TrackParticleAssociationAlgs/src/TrackParticleClusterAssociationAlg.h @@ -40,6 +40,7 @@ class TrackParticleClusterAssociationAlg : public AthAlgorithm std::string m_outputPostFix; std::string m_caloClusters; std::string m_vertexContname; + bool m_useDetectorEta; }; diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx index d058405d658bafb8b7ec0a70940e0873b774cd72..6c3bd3707d76f0052b02da794a961bc6047ac76d 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx @@ -34,6 +34,7 @@ namespace Rec { //coneSize for including calo cells around track declareProperty("ConeSize", m_coneSize = 0.1); declareProperty("UseCovariance", m_useCovariance = true); + declareProperty("UseDetectorEta", m_useDetectorEta = false); } ParticleCaloClusterAssociationTool::~ParticleCaloClusterAssociationTool() {} @@ -146,6 +147,12 @@ namespace Rec { const xAOD::CaloCluster *cl = (*container)[i]; float dPhi = P4Helpers::deltaPhi( cl->phi(), phi); float dEta = cl->eta()-eta; + if (m_useDetectorEta) + { + static SG::AuxElement::ConstAccessor<float> acc_det_eta ("DetectorEta"); + if (acc_det_eta.isAvailable(*cl)) + dEta = acc_det_eta(*cl) - eta; + } float dr2 = dPhi*dPhi+ dEta*dEta; if(m_useCovariance) { diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.h b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.h index 6d9b15a6d1a104430205a6e33098ea5db15ba5de..b1c4d0676adb2fffda6d2748269ee6c88490e484 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.h +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.h @@ -76,6 +76,7 @@ namespace Rec { std::string m_caloEntryMapName; double m_coneSize; bool m_useCovariance; + bool m_useDetectorEta; }; diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/TrackCaloClusterRecTools/ClusterFilterTool.h b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/TrackCaloClusterRecTools/ClusterFilterTool.h index bdfce42dc2d2c1b84aed0ba06365fbd260965aa9..6d4b8eb08b777cea54cd4b09888ed842fe73c24e 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/TrackCaloClusterRecTools/ClusterFilterTool.h +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/TrackCaloClusterRecTools/ClusterFilterTool.h @@ -52,6 +52,9 @@ class ClusterFilterTool : virtual public IClusterFilterTool, public AthAlgTool { // pt fraction at PV0 double m_ptFractionPV0; + // Whether or not to use detector eta when matching tracks to clusters + bool m_useDetectorEta; + }; template<class T> diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py index 9fad316d0227f7c7eb4ac589784d7c52b8ed3de6..96ea45a3c90903b68e6bf0c0d94c44b9410eaf40 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py @@ -6,7 +6,7 @@ def associateAllTracks(trkClustAssocAlg): trkClustAssocAlg.TrackVertexAssoTool = "" trkClustAssocAlg.VertexContainerName = "" -def setupTrackCaloAssoc(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",trackParticleName="InDetTrackParticles", assocPostfix = "TCC", onlyPV0Tracks=False): +def setupTrackCaloAssoc(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",trackParticleName="InDetTrackParticles", assocPostfix = "TCC", onlyPV0Tracks=False, matchUsingDetectorEta=False): """ Schedule a TrackParticleClusterAssociationAlg in the top sequence, taking as input clusters and tracks defined by the keys caloClusterName and trackParticleName. @@ -38,7 +38,8 @@ def setupTrackCaloAssoc(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",t CaloClusterLocation = caloClusterName, ClustersInConeTool = caloClustersInCone, ConeSize = 0.1, - UseCovariance = True) + UseCovariance = True, + UseDetectorEta = matchUsingDetectorEta) ToolSvc+=particleCaloClusterAssociation print particleCaloClusterAssociation @@ -56,7 +57,8 @@ def setupTrackCaloAssoc(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",t OutputCollectionPostFix = assocPostfix, CaloClusterLocation = caloClusterName, TrackVertexAssoTool=ToolSvc.LooseTrackVertexAssociationTool, # will associate trks from PV0 only - VertexContainerName ="PrimaryVertices",) + VertexContainerName ="PrimaryVertices", + UseDetectorEta = matchUsingDetectorEta) if not onlyPV0Tracks: associateAllTracks( trackParticleClusterAssociation) # this removes the vtx selection tool.see above. @@ -66,7 +68,7 @@ def setupTrackCaloAssoc(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",t def runTCCReconstruction(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters",trackParticleName="InDetTrackParticles", - assocPostfix="TCC", doCombined=True, doNeutral=True, doCharged=False, outputTCCName="TrackCaloClusters"): + assocPostfix="TCC", doCombined=True, doNeutral=True, doCharged=False, outputTCCName="TrackCaloClusters", matchUsingDetectorEta=False): """Create a TrackCaloCluster collection from clusters and tracks (caloClusterName and trackParticleName). Depending on options, the collection contains combined, neutral and/or charged TCC. This functions schedules 2 algs : @@ -84,7 +86,7 @@ def runTCCReconstruction(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters", if not hasattr(sequence, "TrackClusterAssociationAlg"+assocPostfix): # make sure we run the TrackClusterAssociationAlg - setupTrackCaloAssoc(sequence, ToolSvc, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=False) + setupTrackCaloAssoc(sequence, ToolSvc, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=False, matchUsingDetectorEta=matchUsingDetectorEta) else: # make sure we use the same CaloCluster container as the TrackClusterAssociationAlg alg = getattr(sequence, "TrackClusterAssociationAlg"+assocPostfix) if alg.CaloClusterLocation != caloClusterName: @@ -134,7 +136,7 @@ def runTCCReconstruction(sequence,ToolSvc,caloClusterName="CaloCalTopoClusters", def runUFOReconstruction(sequence,ToolSvc, PFOPrefix="CSSK", caloClusterName="CaloCalTopoClusters", trackParticleName="InDetTrackParticles", - assocPostfix="TCC", ): + assocPostfix="TCC", matchUsingDetectorEta=False): """Create a TrackCaloCluster collection from PFlow and tracks (PFO retrieved from PFOPrefix and tracks directly from trackParticleName). This functions schedules 2 algs : * a TrackCaloClusterInfoUFOAlg to build the TrackCaloClusterInfo object @@ -147,7 +149,7 @@ def runUFOReconstruction(sequence,ToolSvc, PFOPrefix="CSSK", caloClusterName="Ca return getattr(sequence, "TrackCaloClusterAlgUFO"+PFOPrefix) if not hasattr(sequence, "TrackClusterAssociationAlg"+assocPostfix): - setupTrackCaloAssoc(sequence, ToolSvc, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=True) + setupTrackCaloAssoc(sequence, ToolSvc, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=True, matchUsingDetectorEta=matchUsingDetectorEta) else: # make sure we use the same CaloCluster container as the TrackClusterAssociationAlg alg = getattr(sequence, "TrackClusterAssociationAlg"+assocPostfix) if alg.CaloClusterLocation != caloClusterName: diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/src/ClusterFilterTool.cxx b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/src/ClusterFilterTool.cxx index c779bf1fc0438dd3d58e63d30484f9650e2f4686..5ca22fad0b2a5ed7a39621bd4663f8c1e7cb449e 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/src/ClusterFilterTool.cxx +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/src/ClusterFilterTool.cxx @@ -22,6 +22,7 @@ ClusterFilterTool::ClusterFilterTool(const std::string& t, const std::string& n, declareProperty("VertexCollection", m_vertexCollectionName = "PrimaryVertices" ); declareProperty("ConeSize", m_coneSize = 0.2 ); declareProperty("PtFractionAtPV0", m_ptFractionPV0 = 0.1 ); + declareProperty("UseDetectorEta", m_useDetectorEta = false ); } ClusterFilterTool::~ClusterFilterTool() {} @@ -74,6 +75,12 @@ bool ClusterFilterTool::rejectCluster(const xAOD::CaloCluster& cluster) { float dPhi = P4Helpers::deltaPhi( cluster.phi(), phi); float dEta = cluster.eta()-eta; + if (m_useDetectorEta) + { + static SG::AuxElement::ConstAccessor<float> acc_det_eta("DetectorEta"); + if (acc_det_eta.isAvailable(cluster)) + dEta = acc_det_eta(cluster)-eta; + } float dr2 = dPhi*dPhi+ dEta*dEta; // check if the track is matching the cluster @@ -96,4 +103,4 @@ bool ClusterFilterTool::rejectCluster(const xAOD::CaloCluster& cluster) { return false; -} \ No newline at end of file +}