Beispiel #1
0
def readPhoRegresFromDBFile(process,
                            filename=None,
                            suffex="2017UL",
                            prod=False):
    print "reading in pho regression with tag {} from prod {}".format(
        suffex, prod)
    from CondCore.CondDB.CondDB_cfi import CondDB
    if filename:
        CondDBReg = CondDB.clone(connect='sqlite_file:{}'.format(filename))
    elif prod:
        CondDBReg = CondDB.clone(
            connect='frontier://FrontierProd/CMS_CONDITIONS')
    else:
        CondDBReg = CondDB.clone(
            connect='frontier://FrontierPrep/CMS_CONDITIONS')
    process.phoRegres = cms.ESSource(
        "PoolDBESSource",
        CondDBReg,
        DumpStat=cms.untracked.bool(False),
        toGet=cms.VPSet(
            cms.PSet(record=cms.string("GBRDWrapperRcd"),
                     label=cms.untracked.string(
                         "photon_eb_ecalOnly_5To300_0p2To2_mean"),
                     tag=cms.string(
                         "photon_eb_ecalOnly_5To300_0p2To2_mean_{}".format(
                             suffex))),
            cms.PSet(record=cms.string("GBRDWrapperRcd"),
                     label=cms.untracked.string(
                         "photon_ee_ecalOnly_5To300_0p2To2_mean"),
                     tag=cms.string(
                         "photon_ee_ecalOnly_5To300_0p2To2_mean_{}".format(
                             suffex))),
            cms.PSet(
                record=cms.string("GBRDWrapperRcd"),
                label=cms.untracked.string(
                    "photon_eb_ecalOnly_5To300_0p0002To0p5_sigma"),
                tag=cms.string(
                    "photon_eb_ecalOnly_5To300_0p0002To0p5_sigma_{}".format(
                        suffex))),
            cms.PSet(
                record=cms.string("GBRDWrapperRcd"),
                label=cms.untracked.string(
                    "photon_ee_ecalOnly_5To300_0p0002To0p5_sigma"),
                tag=cms.string(
                    "photon_ee_ecalOnly_5To300_0p0002To0p5_sigma_{}".format(
                        suffex))),
        ))
    process.es_prefer_phoRegres = cms.ESPrefer("PoolDBESSource", "phoRegres")
    return process
Beispiel #2
0
def setup(process, binary_files, tree_files, run_start_geometry):
    """Pede-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `binary_files`: list of binary files to be read by pede
    - `tree_files`: list of ROOT files created in the mille step
    - `run_start_geometry`: run ID to pick the start geometry
    """

    # write alignments, APEs, and surface deformations to DB by default
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = True
    process.AlignmentProducer.saveApeToDB = True
    process.AlignmentProducer.saveDeformationsToDB = True

    # setup database output module
    # --------------------------------------------------------------------------
    from CondCore.CondDB.CondDB_cfi import CondDB
    process.PoolDBOutputService = cms.Service(
        "PoolDBOutputService",
        CondDB.clone(connect="sqlite_file:alignments_MP.db"),
        timetype=cms.untracked.string("runnumber"),
        toPut=cms.VPSet(
            cms.PSet(record=cms.string("TrackerAlignmentRcd"),
                     tag=cms.string("Alignments")),
            cms.PSet(record=cms.string("TrackerAlignmentErrorExtendedRcd"),
                     tag=cms.string("AlignmentErrorsExtended")),
            cms.PSet(record=cms.string("TrackerSurfaceDeformationRcd"),
                     tag=cms.string("Deformations")),
            cms.PSet(record=cms.string("SiStripLorentzAngleRcd_peak"),
                     tag=cms.string("SiStripLorentzAngle_peak")),
            cms.PSet(record=cms.string("SiStripLorentzAngleRcd_deco"),
                     tag=cms.string("SiStripLorentzAngle_deco")),
            cms.PSet(record=cms.string("SiPixelLorentzAngleRcd"),
                     tag=cms.string("SiPixelLorentzAngle")),
            cms.PSet(record=cms.string("SiStripBackPlaneCorrectionRcd"),
                     tag=cms.string("SiStripBackPlaneCorrection"))))

    # Reconfigure parts of the algorithm configuration
    # --------------------------------------------------------------------------
    process.AlignmentProducer.algoConfig.mergeBinaryFiles = binary_files
    process.AlignmentProducer.algoConfig.mergeTreeFiles = tree_files

    # Configure the empty source to include all needed runs
    # --------------------------------------------------------------------------
    iovs = mps_tools.make_unique_runranges(process.AlignmentProducer)
    number_of_events = iovs[-1] - iovs[0] + 1

    process.maxEvents = cms.untracked.PSet(
        input=cms.untracked.int32(number_of_events))
    process.source = cms.Source(
        "EmptySource",
        firstRun=cms.untracked.uint32(run_start_geometry),
        numberEventsInRun=cms.untracked.uint32(1))

    # Define the executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.AlignmentProducer)
Beispiel #3
0
def recomputeQGL(process):
    process.QGPoolDBESSource = cms.ESSource(
        "PoolDBESSource",
        CondDB.clone(
            connect=cms.string('frontier://FrontierProd/CMS_CONDITIONS'), ),
        toGet=cms.VPSet(
            cms.PSet(
                record=cms.string('QGLikelihoodRcd'),
                tag=cms.string('QGLikelihoodObject_v1_AK4PFchs_2017'),
                label=cms.untracked.string('QGL_AK4PFchs'),
            ), ),
    )
    process.es_prefer_qgl = cms.ESPrefer("PoolDBESSource", "QGPoolDBESSource")
Beispiel #4
0
## customised JME collections
from JMETriggerAnalysis.Common.customise_hlt import *

process = addPaths_MC_JMEPFCluster(process)
process = addPaths_MC_JMEPFCHS(process)
process = addPaths_MC_JMEPFPuppi(process)

## ES modules for PF-Hadron Calibrations
import os

from CondCore.CondDB.CondDB_cfi import CondDB as _CondDB

process.pfhcESSource = cms.ESSource(
    'PoolDBESSource',
    _CondDB.clone(connect='sqlite_file:PFHC_Run3Winter21_E2to500.db'),
    #_CondDB.clone(connect = 'sqlite_file:'+os.environ['CMSSW_BASE']+'/src/JMETriggerAnalysis/NTuplizers/data/PFHC_Run3Winter21_E2to500.db'),
    toGet=cms.VPSet(
        cms.PSet(
            record=cms.string('PFCalibrationRcd'),
            tag=cms.string('PFCalibration_CMSSW_12_0_1_HLT_120X_mcRun3_2021'),
            label=cms.untracked.string('HLT'),
        ), ),
)
process.pfhcESPrefer = cms.ESPrefer('PoolDBESSource', 'pfhcESSource')
#process.hltParticleFlow.calibrationsLabel = '' # standard label for Offline-PFHC in GT

###
### Jet Response Analyzer (JRA) NTuple
###
from jescJRA_utils import addJRAPath
Beispiel #5
0
import FWCore.ParameterSet.Config as cms

# import the needed ingredients
from Calibration.TkAlCaRecoProducers.AlcaBeamSpotHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripQualityHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsAAGHarvester_cff import *
from Alignment.CommonAlignmentProducer.AlcaSiPixelAliHarvester_cff import *
from Calibration.EcalCalibAlgos.AlcaEcalPedestalsHarvester_cff import *

from Calibration.TkAlCaRecoProducers.PCLMetadataWriter_cfi import *

# common ingredients
from CondCore.CondDB.CondDB_cfi import CondDB
CondDBOutput = CondDB.clone(
    connect=cms.string("sqlite_file:promptCalibConditions.db"))

PoolDBOutputService = cms.Service(
    "PoolDBOutputService",
    CondDBOutput,
    toPut=cms.VPSet(),
    #timetype = cms.untracked.string("runnumber"),
    #timetype = cms.untracked.string("lumiid"),
)

from DQMServices.Components.DQMFileSaver_cfi import *  # FIXME
dqmSaver.convention = 'Offline'
dqmSaver.workflow = '/Express/PCLTest/ALCAPROMPT'
#dqmSaver.saveAtJobEnd = True

# workflow definitions
Beispiel #6
0
if hasattr(process, 'FastTimerService'):
    del process.FastTimerService
# remove MessageLogger
if hasattr(process, 'MessageLogger'):
    del process.MessageLogger

if update_jmeCalibs:
    ## ES modules for PF-Hadron Calibrations
    import os
    # from CondCore.DBCommon.CondDBSetup_cfi import *
    from CondCore.CondDB.CondDB_cfi import CondDB as _CondDB

    process.pfhcESSource = cms.ESSource(
        'PoolDBESSource',
        _CondDB.clone(
            connect=
            'sqlite_fip:JMETriggerAnalysis/NTuplizers/data/PFHC_Run3Winter20_HLT_v01.db'
        ),
        toGet=cms.VPSet(
            cms.PSet(
                record=cms.string('PFCalibrationRcd'),
                tag=cms.string('PFCalibration_HLT_mcRun3_2021'),
                label=cms.untracked.string('HLT'),
            ), ),
    )

    process.pfhcESPrefer = cms.ESPrefer('PoolDBESSource', 'pfhcESSource')
    ## ES modules for HLT JECs
    process.jescESSource = cms.ESSource(
        'PoolDBESSource',
        _CondDB.clone(
            connect=
#                               gainType = cms.untracked.uint32(1), #0 for G1, 1 for G2
#                               params = subsets, # as a cms.VPset
#                               saveMaps = cms.bool(True)
#                               )

process.load("CondTools.SiStrip.scaleAndSmearSiStripGains_cfi")
process.scaleAndSmearSiStripGains.gainType = 1  # 0 for G1, 1 for G2
process.scaleAndSmearSiStripGains.params = subsets  # as a cms.VPset

##
## Database output service
##
from CondCore.CondDB.CondDB_cfi import CondDB as _CondDB

##
## Output database (in this case local sqlite file)
##
process.CondDBOutput = _CondDB.clone(
    connect='sqlite_file:modifiedSiStripGains_' +
    process.GlobalTag.globaltag._value + '_IOV_' + str(options.runNumber) +
    ".db")
process.PoolDBOutputService = cms.Service(
    "PoolDBOutputService",
    process.CondDBOutput,
    timetype=cms.untracked.string('runnumber'),
    toPut=cms.VPSet(
        cms.PSet(record=cms.string('SiStripApvGainRcd'),
                 tag=cms.string('modifiedGains'))))

process.p = cms.Path(process.scaleAndSmearSiStripGains)
    interval = cms.uint64(1)
)

process.load("SimCalorimetry.EcalTrigPrimProducers.ecalTrigPrimESProducer_cff")
process.tpparams12 = cms.ESSource("EmptyESSource",
    recordName = cms.string('EcalTPGPhysicsConstRcd'),
    iovIsRunNotTime = cms.bool(True),
    firstValid = cms.vuint32(1)
)

process.EcalTrigPrimESProducer.DatabaseFile = 'TPG_beamv7.txt.gz'

from CondCore.CondDB.CondDB_cfi import CondDB

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
     CondDB.clone(connect = cms.string("sqlite_file:TPG_beamv7.db")),
     timetype = cms.untracked.string("runnumber"),
     toPut = cms.VPSet(cms.PSet(
        record = cms.string('EcalTPGPedestalsRcd'),
        tag = cms.string('EcalTPGPedestals_beamv7')
        ),
        cms.PSet(
            record = cms.string('EcalTPGLinearizationConstRcd'),
            tag = cms.string('EcalTPGLinearizationConst_beamv7')
        ),
        cms.PSet(
            record = cms.string('EcalTPGSlidingWindowRcd'),
            tag = cms.string('EcalTPGSlidingWindow_beamv7')
        ),
        cms.PSet(
            record = cms.string('EcalTPGFineGrainEBIdMapRcd'),
Beispiel #9
0
def setup(process, binary_files, tree_files, run_start_geometry):
    """Pede-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `binary_files`: list of binary files to be read by pede
    - `tree_files`: list of ROOT files created in the mille step
    - `run_start_geometry`: run ID to pick the start geometry
    """

    # write alignments, APEs, and surface deformations to DB by default
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = True
    process.AlignmentProducer.saveApeToDB = True
    process.AlignmentProducer.saveDeformationsToDB = True

    # setup database output module
    # --------------------------------------------------------------------------
    from CondCore.CondDB.CondDB_cfi import CondDB
    process.PoolDBOutputService = cms.Service("PoolDBOutputService",
        CondDB.clone(connect = "sqlite_file:alignments_MP.db"),
        timetype = cms.untracked.string("runnumber"),
        toPut = cms.VPSet(
            cms.PSet(
                record = cms.string("TrackerAlignmentRcd"),
                tag = cms.string("Alignments")),
            cms.PSet(
                record = cms.string("TrackerAlignmentErrorExtendedRcd"),
                tag = cms.string("AlignmentErrorsExtended")),
            cms.PSet(
                record = cms.string("TrackerSurfaceDeformationRcd"),
                tag = cms.string("Deformations")),
            cms.PSet(
                record = cms.string("SiStripLorentzAngleRcd_peak"),
                tag = cms.string("SiStripLorentzAngle_peak")),
            cms.PSet(
                record = cms.string("SiStripLorentzAngleRcd_deco"),
                tag = cms.string("SiStripLorentzAngle_deco")),
            cms.PSet(
                record = cms.string("SiPixelLorentzAngleRcd"),
                tag = cms.string("SiPixelLorentzAngle")),
            cms.PSet(
                record = cms.string("SiStripBackPlaneCorrectionRcd"),
                tag = cms.string("SiStripBackPlaneCorrection"))
        )
    )


    # Reconfigure parts of the algorithm configuration
    # --------------------------------------------------------------------------
    process.AlignmentProducer.algoConfig.mergeBinaryFiles = binary_files
    process.AlignmentProducer.algoConfig.mergeTreeFiles   = tree_files


    # align calibrations to general settings
    # --------------------------------------------------------------------------
    for calib in process.AlignmentProducer.calibrations:
        calib.saveToDB       = process.AlignmentProducer.saveToDB
        calib.treeFile       = process.AlignmentProducer.algoConfig.treeFile
        calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles


    # Configure the empty source to include all needed runs
    # --------------------------------------------------------------------------
    iovs = mps_tools.make_unique_runranges(process.AlignmentProducer)
    number_of_events = iovs[-1] - iovs[0] + 1

    process.maxEvents = cms.untracked.PSet(
        input = cms.untracked.int32(number_of_events))
    process.source = cms.Source(
        "EmptySource",
        firstRun = cms.untracked.uint32(run_start_geometry),
        numberEventsInRun = cms.untracked.uint32(1))

    # Define the executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.AlignmentProducer)
Beispiel #10
0
# import the needed ingredients
from Calibration.TkAlCaRecoProducers.AlcaBeamSpotHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripQualityHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsHarvester_cff import *
from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsAAGHarvester_cff import *
from Alignment.CommonAlignmentProducer.AlcaSiPixelAliHarvester_cff import *
from Calibration.EcalCalibAlgos.AlcaEcalPedestalsHarvester_cff import *
from Calibration.LumiAlCaRecoProducers.AlcaLumiPCCHarvester_cff import *


from Calibration.TkAlCaRecoProducers.PCLMetadataWriter_cfi import *

# common ingredients
from CondCore.CondDB.CondDB_cfi import CondDB
CondDBOutput = CondDB.clone(connect = cms.string("sqlite_file:promptCalibConditions.db"))

PoolDBOutputService = cms.Service("PoolDBOutputService",
                                  CondDBOutput,
                                  toPut = cms.VPSet(),
                                  #timetype = cms.untracked.string("runnumber"),
                                  #timetype = cms.untracked.string("lumiid"),
                                  )


from DQMServices.Components.DQMFileSaver_cfi import * # FIXME
dqmSaver.convention = 'Offline'
dqmSaver.workflow = '/Express/PCLTest/ALCAPROMPT'
#dqmSaver.saveAtJobEnd = True

# workflow definitions
# remove FastTimerService
if hasattr(process, 'FastTimerService'):
    del process.FastTimerService

# remove MessageLogger
if hasattr(process, 'MessageLogger'):
    del process.MessageLogger

if update_jmeCalibs:
    ## ES modules for PF-Hadron Calibrations
    import os
    from CondCore.CondDB.CondDB_cfi import CondDB as _CondDB
    process.pfhcESSource = cms.ESSource(
        'PoolDBESSource',
        _CondDB.clone(
            connect='sqlite_file:' + os.environ['CMSSW_BASE'] +
            '/src/JMETriggerAnalysis/NTuplizers/data/PFHC_Run3Winter20_HLT_v01.db'
        ),
        toGet=cms.VPSet(
            cms.PSet(
                record=cms.string('PFCalibrationRcd'),
                tag=cms.string('PFCalibration_HLT_mcRun3_2021'),
                label=cms.untracked.string('HLT'),
            ), ),
    )
    process.pfhcESPrefer = cms.ESPrefer('PoolDBESSource', 'pfhcESSource')
    #process.hltParticleFlow.calibrationsLabel = '' # standard label for Offline-PFHC in GT

    ## ES modules for HLT JECs
    process.jescESSource = cms.ESSource(
        'PoolDBESSource',
        _CondDB.clone(
def addJetSequence(process, isData, is2017, is2018, isFastSim):
    #
    # Latest JEC through globaltag, see https://twiki.cern.ch/twiki/bin/viewauth/CMS/JECDataMC
    #
    process.load('JetMETCorrections.Configuration.JetCorrectors_cff')
    process.load('Configuration.StandardSequences.MagneticField_cff'
                 )  # needed for pfImpactParameterTagInfos
    if isData:
        jetCorrectorLevels = [
            'L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual'
        ]
    else:
        jetCorrectorLevels = ['L1FastJet', 'L2Relative', 'L3Absolute']

    from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection

    if isFastSim:
        from CondCore.CondDB.CondDB_cfi import CondDB
        if is2018:
            JECVersion = 'Autumn18_FastSimV1_MC'
        elif is2017:
            JECVersion = 'Fall17_FastSimV1_MC'
        else:
            JECVersion = 'Summer16_FastSimV1_MC'

        CondDBJECFile = CondDB.clone(connect=cms.string(
            'sqlite_fip:heavyNeutrino/multilep/data/JEC/{}.db'.format(
                JECVersion)))
        process.jec = cms.ESSource(
            'PoolDBESSource',
            CondDBJECFile,
            toGet=cms.VPSet(
                cms.PSet(
                    record=cms.string('JetCorrectionsRecord'),
                    tag=cms.string(
                        'JetCorrectorParametersCollection_{}_AK4PFchs'.format(
                            JECVersion)),
                    label=cms.untracked.string('AK4PFchs')), ))
        process.es_prefer_jec = cms.ESPrefer('PoolDBESSource', 'jec')

    updateJetCollection(
        process,
        jetSource=cms.InputTag('slimmedJets'),
        labelName='UpdatedJEC',
        jetCorrections=('AK4PFchs', cms.vstring(jetCorrectorLevels), 'None'),
        pvSource=cms.InputTag('offlineSlimmedPrimaryVertices'),
        svSource=cms.InputTag('slimmedSecondaryVertices'),
        btagDiscriminators=[
            'pfDeepFlavourJetTags:probb', 'pfDeepFlavourJetTags:probbb',
            'pfDeepFlavourJetTags:problepb', 'pfDeepFlavourJetTags:probc',
            'pfDeepFlavourJetTags:probuds', 'pfDeepFlavourJetTags:probg'
        ],
    )

    process.load("RecoJets.JetProducers.PileupJetID_cfi")
    process.pileupJetIdUpdated = process.pileupJetId.clone(
        jets=cms.InputTag("slimmedJets"),
        inputIsCorrected=True,
        applyJec=True,
        vertexes=cms.InputTag("offlineSlimmedPrimaryVertices"))
    #  print process.pileupJetId.dumpConfig()

    process.updatedPatJetsUpdatedJEC.userData.userInts.src += [
        'pileupJetIdUpdated:fullId'
    ]
    process.updatedPatJetsUpdatedJEC.userData.userFloats.src += [
        'pileupJetIdUpdated:fullDiscriminant'
    ]

    process.jetSequence = cms.Sequence(process.patAlgosToolsTask)

    #
    # Jet energy resolution, see https://twiki.cern.ch/twiki/bin/view/CMS/JetResolution#Smearing_procedures
    # Run three times the SmearedPATJetProducer for nominal, up and down variations
    #
    if not isData:
        for (i, j) in [(0, ''), (-1, 'Down'), (1, 'Up')]:
            jetSmearing = cms.EDProducer(
                'SmearedPATJetProducer',
                src=cms.InputTag('selectedUpdatedPatJetsUpdatedJEC'),
                enabled=cms.bool(True),
                rho=cms.InputTag("fixedGridRhoFastjetAll"),
                algo=cms.string('AK4PFchs'),
                algopt=cms.string('AK4PFchs_pt'),
                genJets=cms.InputTag('slimmedGenJets'),
                dRMax=cms.double(0.2),
                dPtMaxFactor=cms.double(3),
                debug=cms.untracked.bool(False),
                variation=cms.int32(i),
            )
            setattr(process, 'slimmedJetsCorrectedAndSmeared' + j, jetSmearing)
            process.jetSequence *= jetSmearing

    # Propagate JEC to MET (need to add fullPatMetSequence to path)
    # https://twiki.cern.ch/twiki/bin/view/CMS/MissingETUncertaintyPrescription#Instructions_for_9_4_X_X_9_or_10
    from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
    runMetCorAndUncFromMiniAOD(process,
                               isData=isData,
                               fixEE2017=is2017,
                               fixEE2017Params={
                                   'userawPt': True,
                                   'ptThreshold': 50.0,
                                   'minEtaThreshold': 2.65,
                                   'maxEtaThreshold': 3.139
                               })

    #
    # To get updated ecalBadCalibReducedMINIAODFilter
    # See https://twiki.cern.ch/twiki/bin/viewauth/CMS/MissingETOptionalFiltersRun2#How_to_run_ecal_BadCalibReducedM
    # Recipe is preliminary, i.e. recommended to check for updates
    #
    if (is2017 or is2018):
        process.load('RecoMET.METFilters.ecalBadCalibFilter_cfi')

        baddetEcallist = cms.vuint32([
            872439604, 872422825, 872420274, 872423218, 872423215, 872416066,
            872435036, 872439336, 872420273, 872436907, 872420147, 872439731,
            872436657, 872420397, 872439732, 872439339, 872439603, 872422436,
            872439861, 872437051, 872437052, 872420649, 872422436, 872421950,
            872437185, 872422564, 872421566, 872421695, 872421955, 872421567,
            872437184, 872421951, 872421694, 872437056, 872437057, 872437313
        ])

        process.ecalBadCalibReducedMINIAODFilter = cms.EDFilter(
            "EcalBadCalibFilter",
            EcalRecHitSource=cms.InputTag("reducedEgamma:reducedEERecHits"),
            ecalMinEt=cms.double(50.),
            baddetEcal=baddetEcallist,
            taggingMode=cms.bool(True),
            debug=cms.bool(False))

        process.jetSequence *= process.ecalBadCalibReducedMINIAODFilter
process.AlignmentProducer.applyDbAlignment            = readAPEFromDB
process.AlignmentProducer.checkDbAlignmentValidity    = False # enable reading from tags with several IOVs
process.AlignmentProducer.algoConfig.readApeFromASCII = not readAPEFromDB
process.AlignmentProducer.algoConfig.apeASCIIReadFile = cms.FileInPath(readASCIIFile)
#
# define how APEs are written
process.AlignmentProducer.saveApeToDB                 = saveAPEtoDB
process.AlignmentProducer.algoConfig.saveApeToASCII   = saveAPEtoASCII
process.AlignmentProducer.algoConfig.apeASCIISaveFile = saveASCIIFile


### specify the output database file
from CondCore.CondDB.CondDB_cfi import CondDB
process.PoolDBOutputService = cms.Service(
    "PoolDBOutputService",
    CondDB.clone(connect = cms.string("sqlite_file:"+saveAPEFile)),
    timetype = cms.untracked.string("runnumber"),
    toPut = cms.VPSet(
        cms.PSet(
            record = cms.string("TrackerAlignmentErrorExtendedRcd"),
            tag = cms.string(saveAPETag)
            ),
        )
    )

     
process.MessageLogger = cms.Service(
    "MessageLogger",
    statistics = cms.untracked.vstring('cout', 'alignment'),
    categories = cms.untracked.vstring('Alignment'),
    cout = cms.untracked.PSet(
Beispiel #14
0
#         outputCommands = cms.untracked.vstring( 'keep *' )
# )
# process.end = cms.EndPath(process.out)

process.load("Configuration.StandardSequences.RawToDigi_Data_cff")
process.load("SimCalorimetry.Configuration.hcalDigiSequence_cff")
process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff')
process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag(
    cms.InputTag('simHcalUnsuppressedDigis'),
    cms.InputTag('simHcalUnsuppressedDigis'))
# process.simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag( cms.InputTag('simHcalDigis'), cms.InputTag('simHcalDigis') )
process.simHcalTriggerPrimitiveDigis.FrontEndFormatError = cms.bool(False)

process.load("Configuration.Geometry.GeometryExtended2016Reco_cff")

process.CondDBSetup = CondDB.clone()
delattr(process.CondDBSetup, 'connect')

# process.es_pool = cms.ESSource("PoolDBESSource",
#      process.CondDBSetup,
#      timetype = cms.string('runnumber'),
#      toGet = cms.VPSet(
#          cms.PSet(record = cms.string("HcalLutMetadataRcd"),
#              tag = cms.string("HcalLutMetadata_HFTP_1x1")
#              ),
#          cms.PSet(record = cms.string("HcalElectronicsMapRcd"),
#              tag = cms.string("HcalElectronicsMap_HFTP_1x1")
#              )
#          ),
#      connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
#      authenticationMethod = cms.untracked.uint32(0)
process.maxEvents.input = cms.untracked.int32(0)
process.seq = cms.Sequence()
process.p = cms.Path(process.seq)

if not os.path.isdir(opts.output):
  os.makedirs(opts.output)

for _era in sorted(algosPerEraDict.keys()):
  _dbFilePath = opts.output+'/'+_era+'.db'
  if os.path.exists(_dbFilePath):
    raise RuntimeError("target output .db file already exists (delete or rename it, and try again): "+_dbFilePath)

  _modTag = '' #''.join(_tmp for _tmp in _era if _tmp.isalnum())

  setattr(process, 'CondDB'+_modTag,
    _CondDB.clone(connect = 'sqlite_file:'+_dbFilePath))

  setattr(process, 'PoolDBOutputService'+_modTag,
    cms.Service('PoolDBOutputService', getattr(process, 'CondDB'+_modTag), toPut = cms.VPSet()))

  for _algo in sorted(algosPerEraDict[_era].keys()):
    _relDirPath = algosPerEraDict[_era][_algo]

    getattr(process, 'PoolDBOutputService'+_modTag).toPut += [cms.PSet(
      record = cms.string(_algo),
      tag = cms.string('JetCorrectorParametersCollection_{:}_{:}'.format(_era, _algo)),
      label = cms.string(_algo),
    )]

    setattr(process, 'jecDBWriter'+_algo, cms.EDAnalyzer('JetCorrectorDBWriter',
      era = cms.untracked.string(_era),
process.AlignmentProducer.applyDbAlignment = readAPEFromDB
process.AlignmentProducer.checkDbAlignmentValidity = False  # enable reading from tags with several IOVs
process.AlignmentProducer.algoConfig.readApeFromASCII = not readAPEFromDB
process.AlignmentProducer.algoConfig.apeASCIIReadFile = cms.FileInPath(
    readASCIIFile)
#
# define how APEs are written
process.AlignmentProducer.saveApeToDB = saveAPEtoDB
process.AlignmentProducer.algoConfig.saveApeToASCII = saveAPEtoASCII
process.AlignmentProducer.algoConfig.apeASCIISaveFile = saveASCIIFile

### specify the output database file
from CondCore.CondDB.CondDB_cfi import CondDB
process.PoolDBOutputService = cms.Service(
    "PoolDBOutputService",
    CondDB.clone(connect=cms.string("sqlite_file:" + saveAPEFile)),
    timetype=cms.untracked.string("runnumber"),
    toPut=cms.VPSet(
        cms.PSet(record=cms.string("TrackerAlignmentErrorExtendedRcd"),
                 tag=cms.string(saveAPETag)), ))

process.MessageLogger = cms.Service(
    "MessageLogger",
    statistics=cms.untracked.vstring('cout', 'alignment'),
    categories=cms.untracked.vstring('Alignment'),
    cout=cms.untracked.PSet(threshold=cms.untracked.string('DEBUG'),
                            noLineBreaks=cms.untracked.bool(True)),
    alignment=cms.untracked.PSet(
        INFO=cms.untracked.PSet(limit=cms.untracked.int32(-1)),
        noLineBreaks=cms.untracked.bool(True),
        DEBUG=cms.untracked.PSet(limit=cms.untracked.int32(-1)),