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