ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
PlotCalibrationGains.L1CaloGeometryConvertor Class Reference
Collaboration diagram for PlotCalibrationGains.L1CaloGeometryConvertor:

Public Member Functions

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

Public Attributes

 coolIdPath
 
 list_of_channels_em
 
 list_of_channels_had
 
 receiver_to_ppm_map
 
 UNIX2COOL
 

Detailed Description

Definition at line 59 of file PlotCalibrationGains.py.

Constructor & Destructor Documentation

◆ __init__()

def PlotCalibrationGains.L1CaloGeometryConvertor.__init__ (   self)

Definition at line 61 of file PlotCalibrationGains.py.

61  def __init__(self):
62  self.coolIdPath=ROOT.PathResolver.find_calib_file("TrigT1Calo/COOLIdDump_v1.txt")
63  input = open(self.coolIdPath)
64  self.list_of_channels_em={}
65  self.list_of_channels_had={}
66 
67  for line in input.readlines():
68  parts = line.split(' ')
69  emCool = parts[4].rstrip()
70  hadCool = parts[5].rstrip()
71  self.list_of_channels_em[(parts[0],parts[1])] = '0x'+emCool
72  self.list_of_channels_had[(parts[0],parts[1])] = '0x'+hadCool
73 
74  input.close()
75 

Member Function Documentation

◆ getCoolEm()

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

Definition at line 157 of file PlotCalibrationGains.py.

157  def getCoolEm(self,i_eta,i_phi):
158  if (str(i_eta),str(i_phi)) in self.list_of_channels_em:
159  cool = self.list_of_channels_em[(str(i_eta),str(i_phi))]
160  cool.rstrip()
161  cool.lstrip()
162  return (cool)
163  else:
164  return ('')
165 
166 

◆ getCoolHad()

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

Definition at line 167 of file PlotCalibrationGains.py.

167  def getCoolHad(self,i_eta,i_phi):
168  if (str(i_eta),str(i_phi)) in self.list_of_channels_had:
169  cool = self.list_of_channels_had[(str(i_eta),str(i_phi))]
170  cool.rstrip()
171  cool.lstrip()
172  return (cool)
173  else:
174  return ('')
175 

◆ getEtaBin()

def PlotCalibrationGains.L1CaloGeometryConvertor.getEtaBin (   self,
  CoolId 
)

Definition at line 182 of file PlotCalibrationGains.py.

182  def getEtaBin(self,CoolId):
183  if self.isCoolEm(CoolId):
184  channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
185  return int(channel[0][0])
186  elif self.isCoolHad(CoolId):
187  channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
188  return int(channel[0][0])
189  else:
190  return -1
191 

◆ getFCAL23RecEta()

def PlotCalibrationGains.L1CaloGeometryConvertor.getFCAL23RecEta (   self,
  RecCoolId 
)

Definition at line 261 of file PlotCalibrationGains.py.

261  def getFCAL23RecEta(self,RecCoolId):
262 
263  ppm_id = self.getPPMfromReceiver(RecCoolId)
264 
265  if (not self.isPPMFCAL(ppm_id)) or (not self.isCoolHad(ppm_id)):
266  return None
267  eta_bin = self.getEtaBin(ppm_id)
268 
269  RecCoolInt = int(RecCoolId,16)
270  if RecCoolInt%2 == 1:
271  isRecOdd = True
272  else:
273  isRecOdd = False
274 
275  if eta_bin>0:
276  if isRecOdd:
277  return 'LowEta'
278  else:
279  return 'HighEta'
280  else:
281  if isRecOdd:
282  return 'HighEta'
283  else:
284  return 'LowEta'
285 
286 

◆ getMissingReceiverChannels()

def PlotCalibrationGains.L1CaloGeometryConvertor.getMissingReceiverChannels (   self,
  channel_list 
)

Definition at line 202 of file PlotCalibrationGains.py.

202  def getMissingReceiverChannels(self, channel_list):
203 
204  missing_channels= [channel for channel in self.receiver_to_ppm_map.keys() if channel not in channel_list]
205  return missing_channels
206 
207 

◆ getOverlapLayer()

def PlotCalibrationGains.L1CaloGeometryConvertor.getOverlapLayer (   self,
  RecCoolId 
)

Definition at line 243 of file PlotCalibrationGains.py.

243  def getOverlapLayer(self,RecCoolId):
244 
245  ppm_id = self.getPPMfromReceiver(RecCoolId)
246 
247  if not self.isPPMOverlap(ppm_id):
248  return None
249 
250  cabling = self.getReceiverCMCP(RecCoolId)
251  if cabling[0] < 2: # unconnected channel has barrel crate nr.
252  return 'Unconnected'
253  elif cabling[2] == 0:
254  return 'EMEC'
255  elif cabling[2] == 2:
256  return 'EMB'
257  else:
258  print ("Error in GetOverlapLayer, can't determine layer!")
259  return None
260 

◆ getPhiBin()

def PlotCalibrationGains.L1CaloGeometryConvertor.getPhiBin (   self,
  CoolId 
)

Definition at line 192 of file PlotCalibrationGains.py.

192  def getPhiBin(self,CoolId):
193  if self.isCoolEm(CoolId):
194  channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
195  return int(channel[0][1])
196  elif self.isCoolHad(CoolId):
197  channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
198  return int(channel[0][1])
199  else:
200  return -1
201 

◆ getPPMfromReceiver()

def PlotCalibrationGains.L1CaloGeometryConvertor.getPPMfromReceiver (   self,
  ReceiverId 
)

Definition at line 116 of file PlotCalibrationGains.py.

116  def getPPMfromReceiver(self,ReceiverId):
117 
118  if ReceiverId in self.receiver_to_ppm_map:
119  return self.receiver_to_ppm_map[ReceiverId]
120  else:
121  return None
122 

◆ getReceiverCMCP()

def PlotCalibrationGains.L1CaloGeometryConvertor.getReceiverCMCP (   self,
  ReceiverId 
)

Definition at line 208 of file PlotCalibrationGains.py.

208  def getReceiverCMCP(self,ReceiverId):
209 
210  recI=int(ReceiverId,16)
211 
212  crate = recI/1024
213  recI = recI - crate*1024
214 
215  module = recI/64
216  recI = recI - module*64
217 
218  conn = recI/16
219  recI = recI - conn*16
220 
221  pair = recI
222 
223  return [crate,module,conn,pair]
224 

◆ getReceiverfromPPM()

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

Definition at line 123 of file PlotCalibrationGains.py.

123  def getReceiverfromPPM(self,PPMId,strategy_string=None):
124 
125  ReceiverChannels = [item[0] for item in self.receiver_to_ppm_map.items() if item[1]==PPMId]
126 
127  if strategy_string is None:
128  print (" Warning! in getReceiverfromPPM no runtype given, using default!")
129  return ReceiverChannels[0]
130 
131  if self.isPPMFCAL(PPMId) and self.isCoolHad(PPMId): # pick correct FCAL23 channel
132 
133  if strategy_string == "GainOneOvEmbFcalHighEta":
134  for channel in ReceiverChannels:
135  if self.getFCAL23RecEta(channel) == 'HighEta':
136  return channel
137  if strategy_string == "GainOneOvEmecFcalLowEta":
138  for channel in ReceiverChannels:
139  if self.getFCAL23RecEta(channel) == 'LowEta':
140  return channel
141 
142  elif self.isPPMOverlap(PPMId):
143 
144  if strategy_string == "GainOneOvEmbFcalHighEta":
145  for channel in ReceiverChannels:
146  if self.getOverlapLayer(channel) == 'EMB':
147  return channel
148  if strategy_string == "GainOneOvEmecFcalLowEta":
149  for channel in ReceiverChannels:
150  if self.getOverlapLayer(channel) == 'EMEC':
151  return channel
152 
153  else:
154  return ReceiverChannels[0]
155 
156 

◆ isCoolEm()

def PlotCalibrationGains.L1CaloGeometryConvertor.isCoolEm (   self,
  CoolId 
)

Definition at line 176 of file PlotCalibrationGains.py.

176  def isCoolEm(self,CoolId):
177  return (CoolId in self.list_of_channels_em.values())
178 

◆ isCoolHad()

def PlotCalibrationGains.L1CaloGeometryConvertor.isCoolHad (   self,
  CoolId 
)

Definition at line 179 of file PlotCalibrationGains.py.

179  def isCoolHad(self,CoolId):
180  return (CoolId in self.list_of_channels_had.values())
181 

◆ isPPMFCAL()

def PlotCalibrationGains.L1CaloGeometryConvertor.isPPMFCAL (   self,
  CoolId 
)

Definition at line 225 of file PlotCalibrationGains.py.

225  def isPPMFCAL(self,CoolId):
226 
227  eta_bin = self.getEtaBin(CoolId)
228 
229  if eta_bin >= 32 or eta_bin <= -36:
230  return True
231  else:
232  return False
233 
234 

◆ isPPMOverlap()

def PlotCalibrationGains.L1CaloGeometryConvertor.isPPMOverlap (   self,
  CoolId 
)

Definition at line 235 of file PlotCalibrationGains.py.

235  def isPPMOverlap(self,CoolId):
236 
237  eta_bin = self.getEtaBin(CoolId)
238  if self.isCoolEm(CoolId) is True and (eta_bin == 14 or eta_bin == -15):
239  return True
240  else:
241  return False
242 

◆ LoadReceiverPPMMap()

def PlotCalibrationGains.L1CaloGeometryConvertor.LoadReceiverPPMMap (   self)

Definition at line 76 of file PlotCalibrationGains.py.

76  def LoadReceiverPPMMap(self):
77 
78  self.receiver_to_ppm_map={}
79  self.UNIX2COOL = 1000000000
80 
81  # get database service and open database
82  dbSvc = cool.DatabaseSvcFactory.databaseService()
83  dbString = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=CONDBR2'
84  try:
85  db = dbSvc.openDatabase(dbString, False)
86  except Exception as e:
87  print ('Error: Problem opening database', e)
88  sys.exit(1)
89 
90  folder_name = "/TRIGGER/Receivers/RxPpmIdMap"
91  folder=db.getFolder(folder_name)
92 
93  startUtime = int(time.time())
94  endUtime = int(time.time())
95  startValKey = startUtime * self.UNIX2COOL
96  endValKey = endUtime * self.UNIX2COOL
97  chsel = cool.ChannelSelection(0,sys.maxsize)
98 
99  try:
100  itr=folder.browseObjects(startValKey, endValKey, chsel)
101  except Exception as e:
102  print (e)
103  sys.exit(1)
104 
105  for row in itr:
106  ReceiverId = hex(int(row.channelId()))
107  payload = row.payload()
108  PPMId = hex(int(payload['ppmid']))
109  self.receiver_to_ppm_map[ReceiverId]= PPMId
110 
111 # print (self.receiver_to_ppm_map)
112  # close database
113  db.closeDatabase()
114 
115 

Member Data Documentation

◆ coolIdPath

PlotCalibrationGains.L1CaloGeometryConvertor.coolIdPath

Definition at line 62 of file PlotCalibrationGains.py.

◆ list_of_channels_em

PlotCalibrationGains.L1CaloGeometryConvertor.list_of_channels_em

Definition at line 64 of file PlotCalibrationGains.py.

◆ list_of_channels_had

PlotCalibrationGains.L1CaloGeometryConvertor.list_of_channels_had

Definition at line 65 of file PlotCalibrationGains.py.

◆ receiver_to_ppm_map

PlotCalibrationGains.L1CaloGeometryConvertor.receiver_to_ppm_map

Definition at line 78 of file PlotCalibrationGains.py.

◆ UNIX2COOL

PlotCalibrationGains.L1CaloGeometryConvertor.UNIX2COOL

Definition at line 79 of file PlotCalibrationGains.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:797
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790