ATLAS Offline Software
LArCellBinning.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 
6 from ROOT import TMath
7 
9  __slots__ = ('PartitionLayers','Sides','PartLayerNames','PartitionNames','etaRange','phiRange','phiNbin','etaNbin','etaMin','etaCellSize','energyscale','timescale','logEnergyBins','cosmicEneBinning','defaultEnergyBins','larCellSummary')
10 
11 lArCellBinningScheme = LArCellBinningScheme()
12 
13 
14 #Creation of the dictionnary
15 
16 LayersEM=["P","1","2","3"]
17 LayersHEC=["0","1","2","3"]
18 LayersFCAL=["1","2","3"]
19 lArCellBinningScheme.PartitionLayers={"EMB":LayersEM,"EMEC":LayersEM,"HEC":LayersHEC,"FCAL":LayersFCAL}
20 lArCellBinningScheme.Sides=["A","C"]
21 
22 lArCellBinningScheme.PartLayerNames=[]
23 lArCellBinningScheme.PartitionNames=[]
24 
25 for Partition in lArCellBinningScheme.PartitionLayers :
26  for Side in lArCellBinningScheme.Sides :
27  lArCellBinningScheme.PartitionNames.append(Partition+Side)
28  pass
29  for Layer in lArCellBinningScheme.PartitionLayers[Partition]:
30  for Side in lArCellBinningScheme.Sides :
31  lArCellBinningScheme.PartLayerNames.append(Partition+Layer+Side)
32 
33 
34 
35 #Number of Bins in phi
36 lArCellBinningScheme.phiNbin={}
37 phiSteps={}
38 M_PI=TMath.Pi()
39 
40 lArCellBinningScheme.phiNbin["EMB"]= {"P":[64],"1":[64],"2":[256],"3":[256]}
41 phiSteps["EMB"]= {"P":[-M_PI,M_PI],"1":[-M_PI,M_PI],"2":[-M_PI,M_PI],"3":[-M_PI,M_PI]}
42 lArCellBinningScheme.phiNbin["EMEC"]= {"P":[64],"1":[64],"2":[256],"3":[256]}
43 phiSteps["EMEC"]= {"P":[-M_PI,M_PI],"1":[-M_PI,M_PI],"2":[-M_PI,M_PI],"3":[-M_PI,M_PI]}
44 lArCellBinningScheme.phiNbin["HEC"]= {"0":[64],"1":[64],"2":[64],"3":[64]}
45 phiSteps["HEC"]= {"0":[-M_PI,M_PI],"1":[-M_PI,M_PI],"2":[-M_PI,M_PI],"3":[-M_PI,M_PI]}
46 lArCellBinningScheme.phiNbin["FCAL"]= {"1":[2,1,1,1,1,1,1,2,6,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,1,1,2,1,2,1,2,4,3,1,1,2,1,1,3,1,2,2,1,2,3,1,1,1,1,1,1,2,6,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,1,1,2,1,2,1,2,4,3,1,1,2,1,1,3,1,2,2,1,2,1],
47  "2":[1,1,1,1,1,1,1,1,1,8,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,8,1,3,1,1,1,1],
48  "3":[10,1,1,4,2,1,2,2,1,1,2,10,1,1,4,2,1,2,2,1,1,2]}
49 phiSteps["FCAL"]= {"1":[-M_PI,(-250.0/256)*M_PI,(-248.0/256)*M_PI,(-243.0/256)*M_PI,(-240.0/256)*M_PI,(-234.0/256)*M_PI,
50  (-230.0/256)*M_PI,(-225.0/256)*M_PI,(-219.0/256)*M_PI,(-195.0/256)*M_PI,(-190.0/256)*M_PI,(-186.0/256)*M_PI,
51  (-183.0/256)*M_PI,(-178.0/256)*M_PI,(-175.0/256)*M_PI,(-173.0/256)*M_PI,(-167.0/256)*M_PI,(-161.0/256)*M_PI,
52  (-159.0/256)*M_PI,(-156.0/256)*M_PI,(-151.0/256)*M_PI,(-148.0/256)*M_PI,(-146.0/256)*M_PI,(-141.0/256)*M_PI,
53  (-139.0/256)*M_PI,(-135.0/256)*M_PI,(-132.0/256)*M_PI,(-120.0/256)*M_PI,(-117.0/256)*M_PI,(-114.0/256)*M_PI,
54  (-110.0/256)*M_PI,(-105.0/256)*M_PI,(-97.0/256)*M_PI,(-94.0/256)*M_PI,(-86.0/256)*M_PI,(-78.0/256)*M_PI,
55  (-63.0/256)*M_PI,(-60.0/256)*M_PI,(-56.0/256)*M_PI,(-46.0/256)*M_PI,(-44.0/256)*M_PI,(-41.0/256)*M_PI,
56  (-32.0/256)*M_PI,(-28.0/256)*M_PI,(-22.0/256)*M_PI,(-10.0/256)*M_PI,(-7.0/256)*M_PI,(-3.0/256)*M_PI,
57  (6.0/256)*M_PI,(8.0/256)*M_PI,(13.0/256)*M_PI,(16.0/256)*M_PI,(22.0/256)*M_PI,(26.0/256)*M_PI,(31.0/256)*M_PI,
58  (37.0/256)*M_PI,(61.0/256)*M_PI,(66.0/256)*M_PI,(70.0/256)*M_PI,(73.0/256)*M_PI,(78.0/256)*M_PI,(81.0/256)*M_PI,
59  (83.0/256)*M_PI,(89.0/256)*M_PI,(95.0/256)*M_PI,(97.0/256)*M_PI,(100.0/256)*M_PI,(105.0/256)*M_PI,
60  (108.0/256)*M_PI,(110.0/256)*M_PI,(115.0/256)*M_PI,(117.0/256)*M_PI,(121.0/256)*M_PI,(124.0/256)*M_PI,
61  (136.0/256)*M_PI,(139.0/256)*M_PI,(142.0/256)*M_PI,(146.0/256)*M_PI,(151.0/256)*M_PI,(159.0/256)*M_PI,
62  (162.0/256)*M_PI,(170.0/256)*M_PI,(178.0/256)*M_PI,(193.0/256)*M_PI,(196.0/256)*M_PI,(200.0/256)*M_PI,
63  (210.0/256)*M_PI,(212.0/256)*M_PI,(215.0/256)*M_PI,(224.0/256)*M_PI,(228.0/256)*M_PI,(234.0/256)*M_PI,
64  (246.0/256)*M_PI,(249.0/256)*M_PI,(253.0/256)*M_PI,M_PI],
65  "2":[-M_PI,(-62.0/64)*M_PI,(-59.0/64)*M_PI,(-55.0/64)*M_PI,(-52.0/64)*M_PI,(-50.0/64)*M_PI,(-48.0/64)*M_PI,
66  (-45.0/64)*M_PI,(-41.0/64)*M_PI,(-38.0/64)*M_PI,(-22.0/64)*M_PI,(-18.0/64)*M_PI,(-12.0/64)*M_PI,
67  (-8.0/64)*M_PI,(-5.0/64)*M_PI,(-1.0/64)*M_PI,0,(2.0/64)*M_PI,(5.0/64)*M_PI,(9.0/64)*M_PI,(12.0/64)*M_PI,
68  (14.0/64)*M_PI,(16.0/64)*M_PI,(19.0/64)*M_PI,(23.0/64)*M_PI,(26.0/64)*M_PI,(42.0/64)*M_PI,(46.0/64)*M_PI,
69  (52.0/64)*M_PI,(56.0/64)*M_PI,(59.0/64)*M_PI,(63.0/64)*M_PI,M_PI],
70  "3":[-M_PI,(-40.0/64)*M_PI,(-39.0/64)*M_PI,(-35.0/64)*M_PI,(-29.0/64)*M_PI,(-24.0/64)*M_PI,(-22.0/64)*M_PI,
71  (-16.0/64)*M_PI,(-11.0/64)*M_PI,(-9.0/64)*M_PI,(-6.0/64)*M_PI,0,(24.0/64)*M_PI,(25.0/64)*M_PI,
72  (29.0/64)*M_PI,(35.0/64)*M_PI,(40.0/64)*M_PI,(42.0/64)*M_PI,(48.0/64)*M_PI,(53.0/64)*M_PI,(55.0/64)*M_PI,
73  (58.0/64)*M_PI,M_PI]}
74 
75 
76 #Number of bins in eta in each range of cells (defining only for A side since C side is symmetric)
77 #To be read as follow :
78 #The EMB Layer 1 have 3 types of cell sizes
79 #The first bin start at eta=0.0, and have a size of 0.025/4
80 #The bins [2;446], have a size of 0.025/8
81 #The bins [447;450, have a size of 0.025
82 
83 lArCellBinningScheme.etaNbin = {}
84 lArCellBinningScheme.etaMin = {}
85 lArCellBinningScheme.etaCellSize = {}
86 
87 lArCellBinningScheme.etaNbin["EMB"]= {"P":[0,61],"1":[0,1,447,451],"2":[0,58,60],"3":[0, 27, 28]}
88 lArCellBinningScheme.etaMin["EMB"]= {"P":0.0,"1":0.0,"2":0.0,"3":0.0}
89 lArCellBinningScheme.etaCellSize["EMB"]={"P":[0.025],"1":[0.025/4,0.025/8,0.025],"2":[0.025,0.05],"3":[0.05, 0.125]}
90 
91 lArCellBinningScheme.etaNbin["EMEC"]= {"P":[0,12],"1":[0,1,3,107,155,219,223,230],"2":[0,1,47,54],"3":[0,20]}
92 lArCellBinningScheme.etaMin["EMEC"]= {"P":1.5,"1":1.375,"2":1.375,"3":1.5}
93 lArCellBinningScheme.etaCellSize["EMEC"]={"P":[0.025],"1":[0.05,0.025,0.025/8,0.025/6,0.025/4,0.025,0.1],"2":[0.05,0.025,0.1],"3":[0.05]}
94 
95 lArCellBinningScheme.etaNbin["HEC"]= {"0":[0,10,14],"1":[0,10,13],"2":[0,9,12],"3":[0,8,12]}
96 lArCellBinningScheme.etaMin["HEC"]= {"0":1.5,"1":1.5,"2":1.6,"3":1.7}
97 lArCellBinningScheme.etaCellSize["HEC"]={"0":[0.1,0.2],"1":[0.1,0.2],"2":[0.1,0.2],"3":[0.1,0.2]}
98 
99 lArCellBinningScheme.etaNbin["FCAL"]= {"1":[0, 3, 9, 13, 15],"2":[0, 1, 4, 5, 6, 7, 10, 12, 13, 14, 17, 21, 25, 27, 28, 29, 30, 31],"3":[0,2,4,5,6,8]}
100 
101 lArCellBinningScheme.etaMin["FCAL"]= {"1":3.08,"2":3.192,"3":3.27}
102 lArCellBinningScheme.etaCellSize["FCAL"] ={"1":[0.04, 0.1, 0.2, 0.11],"2":[0.007, 0.0035, 0.008, 0.0005, 0.012, 0.01, 0.04, 0.03, 0.02, 0.043, 0.0125, 0.066, 0.132, 0.265, 0.135, 0.15, 0.16],"3":[0.08, 0.135, 0.21, 0.42, 0.21]}
103 
104 
105 
107 lArCellBinningScheme.phiRange={}
108 for Part in lArCellBinningScheme.PartitionLayers:
109  for Layer in lArCellBinningScheme.PartitionLayers[Part]:
110 # if Part=="FCAL": TMath.Pi(
111  # lArCellBinningScheme.phiRange[Part+Layer+"A"]=[-0.5+x for x in range(lArCellBinningScheme.phiNbin[Part][Layer]+1)]
112  # else: #all other partitions
113  lArCellBinningScheme.phiRange[Part+Layer+"A"]=[]
114  for istep in range(1,len(phiSteps[Part][Layer])):
115  lArCellBinningScheme.phiRange[Part+Layer+"A"].extend([phiSteps[Part][Layer][istep-1]+ x*(phiSteps[Part][Layer][istep]-phiSteps[Part][Layer][istep-1])/lArCellBinningScheme.phiNbin[Part][Layer][istep-1] for x in range(lArCellBinningScheme.phiNbin[Part][Layer][istep-1])])
116  pass
117  lArCellBinningScheme.phiRange[Part+Layer+"A"].append(phiSteps[Part][Layer][-1])
118  lArCellBinningScheme.phiRange[Part+Layer+"C"]=lArCellBinningScheme.phiRange[Part+Layer+"A"]
119 
120  pass #layer loop
121  pass #partition loop
122 
123 
124 
125 
126 
128 lArCellBinningScheme.etaRange = {}
129 for Part in lArCellBinningScheme.PartitionLayers:
130  for Lay in lArCellBinningScheme.PartitionLayers[Part]:
131  Ranges=lArCellBinningScheme.etaNbin[Part][Lay]
132  Sizes=lArCellBinningScheme.etaCellSize[Part][Lay]
133  if not len(Ranges)-len(Sizes)==1 :
134  print("Bad list of ranges and size please check", Part,Lay, len(Ranges), len(Sizes))
135  continue
136  #exit(1)
137  etamin=lArCellBinningScheme.etaMin[Part][Lay]
138  currange=[etamin]
139 
140  for k in range(len(Ranges)-1) :
141  currange+=[round(currange[-1] + x * Sizes[k],5) for x in range(1,Ranges[k+1]-Ranges[k]+1)]
142  pass
143 
144  lArCellBinningScheme.etaRange[Part+Lay+"A"]=currange
145  #The C side is just the symmeteric of the A side
146 # if Part=="FCAL":
147  # lArCellBinningScheme.etaRange[Part+Lay+"C"] = lArCellBinningScheme.etaRange[Part+Lay+"A"]
148  # else: #all other partitions
149  lArCellBinningScheme.etaRange[Part+Lay+"C"] =list(map(lambda x: x*-1,lArCellBinningScheme.etaRange[Part+Lay+"A"]))[::-1]
150  # pass
151 
152 #energy and time
153 lArCellBinningScheme.timescale = [-200,-195,-190,-185,-180,-175,-170,-165,-160,-155,-150,-145,-140,-135,-130,-125,-120,-115,-110,-105,-100,-95,-90,-85,-80,-75,-70,-65,-60,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,-8,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,8,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200]
154 lArCellBinningScheme.energyscale = [250,500,1000,2500,5000,10000,25000,50000,100000,250000,500000,1000000]
155 
156 lArCellBinningScheme.logEnergyBins=[None]*55
157 lArCellBinningScheme.logEnergyBins[0]=10
158 step = pow(10,0.1)
159 for i in range(1,len(lArCellBinningScheme.logEnergyBins)):
160  lArCellBinningScheme.logEnergyBins[i] = step * lArCellBinningScheme.logEnergyBins[i-1]
161  pass
162 
163 xbins=201
164 lArCellBinningScheme.cosmicEneBinning={}
165 for side in lArCellBinningScheme.Sides:
166  for Lay in lArCellBinningScheme.PartitionLayers["EMB"]:
167  lArCellBinningScheme.cosmicEneBinning["EMB"+Lay+side]=[xbins,-318.5,1088.5]
168  pass
169  for Lay in lArCellBinningScheme.PartitionLayers["EMEC"]:
170  lArCellBinningScheme.cosmicEneBinning["EMEC"+Lay+side]=[xbins,-591.5,2021.5]
171  pass
172  for Lay in lArCellBinningScheme.PartitionLayers["HEC"]:
173  lArCellBinningScheme.cosmicEneBinning["HEC"+Lay+side]=[xbins,-2047.5,6997.5]
174  pass
175  for Lay in lArCellBinningScheme.PartitionLayers["FCAL"]:
176  lArCellBinningScheme.cosmicEneBinning["FCAL"+Lay+side]=[xbins,-1865.5,6375.5]
177  pass
178  pass
179 
180 lArCellBinningScheme.defaultEnergyBins=[401,-1912.5,28162.5]
181 
182 lArCellBinningScheme.larCellSummary={"xbins":[7, 1., 8.],
183  "xlabels":["Total Events", "RNDM Trigger", "Calo Trigger", "MinBias Trigger", "MET Trigger", "Misc Trigger", "Events Sele\
184 cted for Noise Plots"]}
185 
186 
187 
188 if __name__ =="__main__":
189 
190  print (lArCellBinningScheme.PartLayerNames)
191  print (lArCellBinningScheme.etaRange)
192  for k in lArCellBinningScheme.etaRange:
193  print (k)
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
LArCellBinning.LArCellBinningScheme
Definition: LArCellBinning.py:8
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.KeyStore.list
def list(self, key=None)
Definition: KeyStore.py:318
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
pickleTool.object
object
Definition: pickleTool.py:30