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

Public Member Functions

def __init__ (self, opt, db)
 
def ls (self)
 
def printOptions (self)
 
def writeLogFile (self)
 
def printLogFile (self)
 
def updateDcubeXML (self, tname, path)
 
def updateDcube (self)
 
def updateRefs (self)
 

Public Attributes

 db
 
 opt
 
 djobs
 
 jobs
 
 alias
 
 logfile
 

Detailed Description

Definition at line 400 of file sim_rttUpdate.py.

Constructor & Destructor Documentation

◆ __init__()

def sim_rttUpdate.RttUpdate.__init__ (   self,
  opt,
  db 
)

Definition at line 401 of file sim_rttUpdate.py.

401  def __init__(self,opt,db):
402  self.db = db
403  self.opt = opt
404 
405  # release
406  if opt.rel=='rel_X':
407  opt.rel='rel_%d'% (dt.date.today().isoweekday() % 7)
408 
409  # RTT result directory
410  if opt.rttpath == 'default':
411  opt.rttpath='/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/'+opt.rel+'/'+opt.branch+'/build/'+opt.cmt+'/offline/'+opt.package
412  print 'using default rttpath =',opt.rttpath
413 
414  # EOS result directory, etc.
415  opt.rttcastor='/eos/atlas/atlascerngroupdisk/proj-sit/rtt/prod/rtt/'+opt.rel+'/'+opt.branch+'/'+opt.cmt+'/offline/'+opt.package
416  opt.eoscmd='/afs/cern.ch/project/eos/installation/0.1.0-22d/bin/eos.select'
417  opt.eosprefix='root://eosatlas.cern.ch/'
418 
419  """
420  xrdcp root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/rtt/prod/rtt/rel_2/17.1.X.Y/i686-slc5-gcc43-opt/offline/DigitizationTests/mc11_ttbar_LVL1_on/mc11_ttbar.RDO.pool.root root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/digitization/RTT/ReferenceFiles/MC12/MC11_ttbar_LVL1_ON.RDO.pool.root
421 """
422 
423  opt.testpath,opt.project=db.findPackage(opt.package)
424  opt.ref=db.findReference(opt.branch,opt.project)
425 
426 
427  opt.refpath='/eos/atlas/atlascerngroupdisk/proj-sit/'+opt.project+'/validation/RTT/referenceFiles/'
428  opt.dcubepath='/afs/cern.ch/atlas/project/RTT/DCubeReference/offline/'+opt.testpath+'/'+opt.package+'/'
429  if opt.ref!='':
430  opt.refpath+=opt.ref+'/'
431  opt.dcubepath+=opt.ref+'/'
432 
433  #db._dumpTable('t_jobs')
434  self.djobs=db.findJobs(opt.package,jobtype='dcube')
435  #print 'djobs=',self.djobs
436 
437  self.jobs=db.findJobs(opt.package,jobtype='diffpool')
438  #print 'jobs=',self.jobs
439 
440  if opt.jobs!='':
441  print "selected jobs"
442  print opt.jobs
443  joblist=opt.jobs.split(',')
444  print joblist
445 
446  self.jobs = dict ( [ (k,self.jobs[k]) for k in joblist if self.jobs.has_key(k) ])
447  print self.jobs
448  self.djobs = dict ( [ (k,self.djobs[k]) for k in joblist if self.djobs.has_key(k) ])
449  print self.djobs
450  # python 2.7 could use
451  # self.djobs = { k:self.djobs[k] for k in joblist if self.djobs.has_key(k) }
452 
453  # obsolete for devval
454  #self.alias={'AtlasGeom19Sim':'SingleParticleSim'}
455  self.alias={} #{'FrozenShowerFCalOnly':'FrozenShowerTest1'}
456 
457  if self.opt.today=='AUTO':
458  self.opt.today=dt.date.today().strftime("%y%m%d")
459  #self.opt.today=self.today
460  self.opt.user=get_username()
461  #self.opt.today='120207-fix' #*AS* fix !!
462  self.logfile='/afs/cern.ch/atlas/groups/Simulation/rtt/rttUpdate.log'
463 
464  self.writeLogFile()
465 

Member Function Documentation

◆ ls()

def sim_rttUpdate.RttUpdate.ls (   self)

Definition at line 466 of file sim_rttUpdate.py.

466  def ls(self):
467  os.system('ls '+self.opt.rttpath)
468 

◆ printLogFile()

def sim_rttUpdate.RttUpdate.printLogFile (   self)

Definition at line 494 of file sim_rttUpdate.py.

494  def printLogFile(self):
495  f=file(self.logfile)
496  for l in f:
497  print l,
498 

◆ printOptions()

def sim_rttUpdate.RttUpdate.printOptions (   self)

Definition at line 469 of file sim_rttUpdate.py.

469  def printOptions(self):
470 
471  print '*** options: ***'
472  for i in dir(self.opt):
473  if i=='ensure_value' or i=='read_file' or i=='read_module':
474  continue
475  if i.startswith('_'):
476  continue
477  print '%12s:'%i,getattr(self.opt,i)
478 

◆ updateDcube()

def sim_rttUpdate.RttUpdate.updateDcube (   self)

Definition at line 535 of file sim_rttUpdate.py.

535  def updateDcube(self):
536  if len(self.djobs)>0:
537  cmd='mkdir '+self.opt.dcubepath+self.opt.today
538  print cmd
539  if not self.opt.dryrun:
540  os.system(cmd)
541 
542  # dcube
543  for j,files in self.djobs.items():
544  epath=self.opt.rttpath+'/'+j
545  print '########################################'
546  if len(files)==0:
547  print 'WARNING, no files given, looking for root files '
548  os.system('ls -l '+epath+'/*.root')
549 
550  for f in files:
551  src=epath+'/'+f
552  if not os.path.exists(src):
553  print src,'does not exist'
554  break
555  sj = j
556  parts=j.split('_')
557  dst=self.opt.dcubepath+sj+'.'+f
558  s=os.system('ls '+dst)
559  if (s==0) :
560  print 'destination exists'
561  cmd='rm '+dst
562  print cmd
563  if not self.opt.dryrun:
564  os.system(cmd)
565 
566  cmd='cp -v '+src+' '+self.opt.dcubepath+self.opt.today+'/'+sj+'.'+f
567  print cmd
568  if not self.opt.dryrun:
569  os.system(cmd)
570  cmd='ln -s '+self.opt.today+'/'+sj+'.'+f+' '+dst
571  print cmd
572  if not self.opt.dryrun:
573  os.system(cmd)
574 
575  self.updateDcubeXML(j,self.opt.dcubepath)
576 
577 
578  # break

◆ updateDcubeXML()

def sim_rttUpdate.RttUpdate.updateDcubeXML (   self,
  tname,
  path 
)

Definition at line 499 of file sim_rttUpdate.py.

499  def updateDcubeXML(self,tname,path):
500  print "updating dcube xml file"
501  print tname
502  print path
503 
504  dxml=path+"dcube-"+tname+".xml"
505  dxmln=dxml+".new"
506  print dxml
507 
508  dfile=file(dxml)
509  dnew=file(dxmln,"w")
510  for l in dfile:
511  if l.count("Results from")>0:
512  print l,
513 
514  newl= "Results from "
515  newl+= dt.date.today().strftime("%d %B %Y")
516  newl+= ", "+self.opt.rel+" "
517  newl+= self.opt.branch+" "
518  newl+= self.opt.cmt
519  self.opt.comment=newl
520  newl+= " for "+tname
521  print newl
522  l=newl+"\n"
523  dnew.write(l)
524  dnew.close()
525  dfile.close()
526 
527  cmd="mv "+dxmln+" "+dxml
528  print cmd
529  if not self.opt.dryrun:
530  print "..."
531  os.system(cmd)
532 
533 
534 

◆ updateRefs()

def sim_rttUpdate.RttUpdate.updateRefs (   self)

Definition at line 579 of file sim_rttUpdate.py.

579  def updateRefs(self):
580  if len(self.jobs)>0:
581 
582  # diffPoolFileRunner
583  cmd=self.opt.eoscmd+' mkdir '+self.opt.refpath+self.opt.today
584  print cmd
585  if not self.opt.dryrun:
586  os.system(cmd)
587 
588  for j,files in self.jobs.items():
589  epath=self.opt.rttpath+'/'+j
590  print '########################################'
591  #print epath,':'
592  #print files
593 
594  if len(files)==0:
595  print 'WARNING, no files given, looking for root files '
596  os.system('ls -l '+epath+'/*.root')
597 
598  for f in files:
599  #print '#'
600  s=os.system('ls -l '+epath+'/'+f)
601  #print '#',s
602  if s!=0:
603  epath=self.opt.rttcastor+'/'+j
604  #print epath,':'
605  #s=os.system('nsls -l '+epath+'/'+f) ### Castor
606  s=os.system(self.opt.eoscmd+' ls '+epath+'/'+f)
608  if s==0:
609  epath= self.opt.eosprefix+epath
610 
611  if s==0:
612  #
613  src=epath+'/'+f
614  sj = j
615  parts=j.split('_')
616  if len(parts)>1 and parts[1] in ['EVNT2TR','TR2HITS']:
617  sj=parts[0]
618  if self.alias.has_key(sj):
619  print 'changed', sj
620  sj=self.alias[sj]
621  print 'to', sj
622 
623  #print parts
624  pref,suff=f.split('.',1)
625  dst=self.opt.refpath+sj+self.opt.sbranch+'.'+suff
626  #s=os.system('nsls -l '+dst) ### Castor
627  s=os.system(self.opt.eoscmd+' ls '+dst)
629  if (s==0) :
630  print 'destination exists'
631  # cmd='nsrename '+dst+' '+dst+'.1'
632  # cmd="nsrm "+dst ### Castor
633  cmd=self.opt.eoscmd+" rm "+dst
634  print cmd
635  if not self.opt.dryrun:
636  os.system(cmd)
637  cmd='xrdcp '+src+' '+self.opt.eosprefix+dst
638  print cmd
639  if not self.opt.dryrun:
640  os.system(cmd)
641  dst=self.opt.refpath+self.opt.today+'/'+sj+self.opt.sbranch+'.'+suff
642  cmd='xrdcp '+src+' '+self.opt.eosprefix+dst
643  print cmd
644  if not self.opt.dryrun:
645  os.system(cmd)
646  else:
647  print 'source not found!'
648 
649 

◆ writeLogFile()

def sim_rttUpdate.RttUpdate.writeLogFile (   self)

Definition at line 479 of file sim_rttUpdate.py.

479  def writeLogFile(self):
480  f=file(self.logfile,'a')
481  for i in ['today','dryrun','user','branch','rel','cmt', 'package','jobs','comment']:
482  val ='None'
483  if hasattr(self.opt,i):
484  val = str(getattr(self.opt,i))
485  if val=='':
486  val='None'
487  if val.count(' ')>0:
488  val='"'+val+'"'
489  #print i,'=',val
490  f.write( val )
491  f.write(' ')
492  f.write('\n')
493 

Member Data Documentation

◆ alias

sim_rttUpdate.RttUpdate.alias

Definition at line 455 of file sim_rttUpdate.py.

◆ db

sim_rttUpdate.RttUpdate.db

Definition at line 402 of file sim_rttUpdate.py.

◆ djobs

sim_rttUpdate.RttUpdate.djobs

Definition at line 434 of file sim_rttUpdate.py.

◆ jobs

sim_rttUpdate.RttUpdate.jobs

Definition at line 437 of file sim_rttUpdate.py.

◆ logfile

sim_rttUpdate.RttUpdate.logfile

Definition at line 462 of file sim_rttUpdate.py.

◆ opt

sim_rttUpdate.RttUpdate.opt

Definition at line 403 of file sim_rttUpdate.py.


The documentation for this class was generated from the following file:
sim_rttUpdate.get_username
def get_username()
Definition: sim_rttUpdate.py:397
file
TFile * file
Definition: tile_monitor.h:29
beamspotman.dir
string dir
Definition: beamspotman.py:623
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
str
Definition: BTagTrackIpAccessor.cxx:11
getReferenceRun.ls
def ls(fpath)
Definition: getReferenceRun.py:29