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

Public Member Functions

def __init__ (self, name, readonly, minarg, maxarg, longopts)
 
def procopts (self, opts)
 

Public Attributes

 name
 
 readonly
 
 runLumi
 
 runmin
 
 runmax
 
 lumimin
 
 lumimax
 
 tsmin
 
 tsmax
 
 since
 
 until
 
 debug
 
 conn
 
 db
 

Private Member Functions

def _usage1 (self)
 
def _usage2 (self)
 
def _procopts (self, opts)
 

Detailed Description

Class coolTool implements a base for python command-line tools to access
and set data in COOL folders
Incomplete baseclass implementation - clients must implement the following:
 - setup(self,args) - set additional arguments
 - usage(self) - print usage
 - execute(self) - execute command
 - procopts(self,opts) - (optional) - process additional command switches

Definition at line 288 of file AtlCoolLib.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AtlCoolLib.coolTool.__init__ (   self,
  name,
  readonly,
  minarg,
  maxarg,
  longopts 
)
Initialise class and process command line options and switches

Definition at line 298 of file AtlCoolLib.py.

298  def __init__(self,name,readonly,minarg,maxarg,longopts):
299  """
300  Initialise class and process command line options and switches
301  """
302  self.name=name
303  self.readonly=readonly
304  self.runLumi=True
305  self.runmin=0
306  self.runmax=(1 << 31)-1
307  self.lumimin=0
308  self.lumimax=(1 << 32)-2
309  self.tsmin=cool.ValidityKeyMin
310  self.tsmax=cool.ValidityKeyMax
311  self.since=cool.ValidityKeyMin
312  self.until=cool.ValidityKeyMax
313  self.debug=False
314  # get and process options - note only use long options format
315  try:
316  fullopts=longopts+['r=','rs=','ru=','l=','ls=','lu=','ts=','tu=','debug']
317  opts,args=getopt.getopt(sys.argv[1:],'',fullopts)
318  except getopt.GetoptError as e:
319  print (e)
320  self.usage()
321  sys.exit(1)
322  if len(args)<minarg or len(args)>maxarg:
323  print (name,'takes between',minarg,'and',maxarg,'non-optional parameters')
324  self.usage()
325  sys.exit(1)
326  # set standard parameters
327  self.conn=transConn(str(args[0]))
328  # allow derived class to set parameters
329  self.setup(args[1:])
330  self._procopts(opts)
331  self.procopts(opts)
332  # open database connection and execute command
333  if self.readonly:
334  self.db=indirectOpen(self.conn,debug=self.debug)
335  else:
336  self.db=forceOpen(self.conn)
337  self.execute()
338 

Member Function Documentation

◆ _procopts()

def python.AtlCoolLib.coolTool._procopts (   self,
  opts 
)
private

Definition at line 356 of file AtlCoolLib.py.

356  def _procopts(self,opts):
357  # process the standard parameters
358  for o,a in opts:
359  if (o=='--rs'): self.runmin=int(a)
360  if (o=='--ru'): self.runmax=int(a)
361  if (o=='--r'):
362  self.runmin=int(a)
363  self.runmax=int(a)
364  if (o=='--ls'): self.lumimin=int(a)
365  if (o=='--lu'): self.lumimax=int(a)
366  if (o=='--l'):
367  self.lumimin=int(a)
368  self.lumimax=int(a)
369  if (o=='--ts'):
370  self.tsmin=timeVal(a)*1000000000
371  self.runLumi=False
372  if (o=='--tu'):
373  self.tsmax=timeVal(a)*1000000000
374  self.runLumi=False
375  if (o=='--debug'): self.debug=True
376  # now set the real interval of validity
377  if (self.runLumi):
378  print ('>== Data valid for run,LB [',self.runmin,',',self.lumimin,'] to [',self.runmax,',',self.lumimax,']')
379  self.since=(self.runmin << 32)+self.lumimin
380  self.until=(self.runmax << 32)+self.lumimax+1
381  else:
382  self.since=self.tsmin
383  self.until=self.tsmax
384  print ('>== Data valid for timestamps (sec) from ',self.since/1000000000,'(',timeString(self.since),') to ',self.until/1000000000,'(',timeString(self.until),')')
385  # check IOV is OK
386  if (self.until<self.since):
387  print ('ERROR in IOV definition: until<since')
388  sys.exit(1)
389 

◆ _usage1()

def python.AtlCoolLib.coolTool._usage1 (   self)
private

Definition at line 339 of file AtlCoolLib.py.

339  def _usage1(self):
340  # base implementation of usage - first part
341  print ('Usage:',self.name,' {<options>} dbname ',)
342 

◆ _usage2()

def python.AtlCoolLib.coolTool._usage2 (   self)
private

Definition at line 343 of file AtlCoolLib.py.

343  def _usage2(self):
344  # base implementation of usage - second part
345  print ('Options to specify IOV (default valid for all intervals)')
346  print ('--rs=<first run>')
347  print ('--ru=<last run> (inclusive)')
348  print ('--r=<run> (only single run)')
349  print ('--ls=<lumi block since>')
350  print ('--l=<lumi block> (only single LB)')
351  print ('--lu=<lumi block until> (inclusive)')
352  print ('--ts=<initial timestamp> (in seconds)')
353  print ('--tu=<final timestamp> (in seconds)')
354  print ('--debug: Enable debugging information')
355 

◆ procopts()

def python.AtlCoolLib.coolTool.procopts (   self,
  opts 
)

Definition at line 390 of file AtlCoolLib.py.

390  def procopts(self,opts):
391  # default implementation of procopts - do nothing
392  pass
393 
394 

Member Data Documentation

◆ conn

python.AtlCoolLib.coolTool.conn

Definition at line 327 of file AtlCoolLib.py.

◆ db

python.AtlCoolLib.coolTool.db

Definition at line 334 of file AtlCoolLib.py.

◆ debug

python.AtlCoolLib.coolTool.debug

Definition at line 313 of file AtlCoolLib.py.

◆ lumimax

python.AtlCoolLib.coolTool.lumimax

Definition at line 308 of file AtlCoolLib.py.

◆ lumimin

python.AtlCoolLib.coolTool.lumimin

Definition at line 307 of file AtlCoolLib.py.

◆ name

python.AtlCoolLib.coolTool.name

Definition at line 302 of file AtlCoolLib.py.

◆ readonly

python.AtlCoolLib.coolTool.readonly

Definition at line 303 of file AtlCoolLib.py.

◆ runLumi

python.AtlCoolLib.coolTool.runLumi

Definition at line 304 of file AtlCoolLib.py.

◆ runmax

python.AtlCoolLib.coolTool.runmax

Definition at line 306 of file AtlCoolLib.py.

◆ runmin

python.AtlCoolLib.coolTool.runmin

Definition at line 305 of file AtlCoolLib.py.

◆ since

python.AtlCoolLib.coolTool.since

Definition at line 311 of file AtlCoolLib.py.

◆ tsmax

python.AtlCoolLib.coolTool.tsmax

Definition at line 310 of file AtlCoolLib.py.

◆ tsmin

python.AtlCoolLib.coolTool.tsmin

Definition at line 309 of file AtlCoolLib.py.

◆ until

python.AtlCoolLib.coolTool.until

Definition at line 312 of file AtlCoolLib.py.


The documentation for this class was generated from the following file:
python.AtlCoolLib.forceOpen
def forceOpen(conn)
Definition: AtlCoolLib.py:28
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
transConn
std::string transConn(const std::string &inconn)
Definition: openCoraCool.cxx:323
python.AtlCoolLib.timeVal
def timeVal(val)
Definition: AtlCoolLib.py:107
python.AtlCoolLib.timeString
def timeString(iovkey)
Definition: AtlCoolLib.py:120
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:130