From a3a66632e267d3ebca9423fb53a80cbc2e2410ae Mon Sep 17 00:00:00 2001 From: Susumu Oda <Susumu.Oda@cern.ch> Date: Wed, 13 Apr 2016 16:10:36 +0200 Subject: [PATCH] Changed the order of algorithms to run RDO/PRD to xAOD tools only events are accepeted. (InDetPrepRawDataToxAOD-00-01-37) * Changed the order of algorithms to run RDO/PRD to xAOD tools only events are accepeted. * Tagging as InDetPrepRawDataToxAOD-00-01-37 2016-04-12 Susumu Oda <Susumu.Oda@cern.ch> * Changed names of algorithms and tools in share/SCTxAOD.py to avoid coflict with share/InDetDxAOD.py. * Move the prescale tool in share/SCTxAOD.py to preselection. * Tagging as InDetPrepRawDataToxAOD-00-01-36 2016-04-12 Susumu Oda <Susumu.Oda@cern.ch> * Add a prescale factor for reduction file size to share/SCTxAOD.py. * Add python/SCTxAODJobProperties.py to configure the prescale factor. * Tagging as InDetPrepRawDataToxAOD-00-01-35 2016-03-17 Kilian Rosbach <Kilian.Rosbach@cern.ch> * Testing changes related to ATLASRECTS-2860 from yesterday * Tagging as InDetPrepRawDataToxAOD-00-01-34 2016-03-16 Simon Viel ... (Long ChangeLog diff - truncated) --- .../InDetPrepRawDataToxAOD/CMakeLists.txt | 41 +++++ .../InDetPrepRawDataToxAOD/cmt/requirements | 1 + .../python/InDetDxAODJobProperties.py | 142 ++++++++++++++++++ .../python/SCTxAODJobProperties.py | 28 ++++ .../share/InDetDxAOD.py | 56 ++++--- .../InDetPrepRawDataToxAOD/share/SCTxAOD.py | 51 +++++-- .../src/SCT_PrepDataToxAOD.cxx | 2 +- .../src/SCT_RawDataToxAOD.cxx | 82 ++++++++++ .../src/SCT_RawDataToxAOD.h | 36 +++++ .../InDetPrepRawDataToxAOD_entries.cxx | 3 + 10 files changed, 407 insertions(+), 35 deletions(-) create mode 100644 InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt create mode 100644 InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py create mode 100644 InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/SCTxAODJobProperties.py create mode 100644 InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.cxx create mode 100644 InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.h diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt new file mode 100644 index 00000000000..558ef445de7 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################################################ +# Package: InDetPrepRawDataToxAOD +################################################################################ + +# Declare the package name: +atlas_subdir( InDetPrepRawDataToxAOD ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + GaudiKernel + PRIVATE + Control/AthenaBaseComps + DetectorDescription/Identifier + Event/xAOD/xAODTracking + InnerDetector/InDetConditions/TRT_ConditionsServices + InnerDetector/InDetDetDescr/InDetIdentifier + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetRawEvent/InDetRawData + InnerDetector/InDetRawEvent/InDetSimData + InnerDetector/InDetRecEvent/InDetPrepRawData + InnerDetector/InDetRecTools/TRT_DriftFunctionTool + InnerDetector/InDetSimEvent + Tracking/TrkDetDescr/TrkSurfaces + Tracking/TrkEvent/TrkTruthData ) + +# External dependencies: +find_package( CLHEP ) +find_package( HepMC ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_component( InDetPrepRawDataToxAOD + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps Identifier xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*.py ) + diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/cmt/requirements b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/cmt/requirements index 0fbff6f8bd2..7247317bd27 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/cmt/requirements +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/cmt/requirements @@ -40,5 +40,6 @@ use AtlasROOT AtlasROOT-* External public apply_pattern component_library apply_pattern declare_joboptions files="*.py" +apply_pattern declare_python_modules files="*.py" library InDetPrepRawDataToxAOD *.cxx components/*.cxx diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py new file mode 100644 index 00000000000..42382ac5760 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py @@ -0,0 +1,142 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +## @file InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py +## @purpose Python module to hold common flags to configure xAOD-making jobOptions +## + +""" InDetDxAODJobProperties + Python module to hold common flags to configure ID xAOD-making jobOptions. + +""" + + +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from AthenaCommon.JobProperties import jobproperties + +class InDetDxAODJobPropertyContainer(JobPropertyContainer): + """ The jobProperty container for InDetDxAOD-making flags """ +jobproperties.add_Container(InDetDxAODJobPropertyContainer) + + +class DumpPixelInfo(JobProperty): + """write out pixel info """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpPixelInfo) + +class DumpSctInfo(JobProperty): + """write out SCT info """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = False + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpSctInfo) + +class DumpTrtInfo(JobProperty): + """write out TRT info """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = False + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpTrtInfo) + +class ThinHitsOnTrack(JobProperty): + """thin hits to store only those on-track """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(ThinHitsOnTrack) + +class ThinTrackSelection(JobProperty): + """thinning selection for tracks """ + statusOn = True + allowedTypes = ["string"] + StoredValue = "InDetTrackParticles.pt > 0.1*GeV" + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(ThinTrackSelection) + +class DumpByteStreamErrors(JobProperty): + """BS errors, for those systems that have implemented it """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpByteStreamErrors) + +class DumpUnassociatedHits(JobProperty): + """dump hits not-on-track """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpUnassociatedHits) + +class DumpLArCollisionTime(JobProperty): + """dump LAr collision time """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpLArCollisionTime) + +class DumpTruthInfo(JobProperty): + """dump truth in fo """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpTruthInfo) + +class DumpTriggerInfo(JobProperty): + """dump trigger info """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpTriggerInfo) + +class PrintIdTrkDxAODConf(JobProperty): + """ print configuration """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(PrintIdTrkDxAODConf) + +class MakeSplitCosmicTracks(JobProperty): + """ create split tracks if running on cosmics """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = True + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(MakeSplitCosmicTracks) + +class DumpSctRdoInfo(JobProperty): + """dump RDO info for SCT (only works when running from RAW, or ESD that was made with InDetFlags.writeRDOs=True """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = False + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpSctRdoInfo) + +class DumpPixelRdoInfo(JobProperty): + """dump RDO info for Pixel (only works when running from RAW, or ESD that was made with InDetFlags.writeRDOs=True """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = False + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpPixelRdoInfo) + +class DumpPixelNNInfo(JobProperty): + """dump NN info for Pixel """ + statusOn = True + allowedTypes = ["bool"] + StoredValue = False + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpPixelNNInfo) + + +InDetDxAODFlags = jobproperties.InDetDxAODJobPropertyContainer diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/SCTxAODJobProperties.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/SCTxAODJobProperties.py new file mode 100644 index 00000000000..880fa370370 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/SCTxAODJobProperties.py @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +## @file InDetPrepRawDataToxAOD/python/SCTxAODJobProperties.py +## @purpose Python module to hold common flags to configure SCT AxAOD-making jobOptions +## + +""" SCTxAODJobProperties + Python module to hold common flags to configure SCT AxAOD-making jobOptions. + +""" + + +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from AthenaCommon.JobProperties import jobproperties + +class SCTxAODJobPropertyContainer(JobPropertyContainer): + """ The jobProperty container for SCT AxAOD-making flags """ +jobproperties.add_Container(SCTxAODJobPropertyContainer) + +class Prescale(JobProperty): + """ Prescale factor for SCT AxAOD """ + statusOn = True + allowedTypes = ['int'] + StoredValue = 1 + pass +jobproperties.SCTxAODJobPropertyContainer.add_JobProperty(Prescale) + +SCTxAODFlags = jobproperties.SCTxAODJobPropertyContainer diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py index dc0beb3c002..1288ddfbebd 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py @@ -5,40 +5,42 @@ from AthenaCommon.JobProperties import jobproperties as athCommonFlags from DerivationFrameworkInDet.InDetCommon import * +from InDetPrepRawDataToxAOD.InDetDxAODJobProperties import InDetDxAODFlags + # Select active sub-systems -dumpPixInfo=True -dumpSctInfo=True -dumpTrtInfo=False +dumpPixInfo = InDetDxAODFlags.DumpPixelInfo() +dumpSctInfo = InDetDxAODFlags.DumpSctInfo() +dumpTrtInfo = InDetDxAODFlags.DumpTrtInfo() # Thin hits to store only the ones on-track -thinHitsOnTrack=True +thinHitsOnTrack= InDetDxAODFlags.ThinHitsOnTrack() # Thin track collection, if necessary # Example (p_T > 1.0 GeV && delta_z0 < 5 mm): # InDetTrackParticles.pt > 1*GeV && abs(DFCommonInDetTrackZ0AtPV) < 5.0 -thinTrackSelection = "InDetTrackParticles.pt > 0.1*GeV" +thinTrackSelection = InDetDxAODFlags.ThinTrackSelection() ##"InDetTrackParticles.pt > 0.1*GeV" # Bytestream errors (for sub-systems who have implemented it) -dumpBytestreamErrors=True +dumpBytestreamErrors=InDetDxAODFlags.DumpByteStreamErrors() #True # Unassociated hits decorations -dumpUnassociatedHits=True +dumpUnassociatedHits= InDetDxAODFlags.DumpUnassociatedHits() #True # Add LArCollisionTime augmentation tool -dumpLArCollisionTime=True +dumpLArCollisionTime=InDetDxAODFlags.DumpLArCollisionTime() #True # Force to do not dump truth info if set to False # (otherwise determined by autoconf below) -dumpTruthInfo=True +dumpTruthInfo=InDetDxAODFlags.DumpTruthInfo() # True # Saves partial trigger information in the output stream (none otherwise) -dumpTriggerInfo=True +dumpTriggerInfo= InDetDxAODFlags.DumpTriggerInfo() #True # Print settings for main tools -printIdTrkDxAODConf = True +printIdTrkDxAODConf = InDetDxAODFlags.PrintIdTrkDxAODConf() # True # Create split-tracks if running on cosmics -makeSplitTracks = True and athCommonFlags.Beam.beamType() == 'cosmics' +makeSplitTracks = InDetDxAODFlags.MakeSplitCosmicTracks() and athCommonFlags.Beam.beamType() == 'cosmics' ## Autoconfiguration adjustements isIdTrkDxAODSimulation = False @@ -159,7 +161,7 @@ if dumpSctInfo: ## Content steering Properties (default value shown as comment) xAOD_SCT_PrepDataToxAOD.OutputLevel=INFO xAOD_SCT_PrepDataToxAOD.UseTruthInfo = dumpTruthInfo - xAOD_SCT_PrepDataToxAOD.WriteRDOinformation = False + xAOD_SCT_PrepDataToxAOD.WriteRDOinformation = True #xAOD_SCT_PrepDataToxAOD.WriteSDOs = True #xAOD_SCT_PrepDataToxAOD.WriteSiHits = True # if available @@ -174,8 +176,8 @@ if dumpPixInfo: ## Content steering Properties (default value shown as comment) xAOD_PixelPrepDataToxAOD.OutputLevel = INFO xAOD_PixelPrepDataToxAOD.UseTruthInfo = dumpTruthInfo - xAOD_PixelPrepDataToxAOD.WriteRDOinformation = False - xAOD_PixelPrepDataToxAOD.WriteNNinformation = False + xAOD_PixelPrepDataToxAOD.WriteRDOinformation = InDetDxAODFlags.DumpPixelRdoInfo() + xAOD_PixelPrepDataToxAOD.WriteNNinformation = InDetDxAODFlags.DumpPixelNNInfo() #xAOD_PixelPrepDataToxAOD.WriteSDOs = True #xAOD_PixelPrepDataToxAOD.WriteSiHits = True # if available if InDetFlags.doSLHC(): @@ -294,6 +296,15 @@ if dumpLArCollisionTime: print lArCollisionTimeDecorator print lArCollisionTimeDecorator.properties() +# Add decoration with truth parameters if running on simulation +if isIdTrkDxAODSimulation: + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParametersForTruthParticles + TruthDecor = DerivationFramework__TrackParametersForTruthParticles( name = "TruthTPDecor", + TruthParticleContainerName = "TruthParticles", + DecorationPrefix = "") + ToolSvc += TruthDecor + augmentationTools.append(TruthDecor) + print TruthDecor #==================================================================== # Skimming Tools @@ -401,12 +412,15 @@ IDTRKVALIDStream.AddItem("xAOD::TrackParticleAuxContainer#GSFTrackParticlesAux." # Add truth-related information if dumpTruthInfo: - IDTRKVALIDStream.AddItem("xAOD::TruthParticleContainer#*") - IDTRKVALIDStream.AddItem("xAOD::TruthParticleAuxContainer#TruthParticlesAux.-caloExtension") - IDTRKVALIDStream.AddItem("xAOD::TruthVertexContainer#*") - IDTRKVALIDStream.AddItem("xAOD::TruthVertexAuxContainer#*") - IDTRKVALIDStream.AddItem("xAOD::TruthEventContainer#*") - IDTRKVALIDStream.AddItem("xAOD::TruthEventAuxContainer#*") + IDTRKVALIDStream.AddItem("xAOD::TruthParticleContainer#*") + IDTRKVALIDStream.AddItem("xAOD::TruthParticleAuxContainer#TruthParticlesAux.-caloExtension") + IDTRKVALIDStream.AddItem("xAOD::TruthVertexContainer#*") + IDTRKVALIDStream.AddItem("xAOD::TruthVertexAuxContainer#*") + IDTRKVALIDStream.AddItem("xAOD::TruthEventContainer#*") + IDTRKVALIDStream.AddItem("xAOD::TruthEventAuxContainer#*") + # add pseudo tracking in xAOD + IDTRKVALIDStream.AddItem("xAOD::TrackParticleContainer#InDetPseudoTrackParticles") + IDTRKVALIDStream.AddItem("xAOD::TrackParticleAuxContainer#InDetPseudoTrackParticlesAux."+excludedAuxData) # Add trigger information (including metadata) if dumpTriggerInfo: diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/SCTxAOD.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/SCTxAOD.py index 061bc41457e..5235fd3b113 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/SCTxAOD.py +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/SCTxAOD.py @@ -34,15 +34,26 @@ prefixName = "" ## More fine-tuning available for each tool/alg below (default value shown) - ################# -### Setup decorators tools +### Setup skimming tools ################# +skimmingTools = [] +# Applying prescales +# https://twiki.cern.ch/twiki/bin/view/AtlasProtected/DerivationFramework#Applying_prescales +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__PrescaleTool +from InDetPrepRawDataToxAOD.SCTxAODJobProperties import SCTxAODFlags +prescaleTool = DerivationFramework__PrescaleTool(name = "SCTxAOD_PrescaleTool", + Prescale = SCTxAODFlags.Prescale()) +ToolSvc += prescaleTool +skimmingTools += [prescaleTool] +################# +### Setup decorators tools +################# from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import SCT_PrepDataToxAOD -xAOD_SCT_PrepDataToxAOD = SCT_PrepDataToxAOD( name = "xAOD_SCT_PrepDataToxAOD") +xAOD_SCT_PrepDataToxAOD = SCT_PrepDataToxAOD( name = "SCTxAOD_SCT_PrepDataToxAOD") ## Content steering Properties (default value shown as comment) xAOD_SCT_PrepDataToxAOD.OutputLevel=INFO xAOD_SCT_PrepDataToxAOD.UseTruthInfo = dumpTruthInfo @@ -50,11 +61,16 @@ xAOD_SCT_PrepDataToxAOD.WriteRDOinformation = True #xAOD_SCT_PrepDataToxAOD.WriteSDOs = True #xAOD_SCT_PrepDataToxAOD.WriteSiHits = True # if available -topSequence += xAOD_SCT_PrepDataToxAOD if (printSctDxAODConf): print xAOD_SCT_PrepDataToxAOD print xAOD_SCT_PrepDataToxAOD.properties() +from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import SCT_RawDataToxAOD +xAOD_SCT_RawDataToxAOD = SCT_RawDataToxAOD( name = "SCTxAOD_SCT_RawDataToxAOD") +xAOD_SCT_RawDataToxAOD.OutputLevel = INFO +if printSctDxAODConf: + print xAOD_SCT_RawDataToxAOD + print xAOD_SCT_RawDataToxAOD.properties() ################# @@ -63,7 +79,7 @@ if (printSctDxAODConf): from AthenaCommon import CfgMgr # DerivationJob is COMMON TO ALL DERIVATIONS -DerivationFrameworkJob = CfgMgr.AthSequencer("MySeq2") +DerivationFrameworkJob = CfgMgr.AthSequencer("SCTxAOD_Seq") # Set up stream auditor from AthenaCommon.AppMgr import ServiceMgr as svcMgr @@ -76,7 +92,7 @@ svcMgr.DecisionSvc.CalcStats = True augmentationTools=[] from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackStateOnSurfaceDecorator -DFTSOS = DerivationFramework__TrackStateOnSurfaceDecorator(name = "DFTrackStateOnSurfaceDecorator", +DFTSOS = DerivationFramework__TrackStateOnSurfaceDecorator(name = "SCTxAOD_DFTrackStateOnSurfaceDecorator", ContainerName = "InDetTrackParticles", DecorationPrefix = prefixName, StoreTRT = False, @@ -91,7 +107,7 @@ augmentationTools+=[DFTSOS] # Add BS error augmentation tool if dumpBytestreamErrors: from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EventInfoBSErrDecorator - DFEI = DerivationFramework__EventInfoBSErrDecorator(name = "DFEventInfoBSErrDecorator", + DFEI = DerivationFramework__EventInfoBSErrDecorator(name = "SCTxAOD_DFEventInfoBSErrDecorator", ContainerName = "EventInfo", DecorationPrefix = prefixName, OutputLevel =INFO) @@ -104,10 +120,9 @@ if dumpBytestreamErrors: # Add Unassociated hits augmentation tool if dumpUnassociatedHits: from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__UnassociatedHitsGetterTool - unassociatedHitsGetterTool = DerivationFramework__UnassociatedHitsGetterTool (name = 'unassociatedHitsGetter', + unassociatedHitsGetterTool = DerivationFramework__UnassociatedHitsGetterTool (name = 'SCTxAOD_unassociatedHitsGetter', TrackCollection = "Tracks", - - PixelClusters = "PixelClusters", + PixelClusters = "PixelClusters", SCTClusterContainer = "SCT_Clusters", TRTDriftCircleContainer = "TRT_DriftCircles") ToolSvc += unassociatedHitsGetterTool @@ -116,7 +131,7 @@ if dumpUnassociatedHits: print unassociatedHitsGetterTool.properties() from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__UnassociatedHitsDecorator - unassociatedHitsDecorator = DerivationFramework__UnassociatedHitsDecorator (name ='unassociatedHitsDecorator', + unassociatedHitsDecorator = DerivationFramework__UnassociatedHitsDecorator (name ='SCTxAOD_unassociatedHitsDecorator', UnassociatedHitsGetter = unassociatedHitsGetterTool, ContainerName = "EventInfo", DecorationPrefix = prefixName, @@ -129,8 +144,13 @@ if dumpUnassociatedHits: # Add the derivation job to the top AthAlgSeqeuence -from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation -DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("DFTSOS_KERN", +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("SCTxAOD_PreSelection", + SkimmingTools = skimmingTools, + OutputLevel =INFO) +DerivationFrameworkJob += xAOD_SCT_PrepDataToxAOD +DerivationFrameworkJob += xAOD_SCT_RawDataToxAOD +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("SCTxAOD_DF_KERN", AugmentationTools = augmentationTools, OutputLevel =INFO) @@ -149,6 +169,7 @@ from PrimaryDPDMaker.PrimaryDPDFlags import primDPD streamName = primDPD.WriteDAOD_SCTVALIDStream.StreamName fileName = buildFileName( primDPD.WriteDAOD_SCTVALIDStream ) SCTVALIDStream = MSMgr.NewPoolRootStream( streamName, fileName ) +SCTVALIDStream.AcceptAlgs(["SCTxAOD_DF_KERN"]) excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition" # Add generic event information @@ -177,6 +198,10 @@ SCTVALIDStream.AddItem("xAOD::ElectronAuxContainer#ElectronsAux.") SCTVALIDStream.AddItem("xAOD::TrackParticleContainer#GSFTrackParticles") SCTVALIDStream.AddItem("xAOD::TrackParticleAuxContainer#GSFTrackParticlesAux."+excludedAuxData) +# Add SCT raw-data-objects +SCTVALIDStream.AddItem("xAOD::SCTRawHitValidationContainer#*") +SCTVALIDStream.AddItem("xAOD::SCTRawHitValidationAuxContainer#*") + # Add truth-related information if dumpTruthInfo: SCTVALIDStream.AddItem("xAOD::TruthParticleContainer#*") diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx index 50d8de53aa7..8faa8bc6e6c 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx @@ -557,7 +557,7 @@ void SCT_PrepDataToxAOD::addRDOInformation(xAOD::TrackMeasurementValidation* xpr } timebin.push_back( tbin); groupsize.push_back( gs); - strip.push_back(sctRdo->getStrip()); + strip.push_back(m_SCTHelper->strip(sctRdo->identify())); } else { timebin.push_back( -1 ); strip.push_back( -1 ); diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.cxx new file mode 100644 index 00000000000..466818d9bdd --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.cxx @@ -0,0 +1,82 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// SCT_RawDataToxAOD.cxx +// Implementation file for class SCT_RawDataToxAOD +/////////////////////////////////////////////////////////////////// + +#include "SCT_RawDataToxAOD.h" + +#include "GaudiKernel/ServiceHandle.h" + +#include "InDetIdentifier/SCT_ID.h" + +// SCT ntuple container type +#include "InDetRawData/SCT_RDO_Container.h" + +// xAOD container type +#include "xAODTracking/SCTRawHitValidationContainer.h" +#include "xAODTracking/SCTRawHitValidationAuxContainer.h" + +SCT_RawDataToxAOD::SCT_RawDataToxAOD(const std::string &name, + ISvcLocator *pSvcLocator) + : AthAlgorithm(name, pSvcLocator), + m_SCTHelper(0) +{ + declareProperty("SiClusterContainer", m_clustercontainer = "SCT_RawHits"); +} + +StatusCode SCT_RawDataToxAOD::initialize() { + CHECK(detStore()->retrieve(m_SCTHelper, "SCT_ID")); + return StatusCode::SUCCESS; +} + +// define accessors used by execute method; defining them once means fewer +// string comparisons. +static SG::AuxElement::Accessor<int> bec_acc("bec"); +static SG::AuxElement::Accessor<int> layer_acc("layer"); +static SG::AuxElement::Accessor<int> phi_module_acc("phi_module"); +static SG::AuxElement::Accessor<int> eta_module_acc("eta_module"); +static SG::AuxElement::Accessor<int> side_acc("side"); + +StatusCode SCT_RawDataToxAOD::execute() { + const SCT_RDO_Container* rdoContainer = 0; + CHECK(evtStore()->retrieve(rdoContainer, "SCT_RDOs")); + + // Create the output xAOD container and its auxiliary store: + xAOD::SCTRawHitValidationContainer* xaod = new xAOD::SCTRawHitValidationContainer(); + CHECK(evtStore()->record(xaod, m_clustercontainer)); + xAOD::SCTRawHitValidationAuxContainer* aux = new xAOD::SCTRawHitValidationAuxContainer(); + CHECK(evtStore()->record(aux, m_clustercontainer + "Aux.")); + xaod->setStore(aux); + + /// loop over input RDOs + for (const SCT_RDO_Collection* collection : *rdoContainer) { + for (const SCT_RDORawData* rdo : *collection) { + // create and add xAOD object + xAOD::SCTRawHitValidation* xrdo = new xAOD::SCTRawHitValidation(); + xaod->push_back(xrdo); + /// copy xrdo properties from input rdo + const Identifier& id = rdo->identify(); + xrdo->setIdentifier(id.get_compact()); + xrdo->setWord(rdo->getWord()); + // setting additional decorations based on identifier + bec_acc(*xrdo) = m_SCTHelper->barrel_ec(id); + layer_acc(*xrdo) = m_SCTHelper->layer_disk(id); + phi_module_acc(*xrdo) = m_SCTHelper->phi_module(id); + eta_module_acc(*xrdo) = m_SCTHelper->eta_module(id); + side_acc(*xrdo) = m_SCTHelper->side(id); + // error condensed hit not used anymore (duplicates information from ByteStream errors) + // SCT3_RawData* rdo3 = const_cast<SCT3_RawData*>(dynamic_cast<const SCT3_RawData*>(rdo)); + // if (rdo3) xrdo->setErrorCondensedHit(rdo3->getErrorCondensedHit()); + } + } + ATH_MSG_DEBUG(" recorded SCT_RawData objects: size " << xaod->size()); + return StatusCode::SUCCESS; +} + +StatusCode SCT_RawDataToxAOD::finalize() { + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.h b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.h new file mode 100644 index 00000000000..773f547e103 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_RawDataToxAOD.h @@ -0,0 +1,36 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SCT_RAWDATATOXAOD_H +#define SCT_RAWDATATOXAOD_H + +#include <string> + +#include "AthenaBaseComps/AthAlgorithm.h" + +class ISvcLocator; +class SCT_ID; + +/** Algorithm to read RDO information from SCT ntuple and write augmented xAOD. + **/ +class SCT_RawDataToxAOD : public AthAlgorithm { +public: + SCT_RawDataToxAOD(const std::string& name, ISvcLocator* pSvcLocator); + + StatusCode initialize(); + StatusCode execute(); + StatusCode finalize(); + +private: + const SCT_ID* m_SCTHelper; + + std::string m_clustercontainer; +// std::string m_SDOcontainer; +// std::string m_sihitContainer; +// std::string m_multiTruth; +}; + +#endif diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/components/InDetPrepRawDataToxAOD_entries.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/components/InDetPrepRawDataToxAOD_entries.cxx index 5313b9af720..f931e8db211 100755 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/components/InDetPrepRawDataToxAOD_entries.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/components/InDetPrepRawDataToxAOD_entries.cxx @@ -1,6 +1,7 @@ #include "GaudiKernel/DeclareFactoryEntries.h" #include "../TRT_PrepDataToxAOD.h" #include "../SCT_PrepDataToxAOD.h" +#include "../SCT_RawDataToxAOD.h" #include "../PixelPrepDataToxAOD.h" @@ -8,11 +9,13 @@ DECLARE_ALGORITHM_FACTORY( TRT_PrepDataToxAOD ) DECLARE_ALGORITHM_FACTORY( SCT_PrepDataToxAOD ) +DECLARE_ALGORITHM_FACTORY( SCT_RawDataToxAOD ) DECLARE_ALGORITHM_FACTORY( PixelPrepDataToxAOD ) DECLARE_FACTORY_ENTRIES( InDetPrepRawDataToxAOD ) { DECLARE_ALGORITHM( TRT_PrepDataToxAOD ) DECLARE_ALGORITHM( SCT_PrepDataToxAOD ) + DECLARE_ALGORITHM( SCT_RawDataToxAOD ) DECLARE_ALGORITHM( PixelPrepDataToxAOD ) } -- GitLab