ATLAS Offline Software
LArCalib_CalibDigitsMakerConfig.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.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 import sys
6 
7 def patternToVars( Pattern):
8  f = open(Pattern)
9  lines = [line for line in f.readlines() if line.strip()]
10 
11  f.close()
12  for i in range(len(lines)):
13  lines[i] = (lines[i]).rstrip().split(' ')
14  if len(lines[0]) != 1:
15  print('ERROR: The format of input pattern.dat is unknown.')
16  sys.exit(-1)
17  if int(lines[0][0]) != len(lines[1]):
18  print('ERROR: The format of input pattern.dat is unknown.')
19  sys.exit(-1)
20  if len(lines[2]) != 1:
21  print('ERROR: The format of input pattern.dat is unknown.')
22  sys.exit(-1)
23  if int(lines[2][0]) != len(lines[3]):
24  print('ERROR: The format of input pattern.dat is unknown.')
25  sys.exit(-1)
26  if len(lines[4]) != 1:
27  print('ERROR: The format of input pattern.dat is unknown.')
28  sys.exit(-1)
29  if int(lines[4][0]) != len(lines) - 5:
30  print('ERROR: The format of input pattern.dat is unknown.')
31  sys.exit(-1)
32  DACs = list(map(int, lines[1]))
33  Delays = list(map(int, lines[3]))
34  ptrns = [ item for sublist in lines[5:] for item in sublist ]
35  Pattern = []
36  for i in range(0,len(ptrns)):
37  print(ptrns[i])
38  Pattern += [int(ptrns[i],16)]
39  return DACs, Delays, Pattern
40 
41 def LArCalibDigitsMakerCfg(flags,DigitsKey=""):
42 
43  result = ComponentAccumulator()
44  from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
45  result.merge(LArOnOffIdMappingCfg(flags))
46  if flags.LArCalib.isSC:
47  from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg
48  result.merge(LArOnOffIdMappingSCCfg(flags))
49 
50 
51  BoardIDs = {}
52  BoardIDs["EMBA"] = [1023868928, 1040121856, 1024917504, 1024393216, 1025966080, 1025441792, 1027014656, 1026490368, 1028063232, 1027538944, 1029111808, 1028587520, 1030160384, 1029636096, 1031208960, 1030684672, 1032257536, 1031733248, 1033306112, 1032781824, 1034354688, 1033830400, 1035403264, 1034878976, 1036451840, 1035927552, 1037500416, 1036976128, 1038548992, 1038024704, 1039597568, 1039073280]
53  BoardIDs["EMBC"] = [1015480320, 1014956032, 1014431744, 1013907456, 1013383168, 1012858880, 1012334592, 1011810304, 1011286016, 1010761728, 1010237440, 1009713152, 1009188864, 1008664576, 1008140288, 1007616000, 1007091712, 1023344640, 1022820352, 1022296064, 1021771776, 1021247488, 1020723200, 1020198912, 1019674624, 1019150336, 1018626048, 1018101760, 1017577472, 1017053184, 1016528896, 1016004608]
54 
55  BoardIDs["Barrel"] = BoardIDs["EMBA"] + BoardIDs["EMBC"]
56 
57  BoardIDs["EMECAstd"] = [1057947648, 1057423360, 1060044800, 1059520512, 1061617664, 1061093376, 1063714816, 1063190528, 1064763392, 1064239104, 1066860544, 1066336256, 1067909120, 1067384832, 1070006272, 1069481984]
58  BoardIDs["EMECAspe"] = [1058603008, 1058635776, 1062273024, 1062305792, 1065418752, 1065451520, 1068564480, 1068597248]
59  BoardIDs["EMECCstd"] = [1046937600, 1046413312, 1044840448, 1044316160, 1043267584, 1042743296, 1041170432, 1040646144, 1053229056, 1052704768, 1051131904, 1050607616, 1050083328, 1049559040, 1047986176, 1047461888]
60  BoardIDs["EMECCspe"] = [1045495808, 1045528576, 1041825792, 1041858560, 1051787264, 1051820032, 1048641536, 1048674304]
61 
62  BoardIDs["EMECspe"] = BoardIDs["EMECAspe"]+BoardIDs["EMECCspe"]
63  BoardIDs["EMECstd"] = BoardIDs["EMECAstd"]+BoardIDs["EMECCstd"]
64 
65  BoardIDs["HECA"] = [1058897920, 1062567936, 1065713664, 1068859392]
66  BoardIDs["HECC"] = [1045790720, 1042120704, 1052082176, 1048936448]
67  BoardIDs["FCALA"] = [1060601856]
68  BoardIDs["FCALC"] = [1043824640]
69 
70  BoardIDs["HEC"] = BoardIDs["HECA"] + BoardIDs["HECC"]
71  BoardIDs["FCAL"] = BoardIDs["FCALA"] + BoardIDs["FCALC"]
72 
73  Boards = [ BoardIDs["Barrel"], BoardIDs["EMECstd"], BoardIDs["EMECspe"], BoardIDs["HEC"], BoardIDs["FCAL"] ]
74 
75  # read and interpret parameters.dat
76 
77  DACs,Delays,Patterns=patternToVars(flags.LArCalib.Input.paramsFile)
78  nPatterns=len(Patterns)
79 
80  print('CalibDigitsMakerConfig: ',DACs,' ',Delays,' ',Patterns)
81  result.addEventAlgo(CompFactory.LArCalibDigitMaker("LArCalibDigitMaker", KeyList = [DigitsKey],
82  NTrigger = 100, DAC = [DACs,DACs,DACs,DACs,DACs],
83  Delay = Delays, Pattern = [Patterns,Patterns,Patterns,Patterns,Patterns],
84  nPattern = [nPatterns,nPatterns,nPatterns,nPatterns,nPatterns],
85  BoardIDs = Boards))
86 
87  from AthenaCommon.SystemOfUnits import ns
88  scmap="LArOnOffIdMapSC" if flags.LArCalib.isSC else ""
89  scclmap="LArCalibIdMapSC" if flags.LArCalib.isSC else ""
90  result.addEventAlgo(CompFactory.LArCalibDigitsAccumulator("LArCalibDigitsAccumulator", KeyList = [DigitsKey],
91  LArAccuCalibDigitContainerName = "",
92  CalibMapSCKey=scclmap, ScCablingKey=scmap,
93  DelayScale = (25./240.)*ns, SampleShift = 0,
94  KeepFullyPulsedSC = True, KeepOnlyPulsed = True,
95  isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
96 
97  return result
SystemOfUnits
LArCablingConfig.LArOnOffIdMappingSCCfg
def LArOnOffIdMappingSCCfg(configFlags)
Definition: LArCablingConfig.py:65
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LArCalib_CalibDigitsMakerConfig.patternToVars
def patternToVars(Pattern)
Definition: LArCalib_CalibDigitsMakerConfig.py:7
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
python.LArCalib_CalibDigitsMakerConfig.LArCalibDigitsMakerCfg
def LArCalibDigitsMakerCfg(flags, DigitsKey="")
Definition: LArCalib_CalibDigitsMakerConfig.py:41
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
Trk::open
@ open
Definition: BinningType.h:40
Trk::split
@ split
Definition: LayerMaterialProperties.h:38