4 Emulating pixel defects by dropping elements from the RDO input container
6 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
7 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory
import CompFactory
15 from SGComps.AddressRemappingConfig
import AddressRemappingCfg
16 renames = [
'%s#%s->%s' % (
'PixelRDO_Container', InputKey, f
"{InputKey}_ORIG") ]
23 def DefectsHistSvcCfg(flags, HistogramGroup: str=
"PixelDefects", FileName: str=
'pixel_defects.root') -> ComponentAccumulator:
25 if HistogramGroup
is not None and len(HistogramGroup) > 0
and FileName
is not None and len(FileName) > 0 :
26 histSvc = CompFactory.THistSvc(Output = [f
"{HistogramGroup} DATAFILE='{FileName}', OPT='RECREATE'"] )
27 acc.addService(histSvc)
35 name: str =
"PixelDefectsEmulatorCondAlg",
36 **kwargs: dict) -> ComponentAccumulator:
38 kwargs.setdefault(
"ModulePatterns", [[-2,2,0,99,-99,99,-99,99,0,9999,0,0,0]])
40 kwargs.setdefault(
"DefectProbabilities", [[0.,1e-3,0.,0.]])
41 kwargs.setdefault(
"NDefectFractionsPerPattern",[[1.,-1, 1.]])
42 kwargs.setdefault(
"DetEleCollKey",
"PixelDetectorElementCollection")
43 kwargs.setdefault(
"WriteKey",
"PixelEmulatedDefects")
44 kwargs.setdefault(
"HistogramGroupName",
"")
46 kwargs.setdefault(
"RngPerDefectType",
False)
47 kwargs.setdefault(
"DefectsInputFiles",[])
48 kwargs.setdefault(
"DefectsOutputFile",
"")
49 if "DefectsOutputFile" in kwargs
and kwargs[
"DefectsOutputFile"]
is None :
50 kwargs[
"DefectsOutputFile"]=
""
52 acc.addCondAlgo(CompFactory.InDet.PixelDefectsEmulatorCondAlg(name,**kwargs))
56 name: str =
"ITkPixelDefectsEmulatorCondAlg",
57 **kwargs: dict) -> ComponentAccumulator:
58 kwargs.setdefault(
"ModulePatterns", [[-2,2,0,99,-99,99,-99,99,0,9999,0,0,0]])
60 kwargs.setdefault(
"DefectProbabilities", [[0.,1e-2, 1e-1,0.]])
61 kwargs.setdefault(
"NDefectFractionsPerPattern",[[1.,-1, 1.]])
63 kwargs.setdefault(
"DetEleCollKey",
"ITkPixelDetectorElementCollection")
64 kwargs.setdefault(
"WriteKey",
"ITkPixelEmulatedDefects")
66 kwargs.setdefault(
"RngPerDefectType",
False)
67 kwargs.setdefault(
"DefectsInputFiles",[])
68 kwargs.setdefault(
"DefectsOutputFile",
"")
69 if "DefectsOutputFile" in kwargs
and kwargs[
"DefectsOutputFile"]
is None :
70 kwargs[
"DefectsOutputFile"]=
""
76 name: str =
"PixelDefectsEmulatorAlg",
77 **kwargs: dict) -> ComponentAccumulator:
80 if "InputKey" not in kwargs :
83 kwargs.setdefault(
"InputKey",
"PixelRDOs_ORIG")
85 if "EmulatedDefectsKey" not in kwargs :
88 kwargs.setdefault(
"EmulatedDefectsKey",
"PixelEmulatedDefects")
89 kwargs.setdefault(
"OutputKey",
"PixelRDOs")
90 kwargs.setdefault(
"HistogramGroupName",
"")
92 acc.addEventAlgo(CompFactory.InDet.PixelDefectsEmulatorAlg(name,**kwargs))
96 name: str =
"ITkPixelDefectsEmulatorAlg",
97 **kwargs: dict) -> ComponentAccumulator:
99 if "InputKey" not in kwargs :
102 kwargs.setdefault(
"InputKey",
"ITkPixelRDOs_ORIG")
104 if "EmulatedDefectsKey" not in kwargs :
107 kwargs.setdefault(
"EmulatedDefectsKey",
"ITkPixelEmulatedDefects")
108 kwargs.setdefault(
"OutputKey",
"ITkPixelRDOs")
110 kwargs.setdefault(
"HistogramGroupName",
"")
112 acc.addEventAlgo(CompFactory.InDet.PixelDefectsEmulatorAlg(name,**kwargs))
116 name: str =
"ITkPixelDefectsEmulatorToDetectorElementStatusCondAlgCfg",
117 **kwargs: dict) -> ComponentAccumulator:
119 kwargs.setdefault(
"EmulatedDefectsKey",
"ITkPixelEmulatedDefects")
120 kwargs.setdefault(
"WriteKey",
"ITkPixelDetectorElementStatusFromEmulatedDefects")
121 acc.addCondAlgo(CompFactory.InDet.PixelEmulatedDefectsToDetectorElementStatusCondAlg(name,**kwargs))
124 if __name__ ==
"__main__":
128 from AthenaConfiguration.Enums
import ProductionStep
129 flags.Common.ProductionStep = ProductionStep.Simulation
130 from AthenaConfiguration.TestDefaults
import defaultGeometryTags, defaultConditionsTags
131 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
132 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
133 flags.GeoModel.Align.Dynamic =
False
134 flags.Input.Files = [
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/ATLAS-P2-RUN4-03-00-00/mc21_14TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.RDO.e8481_s4149_r14700/RDO.33629020._000047.pool.root.1']
136 flags.Detector.GeometryITkPixel =
True
137 flags.Detector.GeometryITkStrip =
True
138 flags.Detector.GeometryBpipe =
True
139 flags.Detector.GeometryCalo =
False
141 flags.Concurrency.NumThreads = 8
142 flags.Concurrency.NumConcurrentEvents = 8
144 flags.Exec.MaxEvents = 10
149 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
151 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
155 from ActsConfig.ActsGeometryConfig
import ActsTrackingGeometrySvcCfg
158 RunConsistencyChecks=
False,
159 ObjDebugOutput=
False))
161 from PixelConditionsAlgorithms.ITkPixelConditionsConfig
import ITkPixelDetectorElementStatusCondAlgNoByteStreamErrorsCfg
164 from PixelDefectsEmulatorPostInclude
import emulateITkPixelDefectsPoisson
167 acc.printConfig(withDetails=
True, summariseProps=
True,printDefaults=
True)