ATLAS Offline Software
Functions | Variables
TrackCaloClusterConfig Namespace Reference

Functions

def _unifyPV0onlyTrkClustAssoc (vxContName1, vxContName2)
 
def getDecorationKeyFunc (trackParticleName, assocPostfix)
 
def setupTrackCaloAssoc (flags, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", trackParticleName="InDetTrackParticles", assocPostfix="TCC", onlyPV0Tracks=False)
 
def runTCCReconstruction (flags, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", trackParticleName="InDetTrackParticles", assocPostfix="TCC", doCombined=False, doCharged=False, doNeutral=True, outputTCCName="TrackCaloClusters")
 
def runUFOReconstruction (flags, constits, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", assocPostfix="UFO", inputFEcontainerkey="")
 

Variables

 ufolog = Logging.logging.getLogger('TCCorUFO')
 

Function Documentation

◆ _unifyPV0onlyTrkClustAssoc()

def TrackCaloClusterConfig._unifyPV0onlyTrkClustAssoc (   vxContName1,
  vxContName2 
)
private

Definition at line 11 of file TrackCaloClusterConfig.py.

11 def _unifyPV0onlyTrkClustAssoc( vxContName1, vxContName2):
12  if vxContName2 == vxContName1 : return vxContName1
13  if "" in [vxContName1, vxContName2] : return vxContName1 or vxContName2
14  raise Exception(" Error : incompatible VertexContainerName of 2 instance of TrackParticleClusterAssociationAlg : '{}' and '{}'".format(vxContName1, vxContName2))
15 
16 
17 # we make sure a unique TrackParticleAssociationAlg is well behaved when configured for both TCC and UFOInfo
18 # in the same job. The function below will be used in the de-duplication and implies all tracks (not only PV0)
19 # have associated clusters only if TCC is scheduled.
20 # !! Doesn't seem to work yet ??!!
21 #UnifyProperties.setUnificationFunction( "TrackParticleClusterAssociationAlg.VertexContainerName", _unifyPV0onlyTrkClustAssoc)
22 
23 
24 
25 
26 
27 
28 

◆ getDecorationKeyFunc()

def TrackCaloClusterConfig.getDecorationKeyFunc (   trackParticleName,
  assocPostfix 
)
Simple helper returning a function to build decoration keys 

Definition at line 29 of file TrackCaloClusterConfig.py.

29 def getDecorationKeyFunc(trackParticleName, assocPostfix):
30  """Simple helper returning a function to build decoration keys """
31  return lambda d : trackParticleName+'.'+d+assocPostfix
32 

◆ runTCCReconstruction()

def TrackCaloClusterConfig.runTCCReconstruction (   flags,
  caloClusterName = "CaloCalTopoClusters",
  detectorEtaName = "default",
  trackParticleName = "InDetTrackParticles",
  assocPostfix = "TCC",
  doCombined = False,
  doCharged = False,
  doNeutral = True,
  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.
This functions schedules 2 TCC specific algs :
   * a TrackCaloClusterInfoAlg to build the TrackCaloClusterInfo object
   * a TrackCaloClusterAlg to build the TCC

Definition at line 80 of file TrackCaloClusterConfig.py.

80 def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorEtaName = "default", trackParticleName="InDetTrackParticles",
81  assocPostfix="TCC", doCombined=False, doCharged=False, doNeutral=True, outputTCCName="TrackCaloClusters"):
82  """
83  Create a TrackCaloCluster collection from clusters and tracks (caloClusterName and trackParticleName).
84  Depending on options, the collection contains combined, neutral and/or charged TCC.
85  This functions schedules 2 TCC specific algs :
86  * a TrackCaloClusterInfoAlg to build the TrackCaloClusterInfo object
87  * a TrackCaloClusterAlg to build the TCC
88  """
89 
90  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
91 
92  decorKey = getDecorationKeyFunc(trackParticleName,assocPostfix)
93 
94  components = ComponentAccumulator()
95 
96  components.merge(
97  setupTrackCaloAssoc(flags, caloClusterName, detectorEtaName, trackParticleName, assocPostfix, onlyPV0Tracks=False)
98  )
99 
100 
102  tccInfoAlg = CompFactory.TrackCaloClusterInfoAlg(
103  "TCCInfoAlg",
104  TCCInfoName = "TCCInfo",
105  InputTracks = trackParticleName,
106  InputClusters = caloClusterName,
107  VertexContainer = "PrimaryVertices",
108  AssoClustersDecor = decorKey("AssoClusters"),
109  )
110 
111  components.addEventAlgo( tccInfoAlg)
112 
113 
116  tccTools = []
117 
118  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import TTVAToolCfg
119  commonArgs=dict(
120  TrackVertexAssoTool = components.popToolsAndMerge(
121  TTVAToolCfg(flags,"tvaTool",WorkingPoint="Nonprompt_All_MaxWeight")),
122  AssoClustersDecor=decorKey("AssoClusters"),
123  )
124 
125  if doCombined:
126  tccCombined = CompFactory.TCCCombinedTool("TCCcombined", **commonArgs)
127  tccTools.append(tccCombined)
128  if doCharged:
129  tccCharged = CompFactory.TCCChargedTool("TCCCharged", **commonArgs )
130  tccTools.append(tccCharged)
131  if doNeutral:
132  tccNeutral = CompFactory.TCCNeutralTool("TCCNeutral", **commonArgs )
133  tccTools.append(tccNeutral)
134 
135  tccAlg = CompFactory.TrackCaloClusterAlg(name = "TrackCaloClusterAlg",
136  OutputTCCName = outputTCCName,
137  TCCInfo = "TCCInfo",
138  TCCTools = tccTools,
139  )
140 
141  components.addEventAlgo(tccAlg)
142 
143  return components
144 
145 

◆ runUFOReconstruction()

def TrackCaloClusterConfig.runUFOReconstruction (   flags,
  constits,
  caloClusterName = "CaloCalTopoClusters",
  detectorEtaName = "default",
  assocPostfix = "UFO",
  inputFEcontainerkey = "" 
)
Create a UFO collection from PFlow and tracks (PFO retrieved from PFOPrefix and tracks directly from trackParticleName). 
This functions schedules 2 UFO specific algs : 
   * a TrackCaloClusterInfoUFOAlg to build the TrackCaloClusterInfo object
   * a TrackCaloClusterAlg to build the UFO

Definition at line 146 of file TrackCaloClusterConfig.py.

146 def runUFOReconstruction(flags, constits, caloClusterName="CaloCalTopoClusters", detectorEtaName = "default", assocPostfix="UFO", inputFEcontainerkey=""):
147 
148  """Create a UFO collection from PFlow and tracks (PFO retrieved from PFOPrefix and tracks directly from trackParticleName).
149  This functions schedules 2 UFO specific algs :
150  * a TrackCaloClusterInfoUFOAlg to build the TrackCaloClusterInfo object
151  * a TrackCaloClusterAlg to build the UFO
152  """
153  from JetRecConfig.JetDefinition import JetDefinition
154  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
155  components=ComponentAccumulator()
156 
157  if isinstance(constits, JetDefinition):
158  jdef = constits
159  constits = jdef.inputdef
160  trackParticleName = jdef._contextDic['Tracks'] # defaults to "InDetTrackParticles"
161  else:
162  trackParticleName = "InDetTrackParticles"
163 
164  pfoVariant= constits.label.split("PFlow")[-1] # We expect label to be EMPFlowXYZ or LCPFlowXYZ -> extrat XYZ
165 
166  decorKey = getDecorationKeyFunc(trackParticleName,assocPostfix)
167 
168 
169 
170  components.merge(
171  setupTrackCaloAssoc(flags, caloClusterName, detectorEtaName, trackParticleName, assocPostfix, onlyPV0Tracks=False) #onlyPV0Tracks True was original option
172  )
173 
174 
175  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import TTVAToolCfg
176  commonArgs=dict(
177  TrackVertexAssoTool = components.popToolsAndMerge(
178  TTVAToolCfg(flags,"tvaTool",WorkingPoint="Nonprompt_All_MaxWeight")),
179  AssoClustersDecor=decorKey("AssoClusters"),
180  )
181 
182 
183  inputFEcontainerkey = inputFEcontainerkey or constits.containername
184 
185 
186  UFOInfoAlg = CompFactory.TrackCaloClusterInfoUFOAlg(f"UFOInfoAlg{pfoVariant}",
187  TCCInfoName = pfoVariant+"UFOInfo",
188  InputTracks = trackParticleName,
189  InputClusters = caloClusterName,
190  VertexContainer = "PrimaryVertices",
191  InputPFO=inputFEcontainerkey,
192  OriginPFO='originalObjectLink',
193  ClusterECut = 0.,
194  **commonArgs
195  )
196 
197 
198  components.addEventAlgo( UFOInfoAlg)
199 
200  tccUFO = CompFactory.UFOTool(f"UFOtool{pfoVariant}",
201  ClusterECut = UFOInfoAlg.ClusterECut,
202  InputPFO=inputFEcontainerkey,
203  OriginPFO='originalObjectLink',
204  **commonArgs
205  )
206 
207  UFOAlg = CompFactory.TrackCaloClusterAlg(name = f"TrackCaloClusterAlgUFO{pfoVariant}",
208  OutputTCCName = f"UFO{pfoVariant}",
209  TCCInfo = UFOInfoAlg.TCCInfoName ,
210  TCCTools = [tccUFO,],
211  )
212 
213 
214 
215  components.addEventAlgo( UFOAlg)
216  return components

◆ setupTrackCaloAssoc()

def TrackCaloClusterConfig.setupTrackCaloAssoc (   flags,
  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.

onlyPV0Tracks : calculate associated clusters only for PV0 tracks. Avoids unnecessary calculation (used in the UFO case).
   (IMPORTANT CaloExtensionBuilderAlg does extrapolate all tracks : if too much time consuming, it needs a new option to mask non-PV0 tracks)

Definition at line 33 of file TrackCaloClusterConfig.py.

33 def setupTrackCaloAssoc(flags, caloClusterName="CaloCalTopoClusters",detectorEtaName="default",trackParticleName="InDetTrackParticles", assocPostfix = "TCC", onlyPV0Tracks=False):
34  """ Schedule a TrackParticleClusterAssociationAlg in the top sequence, taking as input clusters and tracks defined
35  by the keys caloClusterName and trackParticleName.
36 
37  onlyPV0Tracks : calculate associated clusters only for PV0 tracks. Avoids unnecessary calculation (used in the UFO case).
38  (IMPORTANT CaloExtensionBuilderAlg does extrapolate all tracks : if too much time consuming, it needs a new option to mask non-PV0 tracks)
39  """
40 
41 
42 
43  decorKey = getDecorationKeyFunc(trackParticleName,assocPostfix)
44 
45  components = ComponentAccumulator()
46 
47  from TrackToCalo.CaloExtensionBuilderAlgCfg import CaloExtensionBuilderAlgCfg
48  caloExtAlg =CaloExtensionBuilderAlgCfg( flags )
49  caloExtAlg.TrkPartContainerName = trackParticleName
50 
51  components.merge(caloExtAlg) #since its a stack of algorithms
52 
53  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import TTVAToolCfg
54  TrackVertexAssoTool = components.popToolsAndMerge(
55  TTVAToolCfg(flags, "tvaTool", WorkingPoint="Nonprompt_All_MaxWeight"))
56 
57  trackParticleClusterAssociation = CompFactory.TrackParticleClusterAssociationAlg(
58  "TrackParticleClusterAssociationAlg"+assocPostfix,
59  #ParticleCaloClusterAssociationTool = particleCaloClusterAssociation,
60  TrackParticleContainerName = trackParticleName,
61  PtCut = 400.,
62  CaloExtensionName = (caloExtAlg.getEventAlgos()[0]).ParticleCache, # ParticleCache is a defunct attribute
63  CaloClusterLocation = caloClusterName,
64  DetectorEtaName = detectorEtaName if detectorEtaName.lower() != "default" else ("DetectorEta" if "Origin" in caloClusterName else ""),
65  TrackVertexAssoTool=TrackVertexAssoTool, # will associate trks from PV0 only
66  VertexContainerName = "PrimaryVertices" if onlyPV0Tracks else "",
67  #VertexContainerName = "PrimaryVertices" if onlyPV0Tracks else "TTVA_AMVFVertices",
68  AssociatedClusterDecorKey = decorKey("AssoClusters"),
69  UseCovariance = flags.UFO.UseCov,
70  DeltaR = flags.UFO.dR,
71 # OutputLevel=2
72  )
73 
74 
75  components.addEventAlgo( trackParticleClusterAssociation )
76  return components
77 
78 
79 

Variable Documentation

◆ ufolog

TrackCaloClusterConfig.ufolog = Logging.logging.getLogger('TCCorUFO')

Definition at line 5 of file TrackCaloClusterConfig.py.

python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
TrackVertexAssociationToolConfig.TTVAToolCfg
def TTVAToolCfg(flags, name, addDecoAlg=True, VertexContName="PrimaryVertices", **kwargs)
Definition: TrackVertexAssociationToolConfig.py:15
TrackCaloClusterConfig.getDecorationKeyFunc
def getDecorationKeyFunc(trackParticleName, assocPostfix)
Definition: TrackCaloClusterConfig.py:29
TrackCaloClusterConfig.setupTrackCaloAssoc
def setupTrackCaloAssoc(flags, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", trackParticleName="InDetTrackParticles", assocPostfix="TCC", onlyPV0Tracks=False)
Definition: TrackCaloClusterConfig.py:33
CaloExtensionBuilderAlgCfg
Definition: CaloExtensionBuilderAlgCfg.py:1
TrackCaloClusterConfig.runUFOReconstruction
def runUFOReconstruction(flags, constits, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", assocPostfix="UFO", inputFEcontainerkey="")
Definition: TrackCaloClusterConfig.py:146
TrackCaloClusterConfig.runTCCReconstruction
def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", trackParticleName="InDetTrackParticles", assocPostfix="TCC", doCombined=False, doCharged=False, doNeutral=True, outputTCCName="TrackCaloClusters")
Definition: TrackCaloClusterConfig.py:80
TrackCaloClusterConfig._unifyPV0onlyTrkClustAssoc
def _unifyPV0onlyTrkClustAssoc(vxContName1, vxContName2)
Definition: TrackCaloClusterConfig.py:11