5def MC21(flags, cfg):
6 """This method overrides the values of Birks Constant to the values
7expected to be used in MC21 and sets the sampling fractions
8consistently. (Based on using G4 10.6.3.3.)"""
9 if flags.Common.ProductionStep in [ProductionStep.Simulation, ProductionStep.FastChain]:
10
11 if flags.Detector.EnableLAr:
12 EMBPresamplerCalculator = cfg.getService("EMBPresamplerCalculator")
13 EMBPresamplerCalculator.BirksLaw = True
14 EMBPresamplerCalculator.Birksk = 0.0486 * 1.2
15
16 EMBCalculator = cfg.getService("EMBCalculator")
17 EMBCalculator.BirksLaw = True
18 EMBCalculator.Birksk = 0.0486 * 1.2
19
20 EMECPosInnerWheelCalculator = cfg.getService("EMECPosInnerWheelCalculator")
21 EMECPosInnerWheelCalculator.BirksLaw = True
22 EMECPosInnerWheelCalculator.Birksk = 0.0486 * 1.2
23
24 EMECNegInnerWheelCalculator = cfg.getService("EMECNegInnerWheelCalculator")
25 EMECNegInnerWheelCalculator.BirksLaw = True
26 EMECNegInnerWheelCalculator.Birksk = 0.0486 * 1.2
27
28 EMECPosOuterWheelCalculator = cfg.getService("EMECPosOuterWheelCalculator")
29 EMECPosOuterWheelCalculator.BirksLaw = True
30 EMECPosOuterWheelCalculator.Birksk = 0.0486 * 1.2
31
32 EMECNegOuterWheelCalculator = cfg.getService("EMECNegOuterWheelCalculator")
33 EMECNegOuterWheelCalculator.BirksLaw = True
34 EMECNegOuterWheelCalculator.Birksk = 0.0486 * 1.2
35
36 EMECPresamplerCalculator = cfg.getService("EMECPresamplerCalculator")
37 EMECPresamplerCalculator.BirksLaw = True
38 EMECPresamplerCalculator.Birksk = 0.0486 * 1.2
39
40 EMECPosBackOuterBarretteCalculator = cfg.getService("EMECPosBackOuterBarretteCalculator")
41 EMECPosBackOuterBarretteCalculator.BirksLaw = True
42 EMECPosBackOuterBarretteCalculator.Birksk = 0.0486 * 1.2
43
44 EMECNegBackOuterBarretteCalculator = cfg.getService("EMECNegBackOuterBarretteCalculator")
45 EMECNegBackOuterBarretteCalculator.BirksLaw = True
46 EMECNegBackOuterBarretteCalculator.Birksk = 0.0486 * 1.2
47
48
49 if flags.Detector.EnableTile:
51 gramsPerMeVcmSq = Units.g/(Units.MeV * Units.cm2)
52 TileGeoG4SDCalc = cfg.getService("TileGeoG4SDCalc")
53 TileGeoG4SDCalc.birk1 = 0.0130 * gramsPerMeVcmSq * 1.54
54 TileGeoG4SDCalc.birk2 = 0.0
55
56 if flags.Common.ProductionStep is not ProductionStep.Simulation:
57
58 if flags.Detector.EnableLAr:
59 from IOVDbSvc.IOVDbSvcConfig import addOverride
60 cfg.merge(addOverride(flags, "/LAR/ElecCalibMC/fSampl","LARElecCalibMCfSampl-G4106-v1-FTFP_BERT_BIRK"))
61
62
63 if flags.Detector.EnableTile:
64 tileInfoLoader = cfg.getService("TileInfoLoader")
65 tileInfoLoader.EmScaleA = 33.432914