Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-17 01:40:52

0001 from __future__ import print_function
0002 import os
0003 import shlex, subprocess
0004 import shutil, getpass
0005 
0006 import FWCore.ParameterSet.Config as cms
0007 
0008 process = cms.Process("SiPixelInclusiveBuilder")
0009 
0010 process.load("FWCore.MessageService.MessageLogger_cfi")
0011 process.MessageLogger.cerr.enable = False
0012 process.MessageLogger.cout = dict(enable = True, threshold = "INFO")
0013 
0014 process.load("Configuration.StandardSequences.MagneticField_cff")
0015 
0016 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
0017 
0018 process.load("CalibTracker.Configuration.TrackerAlignment.TrackerAlignment_Fake_cff")
0019 
0020 process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
0021 
0022 process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
0023 
0024 process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi")
0025 
0026 process.load("CondCore.CondDB.CondDB_cfi")
0027 
0028 process.source = cms.Source("EmptyIOVSource",
0029     firstValue = cms.uint64(1),
0030     lastValue = cms.uint64(1),
0031     timetype = cms.string('runnumber'),
0032     interval = cms.uint64(1)
0033 )
0034 
0035 process.maxEvents = cms.untracked.PSet(
0036     input = cms.untracked.int32(1)
0037 )
0038 
0039 try:
0040     user = os.environ["USER"]
0041 except KeyError:
0042     # user = commands.getoutput('whoami')
0043     # user = subprocess.call('whoami')
0044     # faster, "cheaper" (in terms of resources), and more secure
0045     user = getpass.getuser()
0046  
0047 #file = "/tmp/" + user + "/prova.db"
0048 file = "prova.db"
0049 sqlfile = "sqlite_file:" + file
0050 print('\n-> Uploading as user %s into file %s, i.e. %s\n' % (user, file, sqlfile))
0051 
0052 #subprocess.call(["/bin/cp", "prova.db", file])
0053 #subprocess.call(["/bin/mv", "prova.db", "prova_old.db"])
0054 #faster as it doesn't spawn a process
0055 shutil.move("prova.db", "prova_old.db")
0056 
0057 
0058 ##### DATABASE CONNNECTION AND INPUT TAGS ######
0059 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0060     BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0061     DBParameters = cms.PSet(
0062         authenticationPath = cms.untracked.string('.'),
0063         connectionRetrialPeriod = cms.untracked.int32(10),
0064         idleConnectionCleanupPeriod = cms.untracked.int32(10),
0065         messageLevel = cms.untracked.int32(1),
0066         enablePoolAutomaticCleanUp = cms.untracked.bool(False),
0067         enableConnectionSharing = cms.untracked.bool(True),
0068         connectionRetrialTimeOut = cms.untracked.int32(60),
0069         connectionTimeOut = cms.untracked.int32(0),
0070         enableReadOnlySessionOnUpdateConnection = cms.untracked.bool(False)
0071     ),
0072     timetype = cms.untracked.string('runnumber'),
0073     connect = cms.string(sqlfile),
0074     toPut = cms.VPSet(
0075 #        cms.PSet(
0076 #            record = cms.string('SiPixelFedCablingMapRcd'),
0077 #            tag = cms.string('SiPixelFedCablingMap_v14')
0078 #        ), 
0079         cms.PSet(
0080             record = cms.string('SiPixelLorentzAngleRcd'),
0081             tag = cms.string('SiPixelLorentzAngle_v01')
0082         ),
0083 ###        cms.PSet(
0084 ###            record = cms.string('SiPixelLorentzAngleSimRcd'),
0085 ###            tag = cms.string('SiPixelLorentzAngleSim_v01')
0086 ###        ),
0087 #        cms.PSet(
0088 #            record = cms.string('SiPixelTemplateDBObjectRcd'),
0089 #            tag = cms.string('SiPixelTemplateDBObject')
0090 #        ),
0091 #        cms.PSet(
0092 #           record = cms.string('SiPixelQualityFromDbRcd'),
0093 #           tag = cms.string('SiPixelQuality_test')
0094 #        ),
0095 #        cms.PSet(
0096 #            record = cms.string('SiPixelGainCalibrationOfflineRcd'),
0097 #            tag = cms.string('SiPixelGainCalibration_TBuffer_const')
0098 #        ), 
0099 #        cms.PSet(
0100 #            record = cms.string('SiPixelGainCalibrationForHLTRcd'),
0101 #            tag = cms.string('SiPixelGainCalibration_TBuffer_hlt_const')
0102 #        ),
0103 #        cms.PSet(
0104 #            record = cms.string('SiPixelGainCalibrationOfflineSimRcd'),
0105 #            tag = cms.string('SiPixelGainCalibrationSim_TBuffer_const_new')
0106 #        ), 
0107 #        cms.PSet(
0108 #            record = cms.string('SiPixelGainCalibrationForHLTSimRcd'),
0109 #            tag = cms.string('SiPixelGainCalibrationSim_TBuffer_hlt_const')
0110 #        )
0111                      )
0112 )
0113 
0114 
0115 
0116 
0117 
0118 
0119 
0120 
0121 ###### TEMPLATE OBJECT UPLOADER ######
0122 MagFieldValue = 3.8
0123 if ( MagFieldValue==0 ):
0124     MagFieldString = '0'
0125     files_to_upload = cms.vstring(
0126         "CalibTracker/SiPixelESProducers/data/template_summary_zp0022.out",
0127         "CalibTracker/SiPixelESProducers/data/template_summary_zp0023.out")
0128     theDetIds      = cms.vuint32( 1, 2) # 0 is for all, 1 is Barrel, 2 is EndCap
0129     theTemplateIds = cms.vuint32(22,23)
0130 elif(MagFieldValue==4):
0131     MagFieldString = '4'
0132     files_to_upload = cms.vstring(
0133         "CalibTracker/SiPixelESProducers/data/template_summary_zp0018.out",
0134         "CalibTracker/SiPixelESProducers/data/template_summary_zp0019.out")
0135     theDetIds      = cms.vuint32( 1, 2)
0136     theTemplateIds = cms.vuint32(18,19)
0137 elif(MagFieldValue==3.8 or MagFieldValue==38):
0138     MagFieldString = '38'
0139     files_to_upload = cms.vstring(
0140         "CalibTracker/SiPixelESProducers/data/template_summary_zp0020.out",
0141         "CalibTracker/SiPixelESProducers/data/template_summary_zp0021.out")
0142     theDetIds      = cms.vuint32( 1, 2)
0143     theTemplateIds = cms.vuint32(20,21)
0144 elif(MagFieldValue==2):
0145     MagFieldString = '2'
0146     files_to_upload = cms.vstring(
0147         "CalibTracker/SiPixelESProducers/data/template_summary_zp0030.out",
0148         "CalibTracker/SiPixelESProducers/data/template_summary_zp0031.out")
0149     theDetIds      = cms.vuint32( 1, 2)
0150     theTemplateIds = cms.vuint32(30,31)
0151 elif(MagFieldValue==3):
0152     MagFieldString = '3'
0153     files_to_upload = cms.vstring(
0154         "CalibTracker/SiPixelESProducers/data/template_summary_zp0032.out",
0155         "CalibTracker/SiPixelESProducers/data/template_summary_zp0033.out")
0156     theDetIds      = cms.vuint32( 1, 2)
0157     theTemplateIds = cms.vuint32(32,33)
0158 elif(MagFieldValue==3.5 or MagFieldValue==35):
0159     MagFieldString = '35'
0160     files_to_upload = cms.vstring(
0161         "CalibTracker/SiPixelESProducers/data/template_summary_zp0034.out",
0162         "CalibTracker/SiPixelESProducers/data/template_summary_zp0035.out")
0163     theDetIds      = cms.vuint32( 1, 2)
0164     theTemplateIds = cms.vuint32(34,35)
0165 
0166 version = "v2"
0167 template_base = 'SiPixelTemplateDBObject' + MagFieldString + 'T'
0168 print('\nUploading %s%s with record SiPixelTemplateDBObjectRcd in file siPixelTemplates%sT.db\n' % (template_base,version,MagFieldString))
0169 
0170 process.TemplateUploader = cms.EDAnalyzer("SiPixelTemplateDBObjectUploader",
0171                                           siPixelTemplateCalibrations = files_to_upload,
0172                                           theTemplateBaseString = cms.string(template_base),
0173                                           Version = cms.double(3.0),
0174                                           MagField = cms.double(MagFieldValue),
0175                                           detIds = theDetIds,
0176                                           templateIds = theTemplateIds
0177 )
0178 
0179 
0180 
0181 
0182 ###### QUALITY OBJECT MAKER #######
0183 process.QualityObjectMaker = cms.EDAnalyzer("SiPixelBadModuleByHandBuilder",
0184     BadModuleList = cms.untracked.VPSet(cms.PSet(
0185         errortype = cms.string('whole'),
0186         detid = cms.uint32(302197784)
0187          ),
0188         cms.PSet(
0189             errortype = cms.string('whole'),
0190             detid = cms.uint32(302195232)
0191         ),
0192         cms.PSet(
0193             errortype = cms.string('whole'),
0194             detid = cms.uint32(344014348)
0195         )),
0196     Record = cms.string('SiPixelQualityFromDbRcd'),
0197     SinceAppendMode = cms.bool(True),
0198     IOVMode = cms.string('Run'),
0199     printDebug = cms.untracked.bool(True),
0200     doStoreOnDB = cms.bool(True)
0201 
0202 )
0203 
0204 
0205 
0206 ##### CABLE MAP OBJECT ######
0207 process.PixelToLNKAssociateFromAsciiESProducer = cms.ESProducer("PixelToLNKAssociateFromAsciiESProducer",
0208     fileName = cms.string('pixelToLNK.ascii')
0209 )
0210 
0211 
0212 process.MapWriter = cms.EDAnalyzer("SiPixelFedCablingMapWriter",
0213     record = cms.string('SiPixelFedCablingMapRcd'),
0214     associator = cms.untracked.string('PixelToLNKAssociateFromAscii')
0215 )
0216 
0217 
0218 
0219 ###### LORENTZ ANGLE OBJECT ######
0220 process.SiPixelLorentzAngle = cms.EDAnalyzer("SiPixelLorentzAngleDB",
0221     magneticField = cms.double(3.8),
0222     #in case of PSet
0223     BPixParameters = cms.untracked.VPSet(
0224         cms.PSet(
0225             layer = cms.uint32(1),
0226             module = cms.uint32(1),
0227             angle = cms.double(0.09103)
0228         ),
0229         cms.PSet(
0230             layer = cms.uint32(1),
0231             module = cms.uint32(2),
0232             angle = cms.double(0.09103)
0233         ),
0234         cms.PSet(
0235             layer = cms.uint32(1),
0236             module = cms.uint32(3),
0237             angle = cms.double(0.09103)
0238         ),
0239         cms.PSet(
0240             layer = cms.uint32(1),
0241             module = cms.uint32(4),
0242             angle = cms.double(0.09103)
0243         ),
0244         cms.PSet(
0245             layer = cms.uint32(1),
0246             module = cms.uint32(5),
0247             angle = cms.double(0.09574)
0248         ),
0249         cms.PSet(
0250             layer = cms.uint32(1),
0251             module = cms.uint32(6),
0252             angle = cms.double(0.09574)
0253         ),
0254         cms.PSet(
0255             layer = cms.uint32(1),
0256             module = cms.uint32(7),
0257             angle = cms.double(0.09574)
0258         ),
0259         cms.PSet(
0260             layer = cms.uint32(1),
0261             module = cms.uint32(8),
0262             angle = cms.double(0.09574)
0263         ),
0264         cms.PSet(
0265             layer = cms.uint32(2),
0266             module = cms.uint32(1),
0267             angle = cms.double(0.09415)
0268         ),
0269         cms.PSet(
0270             layer = cms.uint32(2),
0271             module = cms.uint32(2),
0272             angle = cms.double(0.09415)
0273         ),
0274         cms.PSet(
0275             layer = cms.uint32(2),
0276             module = cms.uint32(3),
0277             angle = cms.double(0.09415)
0278         ),
0279         cms.PSet(
0280             layer = cms.uint32(2),
0281             module = cms.uint32(4),
0282             angle = cms.double(0.09415)
0283         ),
0284         cms.PSet(
0285             layer = cms.uint32(2),
0286             module = cms.uint32(5),
0287             angle = cms.double(0.09955)
0288         ),
0289         cms.PSet(
0290             layer = cms.uint32(2),
0291             module = cms.uint32(6),
0292             angle = cms.double(0.09955)
0293         ),
0294         cms.PSet(
0295             layer = cms.uint32(2),
0296             module = cms.uint32(7),
0297             angle = cms.double(0.09955)
0298         ),
0299         cms.PSet(
0300             layer = cms.uint32(2),
0301             module = cms.uint32(8),
0302             angle = cms.double(0.09955)
0303         ),
0304         cms.PSet(
0305             layer = cms.uint32(3),
0306             module = cms.uint32(1),
0307             angle = cms.double(0.09541)
0308         ),
0309         cms.PSet(
0310             layer = cms.uint32(3),
0311             module = cms.uint32(2),
0312             angle = cms.double(0.09541)
0313         ),
0314         cms.PSet(
0315             layer = cms.uint32(3),
0316             module = cms.uint32(3),
0317             angle = cms.double(0.09541)
0318         ),
0319         cms.PSet(
0320             layer = cms.uint32(3),
0321             module = cms.uint32(4),
0322             angle = cms.double(0.09541)
0323         ),
0324         cms.PSet(
0325             layer = cms.uint32(3),
0326             module = cms.uint32(5),
0327             angle = cms.double(0.10121)
0328         ),
0329         cms.PSet(
0330             layer = cms.uint32(3),
0331             module = cms.uint32(6),
0332             angle = cms.double(0.10121)
0333         ),
0334         cms.PSet(
0335             layer = cms.uint32(3),
0336             module = cms.uint32(7),
0337             angle = cms.double(0.10121)
0338         ),
0339         cms.PSet(
0340             layer = cms.uint32(3),
0341             module = cms.uint32(8),
0342             angle = cms.double(0.10121)
0343         ),
0344     ),
0345     FPixParameters = cms.untracked.VPSet(
0346         cms.PSet(
0347             side = cms.uint32(1),
0348             disk = cms.uint32(1),
0349             HVgroup = cms.uint32(1),
0350             angle = cms.double(0.06404)
0351         ),
0352         cms.PSet(
0353             side = cms.uint32(1),
0354             disk = cms.uint32(2),
0355             HVgroup = cms.uint32(1),
0356             angle = cms.double(0.06404)
0357         ),
0358         cms.PSet(
0359             side = cms.uint32(2),
0360             disk = cms.uint32(1),
0361             HVgroup = cms.uint32(1),
0362             angle = cms.double(0.06404)
0363         ),
0364         cms.PSet(
0365             side = cms.uint32(2),
0366             disk = cms.uint32(2),
0367             HVgroup = cms.uint32(1),
0368             angle = cms.double(0.06404)
0369         ),
0370         cms.PSet(
0371             side = cms.uint32(1),
0372             disk = cms.uint32(1),
0373             HVgroup = cms.uint32(2),
0374             angle = cms.double(0.06404)
0375         ),
0376         cms.PSet(
0377             side = cms.uint32(1),
0378             disk = cms.uint32(2),
0379             HVgroup = cms.uint32(2),
0380             angle = cms.double(0.06404)
0381         ),
0382         cms.PSet(
0383             side = cms.uint32(2),
0384             disk = cms.uint32(1),
0385             HVgroup = cms.uint32(2),
0386             angle = cms.double(0.06404)
0387         ),
0388         cms.PSet(
0389             side = cms.uint32(2),
0390             disk = cms.uint32(2),
0391             HVgroup = cms.uint32(2),
0392             angle = cms.double(0.06404)
0393         ),
0394     ),
0395     #in case lorentz angle values for bpix should be read from file -> not implemented yet
0396     useFile = cms.bool(False),
0397     record = cms.untracked.string('SiPixelLorentzAngleRcd'),  
0398     fileName = cms.string('lorentzFit.txt') 
0399 )
0400 
0401 process.SiPixelLorentzAngleSim = cms.EDAnalyzer("SiPixelLorentzAngleDB",
0402     magneticField = cms.double(3.8),
0403     #in case lorentz angle values for bpix should be read from file -> not implemented yet
0404     useFile = cms.bool(False),
0405     record = cms.untracked.string('SiPixelLorentzAngleSimRcd'),
0406     fileName = cms.string('lorentzFit.txt') 
0407 )
0408 
0409 ###### OFFLINE GAIN OBJECT ######
0410 process.SiPixelCondObjOfflineBuilder = cms.EDAnalyzer("SiPixelCondObjOfflineBuilder",
0411     process.SiPixelGainCalibrationServiceParameters,
0412     numberOfModules = cms.int32(2000),
0413     deadFraction = cms.double(0.00),
0414     noisyFraction = cms.double(0.00),
0415     appendMode = cms.untracked.bool(False),
0416     rmsGain = cms.double(0.),
0417     meanGain = cms.double(2.8),
0418     meanPed = cms.double(28.2),
0419     rmsPed = cms.double(0.),
0420 # separate input for the FPIX. If not entered the default values are used.
0421     rmsGainFPix = cms.untracked.double(0.),
0422     meanGainFPix = cms.untracked.double(2.8),
0423     meanPedFPix = cms.untracked.double(28.2),
0424     rmsPedFPix = cms.untracked.double(0.),
0425     fileName = cms.string('../macros/phCalibrationFit_C0.dat'),
0426     record = cms.string('SiPixelGainCalibrationOfflineRcd'),
0427     secondRocRowGainOffset = cms.double(0.0),
0428     fromFile = cms.bool(False),
0429     secondRocRowPedOffset = cms.double(0.0)
0430 )
0431 
0432 process.SiPixelCondObjOfflineBuilderSim = cms.EDAnalyzer("SiPixelCondObjOfflineBuilder",
0433     process.SiPixelGainCalibrationServiceParameters,
0434     numberOfModules = cms.int32(2000),
0435     deadFraction = cms.double(0.00),
0436     noisyFraction = cms.double(0.00),
0437     appendMode = cms.untracked.bool(False),
0438     rmsGain = cms.double(0.),
0439     meanGain = cms.double(2.8),
0440     meanPed = cms.double(28.2),
0441     rmsPed = cms.double(0.),
0442 # separate input for the FPIX. If not entered the default values are used.
0443     rmsGainFPix = cms.untracked.double(0.),
0444     meanGainFPix = cms.untracked.double(2.8),
0445     meanPedFPix = cms.untracked.double(28.2),
0446     rmsPedFPix = cms.untracked.double(0.),
0447     fileName = cms.string('../macros/phCalibrationFit_C0.dat'),
0448     record = cms.string('SiPixelGainCalibrationOfflineSimRcd'),
0449     secondRocRowGainOffset = cms.double(0.0),
0450     fromFile = cms.bool(False),
0451     secondRocRowPedOffset = cms.double(0.0)
0452 )
0453 
0454 
0455 ##### HLT GAIN OBJECT #####
0456 process.SiPixelCondObjForHLTBuilder = cms.EDAnalyzer("SiPixelCondObjForHLTBuilder",
0457     process.SiPixelGainCalibrationServiceParameters,
0458     numberOfModules = cms.int32(2000),
0459     deadFraction = cms.double(0.00),
0460     noisyFraction = cms.double(0.00),
0461     appendMode = cms.untracked.bool(False),
0462     rmsGain = cms.double(0.0),
0463     meanGain = cms.double(2.8),
0464     meanPed = cms.double(28.0),
0465     fileName = cms.string('../macros/phCalibrationFit_C0.dat'),
0466     record = cms.string('SiPixelGainCalibrationForHLTRcd'),
0467     secondRocRowGainOffset = cms.double(0.0),
0468     rmsPed = cms.double(0.0),
0469     fromFile = cms.bool(False),
0470     secondRocRowPedOffset = cms.double(0.0)
0471 )
0472 
0473 process.SiPixelCondObjForHLTBuilderSim = cms.EDAnalyzer("SiPixelCondObjForHLTBuilder",
0474     process.SiPixelGainCalibrationServiceParameters,
0475     numberOfModules = cms.int32(2000),
0476     deadFraction = cms.double(0.00),
0477     noisyFraction = cms.double(0.00),
0478     appendMode = cms.untracked.bool(False),
0479     rmsGain = cms.double(0.0),
0480     rmsPed = cms.double(0.0),
0481     meanGain = cms.double(2.8),
0482     meanPed = cms.double(28.0),
0483     fileName = cms.string('../macros/phCalibrationFit_C0.dat'),
0484     record = cms.string('SiPixelGainCalibrationForHLTSimRcd'),
0485     secondRocRowGainOffset = cms.double(0.0),
0486     fromFile = cms.bool(False),
0487     secondRocRowPedOffset = cms.double(0.0)
0488 )
0489 
0490 
0491 process.p = cms.Path(
0492 #    process.MapWriter*
0493 #    process.SiPixelCondObjOfflineBuilder*
0494 #    process.SiPixelCondObjForHLTBuilder*
0495 #    process.TemplateUploader*
0496 #    process.QualityObjectMaker*
0497 #    process.SiPixelLorentzAngleSim*
0498 #    process.SiPixelCondObjForHLTBuilderSim*
0499 #    process.SiPixelCondObjOfflineBuilderSim*
0500     process.SiPixelLorentzAngle
0501     )
0502