File indexing completed on 2024-11-25 02:29:11
0001
0002
0003
0004
0005
0006
0007
0008 import os
0009 import sys
0010
0011 class Tag:
0012 """Holds all the information about a tag"""
0013 def __init__(self, inputTagName, inputTagType, inputReplaceStrings = "", inputRcdName = ""):
0014 self.tagName = inputTagName
0015 self.tagType = inputTagType
0016 self.replaceStrings = inputReplaceStrings
0017 if( inputRcdName == "" ):
0018 self.rcdName = inputTagName+"Rcd"
0019 else:
0020 self.rcdName = inputRcdName
0021
0022
0023 def systemActions(tag, actionType):
0024 fileName = "DummyCondDB"+actionType+"_"+tag.tagName+"_cfg.py"
0025 os.system("cat "+fileName+" | sed -e \"s@"+oldDest+"@"+newDest+"@\" -e \"s@Ideal_"+oldTag+"@"+tag.tagType+"_"+newTag+"@\" "+tag.replaceStrings+" > DummyCondDB"+actionType+"_tmp_cfg.py")
0026 returnValue = os.system("cmsRun DummyCondDB"+actionType+"_tmp_cfg.py")
0027
0028
0029
0030
0031 signal = returnValue & 0xFF
0032 exitCode = (returnValue >> 8) & 0xFF
0033 if( exitCode == 65 ):
0034 print("Exit code = 65")
0035 if( exitCode != 0 and exitCode != 65 ):
0036 print("Error: return value = ", returnValue)
0037 print("signal = ", end=' ')
0038 print(signal, end=' ')
0039 print("exit code = ", end=' ')
0040 print(exitCode)
0041 os.system("cat "+fileName)
0042 sys.exit()
0043
0044
0045
0046 def createAllTags(tagList, actionType="Writer"):
0047
0048 for tag in tagList:
0049 print("--------------------------------------------------")
0050 print("Creating tag "+tag.tagName+" of type "+tag.tagType, end=' ')
0051 if( tag.replaceStrings != "" ):
0052 print("with additional options: "+tag.replaceStrings)
0053 else:
0054 print()
0055 print("--------------------------------------------------")
0056 systemActions(tag, "Writer")
0057
0058
0059
0060 def readAllTags(tagList):
0061
0062 for tag in tagList:
0063 print("--------------------------------------------------")
0064 print("Reading tag"+tag.tagName+" of type "+tag.tagType)
0065 print("--------------------------------------------------")
0066
0067 os.system("cat DummyCondDBReaderTemplate_cfg.py | sed -e \"s@TAGNAME@"+tag.tagName+"@\" -e \"s@RCDNAME@"+tag.rcdName+"@\" > DummyCondDBReader_"+tag.tagName+"_cfg.py")
0068 tag.replaceStrings = "-e \"s@Ideal.log@"+tag.tagType+"@\""
0069 systemActions(tag, "Reader")
0070
0071
0072
0073
0074
0075
0076 oldDest="sqlite_file:dbfile.db"
0077 newDest="sqlite_file:dbfile.db"
0078
0079
0080 oldTag = "31X"
0081 newTag = "31X"
0082
0083
0084
0085
0086
0087 tagList = [
0088
0089 Tag("SiStripApvGain", "Ideal"),
0090 Tag("SiStripApvGain", "IdealSim"),
0091 Tag("SiStripApvGain", "StartUp", "-e \"s@SigmaGain=0.0@SigmaGain=0.10@\" -e \"s@default@gaussian@\""),
0092
0093 Tag("SiStripThreshold", "Ideal"),
0094 Tag("SiStripClusterThreshold", "Ideal", "", "SiStripThresholdRcd"),
0095
0096 Tag("SiStripBadChannel", "Ideal"),
0097 Tag("SiStripBadFiber", "Ideal"),
0098 Tag("SiStripBadModule", "Ideal"),
0099
0100 Tag("SiStripFedCabling", "Ideal"),
0101
0102 Tag("SiStripLorentzAngle", "Ideal"),
0103 Tag("SiStripLorentzAngle", "IdealSim"),
0104 Tag("SiStripLorentzAngle", "StartUp", "-e \"s@TIB_PerCent_Errs = cms.vdouble(0., 0., 0., 0.)@TIB_PerCent_Errs=cms.vdouble(20.,20.,20.,20.)@\" -e \"s@TOB_PerCent_Errs = cms.vdouble(0., 0., 0., 0., 0., 0.)@TOB_PerCent_Errs=cms.vdouble(20.,20.,20.,20.,20.,20.)@\""),
0105
0106 Tag("SiStripDetVOff", "Ideal"),
0107
0108 Tag("SiStripNoises_DecMode", "Ideal", "", "SiStripNoisesRcd"),
0109 Tag("SiStripNoises_PeakMode", "Ideal", "", "SiStripNoisesRcd"),
0110
0111 Tag("SiStripPedestals", "Ideal"),
0112
0113 Tag("SiStripLatency", "Ideal"),
0114
0115 Tag("SiStripBaseDelay", "Ideal"),
0116
0117 Tag("SiStripConfObject", "Ideal")
0118 ]
0119
0120
0121
0122
0123
0124 createAllTags(tagList)
0125
0126 readAllTags(tagList)
0127