ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
mergeEnergyRamps.L1CaloGeometryConvertor Class Reference
Collaboration diagram for mergeEnergyRamps.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 13 of file mergeEnergyRamps.py.

Constructor & Destructor Documentation

◆ __init__()

def mergeEnergyRamps.L1CaloGeometryConvertor.__init__ (   self)

Definition at line 15 of file mergeEnergyRamps.py.

15  def __init__(self):
16  self.coolIdPath=ROOT.PathResolver.find_calib_file("TrigT1Calo/COOLIdDump_v1.txt")
17  input = open(self.coolIdPath)
18  self.list_of_channels_em={}
19  self.list_of_channels_had={}
20 
21  for line in input.readlines():
22  parts = line.split(' ')
23  emCool = parts[4].rstrip()
24  hadCool = parts[5].rstrip()
25  self.list_of_channels_em[(parts[0],parts[1])] = '0x'+emCool
26  self.list_of_channels_had[(parts[0],parts[1])] = '0x'+hadCool
27 
28  input.close()
29 

Member Function Documentation

◆ getCoolEm()

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

Definition at line 111 of file mergeEnergyRamps.py.

111  def getCoolEm(self,i_eta,i_phi):
112  if (str(i_eta),str(i_phi)) in self.list_of_channels_em:
113  cool = self.list_of_channels_em[(str(i_eta),str(i_phi))]
114  cool.rstrip()
115  cool.lstrip()
116  return (cool)
117  else:
118  return ('')
119 
120 

◆ getCoolHad()

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

Definition at line 121 of file mergeEnergyRamps.py.

121  def getCoolHad(self,i_eta,i_phi):
122  if (str(i_eta),str(i_phi)) in self.list_of_channels_had:
123  cool = self.list_of_channels_had[(str(i_eta),str(i_phi))]
124  cool.rstrip()
125  cool.lstrip()
126  return (cool)
127  else:
128  return ('')
129 

◆ getEtaBin()

def mergeEnergyRamps.L1CaloGeometryConvertor.getEtaBin (   self,
  CoolId 
)

Definition at line 136 of file mergeEnergyRamps.py.

136  def getEtaBin(self,CoolId):
137  if self.isCoolEm(CoolId):
138  channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
139  return int(channel[0][0])
140  elif self.isCoolHad(CoolId):
141  channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
142  return int(channel[0][0])
143  else:
144  return -1
145 

◆ getFCAL23RecEta()

def mergeEnergyRamps.L1CaloGeometryConvertor.getFCAL23RecEta (   self,
  RecCoolId 
)

Definition at line 215 of file mergeEnergyRamps.py.

215  def getFCAL23RecEta(self,RecCoolId):
216 
217  ppm_id = self.getPPMfromReceiver(RecCoolId)
218 
219  if (not self.isPPMFCAL(ppm_id)) or (not self.isCoolHad(ppm_id)):
220  return None
221  eta_bin = self.getEtaBin(ppm_id)
222 
223  RecCoolInt = int(RecCoolId,16)
224  if RecCoolInt%2 == 1:
225  isRecOdd = True
226  else:
227  isRecOdd = False
228 
229  if eta_bin>0:
230  if isRecOdd:
231  return 'LowEta'
232  else:
233  return 'HighEta'
234  else:
235  if isRecOdd:
236  return 'HighEta'
237  else:
238  return 'LowEta'
239 

◆ getMissingReceiverChannels()

def mergeEnergyRamps.L1CaloGeometryConvertor.getMissingReceiverChannels (   self,
  channel_list 
)

Definition at line 156 of file mergeEnergyRamps.py.

156  def getMissingReceiverChannels(self, channel_list):
157 
158  missing_channels= [channel for channel in self.receiver_to_ppm_map.keys() if channel not in channel_list]
159  return missing_channels
160 
161 

◆ getOverlapLayer()

def mergeEnergyRamps.L1CaloGeometryConvertor.getOverlapLayer (   self,
  RecCoolId 
)

Definition at line 197 of file mergeEnergyRamps.py.

197  def getOverlapLayer(self,RecCoolId):
198 
199  ppm_id = self.getPPMfromReceiver(RecCoolId)
200 
201  if not self.isPPMOverlap(ppm_id):
202  return None
203 
204  cabling = self.getReceiverCMCP(RecCoolId)
205  if cabling[0] < 2: # unconnected channel has barrel crate nr.
206  return 'Unconnected'
207  elif cabling[2] == 0:
208  return 'EMEC'
209  elif cabling[2] == 2:
210  return 'EMB'
211  else:
212  print ("Error in GetOverlapLayer, can't determine layer!")
213  return None
214 

◆ getPhiBin()

def mergeEnergyRamps.L1CaloGeometryConvertor.getPhiBin (   self,
  CoolId 
)

Definition at line 146 of file mergeEnergyRamps.py.

146  def getPhiBin(self,CoolId):
147  if self.isCoolEm(CoolId):
148  channel = [item[0] for item in self.list_of_channels_em.items() if item[1]==CoolId]
149  return int(channel[0][1])
150  elif self.isCoolHad(CoolId):
151  channel = [item[0] for item in self.list_of_channels_had.items() if item[1]==CoolId]
152  return int(channel[0][1])
153  else:
154  return -1
155 

◆ getPPMfromReceiver()

def mergeEnergyRamps.L1CaloGeometryConvertor.getPPMfromReceiver (   self,
  ReceiverId 
)

Definition at line 71 of file mergeEnergyRamps.py.

71  def getPPMfromReceiver(self,ReceiverId):
72 
73  if ReceiverId in self.receiver_to_ppm_map:
74  return self.receiver_to_ppm_map[ReceiverId]
75  else:
76  return ''
77 

◆ getReceiverCMCP()

def mergeEnergyRamps.L1CaloGeometryConvertor.getReceiverCMCP (   self,
  ReceiverId 
)

Definition at line 162 of file mergeEnergyRamps.py.

162  def getReceiverCMCP(self,ReceiverId):
163 
164  recI=int(ReceiverId,16)
165 
166  crate = recI/1024
167  recI = recI - crate*1024
168 
169  module = recI/64
170  recI = recI - module*64
171 
172  conn = recI/16
173  recI = recI - conn*16
174 
175  pair = recI
176 
177  return [crate,module,conn,pair]
178 

◆ getReceiverfromPPM()

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

Definition at line 78 of file mergeEnergyRamps.py.

78  def getReceiverfromPPM(self,PPMId,strategy_string=None):
79 
80  ReceiverChannels = [item[0] for item in self.receiver_to_ppm_map.items() if item[1]==PPMId]
81 
82  if strategy_string is None:
83  print (" Warning! in getReceiverfromPPM no runtype give, using default!")
84  return ReceiverChannels[0]
85 
86  if self.isPPMFCAL(PPMId) and self.isCoolHad(PPMId): # pick correct FCAL23 channel
87 
88  if strategy_string == "GainOneOvEmbFcalHighEta":
89  for channel in ReceiverChannels:
90  if self.getFCAL23RecEta(channel) == 'HighEta':
91  return channel
92  if strategy_string == "GainOneOvEmecFcalLowEta":
93  for channel in ReceiverChannels:
94  if self.getFCAL23RecEta(channel) == 'LowEta':
95  return channel
96 
97  elif self.isPPMOverlap(PPMId):
98 
99  if strategy_string == "GainOneOvEmbFcalHighEta":
100  for channel in ReceiverChannels:
101  if self.getOverlapLayer(channel) == 'EMB':
102  return channel
103  if strategy_string == "GainOneOvEmecFcalLowEta":
104  for channel in ReceiverChannels:
105  if self.getOverlapLayer(channel) == 'EMEC':
106  return channel
107 
108  else:
109  return ReceiverChannels[0]
110 

◆ isCoolEm()

def mergeEnergyRamps.L1CaloGeometryConvertor.isCoolEm (   self,
  CoolId 
)

Definition at line 130 of file mergeEnergyRamps.py.

130  def isCoolEm(self,CoolId):
131  return (CoolId in self.list_of_channels_em.values())
132 

◆ isCoolHad()

def mergeEnergyRamps.L1CaloGeometryConvertor.isCoolHad (   self,
  CoolId 
)

Definition at line 133 of file mergeEnergyRamps.py.

133  def isCoolHad(self,CoolId):
134  return (CoolId in self.list_of_channels_had.values())
135 

◆ isPPMFCAL()

def mergeEnergyRamps.L1CaloGeometryConvertor.isPPMFCAL (   self,
  CoolId 
)

Definition at line 179 of file mergeEnergyRamps.py.

179  def isPPMFCAL(self,CoolId):
180 
181  eta_bin = self.getEtaBin(CoolId)
182 
183  if eta_bin >= 32 or eta_bin <= -36:
184  return True
185  else:
186  return False
187 
188 

◆ isPPMOverlap()

def mergeEnergyRamps.L1CaloGeometryConvertor.isPPMOverlap (   self,
  CoolId 
)

Definition at line 189 of file mergeEnergyRamps.py.

189  def isPPMOverlap(self,CoolId):
190 
191  eta_bin = self.getEtaBin(CoolId)
192  if self.isCoolEm(CoolId) is True and (eta_bin == 14 or eta_bin == -15):
193  return True
194  else:
195  return False
196 

◆ LoadReceiverPPMMap()

def mergeEnergyRamps.L1CaloGeometryConvertor.LoadReceiverPPMMap (   self)

Definition at line 30 of file mergeEnergyRamps.py.

30  def LoadReceiverPPMMap(self):
31 
32  self.receiver_to_ppm_map={}
33  self.UNIX2COOL = 1000000000
34 
35  # get database service and open database
36  dbSvc = cool.DatabaseSvcFactory.databaseService()
37 
38  dbString = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=CONDBR2'
39  try:
40  db = dbSvc.openDatabase(dbString, False)
41  except Exception as e:
42  print ('Error: Problem opening database', e)
43  sys.exit(1)
44 
45  folder_name = "/TRIGGER/Receivers/RxPpmIdMap"
46  folder=db.getFolder(folder_name)
47 
48  startUtime = int(time.time())
49  endUtime = int(time.time())
50  startValKey = startUtime * self.UNIX2COOL
51  endValKey = endUtime * self.UNIX2COOL
52  chsel = cool.ChannelSelection(0,sys.maxsize)
53 
54  try:
55  itr=folder.browseObjects(startValKey, endValKey, chsel)
56  except Exception as e:
57  print (e)
58  sys.exit(1)
59 
60  for row in itr:
61  ReceiverId = hex(int(row.channelId()))
62  payload = row.payload()
63  PPMId = hex(int(payload['ppmid']))
64  self.receiver_to_ppm_map[ReceiverId]= PPMId
65 
66 # print (self.receiver_to_ppm_map)
67  # close database
68  db.closeDatabase()
69 
70 

Member Data Documentation

◆ coolIdPath

mergeEnergyRamps.L1CaloGeometryConvertor.coolIdPath

Definition at line 16 of file mergeEnergyRamps.py.

◆ list_of_channels_em

mergeEnergyRamps.L1CaloGeometryConvertor.list_of_channels_em

Definition at line 18 of file mergeEnergyRamps.py.

◆ list_of_channels_had

mergeEnergyRamps.L1CaloGeometryConvertor.list_of_channels_had

Definition at line 19 of file mergeEnergyRamps.py.

◆ receiver_to_ppm_map

mergeEnergyRamps.L1CaloGeometryConvertor.receiver_to_ppm_map

Definition at line 32 of file mergeEnergyRamps.py.

◆ UNIX2COOL

mergeEnergyRamps.L1CaloGeometryConvertor.UNIX2COOL

Definition at line 33 of file mergeEnergyRamps.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:805
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:798