ATLAS Offline Software
SCTVALID.py
Go to the documentation of this file.
1 
3 
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from AthenaConfiguration.Enums import MetadataCategory
7 from AthenaCommon.CFElements import seqAND
8 from AthenaCommon.Constants import INFO
9 
10 def SCTVALIDKernelCfg(flags, name='SCTVALIDKernel', **kwargs):
11  """Configure the derivation framework driving algorithm (kernel) for SCTVALID"""
12  acc = ComponentAccumulator()
13 
14 
17  skimmingTools = []
18 
19  SCTVALIDSequenceName='SCTVALIDSequence'
20  acc.addSequence(seqAND(SCTVALIDSequenceName))
21 
22  # Applying prescales
23  # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/DerivationFramework#Applying_prescales
24 
25  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import PrescaleToolCfg
26 
27  prescaleTool = acc.getPrimaryAndMerge(PrescaleToolCfg(
28  flags, name="SCTxAOD_PrescaleTool", Prescale=flags.InDet.SCTxAODPrescale))
29 
30  skimmingTools += [prescaleTool]
31 
32  SCTVALIDKernelPresel = CompFactory.DerivationFramework.DerivationKernel("SCTVALIDKernelPresel",
33  SkimmingTools=skimmingTools)
34  acc.addEventAlgo(SCTVALIDKernelPresel, sequenceName="SCTVALIDSequence")
35 
36  from InDetConfig.InDetPrepRawDataToxAODConfig import InDetSCT_PrepDataToxAODCfg
37  acc.merge(InDetSCT_PrepDataToxAODCfg(flags,name="xAOD_SCT_PrepDataToxAOD",
38  OutputLevel=INFO,
39  WriteRDOinformation=True, # TO CHECK
40  WriteSiHits=False,
41  WriteSDOs=False,
42  UseTruthInfo=flags.Input.isMC),
43  sequenceName=SCTVALIDSequenceName)
44 
45 
46  from InDetConfig.InDetPrepRawDataToxAODConfig import InDetSCT_RawDataToxAODCfg
47  acc.merge(InDetSCT_RawDataToxAODCfg(flags, name = "xAOD_SCT_RawDataToxAOD"),
48  sequenceName=SCTVALIDSequenceName)
49 
50  # Add the TSOS augmentation tool to the derivation framework
51  augmentationTools=[]
52 
53  if flags.Reco.EnableTracking is True:
54  from DerivationFrameworkInDet.InDetToolsConfig import TrackStateOnSurfaceDecoratorCfg
55  DFTSOS = acc.getPrimaryAndMerge(TrackStateOnSurfaceDecoratorCfg(flags, name="SCTVALID_DFTrackStateOnSurfaceDecorator",
56  DecorationPrefix = "SCTVALID_",
57  StoreTRT=True,
58  StoreSCT=True,
59  StorePixel=True,
60  PRDtoTrackMap="")
61  )
62  augmentationTools.append(DFTSOS)
63 
64  from DerivationFrameworkInDet.InDetToolsConfig import EventInfoBSErrDecoratorCfg
65  DFEI = acc.getPrimaryAndMerge(EventInfoBSErrDecoratorCfg(flags, name = "SCTxAOD_DFEventInfoBSErrDecorator"))
66  augmentationTools.append(DFEI)
67 
68  from DerivationFrameworkInDet.InDetToolsConfig import UnassociatedHitsGetterToolCfg
69  unassociatedHitsGetterTool = acc.popToolsAndMerge(UnassociatedHitsGetterToolCfg(flags, name="SCTVALID_UnassociatedHitsGetterTool",
70  TrackCollection = "CombinedInDetTracks",
71  PixelClusters = "PixelClusters",
72  SCTClusterContainer = "SCT_Clusters",
73  TRTDriftCircleContainer = "TRT_DriftCircles"))
74 
75  from DerivationFrameworkJetEtMiss.JetToolConfig import DistanceInTrainToolCfg
76  distanceInTrainTool = acc.getPrimaryAndMerge(DistanceInTrainToolCfg(flags))
77  augmentationTools.append(distanceInTrainTool)
78 
79  from DerivationFrameworkInDet.InDetToolsConfig import UnassociatedHitsDecoratorCfg
80  unassociatedHitsDecorator = acc.getPrimaryAndMerge(UnassociatedHitsDecoratorCfg(flags,
81  name='SCTxAOD_unassociatedHitsDecorator',
82  UnassociatedHitsGetter = unassociatedHitsGetterTool))
83  augmentationTools.append(unassociatedHitsDecorator)
84 
85  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
86  name,
87  AugmentationTools=augmentationTools,
88  SkimmingTools=skimmingTools,
89  ThinningTools=[],
90  OutputLevel=INFO), sequenceName=SCTVALIDSequenceName)
91  return acc
92 
93 # Main config
94 def SCTVALIDCfg(flags):
95  """Main config fragment for SCTVALID"""
96  acc = ComponentAccumulator()
97 
98  # Main algorithm (kernel)
99  acc.merge(SCTVALIDKernelCfg(flags,
100  name = "SCTVALIDKernel",
101  StreamName = 'StreamDAOD_SCTVALID') )
102 
103  # =============================
104  # Define contents of the format
105  # =============================
106  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
107  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
108  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
109  SCTVALIDSlimmingHelper = SlimmingHelper(
110  "SCTVALIDSlimmingHelper",
111  NamesAndTypes = flags.Input.TypedCollections,
112  flags = flags
113  )
114 
115  AllVariables = []
116  StaticContent = []
117  SmartCollections = []
118  ExtraVariables = []
119 
120  SCTVALIDSlimmingHelper.AppendToDictionary.update({
121  "EventInfo": "xAOD::EventInfo", "EventInfoAux": "xAOD::EventAuxInfo",
122  "Muons": "xAOD::MuonContainer", "MuonsAux": "xAOD::MuonAuxContainer",
123  "Electrons": "xAOD::ElectronContainer", "ElectronsAux": "xAOD::ElectronAuxContainer",
124  "GSFTrackParticles": "xAOD::TrackParticleContainer",
125  "GSFTrackParticlesAux": "xAOD::TrackParticleAuxContainer",
126 
127  })
128 
129  AllVariables += ["EventInfo", "InDetTrackParticles",]
130  SmartCollections += ["Muons", "Electrons"]
131 
132  excludedPrimaryVerticesAuxData = "-VTAV"
133  excludedInDetTrackParticlesAuxData = ".-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
134  excludedGSFTrackParticlesAuxData = ".-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
135 
136  StaticContent = []
137  StaticContent += ["xAOD::VertexContainer#PrimaryVertices"]
138  StaticContent += ["xAOD::VertexAuxContainer#PrimaryVerticesAux" + excludedPrimaryVerticesAuxData]
139  StaticContent += ["xAOD::TrackParticleContainer#InDetTrackParticles"]
140  StaticContent += ["xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux" + excludedInDetTrackParticlesAuxData]
141  StaticContent += ["xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux"]
142 
143  StaticContent += ["xAOD::TrackParticleContainer#GSFTrackParticles"]
144  StaticContent += ["xAOD::TrackParticleAuxContainer#GSFTrackParticlesAux" + excludedGSFTrackParticlesAuxData]
145 
146 
147  StaticContent += ["TileCellContainer#MBTSContainer"]
148  StaticContent += ["BCM_RDOs#BCM_RDO_Container"]
149 
150  SCTVALIDSlimmingHelper.AppendToDictionary.update(
151  {
152  "SCT_MSOSs": "xAOD::TrackStateValidationContainer",
153  "SCT_MSOSsAux": "xAOD::TrackStateValidationAuxContainer",
154  "SCT_Clusters": "xAOD::TrackMeasurementValidationContainer",
155  "SCT_ClustersAux": "xAOD::TrackMeasurementValidationAuxContainer",
156  "SCT_RawHits": "xAOD::SCTRawHitValidationContainer",
157  "SCT_RawHitsAux": "xAOD::SCTRawHitValidationAuxContainer"})
158 
159  AllVariables += [
160  "SCT_MSOSs",
161  "SCT_Clusters",
162  "SCT_RawHits",
163  "SCT_RawHitsAux"]
164 
165  if flags.Input.isMC:
166 
167  SCTVALIDSlimmingHelper.AppendToDictionary.update({
168  "TruthEvents": "xAOD::TruthEventContainer",
169  "TruthEventsAux": "xAOD::TruthEventAuxContainer",
170  "TruthParticles": "xAOD::TruthParticleContainer",
171  "TruthParticlesAux": "xAOD::TruthParticleAuxContainer",
172  "TruthVertices": "xAOD::TruthVertexContainer",
173  "TruthVerticesAux": "xAOD::TruthVertexAuxContainer"})
174 
175  AllVariables += ["TruthEvents", "TruthParticles", "TruthVertices"]
176 
177  # Trigger info is actually stored only when running on data...
178  SCTVALIDSlimmingHelper.IncludeTriggerNavigation = True
179  SCTVALIDSlimmingHelper.IncludeAdditionalTriggerContent = True
180 
181  SCTVALIDSlimmingHelper.AllVariables = AllVariables
182  SCTVALIDSlimmingHelper.StaticContent = StaticContent
183  SCTVALIDSlimmingHelper.SmartCollections = SmartCollections
184  SCTVALIDSlimmingHelper.ExtraVariables = ExtraVariables
185 
186  # Output stream
187  SCTVALIDItemList = SCTVALIDSlimmingHelper.GetItemList()
188  acc.merge(OutputStreamCfg(flags, "DAOD_SCTVALID",
189  ItemList=SCTVALIDItemList, AcceptAlgs=["SCTVALIDKernel"]))
190  acc.merge(SetupMetaDataForStreamCfg(
191  flags, "DAOD_SCTVALID",
192  AcceptAlgs=["SCTVALIDKernel"],
193  createMetadata=[MetadataCategory.CutFlowMetaData,
194  MetadataCategory.TriggerMenuMetaData]))
195 
196  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.InDetToolsConfig.UnassociatedHitsGetterToolCfg
def UnassociatedHitsGetterToolCfg(flags, name="UnassociatedHitsGetterTool", **kwargs)
Definition: InDetToolsConfig.py:651
python.InDetToolsConfig.UnassociatedHitsDecoratorCfg
def UnassociatedHitsDecoratorCfg(flags, name="UnassociatedHitsDecorator", **kwargs)
Definition: InDetToolsConfig.py:665
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.SCTVALID.SCTVALIDCfg
def SCTVALIDCfg(flags)
Definition: SCTVALID.py:94
Constants
some useful constants -------------------------------------------------—
python.JetToolConfig.DistanceInTrainToolCfg
def DistanceInTrainToolCfg(ConfigFlags)
Definition: JetToolConfig.py:13
python.InDetToolsConfig.EventInfoBSErrDecoratorCfg
def EventInfoBSErrDecoratorCfg(flags, name="EventInfoBSErrDecorator", **kwargs)
Definition: InDetToolsConfig.py:644
python.InDetPrepRawDataToxAODConfig.InDetSCT_RawDataToxAODCfg
def InDetSCT_RawDataToxAODCfg(flags, name='InDetSCTRawDataToxAOD', **kwargs)
Definition: InDetPrepRawDataToxAODConfig.py:130
python.InDetToolsConfig.TrackStateOnSurfaceDecoratorCfg
def TrackStateOnSurfaceDecoratorCfg(flags, name, **kwargs)
Definition: InDetToolsConfig.py:62
python.InDetPrepRawDataToxAODConfig.InDetSCT_PrepDataToxAODCfg
def InDetSCT_PrepDataToxAODCfg(flags, name='InDetSCTPrepDataToxAOD', **kwargs)
Definition: InDetPrepRawDataToxAODConfig.py:118
python.SCTVALID.SCTVALIDKernelCfg
def SCTVALIDKernelCfg(flags, name='SCTVALIDKernel', **kwargs)
Definition: SCTVALID.py:10
python.DerivationFrameworkToolsConfig.PrescaleToolCfg
def PrescaleToolCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:50
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1