Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-25 03:29:13

0001 import FWCore.ParameterSet.Config as cms
0002 process = cms.Process("CALIB")
0003 
0004 ####################################################
0005 def getFileInPath(rfile):
0006 ####################################################
0007    import os
0008    for dir in os.environ['CMSSW_SEARCH_PATH'].split(":"):
0009      if os.path.exists(os.path.join(dir,rfile)): return os.path.join(dir,rfile)
0010    return None
0011 
0012 process.MessageLogger = cms.Service("MessageLogger",
0013     cerr = cms.untracked.PSet(
0014         enable = cms.untracked.bool(False)
0015     ),
0016     cout = cms.untracked.PSet(
0017         enable = cms.untracked.bool(True),
0018         threshold = cms.untracked.string('INFO')
0019     ),
0020     debugModules = cms.untracked.vstring('')
0021 )
0022 
0023 process.source = cms.Source("EmptyIOVSource",
0024     timetype = cms.string('runnumber'),
0025     firstValue = cms.uint64(1), # Specify the first run number for which the masking should be done
0026     lastValue = cms.uint64(1),  # Specify the first run number for which the masking should be done
0027     interval = cms.uint64(1)
0028 )
0029 
0030 process.maxEvents = cms.untracked.PSet(
0031     input = cms.untracked.int32(1)
0032 )
0033 
0034 
0035 ### Example of APVs to be masked
0036 #DetId369141286_APV0
0037 #DetId369141286_APV1
0038 #DetId369141862_APV0
0039 #DetId369141862_APV1
0040 #DetId369157180_APV0
0041 #DetId369157180_APV1
0042 #DetId436244845_APV0
0043 #DetId436244845_APV1
0044 #DetId436245994_APV0
0045 #DetId436245994_APV1
0046 #DetId436248977_APV0
0047 
0048 detIDsFileName = getFileInPath('CalibTracker/SiStripCommon/data/SiStripDetInfo.dat')
0049 detDict = {}
0050 with open(detIDsFileName,"r") as detIDs:  # create dictionary online -> rawid
0051     for entry in detIDs:
0052         fields = entry.strip().split()
0053         detDict[fields[0]]=fields[1]
0054 
0055 #print(detDict)
0056 
0057 APVsToKill = []
0058 for det,napv in detDict.items():
0059     APVsToKill.append(
0060         cms.PSet(
0061             DetId = cms.uint32(int(det)),            
0062             APVs = cms.vuint32( 0,1 if int(napv)<6 else 2,3,4,5  ),       
0063             )
0064         )
0065 
0066 #Populate ES
0067 process.load("CalibTracker.SiStripESProducers.fake.SiStripBadModuleConfigurableFakeESSource_cfi")
0068 from CalibTracker.SiStripESProducers.fake.SiStripBadModuleConfigurableFakeESSource_cfi import siStripBadModuleConfigurableFakeESSource
0069 siStripBadModuleConfigurableFakeESSource.doByAPVs = cms.untracked.bool(True)  
0070 siStripBadModuleConfigurableFakeESSource.BadComponentList = cms.untracked.VPSet()
0071 siStripBadModuleConfigurableFakeESSource.BadAPVList = cms.untracked.VPSet(*APVsToKill)
0072     # cms.PSet(
0073     #     DetId = cms.uint32(369141286),             
0074     #     APVs = cms.vuint32(0,1),       
0075     #     ),
0076     # cms.PSet(
0077     #     DetId = cms.uint32(369141862),             
0078     #     APVs = cms.vuint32(0,1),       
0079     #     ),
0080     # cms.PSet(
0081     #     DetId = cms.uint32(369157180),             
0082     #     APVs = cms.vuint32(0,1),       
0083     #     ),
0084     # cms.PSet(
0085     #     DetId = cms.uint32(436244845),             
0086     #     APVs = cms.vuint32(0,1),       
0087     #     )
0088     #)
0089 
0090 #Write on DB
0091 process.load("CalibTracker.SiStripESProducers.DBWriter.SiStripBadModuleDummyDBWriter_cfi")
0092 process.siStripBadModuleDummyDBWriter.OpenIovAt = cms.untracked.string("currentTime")
0093 
0094 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0095     BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0096     DBParameters = cms.PSet(
0097         messageLevel = cms.untracked.int32(2),
0098         authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
0099     ),
0100     timetype = cms.untracked.string('runnumber'),
0101     connect = cms.string('sqlite_file:SiStripBadComponentsToMask.db'),
0102     toPut = cms.VPSet(cms.PSet(
0103         record = cms.string('SiStripBadStrip'),
0104         tag = cms.string('SiStripBadComponentsToMask')
0105         ))
0106 )
0107 
0108 
0109 ###### Quality ESProducer                                                                       
0110 process.load("CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi")
0111 process.siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet(
0112      cms.PSet( record = cms.string("SiStripBadModuleRcd"),  tag    = cms.string("") )
0113      )
0114 
0115 #### Add these lines to produce a tracker map
0116 # load TrackerTopology (needed for TkDetMap and TkHistoMap)
0117 process.load("Configuration.Geometry.GeometryExtended2017_cff")
0118 process.load("Geometry.TrackerGeometryBuilder.trackerParameters_cfi")
0119 process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")
0120 process.load("DQM.SiStripCommon.TkHistoMap_cff")
0121 ####
0122 
0123 from CalibTracker.SiStripQuality.siStripQualityStatistics_cfi import siStripQualityStatistics
0124 process.reader = siStripQualityStatistics.clone(
0125         TkMapFileName = cms.untracked.string("TkMapBadComponents_byHand.png")
0126         )
0127 
0128 
0129 process.siStripBadModuleDummyDBWriter.record=process.PoolDBOutputService.toPut[0].record
0130 process.p = cms.Path(process.reader*process.siStripBadModuleDummyDBWriter)
0131 
0132