Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-17 02:41:47

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                                           toGet = cms.VPSet(
0049               cms.PSet(
0050             record = cms.string('EcalPedestalsRcd'),
0051                     #tag = cms.string('EcalPedestals_v5_online')
0052                     #tag = cms.string('EcalPedestals_2009runs_hlt') ### obviously diff w.r.t previous
0053                     tag = cms.string('EcalPedestals_hlt'), ### modif-alex 22/02/2011
0054                  ),
0055               cms.PSet(
0056             record = cms.string('EcalADCToGeVConstantRcd'),
0057                     #tag = cms.string('EcalADCToGeVConstant_EBg50_EEnoB_new')
0058                     #tag = cms.string('EcalADCToGeVConstant_2009runs_express') ### the 2 ADCtoGEV in EB and EE are diff w.r.t previous
0059                     tag = cms.string('EcalADCToGeVConstant_V1_hlt')
0060                  ),
0061               cms.PSet(
0062             record = cms.string('EcalIntercalibConstantsRcd'),
0063                     #tag = cms.string('EcalIntercalibConstants_EBg50_EEnoB_new')
0064                     #tag = cms.string('EcalIntercalibConstants_2009runs_express') ### differs from previous
0065                     tag = cms.string('EcalIntercalibConstants_V1_hlt')
0066                  ),
0067               cms.PSet(
0068             record = cms.string('EcalGainRatiosRcd'),
0069                     #tag = cms.string('EcalGainRatios_TestPulse_online')
0070                     tag = cms.string('EcalGainRatios_TestPulse_express') ### no diff w.r.t previous
0071                  ),
0072               cms.PSet(
0073                 record = cms.string('EcalMappingElectronicsRcd'),
0074                     tag = cms.string('EcalMappingElectronics_EEMap_v1_mc')
0075                  ),
0076               cms.PSet(
0077                 record = cms.string('EcalLaserAlphasRcd'),
0078                 tag = cms.string('EcalLaserAlphas_EB_sic1_btcp152_EE_sic1_btcp116')
0079               )
0080                )
0081              )
0082 
0083 
0084 #########################
0085 process.source = cms.Source("EmptySource",
0086        ##firstRun = cms.untracked.uint32(100000000) ### need to use latest run to pick-up update values from DB
0087        firstRun = cms.untracked.uint32(161310)
0088 )
0089 
0090 
0091 process.maxEvents = cms.untracked.PSet(
0092     input = cms.untracked.int32(1)
0093 )
0094 
0095 db_reader_account = 'CMS_ECAL_CONF'
0096 db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account )
0097 
0098 
0099 ##process.TPGParamProducer = cms.EDFilter("EcalTPGParamBuilder",
0100 process.TPGParamProducer = cms.EDAnalyzer("EcalTPGParamBuilder",
0101 
0102     #### inputs/ouputs control ####
0103     writeToDB  = cms.bool(options.writeToDB),
0104     allowDBEE  = cms.bool(True),
0105 
0106 #    DBsid   = cms.string('cms_omds_lb'), ## real DB on P5
0107     DBuser = cms.string(db_user),
0108     DBpass = cms.string(db_pwd),
0109     DBsid  = cms.string(db_service),
0110     DBport  = cms.uint32(10121),
0111 
0112     TPGWritePed = cms.uint32(1), # can be 1=load ped from offline DB  0=use previous ped NN=use ped from ped_conf_id=NN
0113     TPGWriteLin = cms.uint32(1),
0114     TPGWriteSli = cms.uint32(1),
0115     TPGWriteWei = cms.uint32(1),
0116     TPGWriteWei2 = cms.uint32(1), # odd weights
0117     TPGWriteLut = cms.uint32(1),
0118     TPGWriteFgr = cms.uint32(1),
0119     TPGWriteSpi = cms.uint32(1),
0120     TPGWriteDel = cms.uint32(1),
0121     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
0122     TPGWriteBtt = cms.uint32(0),
0123     TPGWriteBst = cms.uint32(0),
0124 
0125     writeToFiles = cms.bool(True),
0126     outFile = cms.string(options.outFile),
0127 
0128    #### TPG config tag and version (if not given it will be automatically given ) ####
0129     TPGtag = cms.string('BEAMV7_TEST'),
0130     TPGversion = cms.uint32(1),
0131 
0132    #### TPG calculation parameters ####
0133     useTransverseEnergy = cms.bool(True),    ## true when TPG computes transverse energy, false for energy
0134     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)
0135     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)
0136 
0137     sliding = cms.uint32(0),                 ## Parameter used for the FE data format, should'nt be changed
0138 
0139     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
0140     weight_sampleMax = cms.uint32(3),        ## position of the maximum among the 5 samples used by the TPG amplitude filter
0141     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
0142 
0143     weight_even_computeFromShape = cms.bool(True),   ## If False do not compute the even weights but read them from files
0144     weight_even_idMapFile = cms.string('EcalTPGIdMap_2018_PU50_S2.txt'),
0145     weight_even_weightGroupFile = cms.string('EcalTPGWeightGroup_2018_PU50_S2.txt'),
0146     weight_odd_idMapFile = cms.string('EcalTPGIdMap_odd.txt'),
0147     weight_odd_weightGroupFile = cms.string('EcalTPGWeightGroup_odd.txt'),
0148 
0149     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)
0150     TPmode_EnableEBOddFilter = cms.bool(False), # TPmode configs are used only is weight_useDoubleWeights is True
0151     TPmode_EnableEEOddFilter = cms.bool(False),
0152     TPmode_EnableEBOddPeakFinder = cms.bool(False),
0153     TPmode_EnableEEOddPeakFinder = cms.bool(False),
0154     TPmode_DisableEBEvenPeakFinder = cms.bool(False),
0155     TPmode_DisableEEEvenPeakFinder = cms.bool(False),
0156     TPmode_FenixEBStripOutput      = cms.uint32(0),
0157     TPmode_FenixEEStripOutput      = cms.uint32(0),
0158     TPmode_FenixEBStripInfobit2    = cms.uint32(0),
0159     TPmode_FenixEEStripInfobit2    = cms.uint32(0),
0160     TPmode_FenixEBTcpOutput        = cms.uint32(0),
0161     TPmode_FenixEBTcpInfobit1      = cms.uint32(0),
0162     TPmode_FenixEETcpOutput        = cms.uint32(0),
0163     TPmode_FenixEETcpInfobit1      = cms.uint32(0),
0164 
0165     forcedPedestalValue = cms.int32(-3),     ## use this value instead of getting it from DB or MC
0166                                              ## -1: means use value from DB or MC.
0167                                               ## -2: ped12 = 0 used to cope with FENIX bug
0168                                              ## -3: used with sFGVB: baseline subtracted is pedestal-offset*sin(theta)/G with G=mult*2^-(shift+2)
0169     pedestal_offset =  cms.uint32(150),      ## pedestal offset used with option forcedPedestalValue = -3
0170 
0171     useInterCalibration = cms.bool(True),    ## use or not values from DB. If not, 1 is assumed
0172 
0173     timing_delays_EB = cms.string('Delays_EB.txt'), # timing delays for latency EB / TT
0174     timing_delays_EE = cms.string('Delays_EE.txt'), # timing delays for latency EE / strip
0175     timing_phases_EB = cms.string('Phases_EB.txt'), # TCC phase setting for EB / TT
0176     timing_phases_EE = cms.string('Phases_EE.txt'), # TCC phase setting for EE / strip
0177 
0178     useTransparencyCorr = cms.bool(True),   ## true if you want to correct TPG for transparency change in EE
0179     transparency_corrections = cms.string(options.transparency), # transparency corr to be used to compute linearizer parameters 1/crystal
0180 
0181     SFGVB_Threshold = cms.uint32(16),             ## (adc) SFGVB threshold in FE
0182     SFGVB_lut = cms.uint32(0xfffefee8),           ## SFGVB LUT in FE
0183     SFGVB_SpikeKillingThreshold = cms.int32(16),  ## (GeV) Spike killing threshold applied in TPG ET in TCC (-1 no killing)
0184 
0185     forceEtaSlice = cms.bool(False),         ## when true, same linearization coeff for all crystals belonging to a given eta slice (tower)
0186 
0187     LUT_option = cms.string('Linear'),       ## compressed LUT option can be: "Identity", "Linear", "EcalResolution"
0188     LUT_threshold_EB = cms.double(0.50),    ## All Trigger Primitives <= threshold (in GeV) will be set to 0
0189     LUT_threshold_EE = cms.double(0.50),    ## All Trigger Primitives <= threshold (in GeV) will be set to 0
0190     LUT_stochastic_EB = cms.double(0.03),    ## Stochastic term of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0191     LUT_noise_EB = cms.double(0.2),          ## noise term (GeV) of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0192     LUT_constant_EB = cms.double(0.005),     ## constant term of the ECAL-EB ET resolution (used only if LUT_option="EcalResolution")
0193     LUT_stochastic_EE = cms.double(0.03),    ## Stochastic term of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0194     LUT_noise_EE = cms.double(0.2),          ## noise term (GeV) of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0195     LUT_constant_EE = cms.double(0.005),     ## constant term of the ECAL-EE ET resolution (used only if LUT_option="EcalResolution")
0196 
0197     TTF_lowThreshold_EB = cms.double(2),   ## EB Trigger Tower Flag low threshold in GeV
0198     TTF_highThreshold_EB = cms.double(4),  ## EB Trigger Tower Flag high threshold in GeV
0199     TTF_lowThreshold_EE = cms.double(2),   ## EE Trigger Tower Flag low threshold in GeV
0200     TTF_highThreshold_EE = cms.double(4),  ## EE Trigger Tower Flag high threshold in GeV
0201 
0202     FG_lowThreshold_EB = cms.double(3.9),      ## EB Fine Grain Et low threshold in GeV
0203     FG_highThreshold_EB = cms.double(3.9),     ## EB Fine Grain Et high threshold in GeV
0204     FG_lowRatio_EB = cms.double(0.9),          ## EB Fine Grain low-ratio
0205     FG_highRatio_EB = cms.double(0.9),         ## EB Fine Grain high-ratio
0206     FG_lut_EB = cms.uint32(0x08),              ## EB Fine Grain Look-up table. Put something != 0 if you really know what you do!
0207     FG_Threshold_EE = cms.double(18.75),       ## EE Fine threshold in GeV
0208     FG_lut_strip_EE = cms.uint32(0xfffefee8),  ## EE Fine Grain strip Look-up table
0209     FG_lut_tower_EE = cms.uint32(0)            ## EE Fine Grain tower Look-up table
0210 )
0211 
0212 process.p = cms.Path(process.TPGParamProducer)