Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LArMinBiasAlgConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 
6 def LArMinBiasAlgCfg(flags, output='ntuple.root', supercell=False,
7  idlowpt=900311, idhighpt=800831, wlowpt=0.099791, whighpt=0.00209):
8 
9  result=ComponentAccumulator()
10 
11  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
12  result.merge(LArGMCfg(flags))
13  from TileGeoModel.TileGMConfig import TileGMCfg
14  result.merge(TileGMCfg(flags))
15 
16  if(supercell):
17  from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg
18  result.merge(LArOnOffIdMappingSCCfg(flags))
19 
20  rKey="LArOnOffIdMapSC"
21  else:
22  from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
23  result.merge(LArOnOffIdMappingCfg(flags))
24 
25  rKey="LArOnOffIdMap"
26 
27  result.addCondAlgo(CompFactory.LArMCSymCondAlg("LArMCSymCondAlgSC",SuperCell=supercell,ReadKey=rKey))
28 
29  from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
30  result.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True))
31 
32  larMinBiasAlg = CompFactory.LArMinBiasAlg()
33  larMinBiasAlg.datasetID_lowPt=idlowpt
34  larMinBiasAlg.datasetID_highPt=idhighpt
35  # in mc16 files, computed at the beginning:
36  larMinBiasAlg.weight_lowPt = wlowpt
37  larMinBiasAlg.weight_highPt= whighpt
38  larMinBiasAlg.EvtInfo="EventInfo"
39  larMinBiasAlg.CablingKey=rKey
40  larMinBiasAlg.SuperCell=supercell
41  #larMinBiasAlg.OutputLevel=2
42 
43  result.addEventAlgo(larMinBiasAlg)
44 
45  import os
46  if os.path.exists(output):
47  os.remove(output)
48  result.addService(CompFactory.THistSvc(Output = ["file1 DATAFILE='"+output+"' OPT='RECREATE'"]))
49  result.setAppProperty("HistogramPersistency","ROOT")
50 
51  return result
52 
53 def list_of_strings(arg):
54  return arg.split(',')
55 
56 if __name__=="__main__":
57  import argparse
58  parser= argparse.ArgumentParser(description="Compute LArMinBias from hits")
59  parser.add_argument('-r', '--run',type=int,default=999999,help="run number")
60  parser.add_argument('-o', '--output',type=str,default="ntuple.root",help="name of th root output file")
61  parser.add_argument('-i', '--input',type=list_of_strings,default=[],help="name of the input files")
62  parser.add_argument('-t', '--globaltag', type=str, help="Global conditions tag ")
63  parser.add_argument( '--idlow',type=int,default=900311,help="ID of lowPt sample")
64  parser.add_argument( '--idhigh',type=int,default=800831,help="ID of highPt sample")
65  parser.add_argument( '--wlow',type=float,default=0.099791,help="weight of lowPt sample")
66  parser.add_argument( '--whigh',type=float,default=0.00209,help="weight of highPt sample")
67  parser.add_argument('-s', '--isSC',default=False,action='store_true',help="running for SC ?")
68  args = parser.parse_args()
69  print(args)
70  print(len(args.input))
71 
72  from AthenaConfiguration.AllConfigFlags import initConfigFlags
73  flags = initConfigFlags()
74  flags.Input.RunNumbers=[args.run]
75  print("set the runnumber: ",flags.Input.RunNumbers)
76  flags.Input.Files=args.input
77  flags.IOVDb.DatabaseInstance="OFLP200"
78  from AthenaConfiguration.TestDefaults import defaultGeometryTags
79  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
80 
81  if args.globaltag:
82  flags.IOVDb.GlobalTag=args.globaltag
83 
84  #flags.Debug.DumpEvtStore=True
85  #flags.Debug.DumpDetStore=True
86  #flags.Debug.DumpCondStore=True
87 
88  flags.lock()
89 
90  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
91  cfg=MainServicesCfg(flags)
92 
93  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
94  cfg.merge(PoolReadCfg(flags))
95 
96  cfg.merge(LArMinBiasAlgCfg(flags,output=args.output, supercell=args.isSC,
97  idlowpt=args.idlow, idhighpt=args.idhigh,
98  wlowpt=args.wlow, whighpt=args.whigh))
99 
100  print("Start running...")
101  cfg.getService("MessageSvc").debugLimit=1000000
102  cfg.run()
LArCablingConfig.LArOnOffIdMappingSCCfg
def LArOnOffIdMappingSCCfg(configFlags)
Definition: LArCablingConfig.py:65
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.LArMinBiasAlgConfig.LArMinBiasAlgCfg
def LArMinBiasAlgCfg(flags, output='ntuple.root', supercell=False, idlowpt=900311, idhighpt=800831, wlowpt=0.099791, whighpt=0.00209)
Definition: LArMinBiasAlgConfig.py:6
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.LArMinBiasAlgConfig.list_of_strings
list_of_strings
Definition: LArMinBiasAlgConfig.py:61
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7