ATLAS Offline Software
Loading...
Searching...
No Matches
LArMinBiasAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentFactory import CompFactory
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5
6def 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 result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg('CaloSuperCellAlignCondAlg'))
20
21 rKey="LArOnOffIdMapSC"
22 else:
23 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
24 result.merge(LArOnOffIdMappingCfg(flags))
25
26 rKey="LArOnOffIdMap"
27
28 result.addCondAlgo(CompFactory.LArMCSymCondAlg("LArMCSymCondAlg",SuperCell=supercell,ReadKey=rKey))
29
30 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
31 result.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True))
32
33 larMinBiasAlg = CompFactory.LArMinBiasAlg()
34 larMinBiasAlg.datasetID_lowPt=idlowpt
35 larMinBiasAlg.datasetID_highPt=idhighpt
36 # in mc16 files, computed at the beginning:
37 larMinBiasAlg.weight_lowPt = wlowpt
38 larMinBiasAlg.weight_highPt= whighpt
39 larMinBiasAlg.EvtInfo="EventInfo"
40 larMinBiasAlg.CablingKey=rKey
41 larMinBiasAlg.SuperCell=supercell
42 #larMinBiasAlg.OutputLevel=2
43
44 result.addEventAlgo(larMinBiasAlg)
45
46 import os
47 if os.path.exists(output):
48 os.remove(output)
49 result.addService(CompFactory.THistSvc(Output = ["file1 DATAFILE='"+output+"' OPT='RECREATE'"]))
50 result.setAppProperty("HistogramPersistency","ROOT")
51
52 return result
53
55 return arg.split(',')
56
57if __name__=="__main__":
58 import argparse
59 parser= argparse.ArgumentParser(description="Compute LArMinBias from hits")
60 parser.add_argument('-r', '--run',type=int,default=999999,help="run number")
61 parser.add_argument('-o', '--output',type=str,default="ntuple.root",help="name of the root output file")
62 parser.add_argument('-i', '--input',type=list_of_strings,default=[],help="name of the input files")
63 parser.add_argument('-t', '--globaltag', type=str, help="Global conditions tag ")
64 parser.add_argument( '--idlow',type=int,default=900311,help="ID of lowPt sample")
65 parser.add_argument( '--idhigh',type=int,default=800831,help="ID of highPt sample")
66 parser.add_argument( '--wlow',type=float,default=0.099791,help="weight of lowPt sample")
67 parser.add_argument( '--whigh',type=float,default=0.00209,help="weight of highPt sample")
68 parser.add_argument('-s', '--isSC',default=False,action='store_true',help="running for SC ?")
69 parser.add_argument('-g', '--geometrytag',type=str,default="",help="geometry tag to use")
70 args = parser.parse_args()
71 print(args)
72 print(len(args.input))
73
74 from AthenaConfiguration.AllConfigFlags import initConfigFlags
75 flags = initConfigFlags()
76 flags.Input.RunNumbers=[args.run]
77 print("set the runnumber: ",flags.Input.RunNumbers)
78 flags.Input.Files=args.input
79 flags.IOVDb.DatabaseInstance="OFLP200"
80 if args.geometrytag:
81 flags.GeoModel.AtlasVersion = args.geometrytag
82 else:
83 from AthenaConfiguration.TestDefaults import defaultGeometryTags
84 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
85
86 if args.globaltag:
87 flags.IOVDb.GlobalTag=args.globaltag
88
89 #flags.Debug.DumpEvtStore=True
90 #flags.Debug.DumpDetStore=True
91 #flags.Debug.DumpCondStore=True
92
93 flags.lock()
94
95 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
96 cfg=MainServicesCfg(flags)
97
98 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
99 cfg.merge(PoolReadCfg(flags))
100
101 cfg.merge(LArMinBiasAlgCfg(flags,output=args.output, supercell=args.isSC,
102 idlowpt=args.idlow, idhighpt=args.idhigh,
103 wlowpt=args.wlow, whighpt=args.whigh))
104
105 print("Start running...")
106 cfg.getService("MessageSvc").debugLimit=1000000
107 cfg.run()
if(febId1==febId2)
void print(char *figname, TCanvas *c1)
LArMinBiasAlgCfg(flags, output='ntuple.root', supercell=False, idlowpt=900311, idhighpt=800831, wlowpt=0.099791, whighpt=0.00209)