Skip to content
Snippets Groups Projects
Commit 9244f5fb authored by Steven Schramm's avatar Steven Schramm Committed by Oana Vickey Boeriu
Browse files

Adding switch for TCC matching using cluster detector eta in r21

parent ca898b90
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -40,6 +40,7 @@ class TrackParticleClusterAssociationAlg : public AthAlgorithm
std::string m_outputPostFix;
std::string m_caloClusters;
std::string m_vertexContname;
bool m_useDetectorEta;
};
......
......@@ -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) {
......
......@@ -76,6 +76,7 @@ namespace Rec {
std::string m_caloEntryMapName;
double m_coneSize;
bool m_useCovariance;
bool m_useDetectorEta;
};
......
......@@ -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>
......
......@@ -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:
......
......@@ -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
}
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