ATLAS Offline Software
Loading...
Searching...
No Matches
PlotCalibrationGains.L1CaloGeometryConvertor Class Reference
Collaboration diagram for PlotCalibrationGains.L1CaloGeometryConvertor:

Public Member Functions

 __init__ (self)
 LoadReceiverPPMMap (self)
 getPPMfromReceiver (self, ReceiverId)
 getReceiverfromPPM (self, PPMId, strategy_string=None)
 getCoolEm (self, i_eta, i_phi)
 getCoolHad (self, i_eta, i_phi)
 isCoolEm (self, CoolId)
 isCoolHad (self, CoolId)
 getEtaBin (self, CoolId)
 getPhiBin (self, CoolId)
 getMissingReceiverChannels (self, channel_list)
 getReceiverCMCP (self, ReceiverId)
 isPPMFCAL (self, CoolId)
 isPPMOverlap (self, CoolId)
 getOverlapLayer (self, RecCoolId)
 getFCAL23RecEta (self, RecCoolId)

Public Attributes

 coolIdPath = ROOT.PathResolver.find_calib_file("TrigT1Calo/COOLIdDump_v1.txt")
dict list_of_channels_em = {}
dict list_of_channels_had = {}
dict receiver_to_ppm_map = {}
int UNIX2COOL = 1000000000

Detailed Description

Definition at line 83 of file PlotCalibrationGains.py.

Constructor & Destructor Documentation

◆ __init__()

PlotCalibrationGains.L1CaloGeometryConvertor.__init__ ( self)

Definition at line 85 of file PlotCalibrationGains.py.

85 def __init__(self):
86 self.coolIdPath=ROOT.PathResolver.find_calib_file("TrigT1Calo/COOLIdDump_v1.txt")
87 input = open(self.coolIdPath)
88 self.list_of_channels_em={}
89 self.list_of_channels_had={}
90
91 for line in input.readlines():
92 parts = line.split(' ')
93 emCool = parts[4].rstrip()
94 hadCool = parts[5].rstrip()
95 self.list_of_channels_em[(parts[0],parts[1])] = '0x'+emCool
96 self.list_of_channels_had[(parts[0],parts[1])] = '0x'+hadCool
97
98 input.close()
99

Member Function Documentation

◆ getCoolEm()

PlotCalibrationGains.L1CaloGeometryConvertor.getCoolEm ( self,
i_eta,
i_phi )

Definition at line 176 of file PlotCalibrationGains.py.

176 def getCoolEm(self,i_eta,i_phi):
177 if (str(i_eta),str(i_phi)) in self.list_of_channels_em:
178 cool = self.list_of_channels_em[(str(i_eta),str(i_phi))]
179 cool.rstrip()
180 cool.lstrip()
181 return (cool)
182 else:
183 return ('')
184

◆ getCoolHad()

PlotCalibrationGains.L1CaloGeometryConvertor.getCoolHad ( self,
i_eta,
i_phi )

Definition at line 185 of file PlotCalibrationGains.py.

185 def getCoolHad(self,i_eta,i_phi):
186 if (str(i_eta),str(i_phi)) in self.list_of_channels_had:
187 cool = self.list_of_channels_had[(str(i_eta),str(i_phi))]
188 cool.rstrip()
189 cool.lstrip()
190 return (cool)
191 else:
192 return ('')
193

◆ getEtaBin()

PlotCalibrationGains.L1CaloGeometryConvertor.getEtaBin ( self,
CoolId )

Definition at line 200 of file PlotCalibrationGains.py.

200 def getEtaBin(self,CoolId):
201 if self.isCoolEm(CoolId):
202 channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
203 return int(channel[0][0])
204 elif self.isCoolHad(CoolId):
205 channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
206 return int(channel[0][0])
207 else:
208 return -1
209

◆ getFCAL23RecEta()

PlotCalibrationGains.L1CaloGeometryConvertor.getFCAL23RecEta ( self,
RecCoolId )

Definition at line 271 of file PlotCalibrationGains.py.

271 def getFCAL23RecEta(self,RecCoolId):
272 ppm_id = self.getPPMfromReceiver(RecCoolId)
273
274 if (not self.isPPMFCAL(ppm_id)) or (not self.isCoolHad(ppm_id)):
275 return None
276 eta_bin = self.getEtaBin(ppm_id)
277
278 RecCoolInt = int(RecCoolId,16)
279 if RecCoolInt%2 == 1:
280 isRecOdd = True
281 else:
282 isRecOdd = False
283
284 if eta_bin>0:
285 if isRecOdd:
286 return 'LowEta'
287 else:
288 return 'HighEta'
289 else:
290 if isRecOdd:
291 return 'HighEta'
292 else:
293 return 'LowEta'
294
295

◆ getMissingReceiverChannels()

PlotCalibrationGains.L1CaloGeometryConvertor.getMissingReceiverChannels ( self,
channel_list )

Definition at line 220 of file PlotCalibrationGains.py.

220 def getMissingReceiverChannels(self, channel_list):
221 missing_channels= [channel for channel in self.receiver_to_ppm_map.keys() if channel not in channel_list]
222 return missing_channels
223

◆ getOverlapLayer()

PlotCalibrationGains.L1CaloGeometryConvertor.getOverlapLayer ( self,
RecCoolId )

Definition at line 254 of file PlotCalibrationGains.py.

254 def getOverlapLayer(self,RecCoolId):
255 ppm_id = self.getPPMfromReceiver(RecCoolId)
256
257 if not self.isPPMOverlap(ppm_id):
258 return None
259
260 cabling = self.getReceiverCMCP(RecCoolId)
261 if cabling[0] < 2: # unconnected channel has barrel crate nr.
262 return 'Unconnected'
263 elif cabling[2] == 0:
264 return 'EMEC'
265 elif cabling[2] == 2:
266 return 'EMB'
267 else:
268 print ("Error in GetOverlapLayer, can't determine layer!")
269 return None
270

◆ getPhiBin()

PlotCalibrationGains.L1CaloGeometryConvertor.getPhiBin ( self,
CoolId )

Definition at line 210 of file PlotCalibrationGains.py.

210 def getPhiBin(self,CoolId):
211 if self.isCoolEm(CoolId):
212 channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
213 return int(channel[0][1])
214 elif self.isCoolHad(CoolId):
215 channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
216 return int(channel[0][1])
217 else:
218 return -1
219

◆ getPPMfromReceiver()

PlotCalibrationGains.L1CaloGeometryConvertor.getPPMfromReceiver ( self,
ReceiverId )

Definition at line 138 of file PlotCalibrationGains.py.

138 def getPPMfromReceiver(self,ReceiverId):
139 if ReceiverId in self.receiver_to_ppm_map:
140 return self.receiver_to_ppm_map[ReceiverId]
141 else:
142 return None
143

◆ getReceiverCMCP()

PlotCalibrationGains.L1CaloGeometryConvertor.getReceiverCMCP ( self,
ReceiverId )

Definition at line 224 of file PlotCalibrationGains.py.

224 def getReceiverCMCP(self,ReceiverId):
225 recI=int(ReceiverId,16)
226
227 crate = recI/1024
228 recI = recI - crate*1024
229
230 module = recI/64
231 recI = recI - module*64
232
233 conn = recI/16
234 recI = recI - conn*16
235
236 pair = recI
237
238 return [crate,module,conn,pair]
239

◆ getReceiverfromPPM()

PlotCalibrationGains.L1CaloGeometryConvertor.getReceiverfromPPM ( self,
PPMId,
strategy_string = None )

Definition at line 144 of file PlotCalibrationGains.py.

144 def getReceiverfromPPM(self,PPMId,strategy_string=None):
145
146 ReceiverChannels = [item[0] for item in self.receiver_to_ppm_map.items() if item[1]==PPMId]
147
148 if strategy_string is None:
149 print (" Warning! in getReceiverfromPPM no runtype given, using default!")
150 return ReceiverChannels[0]
151
152 if self.isPPMFCAL(PPMId) and self.isCoolHad(PPMId): # pick correct FCAL23 channel
153
154 if strategy_string == "GainOneOvEmbFcalHighEta":
155 for channel in ReceiverChannels:
156 if self.getFCAL23RecEta(channel) == 'HighEta':
157 return channel
158 if strategy_string == "GainOneOvEmecFcalLowEta":
159 for channel in ReceiverChannels:
160 if self.getFCAL23RecEta(channel) == 'LowEta':
161 return channel
162
163 elif self.isPPMOverlap(PPMId):
164 if strategy_string == "GainOneOvEmbFcalHighEta":
165 for channel in ReceiverChannels:
166 if self.getOverlapLayer(channel) == 'EMB':
167 return channel
168 if strategy_string == "GainOneOvEmecFcalLowEta":
169 for channel in ReceiverChannels:
170 if self.getOverlapLayer(channel) == 'EMEC':
171 return channel
172
173 else:
174 return ReceiverChannels[0]
175

◆ isCoolEm()

PlotCalibrationGains.L1CaloGeometryConvertor.isCoolEm ( self,
CoolId )

Definition at line 194 of file PlotCalibrationGains.py.

194 def isCoolEm(self,CoolId):
195 return (CoolId in self.list_of_channels_em.values())
196

◆ isCoolHad()

PlotCalibrationGains.L1CaloGeometryConvertor.isCoolHad ( self,
CoolId )

Definition at line 197 of file PlotCalibrationGains.py.

197 def isCoolHad(self,CoolId):
198 return (CoolId in self.list_of_channels_had.values())
199

◆ isPPMFCAL()

PlotCalibrationGains.L1CaloGeometryConvertor.isPPMFCAL ( self,
CoolId )

Definition at line 240 of file PlotCalibrationGains.py.

240 def isPPMFCAL(self,CoolId):
241 eta_bin = self.getEtaBin(CoolId)
242 if eta_bin >= 32 or eta_bin <= -36:
243 return True
244 else:
245 return False
246

◆ isPPMOverlap()

PlotCalibrationGains.L1CaloGeometryConvertor.isPPMOverlap ( self,
CoolId )

Definition at line 247 of file PlotCalibrationGains.py.

247 def isPPMOverlap(self,CoolId):
248 eta_bin = self.getEtaBin(CoolId)
249 if self.isCoolEm(CoolId) is True and (eta_bin == 14 or eta_bin == -15):
250 return True
251 else:
252 return False
253

◆ LoadReceiverPPMMap()

PlotCalibrationGains.L1CaloGeometryConvertor.LoadReceiverPPMMap ( self)

Definition at line 100 of file PlotCalibrationGains.py.

100 def LoadReceiverPPMMap(self):
101
102 self.receiver_to_ppm_map={}
103 self.UNIX2COOL = 1000000000
104
105 # get database service and open database
106 dbSvc = cool.DatabaseSvcFactory.databaseService()
107 dbString = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=CONDBR2'
108 try:
109 db = dbSvc.openDatabase(dbString, False)
110 except Exception as e:
111 print ('Error: Problem opening database', e)
112 sys.exit(1)
113
114 folder_name = "/TRIGGER/Receivers/RxPpmIdMap"
115 folder=db.getFolder(folder_name)
116
117 startUtime = int(time.time())
118 endUtime = int(time.time())
119 startValKey = startUtime * self.UNIX2COOL
120 endValKey = endUtime * self.UNIX2COOL
121 chsel = cool.ChannelSelection(0,sys.maxsize)
122
123 try:
124 itr=folder.browseObjects(startValKey, endValKey, chsel)
125 except Exception as e:
126 print (e)
127 sys.exit(1)
128
129 for row in itr:
130 ReceiverId = hex(int(row.channelId()))
131 payload = row.payload()
132 PPMId = hex(int(payload['ppmid']))
133 self.receiver_to_ppm_map[ReceiverId]= PPMId
134
135 # close database
136 db.closeDatabase()
137

Member Data Documentation

◆ coolIdPath

PlotCalibrationGains.L1CaloGeometryConvertor.coolIdPath = ROOT.PathResolver.find_calib_file("TrigT1Calo/COOLIdDump_v1.txt")

Definition at line 86 of file PlotCalibrationGains.py.

◆ list_of_channels_em

dict PlotCalibrationGains.L1CaloGeometryConvertor.list_of_channels_em = {}

Definition at line 88 of file PlotCalibrationGains.py.

◆ list_of_channels_had

dict PlotCalibrationGains.L1CaloGeometryConvertor.list_of_channels_had = {}

Definition at line 89 of file PlotCalibrationGains.py.

◆ receiver_to_ppm_map

dict PlotCalibrationGains.L1CaloGeometryConvertor.receiver_to_ppm_map = {}

Definition at line 102 of file PlotCalibrationGains.py.

◆ UNIX2COOL

int PlotCalibrationGains.L1CaloGeometryConvertor.UNIX2COOL = 1000000000

Definition at line 103 of file PlotCalibrationGains.py.


The documentation for this class was generated from the following file: