ATLAS Offline Software
Loading...
Searching...
No Matches
LArFCalSamplingFractionConfig.py
Go to the documentation of this file.
1#!/usr/bin/env athena.py
2
3# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4#
5# This CA configuration script replaces the previously used legacy script for simulating sampling fractions
6#
7
8import sys
9
10from AthenaConfiguration.AllConfigFlags import initConfigFlags
11from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
12from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
13from AthenaConfiguration.MainServicesConfig import MainServicesCfg
14from AthenaConfiguration.ComponentFactory import CompFactory
15from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
16from TileConditions.TileSamplingFractionConfig import TileSamplingFractionCondAlgCfg
17from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
18from LArGeoAlgsNV.LArGMConfig import LArGMCfg
19
20# Adding algorithm
21def LarFCalSamplingFractionCfg(flags, name="LarFCalSamplingFraction", **kwargs):
22 acc = ComponentAccumulator()
23
24 acc.addService(CompFactory.THistSvc(name="THistSvc", Output=[ f"AANT DATAFILE='{flags.Output.HISTFileName}' OPT='RECREATE'" ]))
25
26 kwargs.setdefault('Calibration', True)
27
28 acc.merge( TileCablingSvcCfg(flags) )
29 acc.merge( TileSamplingFractionCondAlgCfg(flags) )
30 acc.getCondAlgo('TileSamplingFractionCondAlg').G4Version=-1
31 requiredConditons=["Shape","AutoCorr","Noise","Pedestal","fSampl","MinBias"]
32 acc.merge(LArElecCalibDBCfg(flags,requiredConditons))
33 acc.merge(LArGMCfg(flags))
34 acc.addEventAlgo(CompFactory.LArFCalSamplingFraction(name, **kwargs))
35
36 return acc
37
38if __name__ == "__main__":
39 # Setting flags
40 flags = initConfigFlags()
41 flags.IOVDb.GlobalTag = 'OFLCOND-MC23-SDR-RUN3-04'
42 flags.Input.Files = ['test.root']
43 flags.Output.HISTFileName = 'LArFCal_SF.root'
44 flags.Exec.MaxEvents = -1
45 flags.fillFromArgs()
46 flags.dump()
47 flags.lock()
48
49 # Main CA and basic services
50 acc = MainServicesCfg(flags)
51 acc.merge(PoolReadCfg(flags))
52 acc.merge(LarFCalSamplingFractionCfg(flags))
53 acc.printConfig(withDetails=True)
54
55 # Finalize
56 sys.exit( acc.run().isFailure() )
LarFCalSamplingFractionCfg(flags, name="LarFCalSamplingFraction", **kwargs)