ATLAS Offline Software
genGasmonSource.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 
4 import sys
5 from MuonCalibDbOperations.CalibrationSourceConfig import MuonCalib__gCalibrationSourceConfigs, MuonCalib__CalibrationSourceConfig
6 import time
7 
8 def MuonCalib__genGasmonSource(toroidOn, cal_time, reader_cursor):
9  if len(MuonCalib__gCalibrationSourceConfigs)==0 and not time:
10  print ("FATAL Cannot generate gasmon source if no time and no other calibration sources are given")
11  sys.exit(1)
12 
13  if not cal_time:
14  cal_time = MuonCalib__gCalibrationSourceConfigs[0].GetTime(reader_cursor)
15 
16  if not isinstance(type(cal_time), str):
17  tm=time.gmtime(cal_time)
18  cal_time=str(tm.tm_year) + str(tm.tm_mon).zfill(2) + str(tm.tm_mday).zfill(2)
19  imp_str="GASMON_RT_" + cal_time + "_TP"
20  if toroidOn:
21  imp_str += "M"
22 
23  print ("INFO Getting", imp_str)
24 
25  reader_cursor.execute("select head_id, data_schema from ATLAS_MUONCALIB_UM_META.MDT_HEAD where IMPLEMENTATION=:imp", {'imp':imp_str})
26  gm_head_id, gm_schema= reader_cursor.fetchone()
27 
28  return MuonCalib__CalibrationSourceConfig("UM", gm_head_id, "", True, False)
29 
30 
31 
genGasmonSource.MuonCalib__genGasmonSource
def MuonCalib__genGasmonSource(toroidOn, cal_time, reader_cursor)
Definition: genGasmonSource.py:8
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
str
Definition: BTagTrackIpAccessor.cxx:11