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

Public Member Functions

def __init__ (self, name, geometryMapper)
 
def getGoodGains (self)
 

Public Attributes

 cut_gain_low
 
 cut_gain_high
 
 cut_offset_low
 
 cut_offset_high
 
 geometry_convertor
 
 run_nr
 
 strategy
 
 measured_gains
 
 measured_chi2
 
 measured_offset
 
 measured_error_code
 
 UNIX2COOL
 

Detailed Description

Definition at line 279 of file mergeEnergyRamps.py.

Constructor & Destructor Documentation

◆ __init__()

def mergeEnergyRamps.GainsFromSqlite.__init__ (   self,
  name,
  geometryMapper 
)

Definition at line 281 of file mergeEnergyRamps.py.

281  def __init__(self,name,geometryMapper):
282 
283 # self.cut_gain_low = 0.5
284 # self.cut_gain_high = 1.6
285 # self.cut_offset_low = -10.
286 # self.cut_offset_high = 10.
287 
288  self.cut_gain_low = 0. # all gains that are not completly crazy...
289  self.cut_gain_high = 3
290  self.cut_offset_low = -100.
291  self.cut_offset_high = 100.
292 
293  self.geometry_convertor = geometryMapper
294 
295  self.run_nr = None #will come later
296  self.strategy = None #later
297 
298  self.measured_gains={}
299  self.measured_chi2={}
300  self.measured_offset={}
301  self.measured_error_code={}
302 
303  self.UNIX2COOL = 1000000000
304 
305  # get database service and open database
306  dbSvc = cool.DatabaseSvcFactory.databaseService()
307 
308  dbString='sqlite://;schema='+name+';dbname=L1CALO'
309  try:
310  db = dbSvc.openDatabase(dbString, False)
311  except Exception as e:
312  print ('Error: Problem opening database', e)
313  sys.exit(1)
314 
315  folder_name = '/TRIGGER/L1Calo/V1/Results/EnergyScanResults'
316  folder=db.getFolder(folder_name)
317 
318  startUtime = int(time.time())
319  endUtime = int(time.time())
320  startValKey = startUtime * self.UNIX2COOL
321  endValKey = endUtime * self.UNIX2COOL
322  chsel = cool.ChannelSelection(0,sys.maxsize)
323 
324  try:
325  itr=folder.browseObjects(startValKey, endValKey, chsel)
326  except Exception as e:
327  print (e)
328  sys.exit(1)
329 
330  for row in itr:
331  CoolId = hex(int(row.channelId()))
332  payload = row.payload()
333  self.measured_gains[CoolId] = payload['Slope']
334  self.measured_chi2[CoolId] = payload['Chi2']
335  self.measured_offset[CoolId] = payload['Offset']
336  self.measured_error_code[CoolId] = payload['ErrorCode']
337 
338 # print (self.measured_gains)
339 
340  folder_gen_name = '/TRIGGER/L1Calo/V1/Results/EnergyScanRunInfo'
341  folder_gen=db.getFolder(folder_gen_name)
342 
343  try:
344  itr=folder_gen.browseObjects(startValKey, endValKey, chsel)
345  except Exception as e:
346  print (e)
347  sys.exit(1)
348 
349  for row in itr:
350  payload = row.payload()
351  self.run_nr = payload['RunNumber']
352  self.strategy = payload['GainStrategy']
353 
354 
355  # close database
356  db.closeDatabase()
357 

Member Function Documentation

◆ getGoodGains()

def mergeEnergyRamps.GainsFromSqlite.getGoodGains (   self)

Definition at line 358 of file mergeEnergyRamps.py.

358  def getGoodGains(self):
359 
360  good_gains={}
361 
362  for i in self.measured_gains.keys():
363 
364  if ((self.measured_gains[i] > self.cut_gain_low and self.measured_gains[i] < self.cut_gain_high) and
365  (self.measured_offset[i] > self.cut_offset_low and self.measured_offset[i] < self.cut_offset_high) and
366 # not (self.geometry_convertor.isCoolHad(i) and self.geometry_convertor.isPPMFCAL(i)) ):
367  not (self.geometry_convertor.isPPMFCAL(i)) ):
368 
369  good_gains[i]=[self.measured_gains[i],self.measured_error_code[i]]
370 
371  elif self.geometry_convertor.isPPMFCAL(i):
372  good_gains[i]=[self.measured_gains[i]/2,self.measured_error_code[i]]
373 
374  else:
375  print ("GainsFromSqlite::getGoodGains have rejected channel ", i)
376 
377  return good_gains # these are gains as a function of PPM Cool
378 
379 

Member Data Documentation

◆ cut_gain_high

mergeEnergyRamps.GainsFromSqlite.cut_gain_high

Definition at line 289 of file mergeEnergyRamps.py.

◆ cut_gain_low

mergeEnergyRamps.GainsFromSqlite.cut_gain_low

Definition at line 288 of file mergeEnergyRamps.py.

◆ cut_offset_high

mergeEnergyRamps.GainsFromSqlite.cut_offset_high

Definition at line 291 of file mergeEnergyRamps.py.

◆ cut_offset_low

mergeEnergyRamps.GainsFromSqlite.cut_offset_low

Definition at line 290 of file mergeEnergyRamps.py.

◆ geometry_convertor

mergeEnergyRamps.GainsFromSqlite.geometry_convertor

Definition at line 293 of file mergeEnergyRamps.py.

◆ measured_chi2

mergeEnergyRamps.GainsFromSqlite.measured_chi2

Definition at line 299 of file mergeEnergyRamps.py.

◆ measured_error_code

mergeEnergyRamps.GainsFromSqlite.measured_error_code

Definition at line 301 of file mergeEnergyRamps.py.

◆ measured_gains

mergeEnergyRamps.GainsFromSqlite.measured_gains

Definition at line 298 of file mergeEnergyRamps.py.

◆ measured_offset

mergeEnergyRamps.GainsFromSqlite.measured_offset

Definition at line 300 of file mergeEnergyRamps.py.

◆ run_nr

mergeEnergyRamps.GainsFromSqlite.run_nr

Definition at line 295 of file mergeEnergyRamps.py.

◆ strategy

mergeEnergyRamps.GainsFromSqlite.strategy

Definition at line 296 of file mergeEnergyRamps.py.

◆ UNIX2COOL

mergeEnergyRamps.GainsFromSqlite.UNIX2COOL

Definition at line 303 of file mergeEnergyRamps.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798