ATLAS Offline Software
CaloLCWPerformanceConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 # CA config of job to get performance plots for local hadronic
3 # calibration on single pions
4 
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 def blockFolder(ca,folder):
10  "Block use of specified conditions DB folder so data can be read from elsewhere"
11  iovdbsvc=ca.getService("IOVDbSvc")
12  # check existing list of folders and remove it if found
13  for i in range(0,len(iovdbsvc.Folders)):
14  if (iovdbsvc.Folders[i].find(folder)>=0):
15  del iovdbsvc.Folders[i]
16  break
17  condInputLoader=ca.getCondAlgo("CondInputLoader")
18  for i in range(0, len(condInputLoader.Load)):
19  if (folder in condInputLoader.Load[i][-1] ):
20  del condInputLoader.Load[i]
21  break
22 
23 def GetLCWPerfCfg(flags):
24 
26 
27  lcPerf = CompFactory.GetLCSinglePionsPerf("LocalHadPerformance")
28 
29  # collection name to study cluster moments
30  lcPerf.ClusterBasicCollName = "CaloTopoClusters"
31 
32  # collections names to study engReco wrt Truth after different correction steps
33  lcPerf.ClusterCollectionNames = ["CaloTopoClusters", "CaloWTopoCluster", "CaloOOCTopoCluster", "CaloCalTopoClusters"]
34 
35  lcPerf.CalibrationHitContainerNames= ["LArCalibrationHitInactive","LArCalibrationHitActive","TileCalibHitActiveCell","TileCalibHitInactiveCell"]
36  lcPerf.DMCalibrationHitContainerNames= ["LArCalibrationHitDeadMaterial_DEAD","LArCalibrationHitInactive_DEAD","LArCalibrationHitActive_DEAD","TileCalibHitDeadMaterial"]
37 
38  from math import pi
39  lcPerf.DistanceCut = 1.5
40  lcPerf.doEngRecOverTruth = True
41  lcPerf.doEngTag = True
42  lcPerf.doEngRecSpect = True
43  lcPerf.doEngNoiseClus = True
44  lcPerf.doClusMoments = True
45  lcPerf.doRecoEfficiency = True
46  lcPerf.etamin = 0.0
47  lcPerf.etamax = 5.0
48  lcPerf.netabin = 25
49  lcPerf.phimin = -pi
50  lcPerf.phimax = pi
51  lcPerf.nphibin = 1
52  lcPerf.logenermin = 2.0
53  lcPerf.logenermax = 6.4
54  lcPerf.nlogenerbin = 22
55  lcPerf.useGoodClus = False
56  lcPerf.usePionClustersOnly = False
57  lcPerf.useRecoEfficiency = False
58 
59  lcPerf.OutputFileName = flags.LCW.outFileNamePerf
60 
61  cfg.addEventAlgo(lcPerf)
62 
63  return cfg
64 
65 
66 if __name__=="__main__":
67  from AthenaConfiguration.AllConfigFlags import initConfigFlags
68  flags = initConfigFlags()
69  from CaloLocalHadCalib.LCWConfigFlags import addLCWFlags
70  addLCWFlags(flags)
71 
72  #flags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"]
73  #flags.Input.Files = ["/home/pavol/mc10_7TeV/ESD.371532._001990.pool.root.1"]
74  flags.Input.Files = ["/home/pavol/mc16_13TeV/ESD.29275544._000648.pool.root.1"]
75  flags.Output.ESDFileName="esdOut.pool.root"
76  from AthenaConfiguration.Enums import LHCPeriod
77  flags.GeoModel.Run = LHCPeriod.Run1
78  from AthenaConfiguration.TestDefaults import defaultGeometryTags
79  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN1_2010
80 
81 
82  flags.fillFromArgs()
83 
84  # for debugging
85  from AthenaCommon.Constants import DEBUG
86  flags.Exec.OutputLevel=DEBUG
87 
88  # redo topo clusters on LC scale
89  flags.Calo.TopoCluster.doTopoClusterLocalCalib = True
90  flags.Calo.TopoCluster.doCellWeightCalib = False
91  flags.Calo.TopoCluster.doCalibHitMoments = True
92 
93  flags.Digitization.HighGainEMECIW = False
94  flags.Calo.Noise.fixedLumiForNoise=60*0.1724*50/25 # mu=60; dt=25ns
95  flags.Calo.Noise.useCaloNoiseLumi=False
96 
97  flags.lock()
98 
99  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
100  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
101 
102  cfg = MainServicesCfg(flags)
103  cfg.merge(PoolReadCfg(flags))
104 
105  from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg
106  cfg.merge(CaloTopoClusterCfg(flags))
107 
108  topoAlg = cfg.getEventAlgo("CaloCalTopoClustersMaker")
109  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").MatchDmType = 1 # 1=loose, 2=medium (default), 3=tight
110  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").MomentsNames += ["ENG_CALIB_OUT_L"]
111  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").CalibrationHitContainerNames = ["LArCalibrationHitInactive","LArCalibrationHitActive","TileCalibHitActiveCell","TileCalibHitInactiveCell"]
112  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial_DEAD","LArCalibrationHitInactive_DEAD","LArCalibrationHitActive_DEAD","TileCalibHitDeadMaterial"]
113 
114  # here add snapshots
115  from CaloRec.CaloTopoClusterConfig import addSnapshot
116  addSnapshot(topoAlg,"OOCPi0Calib","CaloOOCTopoCluster")
117  addSnapshot(topoAlg,"LocalCalib","CaloWTopoCluster")
118 
119  cfg.merge(GetLCWPerfCfg(flags))
120 
121  # configure output
122  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
123  myItemList = ['EventInfo#*', "McEventCollection#TruthEvent",
124  'xAOD::CaloClusterContainer#CaloCalTopoClusters',
125  'xAOD::CaloClusterAuxContainer#CaloCalTopoClustersAux.']
126 
127  cfg.merge( OutputStreamCfg(flags,"StreamDPD", ItemList=myItemList,
128  disableEventTag=True, takeItemsFromInput=False))
129 
130  # remove the default folders
131  blockFolder(cfg,"/CALO/Ofl/HadCalibration2/CaloEMFrac")
132  blockFolder(cfg,"/CALO/Ofl/HadCalibration2/H1ClusterCellWeights")
133  blockFolder(cfg,"/CALO/Ofl/HadCalibration2/CaloOutOfCluster")
134  blockFolder(cfg,"/CALO/Ofl/HadCalibration2/CaloOutOfClusterPi0")
135  blockFolder(cfg,"/CALO/Ofl/HadCalibration2/CaloDMCorr2")
136 
137 
138 
139  # LCW folders from sqlite files
140  clFolders=( ("/CALO/HadCalibration2/CaloEMFrac<tag>CaloEMFrac2-R3S-2021-02-00-00-FTFP-BERT-DT25-EPOS-A3-OFC25-MU60</tag>", "myclwooc.db","CaloLocalHadCoeff"),
141  ("/CALO/HadCalibration2/H1ClusterCellWeights<tag>CaloH1CellWeights2-R3S-2021-02-00-00-FTFP-BERT-DT25-EPOS-A3-OFC25-MU60</tag>", "myclwooc.db","CaloLocalHadCoeff"),
142  ("/CALO/HadCalibration2/CaloOutOfCluster<tag>CaloHadOOCCorr2-R3S-2021-02-00-00-FTFP-BERT-DT25-EPOS-A3-OFC25-MU60</tag>", "myclwooc.db","CaloLocalHadCoeff"),
143  ("/CALO/HadCalibration2/CaloOutOfClusterPi0<tag>CaloHadOOCCorrPi02-R3S-2021-02-00-00-FTFP-BERT-DT25-EPOS-A3-OFC25-MU60</tag>", "myclwooc.db","CaloLocalHadCoeff"),
144  ("/CALO/HadCalibration2/CaloDMCorr2<tag>CaloHadDMCorr2-R3S-2021-02-00-00-FTFP-BERT-DT25-EPOS-A3-OFC25-MU60</tag>", "myDm.db","CaloLocalHadCoeff") )
145  from IOVDbSvc.IOVDbSvcConfig import addFolderList
146  cfg.merge(addFolderList(flags, clFolders, db="OFLP200"))
147 
148  # for debugging purposes:
149  cfg.getService("StoreGateSvc").Dump=True
150  cfg.getService("MessageSvc").defaultLimit=999999
151 
152  cfg.run(10)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.IOVDbSvcConfig.addFolderList
def addFolderList(flags, listOfFolderInfoTuple, extensible=False, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:90
python.CaloTopoClusterConfig.addSnapshot
def addSnapshot(topomaker, corrName, contName)
Definition: CaloTopoClusterConfig.py:470
CaloLCWPerformanceConfig.GetLCWPerfCfg
def GetLCWPerfCfg(flags)
Definition: CaloLCWPerformanceConfig.py:23
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Constants
some useful constants -------------------------------------------------—
python.CaloTopoClusterConfig.CaloTopoClusterCfg
def CaloTopoClusterCfg(flags, cellsname="AllCalo", clustersname=None, clustersnapname="CaloTopoClusters")
Definition: CaloTopoClusterConfig.py:318
LCWConfigFlags.addLCWFlags
def addLCWFlags(flags)
Definition: LCWConfigFlags.py:3
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
CaloLCWPerformanceConfig.blockFolder
def blockFolder(ca, folder)
Definition: CaloLCWPerformanceConfig.py:9
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69