ATLAS Offline Software
Loading...
Searching...
No Matches
LArEMSamplingFractionConfig.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 LarEMSamplingFractionCfg(flags, name="LarEMSamplingFraction", **kwargs):
22 acc = ComponentAccumulator()
23
24 acc.addService(CompFactory.THistSvc(name="THistSvc", Output=[ f"MYSTREAM DATAFILE='{flags.Output.HISTFileName}' OPT='RECREATE'" ]))
25
26 kwargs.setdefault('DoCells', 0)
27
28 kwargs.setdefault('CalibrationHitContainerNames', [
29 "LArCalibrationHitInactive",
30 "LArCalibrationHitActive",
31 "TileCalibHitInactiveCell",
32 "TileCalibHitActiveCell",
33 ] )
34
35 acc.merge( TileCablingSvcCfg(flags) )
36 acc.merge( TileSamplingFractionCondAlgCfg(flags) )
37 acc.getCondAlgo('TileSamplingFractionCondAlg').G4Version=-1
38 requiredConditons=["Shape","AutoCorr","Noise","Pedestal","fSampl","MinBias"]
39 acc.merge(LArElecCalibDBCfg(flags,requiredConditons))
40 acc.merge(LArGMCfg(flags))
41 acc.addEventAlgo(CompFactory.LarEMSamplingFraction(name, **kwargs))
42
43 return acc
44
45
46# Setting flags
47flags = initConfigFlags()
48flags.IOVDb.GlobalTag = 'OFLCOND-MC23-SDR-RUN3-04'
49flags.Input.Files = ['test.root']
50flags.Output.HISTFileName = 'LArEM_SF.root'
51flags.Exec.MaxEvents = -1
52flags.fillFromArgs()
53flags.dump()
54flags.lock()
55
56# Main CA and basic services
57acc = MainServicesCfg(flags)
58acc.merge(PoolReadCfg(flags))
59acc.merge(LarEMSamplingFractionCfg(flags))
60acc.printConfig(withDetails=True)
61
62# Finalize
63sys.exit( acc.run().isFailure() )
LarEMSamplingFractionCfg(flags, name="LarEMSamplingFraction", **kwargs)