Skip to content
Snippets Groups Projects
Commit b62d6c71 authored by Steven Schramm's avatar Steven Schramm Committed by Edward Moyse
Browse files

Switching TCC algorithm to use DetectorEta in r22

parent cc7fc71d
No related branches found
No related tags found
7 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!51674Fixing hotSpotInHIST for Run3 HIST,!50012RecExConfig: Adjust log message levels from GetRunNumber and GetLBNumber,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45894Switching TCC algorithm to use DetectorEta in r22
......@@ -4,6 +4,7 @@
#include "TrackParticleClusterAssociationAlg.h"
#include "StoreGate/ReadDecorHandle.h"
#include "StoreGate/WriteDecorHandle.h"
#include "FourMomUtils/P4Helpers.h"
......@@ -12,14 +13,23 @@
TrackParticleClusterAssociationAlg::TrackParticleClusterAssociationAlg(const std::string& name, ISvcLocator* pSvcLocator):
AthAlgorithm(name,pSvcLocator) { }
AthAlgorithm(name,pSvcLocator), m_doDetEta{false} { }
StatusCode TrackParticleClusterAssociationAlg::initialize()
{
if (m_detectorEtaDecor.key().empty())
m_doDetEta = false;
else
{
m_doDetEta = true;
m_detectorEtaDecor = m_caloClusters.key() + "." + m_detectorEtaDecor.key();
}
ATH_CHECK( m_caloExtKey.initialize() );
ATH_CHECK( m_trackParticleCollectionHandle.initialize() );
ATH_CHECK( m_caloClusters.initialize() );
ATH_CHECK( m_detectorEtaDecor.initialize(m_doDetEta) );
ATH_CHECK( m_assocClustersDecor.initialize() );
ATH_CHECK(m_caloEntryParsDecor.initialize( !m_caloEntryParsDecor.empty() ) );
......@@ -51,7 +61,17 @@ 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());
float cl_eta {99};
if (m_doDetEta)
{
SG::ReadDecorHandle<xAOD::CaloClusterContainer, float> detEta(m_detectorEtaDecor);
cl_eta = detEta(*cl);
}
else
cl_eta = cl->eta();
double sigmaWidth = atan(sqrt(rad)/cent)*cosh(cl_eta);
sig_dec(*cl) = sigmaWidth;
}
......@@ -151,7 +171,17 @@ std::vector<const xAOD::CaloCluster* > TrackParticleClusterAssociationAlg::assoc
for(const xAOD::CaloCluster * cl : allClusters){
float dPhi = P4Helpers::deltaPhi( cl->phi(), phi);
float dEta = cl->eta()-eta;
float cl_eta {99};
if (m_doDetEta)
{
SG::ReadDecorHandle<xAOD::CaloClusterContainer, float> detEta(m_detectorEtaDecor);
cl_eta = detEta(*cl);
}
else
cl_eta = cl->eta();
float dEta = cl_eta - eta;
float dr2 = dPhi*dPhi+ dEta*dEta;
float dr2Cut = dr2Cut0;
......
......@@ -8,6 +8,7 @@
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/ReadDecorHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include "StoreGate/WriteDecorHandleKey.h"
......@@ -60,6 +61,11 @@ class TrackParticleClusterAssociationAlg : public AthAlgorithm
SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleCollectionHandle {this,"TrackParticleContainerName", "InDetTrackParticles", "input tracks" };
SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloClusters {this, "CaloClusterLocation", "CaloCalTopoClusters","input calo clusters"};
// Whether or not to use the DetectorEta attribute of the clusters, which is important if the input cluster container has had the origin correction applied
// Default assumes no origin correction, must be configured if desired
SG::ReadDecorHandleKey<xAOD::CaloClusterContainer> m_detectorEtaDecor { this, "DetectorEtaName", "", "Decoration for CaloCluster DetectorEta" };
bool m_doDetEta;
// vertex handling
SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContHandle {this, "VertexContainerName", "", "if empty all tracks will be decorated. if not only those corresponding to the PV[0] will."};
ToolHandle<CP::ITrackVertexAssociationTool> m_trackvertexassoTool {this, "TrackVertexAssoTool", "" };
......
......@@ -104,7 +104,7 @@ def getDecorationKeyFunc(trackParticleName, assocPostfix):
"""Simple helper returning a function to build decoration keys """
return lambda d : trackParticleName+'.'+d+assocPostfix
def setupTrackCaloAssoc(configFlags, caloClusterName="CaloCalTopoClusters",trackParticleName="InDetTrackParticles", assocPostfix = "TCC", onlyPV0Tracks=False):
def setupTrackCaloAssoc(configFlags, caloClusterName="CaloCalTopoClusters",detectorEtaName="default",trackParticleName="InDetTrackParticles", assocPostfix = "TCC", onlyPV0Tracks=False):
""" Schedule a TrackParticleClusterAssociationAlg in the top sequence, taking as input clusters and tracks defined
by the keys caloClusterName and trackParticleName.
......@@ -133,6 +133,7 @@ def setupTrackCaloAssoc(configFlags, caloClusterName="CaloCalTopoClusters",track
PtCut = 400.,
CaloExtensionName = "ParticleCaloExtension",
CaloClusterLocation = caloClusterName,
DetectorEtaName = detectorEtaName if detectorEtaName.lower() != "default" else ("DetectorEta" if "Origin" in caloClusterName else ""),
TrackVertexAssoTool=setupTrackVertexAssocTool(), # will associate trks from PV0 only
VertexContainerName = "PrimaryVertices" if onlyPV0Tracks else "",
AssociatedClusterDecorKey = decorKey("AssoClusters"),
......@@ -144,7 +145,7 @@ def setupTrackCaloAssoc(configFlags, caloClusterName="CaloCalTopoClusters",track
return components
def runTCCReconstruction(configFlags, caloClusterName="CaloCalTopoClusters",trackParticleName="InDetTrackParticles",
def runTCCReconstruction(configFlags, caloClusterName="CaloCalTopoClusters", detectorEtaName = "default", trackParticleName="InDetTrackParticles",
assocPostfix="TCC", doCombined=False, doNeutral=True, doCharged=False, outputTCCName="TrackCaloClusters"):
"""Create a TrackCaloCluster collection from clusters and tracks (caloClusterName and trackParticleName).
Depending on options, the collection contains combined, neutral and/or charged TCC.
......@@ -161,7 +162,7 @@ def runTCCReconstruction(configFlags, caloClusterName="CaloCalTopoClusters",trac
components = ComponentAccumulator()
components.merge(
setupTrackCaloAssoc(configFlags, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=False)
setupTrackCaloAssoc(configFlags, caloClusterName, detectorEtaName, trackParticleName, assocPostfix, onlyPV0Tracks=False)
)
......@@ -242,7 +243,7 @@ def runTCCReconstruction(configFlags, caloClusterName="CaloCalTopoClusters",trac
return components
def runUFOReconstruction( constits, configFlags, caloClusterName="CaloCalTopoClusters", trackParticleName="InDetTrackParticles",
def runUFOReconstruction( constits, configFlags, caloClusterName="CaloCalTopoClusters", detectorEtaName = "default", trackParticleName="InDetTrackParticles",
assocPostfix="TCC", ):
"""Create a TrackCaloCluster collection from PFlow and tracks (PFO retrieved from PFOPrefix and tracks directly from trackParticleName).
This functions schedules 2 UFO specific algs :
......@@ -258,7 +259,7 @@ def runUFOReconstruction( constits, configFlags, caloClusterName="CaloCalTopoClu
components.merge(
setupTrackCaloAssoc(configFlags, caloClusterName, trackParticleName, assocPostfix, onlyPV0Tracks=True)
setupTrackCaloAssoc(configFlags, caloClusterName, detectorEtaName, trackParticleName, assocPostfix, onlyPV0Tracks=True)
)
......
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