Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-15 04:27:01

0001 import FWCore.ParameterSet.Config as cms
0002 import CondTools.Ecal.db_credentials as auth
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 
0005 process = cms.Process("ProdTPGParam")
0006 options = VarParsing.VarParsing('tpg')
0007 
0008 options.register ('writeToDB',
0009                   0, # default value
0010                   VarParsing.VarParsing.multiplicity.singleton, 
0011                   VarParsing.VarParsing.varType.int,         
0012                   "Write conditions to DB")
0013 options.register ('outFile',
0014                   'TPG_beamv7_trans_rrrrrr_spikekill_2021.txt', 
0015                   VarParsing.VarParsing.multiplicity.singleton, 
0016                   VarParsing.VarParsing.varType.string,         
0017                   "Output file")
0018 options.register ('transparency',
0019                   'TRANSPARENCY_2018/hourly_rrrrrr', 
0020                   VarParsing.VarParsing.multiplicity.singleton, 
0021                   VarParsing.VarParsing.varType.string,         
0022                   "Transparency conditions file")
0023 
0024 options.parseArguments()
0025 
0026 # Calo geometry service model
0027 process.load("Configuration.StandardSequences.GeometryDB_cff")
0028 
0029 # ecal mapping
0030 process.eegeom = cms.ESSource("EmptyESSource",
0031     recordName = cms.string('EcalMappingRcd'),
0032     iovIsRunNotTime = cms.bool(True),
0033     firstValid = cms.vuint32(1)
0034 )
0035 
0036 # Get hardcoded conditions the same used for standard digitization before CMSSW_3_1_x
0037 ## process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetriever_cfi")
0038 # or Get DB parameters
0039 # process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
0040 process.load("CondCore.CondDB.CondDB_cfi")
0041 
0042 process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS'
0043 process.CondDB.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' ###P5 stuff
0044 
0045 
0046 process.PoolDBESSource = cms.ESSource("PoolDBESSource",
0047                                           process.CondDB,
0048                                           timetype = cms.untracked.string('runnumber'),
0049                                           toGet = cms.VPSet(
0050               cms.PSet(
0051             record = cms.string('EcalPedestalsRcd'),
0052                     #tag = cms.string('EcalPedestals_v5_online')
0053                     #tag = cms.string('EcalPedestals_2009runs_hlt') ### obviously diff w.r.t previous
0054                     tag = cms.string('EcalPedestals_hlt'), ### modif-alex 22/02/2011
0055                  ),
0056               cms.PSet(
0057             record = cms.string('EcalADCToGeVConstantRcd'),
0058                     #tag = cms.string('EcalADCToGeVConstant_EBg50_EEnoB_new')
0059                     #tag = cms.string('EcalADCToGeVConstant_2009runs_express') ### the 2 ADCtoGEV in EB and EE are diff w.r.t previous
0060                     tag = cms.string('EcalADCToGeVConstant_V1_hlt')
0061                  ),
0062               cms.PSet(
0063             record = cms.string('EcalIntercalibConstantsRcd'),
0064                     #tag = cms.string('EcalIntercalibConstants_EBg50_EEnoB_new')
0065                     #tag = cms.string('EcalIntercalibConstants_2009runs_express') ### differs from previous
0066                     tag = cms.string('EcalIntercalibConstants_V1_hlt')
0067                  ),
0068               cms.PSet(
0069             record = cms.string('EcalGainRatiosRcd'),
0070                     #tag = cms.string('EcalGainRatios_TestPulse_online')
0071                     tag = cms.string('EcalGainRatios_TestPulse_express') ### no diff w.r.t previous
0072                  ),
0073               cms.PSet(
0074                 record = cms.string('EcalMappingElectronicsRcd'),
0075                     tag = cms.string('EcalMappingElectronics_EEMap_v1_mc')
0076                  ),
0077               cms.PSet(
0078                 record = cms.string('EcalLaserAlphasRcd'),
0079                 tag = cms.string('EcalLaserAlphas_EB_sic1_btcp152_EE_sic1_btcp116')
0080               )
0081                )
0082              )
0083 
0084 
0085 #########################
0086 process.source = cms.Source("EmptySource",
0087        ##firstRun = cms.untracked.uint32(100000000) ### need to use latest run to pick-up update values from DB
0088        firstRun = cms.untracked.uint32(161310)
0089 )
0090 
0091 
0092 process.maxEvents = cms.untracked.PSet(
0093     input = cms.untracked.int32(1)
0094 )
0095 
0096 db_reader_account = 'CMS_ECAL_CONF'
0097 db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account )
0098 
0099 
0100 ##process.TPGParamProducer = cms.EDFilter("EcalTPGParamBuilder",
0101 process.TPGParamProducer = cms.EDAnalyzer("EcalTPGParamBuilder",
0102 
0103     #### inputs/ouputs control ####
0104     writeToDB  = cms.bool(options.writeToDB),
0105     allowDBEE  = cms.bool(True),
0106 
0107 #    DBsid   = cms.string('cms_omds_lb'), ## real DB on P5
0108     DBuser = cms.string(db_user),
0109     DBpass = cms.string(db_pwd),
0110     DBsid  = cms.string(db_service),
0111     DBport  = cms.uint32(10121),
0112 
0113     TPGWritePed = cms.uint32(1), # can be 1=load ped from offline DB  0=use previous ped NN=use ped from ped_conf_id=NN
0114     TPGWriteLin = cms.uint32(1),
0115     TPGWriteSli = cms.uint32(1),
0116     TPGWriteWei = cms.uint32(1),
0117     TPGWriteWei2 = cms.uint32(1), # odd weights
0118     TPGWriteLut = cms.uint32(1),
0119     TPGWriteFgr = cms.uint32(1),
0120     TPGWriteSpi = cms.uint32(1),
0121     TPGWriteDel = cms.uint32(1),
0122     TPGWriteBxt = cms.uint32(0), # these can be 0=use same as existing number for this tag or NN=use badxt from bxt_conf_id=NN
0123     TPGWriteBtt = cms.uint32(0),
0124     TPGWriteBst = cms.uint32(0),
0125 
0126     writeToFiles = cms.bool(True),
0127     outFile = cms.string(options.outFile),
0128 
0129    #### TPG config tag and version (if not given it will be automatically given ) ####
0130     TPGtag = cms.string('BEAMV7_TEST'),
0131     TPGversion = cms.uint32(1),
0132 
0133    #### TPG calculation parameters ####
0134     useTransverseEnergy = cms.bool(True),    ## true when TPG computes transverse energy, false for energy
0135     Et_sat_EB = cms.double(128.0),            ## Saturation value (in GeV) of the TPG before the compressed-LUT (rem: with 35.84 the TPG_LSB = crystal_LSB)
0136     Et_sat_EE = cms.double(128.0),            ## Saturation value (in GeV) of the TPG before the compressed-LUT (rem: with 35.84 the TPG_LSB = crystal_LSB)
0137 
0138     sliding = cms.uint32(0),                 ## Parameter used for the FE data format, should'nt be changed
0139 
0140     weight_timeShift = cms.double(0.),       ## weights are computed shifting the timing of the shape by this amount in ns: val>0 => shape shifted to the right
0141     weight_sampleMax = cms.uint32(3),        ## position of the maximum among the 5 samples used by the TPG amplitude filter
0142     weight_unbias_recovery = cms.bool(True), ## true if weights after int conversion are forced to have sum=0. Pb, in that case it can't have sum f*w = 1
0143 
0144     weight_even_computeFromShape = cms.bool(True),   ## If False do not compute the even weights but read them from files
0145     weight_even_idMapFile = cms.string('EcalTPGIdMap_2018_PU50_S2.txt'),
0146     weight_even_weightGroupFile = cms.string('EcalTPGWeightGroup_2018_PU50_S2.txt'),
0147     weight_odd_idMapFile = cms.string('EcalTPGIdMap_odd.txt'),
0148     weight_odd_weightGroupFile = cms.string('EcalTPGWeightGroup_odd.txt'),
0149 
0150     weight_useDoubleWeights =  cms.bool(False),  # If True the double weights configuration is created, if False the wei2_id is set to 1, the Run2 default (special meaning for the DAQ)
0151     TPmode_EnableEBOddFilter = cms.bool(False), # TPmode configs are used only is weight_useDoubleWeights is True
0152     TPmode_EnableEEOddFilter = cms.bool(False),
0153     TPmode_EnableEBOddPeakFinder = cms.bool(False),
0154     TPmode_EnableEEOddPeakFinder = cms.bool(False),
0155     TPmode_DisableEBEvenPeakFinder = cms.bool(False),
0156     TPmode_DisableEEEvenPeakFinder = cms.bool(False),
0157     TPmode_FenixEBStripOutput      = cms.uint32(0),
0158     TPmode_FenixEEStripOutput      = cms.uint32(0),
0159     TPmode_FenixEBStripInfobit2    = cms.uint32(0),
0160     TPmode_FenixEEStripInfobit2    = cms.uint32(0),
0161     TPmode_FenixEBTcpOutput        = cms.uint32(0),
0162     TPmode_FenixEBTcpInfobit1      = cms.uint32(0),
0163     TPmode_FenixEETcpOutput        = cms.uint32(0),
0164     TPmode_FenixEETcpInfobit1      = cms.uint32(0),
0165 
0166     forcedPedestalValue = cms.int32(-3),     ## use this value instead of getting it from DB or MC
0167                                              ## -1: means use value from DB or MC.
0168                                               ## -2: ped12 = 0 used to cope with FENIX bug
0169                                              ## -3: used with sFGVB: baseline subtracted is pedestal-offset*sin(theta)/G with G=mult*2^-(shift+2)
0170     pedestal_offset =  cms.uint32(150),      ## pedestal offset used with option forcedPedestalValue = -3
0171 
0172     useInterCalibration = cms.bool(True),    ## use or not values from DB. If not, 1 is assumed
0173 
0174     timing_delays_EB = cms.string('Delays_EB.txt'), # timing delays for latency EB / TT
0175     timing_delays_EE = cms.string('Delays_EE.txt'), # timing delays for latency EE / strip
0176     timing_phases_EB = cms.string('Phases_EB.txt'), # TCC phase setting for EB / TT
0177     timing_phases_EE = cms.string('Phases_EE.txt'), # TCC phase setting for EE / strip
0178 
0179     useTransparencyCorr = cms.bool(True),   ## true if you want to correct TPG for transparency change in EE
0180     transparency_corrections = cms.string(options.transparency), # transparency corr to be used to compute linearizer parameters 1/crystal
0181 
0182     SFGVB_Threshold = cms.uint32(16),             ## (adc) SFGVB threshold in FE
0183     SFGVB_lut = cms.uint32(0xfffefee8),           ## SFGVB LUT in FE
0184     SFGVB_SpikeKillingThreshold = cms.int32(16),  ## (GeV) Spike killing threshold applied in TPG ET in TCC (-1 no killing)
0185 
0186     forceEtaSlice = cms.bool(False),         ## when true, same linearization coeff for all crystals belonging to a given eta slice (tower)
0187 
0188     LUT_option = cms.string('Linear'),       ## compressed LUT option can be: "Identity", "Linear", "EcalResolution"
0189     LUT_threshold_EB = cms.double(0.50),    ## All Trigger Primitives <= threshold (in GeV) will be set to 0
0190     LUT_threshold_EE = cms.double(0.50),    ## All Trigger Primitives <= threshold (in GeV) will be set to 0
0191     LUT_stochastic_EB = cms.double(0.03),    ## Stochastic term of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0192     LUT_noise_EB = cms.double(0.2),          ## noise term (GeV) of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0193     LUT_constant_EB = cms.double(0.005),     ## constant term of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0194     LUT_stochastic_EE = cms.double(0.03),    ## Stochastic term of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0195     LUT_noise_EE = cms.double(0.2),          ## noise term (GeV) of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0196     LUT_constant_EE = cms.double(0.005),     ## constant term of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0197 
0198     TTF_lowThreshold_EB = cms.double(2),   ## EB Trigger Tower Flag low threshold in GeV
0199     TTF_highThreshold_EB = cms.double(4),  ## EB Trigger Tower Flag high threshold in GeV
0200     TTF_lowThreshold_EE = cms.double(2),   ## EE Trigger Tower Flag low threshold in GeV
0201     TTF_highThreshold_EE = cms.double(4),  ## EE Trigger Tower Flag high threshold in GeV
0202 
0203     FG_lowThreshold_EB = cms.double(3.9),      ## EB Fine Grain Et low threshold in GeV
0204     FG_highThreshold_EB = cms.double(3.9),     ## EB Fine Grain Et high threshold in GeV
0205     FG_lowRatio_EB = cms.double(0.9),          ## EB Fine Grain low-ratio
0206     FG_highRatio_EB = cms.double(0.9),         ## EB Fine Grain high-ratio
0207     FG_lut_EB = cms.uint32(0x08),              ## EB Fine Grain Look-up table. Put something != 0 if you really know what you do!
0208     FG_Threshold_EE = cms.double(18.75),       ## EE Fine threshold in GeV
0209     FG_lut_strip_EE = cms.uint32(0xfffefee8),  ## EE Fine Grain strip Look-up table
0210     FG_lut_tower_EE = cms.uint32(0)            ## EE Fine Grain tower Look-up table
0211 )
0212 
0213 process.p = cms.Path(process.TPGParamProducer)