ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
python.TileDCSDataInfo.TileDCSDataInfo Class Reference
Collaboration diagram for python.TileDCSDataInfo.TileDCSDataInfo:

Public Member Functions

def __init__ (self, dbstring=None)
 
def get_dbstring (self, key, ind=2)
 
def get_channel (self, folder, drawer)
 
def get_drawer (self, folder, channel)
 
def get_folder_and_channel (self, variable, drawer)
 
def get_variable_type (self, variable)
 
def get_all_variables (self)
 
def check_drawer_syntax (self, drawer)
 
def get_variables_by_folder (self, variables, drawer)
 
def find_data_file (self, fname, pathlist=None, access=os.R_OK)
 

Public Attributes

 vars
 
 folderDrawer_to_channel
 
 folderChannel_to_drawer
 
 folderDrawer_to_oracleId
 
 dbstring
 

Static Public Attributes

 LVPS_AI
 
 LVPS_STATES
 
 VARS_HV
 
 VARS_HVSET
 
 VARS_DAQ
 
 type_float
 
 type_int
 
 vars_LVPS_STATES
 
 vars_LVPS_AI
 
 vars_HV
 
 i
 
 vars_HVSET
 
 vars_DAQ
 
 systemID
 
 partitionID
 

Detailed Description

Keeps a list of drawer, variable <---> folder, channel
associations and provides information about the available
variables and their datatypes.

Definition at line 8 of file TileDCSDataInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TileDCSDataInfo.TileDCSDataInfo.__init__ (   self,
  dbstring = None 
)

Definition at line 117 of file TileDCSDataInfo.py.

117  def __init__( self, dbstring=None ):
118 
119  self.vars = {}
120  for var, info in list(self.vars_LVPS_AI.items()):
121  self.vars[var] = info
122  for var, info in list(self.vars_LVPS_STATES.items()):
123  self.vars[var] = info
124  for var, info in list(self.vars_HV.items()):
125  self.vars[var] = info
126  for var, info in list(self.vars_HVSET.items()):
127  self.vars[var] = info
128  for var, info in list(self.vars_DAQ.items()):
129  self.vars[var] = info
130 
131  self.folderDrawer_to_channel = {}
132  self.folderChannel_to_drawer = {}
133  self.folderDrawer_to_oracleId = {}
134 
135  filename=self.find_data_file("cool_channel_id.dat")
136  lines = open(filename,"r").readlines()
137  for line in lines:
138  line = line.strip()
139  folder, drawer, channel, oracleId = line.split()
140 
141  keyFolderDrawer = ( folder , drawer)
142  if keyFolderDrawer in self.folderDrawer_to_channel:
143  raise Exception ("trying to generate key twice: ", keyFolderDrawer)
144  self.folderDrawer_to_channel[ keyFolderDrawer] = int(channel)
145  self.folderDrawer_to_oracleId[keyFolderDrawer] = oracleId
146 
147  keyFolderChannel = ( folder , int(channel))
148  if keyFolderChannel in self.folderChannel_to_drawer:
149  raise Exception ("trying to generate key twice: ", keyFolderChannel)
150  self.folderChannel_to_drawer[keyFolderChannel] = drawer
151 
152  self.dbstring = {"DEFAULT":[],"COOL":[],"ORACLE":[],"TESTBEAM":[]}
153  self.dbstring['DEFAULT'] += [dbstring]*3
154  dbstring = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200;"
155  dbstring+= "user=ATLAS_COOL_READER;password=COOLRED4PRO"
156  self.dbstring['COOL'] += [None]
157  self.dbstring['COOL'] += [dbstring]
158  self.dbstring['COOL'] += [dbstring.replace("COMP200","CONDBR2")]
159  self.dbstring['ORACLE'] += [["oracle://localhost/ATONR_PVSSPROD","ATLAS_PVSS_READER","PVSSRED4PRO"]]
160  self.dbstring['ORACLE'] += [["oracle://localhost/ATLAS_PVSSPROD","ATLAS_PVSS_READER","PVSSRED4PRO"]]
161  self.dbstring['ORACLE'] += [["oracle://localhost/ATONR_ADG","ATLAS_PVSS_READER","PVSSRED4PRO"]]
162  self.dbstring['TESTBEAM'] += [["oracle://localhost/INTR","ATLAS_PVSS_READER","PVSSRED4INT"]]*3
163 
164 

Member Function Documentation

◆ check_drawer_syntax()

def python.TileDCSDataInfo.TileDCSDataInfo.check_drawer_syntax (   self,
  drawer 
)

Definition at line 221 of file TileDCSDataInfo.py.

221  def check_drawer_syntax(self, drawer):
222  partition = drawer[0:3]
223  drawerNum = int(drawer[3:5])
224  valid = ("LBA" , "LBC", "EBA", "EBC")
225  if partition not in valid:
226  return False
227  if drawerNum<1 or drawerNum>64:
228  return False
229  return True
230 

◆ find_data_file()

def python.TileDCSDataInfo.TileDCSDataInfo.find_data_file (   self,
  fname,
  pathlist = None,
  access = os.R_OK 
)
the python equivalent to the C++ PathResolver for datafiles.

Definition at line 249 of file TileDCSDataInfo.py.

249  def find_data_file(self, fname, pathlist=None, access=os.R_OK):
250  """the python equivalent to the C++ PathResolver for datafiles.
251  """
252 
253  if pathlist is None:
254  pathlist = os.getenv('DATAPATH').split(os.pathsep)
255 
256  for path in pathlist:
257  f = os.path.join( path, fname )
258  if os.access( f, access ):
259  return f

◆ get_all_variables()

def python.TileDCSDataInfo.TileDCSDataInfo.get_all_variables (   self)

Definition at line 218 of file TileDCSDataInfo.py.

218  def get_all_variables(self):
219  return list(self.vars.keys())
220 

◆ get_channel()

def python.TileDCSDataInfo.TileDCSDataInfo.get_channel (   self,
  folder,
  drawer 
)

Definition at line 168 of file TileDCSDataInfo.py.

168  def get_channel(self, folder, drawer):
169 
170  if not self.check_drawer_syntax(drawer):
171  raise Exception ("ERROR: drawer not valid: ", drawer)
172  key = (folder, drawer )
173  if key not in self.folderDrawer_to_channel:
174  print ("get_channel WARNING, can not resolve key: ", key)
175  return None
176  return self.folderDrawer_to_channel[key]
177 

◆ get_dbstring()

def python.TileDCSDataInfo.TileDCSDataInfo.get_dbstring (   self,
  key,
  ind = 2 
)

Definition at line 165 of file TileDCSDataInfo.py.

165  def get_dbstring(self, key, ind=2):
166  return self.dbstring[key][ind] if key in self.dbstring and len(self.dbstring[key])>ind else None
167 

◆ get_drawer()

def python.TileDCSDataInfo.TileDCSDataInfo.get_drawer (   self,
  folder,
  channel 
)

Definition at line 178 of file TileDCSDataInfo.py.

178  def get_drawer(self, folder, channel):
179 
180  key = (folder, channel)
181  if key not in self.folderChannel_to_drawer:
182  print ("get_drawer WARNING, can not resolve key: ", key)
183  return None
184  return self.folderChannel_to_drawer[key]
185 
186 

◆ get_folder_and_channel()

def python.TileDCSDataInfo.TileDCSDataInfo.get_folder_and_channel (   self,
  variable,
  drawer 
)
For a given DCS variable and drawer, return the complete COOL
folder name and the channel number associated to the drawer

Definition at line 187 of file TileDCSDataInfo.py.

187  def get_folder_and_channel(self, variable, drawer):
188  """
189  For a given DCS variable and drawer, return the complete COOL
190  folder name and the channel number associated to the drawer
191  """
192  if variable not in self.vars:
193  raise Exception ("Variable not known: ", variable)
194  partition = drawer[0:3]
195 
196  folderDef = self.vars[variable][0]
197  #=== for STATE, we have only one "drawer" per partition
198  if variable=="STATE":
199  drawer = partition+"XX"
200  folder = folderDef[0]+partition+folderDef[1]
201  else:
202  folder = folderDef[0]+folderDef[1]
203  key = (folder, drawer)
204  if key not in self.folderDrawer_to_channel:
205  print ("WARNING, can not resolve key: ", key)
206  return None
207  channel = self.folderDrawer_to_channel[key]
208  return (folder, channel)
209 

◆ get_variable_type()

def python.TileDCSDataInfo.TileDCSDataInfo.get_variable_type (   self,
  variable 
)
Returns the type of a variable

Definition at line 210 of file TileDCSDataInfo.py.

210  def get_variable_type(self, variable):
211  """
212  Returns the type of a variable
213  """
214  if variable not in self.vars:
215  raise Exception ("Variable not known: ", variable)
216  return self.vars[variable][1]
217 

◆ get_variables_by_folder()

def python.TileDCSDataInfo.TileDCSDataInfo.get_variables_by_folder (   self,
  variables,
  drawer 
)
Return a dictionary listing all folders that need to be
accessed as keys and all variables associated to the key folder
as values.

Definition at line 231 of file TileDCSDataInfo.py.

231  def get_variables_by_folder(self, variables, drawer):
232  """
233  Return a dictionary listing all folders that need to be
234  accessed as keys and all variables associated to the key folder
235  as values.
236  """
237  folderDict = {}
238  for var in variables:
239  if var not in self.vars:
240  print ("Unknown variable, IGNORING IT: ", var)
241  else:
242  folder, channel = self.get_folder_and_channel(var,drawer)
243  if folder not in folderDict:
244  folderDict[folder] = [var]
245  else:
246  folderDict[folder].extend([var])
247  return folderDict
248 

Member Data Documentation

◆ dbstring

python.TileDCSDataInfo.TileDCSDataInfo.dbstring

Definition at line 152 of file TileDCSDataInfo.py.

◆ folderChannel_to_drawer

python.TileDCSDataInfo.TileDCSDataInfo.folderChannel_to_drawer

Definition at line 132 of file TileDCSDataInfo.py.

◆ folderDrawer_to_channel

python.TileDCSDataInfo.TileDCSDataInfo.folderDrawer_to_channel

Definition at line 131 of file TileDCSDataInfo.py.

◆ folderDrawer_to_oracleId

python.TileDCSDataInfo.TileDCSDataInfo.folderDrawer_to_oracleId

Definition at line 133 of file TileDCSDataInfo.py.

◆ i

python.TileDCSDataInfo.TileDCSDataInfo.i
static

Definition at line 78 of file TileDCSDataInfo.py.

◆ LVPS_AI

python.TileDCSDataInfo.TileDCSDataInfo.LVPS_AI
static

Definition at line 15 of file TileDCSDataInfo.py.

◆ LVPS_STATES

python.TileDCSDataInfo.TileDCSDataInfo.LVPS_STATES
static

Definition at line 16 of file TileDCSDataInfo.py.

◆ partitionID

python.TileDCSDataInfo.TileDCSDataInfo.partitionID
static

Definition at line 112 of file TileDCSDataInfo.py.

◆ systemID

python.TileDCSDataInfo.TileDCSDataInfo.systemID
static

Definition at line 106 of file TileDCSDataInfo.py.

◆ type_float

python.TileDCSDataInfo.TileDCSDataInfo.type_float
static

Definition at line 20 of file TileDCSDataInfo.py.

◆ type_int

python.TileDCSDataInfo.TileDCSDataInfo.type_int
static

Definition at line 21 of file TileDCSDataInfo.py.

◆ vars

python.TileDCSDataInfo.TileDCSDataInfo.vars

Definition at line 119 of file TileDCSDataInfo.py.

◆ VARS_DAQ

python.TileDCSDataInfo.TileDCSDataInfo.VARS_DAQ
static

Definition at line 19 of file TileDCSDataInfo.py.

◆ vars_DAQ

python.TileDCSDataInfo.TileDCSDataInfo.vars_DAQ
static

Definition at line 103 of file TileDCSDataInfo.py.

◆ VARS_HV

python.TileDCSDataInfo.TileDCSDataInfo.VARS_HV
static

Definition at line 17 of file TileDCSDataInfo.py.

◆ vars_HV

python.TileDCSDataInfo.TileDCSDataInfo.vars_HV
static

Definition at line 76 of file TileDCSDataInfo.py.

◆ VARS_HVSET

python.TileDCSDataInfo.TileDCSDataInfo.VARS_HVSET
static

Definition at line 18 of file TileDCSDataInfo.py.

◆ vars_HVSET

python.TileDCSDataInfo.TileDCSDataInfo.vars_HVSET
static

Definition at line 88 of file TileDCSDataInfo.py.

◆ vars_LVPS_AI

python.TileDCSDataInfo.TileDCSDataInfo.vars_LVPS_AI
static

Definition at line 27 of file TileDCSDataInfo.py.

◆ vars_LVPS_STATES

python.TileDCSDataInfo.TileDCSDataInfo.vars_LVPS_STATES
static

Definition at line 23 of file TileDCSDataInfo.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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
ActsTrk::detail::MakeDerivedVariant::extend
constexpr std::variant< Args..., T > extend(const std::variant< Args... > &, const T &)
Definition: MakeDerivedVariant.h:17
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Trk::split
@ split
Definition: LayerMaterialProperties.h:38