From f59b072020ecc113985e5c080e732ec86273e84d Mon Sep 17 00:00:00 2001
From: Peter Onyisi <ponyisi@utexas.edu>
Date: Tue, 30 Jun 2020 16:21:56 +0200
Subject: [PATCH] Remove outdated scripts

---
 .../DataQualityUtils/scripts/BrowseDB.py      |  54 -------
 .../DataQualityUtils/scripts/CreateDB.py      |  86 -----------
 .../scripts/CreateDB_Histo.py                 |  96 -------------
 .../DataQualityUtils/scripts/GetHistogram.py  |  69 ---------
 .../DataQualityUtils/scripts/StoreDB.py       | 135 ------------------
 5 files changed, 440 deletions(-)
 delete mode 100755 DataQuality/DataQualityUtils/scripts/BrowseDB.py
 delete mode 100755 DataQuality/DataQualityUtils/scripts/CreateDB.py
 delete mode 100755 DataQuality/DataQualityUtils/scripts/CreateDB_Histo.py
 delete mode 100755 DataQuality/DataQualityUtils/scripts/GetHistogram.py
 delete mode 100755 DataQuality/DataQualityUtils/scripts/StoreDB.py

diff --git a/DataQuality/DataQualityUtils/scripts/BrowseDB.py b/DataQuality/DataQualityUtils/scripts/BrowseDB.py
deleted file mode 100755
index 3ef767525e7..00000000000
--- a/DataQuality/DataQualityUtils/scripts/BrowseDB.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# +-----------------------------------------------------+
-# | Vassilis D. Kazazakis - BrowseDB.py v1.0            |
-# |  Browses the COOL database and prints all elements  |
-# |  For testing purposes only                          |
-# +-----------------------------------------------------+
-
-import sys
-
-from PyCool import cool, coral
-
-import DataQualityUtils.DBInfo as DBInfo
-
-# user & password information should be handled by each individual program
-# if you have authentication file, this works
-
-home = os.environ.get('HOME')
-os.environ['CORAL_AUTH_PATH'] = home+"/private"
-
-#userName = "ATLAS_COOL_READER"
-#password = "*******" no need for a pwd here 
-
-connectString  = "oracle://" +  DBInfo.getWriteServer()
-connectString += ";schema=" +   DBInfo.getSchema()
-#connectString += ";user=" +     userName
-connectString += ";dbname=" +   DBInfo.getDbName()
-#connectString += ";password=" + password
-
-folderName = DBInfo.getFolder()
-
-dbSvc = cool.DatabaseSvcFactory.databaseService()
-
-try:
-        db = dbSvc.openDatabase( connectString )
-except:
-        print >>sys.stderr, "Database does not exist"
-        sys.exit(-1)
-
-folder = db.getFolder( folderName)
-metadata = DBInfo.getChannelDict()
-for key in metadata:
-	channel = metadata[key]
-	objIter = folder.browseObjects(0, cool.ValidityKeyMax, cool.ChannelSelection(channel))
-
-	print "Folder:", folderName
-	print "Channel:", channel, "Stream:", key
-
-	while(objIter.hasNext()):
-		objPayload = objIter.next().payload()
-		print " ", objPayload["filename"], "GUID:", objPayload["guid"]
-
-	print
diff --git a/DataQuality/DataQualityUtils/scripts/CreateDB.py b/DataQuality/DataQualityUtils/scripts/CreateDB.py
deleted file mode 100755
index 55a368f1bfe..00000000000
--- a/DataQuality/DataQualityUtils/scripts/CreateDB.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# +-----------------------------------------------------+
-# | Vassilis D. Kazazakis, CreateDB.py v1.0		|
-# | Creates the appropriate folder structure in COOL db	|
-# +-----------------------------------------------------+
-
-import sys, os
-import DataQualityUtils.DBInfo_Histo as DBInfo
-
-from PyCool import cool, coral
-
-# user & password information should be handled by each individual program
-# if you have authentication file, this works
-
-home = os.environ.get('HOME')
-os.environ['CORAL_AUTH_PATH'] = home+"/private"
-
-#userName = "ATLAS_COOLOFL_GLOBAL"
-#password = "*********" # no need for a pwd 
-
-dropExistingDB = False
-
-connectString  = "sqlite://" +	DBInfo.getWriteServer()
-connectString += ";schema=" + 	DBInfo.getSchema()
-#connectString += ";user=" + 	userName
-connectString += ";dbname=" + 	DBInfo.getDbName()
-#connectString += ";password=" + password
-
-if len(sys.argv) > 1 and sys.argv[1] == "createdb":
-  dbSvc = cool.DatabaseSvcFactory.databaseService()
-  db = dbSvc.createDatabase( connectString )
-
-if len(sys.argv) > 1 and sys.argv[1] == "drop":
-	dropExistingDB = True
-
-folderNames = DBInfo.getFolders()
-
-dbSvc = cool.DatabaseSvcFactory.databaseService()
-print connectString
-db = dbSvc.openDatabase( connectString, False) 
-
-for folderName in folderNames:
-  folderList = folderName.split("/")[1:]
-  folder = ""
-  for name in folderList[:-1]:
-          folder = folder + "/" + name
-          if db.existsFolderSet(folder):
-                  print "Folderset", folder, "already exists."
-                  continue
-          print "Creating folderset", folder,
-          db.createFolderSet(folder)
-          print "... Done"
-
-  if dropExistingDB:
-          if db.existsFolder(folderName):
-                  print "Droping", folderName,
-                  folder = db.dropNode(folderName)
-                  print "... Done"
-  if db.existsFolder(folderName):
-          folder = db.getFolder(folderName)
-  else:
-          spec = cool.RecordSpecification()
-          #spec.extend("filename", cool.StorageType.String255)
-          #spec.extend("guid", cool.StorageType.Int32)
-          spec.extend("Code", cool.StorageType.Int32)
-          spec.extend("deadFrac", cool.StorageType.Float)
-          spec.extend("Thrust",cool.StorageType.Float)
-          # heaven forgive me ...
-          if 'SHIFT' in folderName:
-            spec.extend("Comment",cool.StorageType.String255)
-          print "Creating folder", folderName, 
-          # Deprecated/dropped:  folder = db.createFolder(folderName, spec, "", cool.FolderVersioning.MULTI_VERSION, False)
-          folderSpec=cool.FolderSpecification(cool.FolderVersioning.MULTI_VERSION, spec)
-          folder = db.createFolder(folderName, folderSpec, "", False)
-          print "... Done"
-
-  print "Creating channels."
-  channelDict = DBInfo.getChannelDict()
-  for channelName in channelDict.keys():
-          try:
-                  folder.createChannel(channelDict[channelName], channelName)
-                  print "Created channel:", channelName
-          except:
-                  print "Channel", channelName, "already exists."
diff --git a/DataQuality/DataQualityUtils/scripts/CreateDB_Histo.py b/DataQuality/DataQualityUtils/scripts/CreateDB_Histo.py
deleted file mode 100755
index 4ad0dfb2ee6..00000000000
--- a/DataQuality/DataQualityUtils/scripts/CreateDB_Histo.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# +-----------------------------------------------------+
-# | Vassilis D. Kazazakis, CreateDB.py v1.0		|
-# | Creates the appropriate folder structure in COOL db	|
-# | Update by M.D'Onofrio to include new folder         |
-# | for history plots             	                |
-# +-----------------------------------------------------+
-
-import sys, os
-from DataQualityUtils.DBInfo_Histo import *
-
-from PyCool import cool, coral
-
-# user & password information should be handled by each individual program
-# if you have authentication file, this works
-
-home = os.environ.get('HOME')
-os.environ['CORAL_AUTH_PATH'] = home+"/private"
-
-#userName = "ATLAS_COOLOFL_GLOBAL"
-#password = "*******" #no need for a pwd
-
-dropExistingDB = False
-
-connectString  = "sqlite://" +	getWriteServer()
-connectString += ";schema=" + 	getSchema()
-#connectString += ";user=" + 	userName
-connectString += ";dbname=" + 	getDbName()
-#connectString += ";password=" + password
-
-if len(sys.argv) > 1 and sys.argv[1] == "createdb":
-  dbSvc = cool.DatabaseSvcFactory.databaseService()
-  db = dbSvc.createDatabase( connectString )
-
-if len(sys.argv) > 1 and sys.argv[1] == "drop":
-	dropExistingDB = True
-
-folderName = getFolder()
-folderNameH = getFolderH()
-
-dbSvc = cool.DatabaseSvcFactory.databaseService()
-print connectString
-db = dbSvc.openDatabase( connectString, False) 
-
-# DQMF folder
-
-folderList = folderName.split("/")[1:]
-folder = ""
-for name in folderList[:-1]:
-	folder = folder + "/" + name
-	if db.existsFolderSet(folder):
-		print "Folderset", folder, "already exists."
-		continue
-	print "Creating folderset", folder,
-	db.createFolderSet(folder)
-	print "... Done"
-
-if dropExistingDB:
-	if db.existsFolder(folderName):
-		print "Droping", folderName,
-		folder = db.dropNode(folderName)
-		print "... Done"
-if db.existsFolder(folderName):
-	folder = db.getFolder(folderName)
-else:
-	spec = cool.RecordSpecification()
-	#spec.extend("filename", cool.StorageType.String255)
-	#spec.extend("guid", cool.StorageType.Int32)
-	spec.extend("Code", cool.StorageType.Int32)
-	spec.extend("deadFrac", cool.StorageType.Float)
-	spec.extend("Thrust",cool.StorageType.Float)
-	print "Creating folder", folderName, 
-	# Deprecated/dropped:  folder = db.createFolder(folderName, spec, "", cool.FolderVersioning.MULTI_VERSION, False)
-	folderSpec=cool.FolderSpecification(cool.FolderVersioning.MULTI_VERSION, spec)
-	folder = db.createFolder(folderName, folderSpec, "", False)
-	print "... Done"
-
-print "Creating channels."
-channelDict = getChannelDict()
-for channelName in channelDict.keys():
-	try:
-		folder.createChannel(channelDict[channelName], channelName)
-		print "Created channel:", channelName
-	except:
-		print "Channel", channelName, "already exists."
-
-db.closeDatabase()
-
-# create defects
-from DQDefects import DefectsDB
-ddb = DefectsDB(connectString, create=True, read_only=False)
-chandb = DefectsDB('COOLOFL_GLOBAL/CONDBR2')
-for chan in chandb.defect_names:
-    ddb.create_defect(chan, chandb.get_channel_descriptions([chan]))
diff --git a/DataQuality/DataQualityUtils/scripts/GetHistogram.py b/DataQuality/DataQualityUtils/scripts/GetHistogram.py
deleted file mode 100755
index f53d6d7c4bc..00000000000
--- a/DataQuality/DataQualityUtils/scripts/GetHistogram.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# +---------------------------------------------+
-# | Vassilis D. Kazazakis, GetHistogram.py v1.0	|
-# | Extracts histograms from ROOT files		|
-# |  Interface used by QuerryDB.py application	|
-# +---------------------------------------------+
-
-import DataQualityUtils.DQGetHistogramMod as mod
-
-
-def usage():
-	print "Usage:", sys.argv[0] , "[options]"
-	print """
-	-i/--input filename		 Input ROOT file
-	-o/--output filename		 Output ROOT file
-	-n/--name histogram		 Name of the histogram to extract
-	-d/--directory directory[:flag]	 Name of the directory from which to extract all[or flagged] histograms
-	-f/--flag flag			 Flag of the histograms to extract (shift/expert/etc)
-	"""
-
-
-if __name__ == "__main__":
-	input = output = None
-	nameList = []
-	try:
-		optlist, unparsed = getopt.getopt(sys.argv[1:],
-					"i:o:n:d:f:",
-					["input=", "output=", "name=", "directory=", "flag="])
-	except getopt.GetoptError:
-		usage()
-		sys.exit(-1)
-
-	if len(optlist) == 0:
-		usage()
-		sys.exit(0)
-
-	if len(unparsed) != 0:
-		print "Extra arguments", unparsed, "not used."
-
-	for opt, arg in optlist:
-		if opt in ("-i", "--input"):
-			input = arg
-		elif opt in ("-o", "--output"):
-			output = arg
-		elif opt in ("-n", "--name"):
-			nameList.append(arg)
-		elif opt in ("-d", "--directory"):
-			tmpList = arg.split(":")
-			if len(tmpList) < 2:
-				tmpList.append("")
-			if not tmpList[0].endswith('/'):
-				if tmpList[1] != "":
-					tmpList[1] = ":" + tmpList[1]
-				arg = tmpList[0] + "/" + tmpList[1]
-			nameList.append(arg)
-		elif opt in ("-f", "--flag"):
-			nameList.append(":" + arg)
-
-	if None in (input, output):
-		print >>sys.stderr, "Error: Must define input/output files."
-		usage()
-		sys.exit(-1)
-	if len(nameList) == 0:
-		print >>sys.stderr, "Error: Must give at least one histogram or directory name."
-		usage()
-		sys.exit(-1)
-	mod.GetHistogram(input, output, nameList)
diff --git a/DataQuality/DataQualityUtils/scripts/StoreDB.py b/DataQuality/DataQualityUtils/scripts/StoreDB.py
deleted file mode 100755
index b5a3a17108d..00000000000
--- a/DataQuality/DataQualityUtils/scripts/StoreDB.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# +-----------------------------------------------------+
-# | Vassilis D. Kazazakis, StoreDB.py v1.1		|
-# | Stores ROOT file information in the COOL database	|
-# +-----------------------------------------------------+
-
-import sys
-import getopt
-import DataQualityUtils.DBInfo as DBInfo
-
-from PyCool import cool, coral
-
-# user & password information should be handled by each individual program
-# if you have authentication file, this works 
-
-home = os.environ.get('HOME')
-os.environ['CORAL_AUTH_PATH'] = home+"/private"
-
-##userName = "ATLAS_COOLOFL_GLOBAL_W"
-##password = "*******" ### 
-
-connectString  = "oracle://" +  DBInfo.getWriteServer()
-connectString += ";schema=" +   DBInfo.getSchema()
-#connectString += ";user=" +     userName
-connectString += ";dbname=" +   DBInfo.getDbName()
-#connectString += ";password=" + password
-
-folderName = DBInfo.getFolder()
-
-def usage():
-	print "Usage:", sys.argv[0], "[options]"
-	print """
-	-f/--filename 	ROOT filename to enter to the database
-	-g/--guid	GUID of the file
-	-s/--start	Starting run:lumiBlock number
-	-e/--end	Ending run:lumiBlock (defaults to valid until next insertion) 
-	-c/--channel	Channel name
-	-l/--list	List all available channels
-	"""
-
-def addToDatabase(filename, guid, channelName, runStart, runEnd = None):
-	dbSvc = cool.DatabaseSvcFactory.databaseService()
-
-	try:
-		channel_id = DBInfo.getChannelDict()[channelName]
-	except KeyError:
-		print >>sys.stderr, "Channel", channelName, "does not exist."
-		sys.exit(-1)
-
-	if runEnd == None:
-		timeEnd = cool.ValidityKeyMax
-	else:
-		timeEnd = runEnd[0]  << 32
-		timeEnd += runEnd[1]
-	timeStart = runStart[0] << 32	## Since the 32 low bits are reserved for LumiBlocks...
-	timeStart += runStart[1]	## add lumiblock
-	
-	if timeStart >= timeEnd:
-		print >>sys.stderr, "Starting timestamp must be LESS than ending timestamp."
-		sys.exit(-1)
-
-	try:
-		db = dbSvc.openDatabase( connectString, False )
-	except:
-		print >>sys.stderr, "Error opening database."
-		sys.exit(-1)
-	
-	if db.existsFolder(folderName):
-		folder = db.getFolder(folderName)
-		spec = folder.payloadSpecification()
-	else:
-		print >>sys.stderr, "Error: Folder", folderName,"does not exist in database."
-		sys.exit(-1)
-
-	data = cool.Record(spec)
-	data["filename"] = filename
-	data["guid"] = guid
-	folder.storeObject( timeStart, timeEnd, data, channel_id)
-
-if __name__ == "__main__":
-	
-	try:
-		optlist, unparsed = getopt.getopt(sys.argv[1:], 
-							"f:s:e:c:lg:",
-							["filename=", "start=", "end=", "channel=", "list", "guid="])
-	except getopt.GetoptError:
-		print >>sys.stderr, "Error parsing arguments."
-		usage()
-		sys.exit(-1)
-
-	filename = None
-	channelName = "default"
-	guid = 0
-	runStart = (0, 0)
-	runEnd = None
-
-	for opt, arg in optlist:
-		if opt in ("-f", "--filename"):
-			filename = arg
-		elif opt in ("-g", "--guid"):
-			guid = int(arg)
-		elif opt in ("-s", "--start"):
-			startList = arg.split(":")
-			if len(startList) == 1:
-				startList.append("0")
-			for i in range(2):
-				if startList[i] == "":
-					startList[i] = "0"
-			runStart = ( int(startList[0]), int(startList[1]) )
-		elif opt in ("-e", "--end"):
-			endList = arg.split(":")
-			if len(endList) == 1:
-				endList.append("0")
-			for i in range(2):
-				if endList[i] == "":
-					endList[i] = "0"
-			runEnd = ( int(endList[0]), int(endList[1]) )
-		elif opt in ("-c", "--channel"):
-			channelName = arg
-		elif opt in ("-l", "--list"):
-			print "Available channels:"
-			for key in DBInfo.getChannelDict().keys():
-				print " ",key
-			sys.exit(0)
-
-	if filename == None:
-		print >>sys.stderr, "Must define ROOT file."
-		usage()
-		sys.exit(-1)
-
-	#guid = generateGUID(filename)
-
-	addToDatabase(filename, guid, channelName, runStart, runEnd)
-- 
GitLab