Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-09 04:49:40

0001 from __future__ import print_function
0002 # Auto generated configuration file
0003 # with command line options: stepALCA --datatier ALCARECO --conditions auto:run2_data -s ALCA:PromptCalibProdSiStripGains --eventcontent ALCARECO -n 1000 --dasquery=file dataset=/ZeroBias/Run2016C-SiStripCalMinBias-18Apr2017-v1/ALCARECO run=276243 --no_exec
0004 import warnings
0005 import FWCore.ParameterSet.Config as cms
0006 from FWCore.ParameterSet.VarParsing import VarParsing
0007 
0008 options = VarParsing('analysis')
0009 options.register('era',"A", VarParsing.multiplicity.singleton, VarParsing.varType.string, "input era")
0010 options.parseArguments()
0011 
0012 import os
0013 
0014 import Utilities.General.cmssw_das_client as das_client
0015 
0016 ###################################################################
0017 def getFileNames_das_client(era_name):
0018 ###################################################################
0019     """Return files for given DAS query via das_client"""
0020     files = []
0021 
0022     query = "dataset dataset=/ZeroBias/Run2*"+era_name+"*SiStripCalMinBias-*/ALCARECO site=T2_CH_CERN"
0023     jsondict = das_client.get_data(query)
0024     status = jsondict['status']
0025     if status != 'ok':
0026         warnings.warn("DAS query status: %s"%(status))
0027         return files
0028 
0029     data =  jsondict['data']
0030     viableDS = []
0031     for element in data:
0032         viableDS.append(element['dataset'][0]['name'])
0033 
0034     print("Using Dataset:",viableDS[-1])
0035 
0036     query = "file dataset=%s site=T2_CH_CERN | grep file.name" % viableDS[-1]
0037     jsondict = das_client.get_data(query)
0038     status = jsondict['status']
0039     if status != 'ok':
0040         warnings.warn("DAS query status: %s"%(status))
0041         return files
0042 
0043     mongo_query = jsondict['mongo_query']
0044     filters = mongo_query['filters']
0045     data = jsondict['data']
0046 
0047     files = []
0048     for row in data:
0049         the_file = [r for r in das_client.get_value(row, filters['grep'])][0]
0050         if len(the_file) > 0 and not the_file in files:
0051             files.append(the_file)
0052 
0053     return files
0054 
0055 ###################################################################
0056 process = cms.Process('testFromALCARECO')
0057 
0058 # import of standard configurations
0059 process.load('Configuration.StandardSequences.Services_cff')
0060 
0061 ###################################################################
0062 # Messages
0063 ###################################################################
0064 process.load('FWCore.MessageService.MessageLogger_cfi')   
0065 process.MessageLogger.cerr.enable = False
0066 process.MessageLogger.SiStripGainsPCLWorker=dict()  
0067 process.MessageLogger.cout = cms.untracked.PSet(
0068     enable    = cms.untracked.bool(True),
0069     threshold = cms.untracked.string("DEBUG"),
0070     enableStatistics = cms.untracked.bool(True),
0071     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0072     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0073                                    reportEvery = cms.untracked.int32(1000)
0074                                    ),                                                      
0075     SiStripGainsPCLWorker = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0076     )
0077 
0078 process.load('Configuration.EventContent.EventContent_cff')
0079 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0080 process.load('Configuration.StandardSequences.MagneticField_cff')
0081 process.load('Configuration.StandardSequences.AlCaRecoStreams_cff')
0082 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0083 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0084 
0085 process.maxEvents = cms.untracked.PSet(
0086     input = cms.untracked.int32(10)
0087     )
0088 
0089 
0090 INPUTFILES=getFileNames_das_client(options.era)
0091 
0092 if len(INPUTFILES)==0: 
0093     warnings.warn("** WARNING: ** According to a DAS query no suitable data for test is available. Skipping test!")
0094     ### since there are tests depending on this one, if the query fails, let's exit with an error
0095     os._exit(1)
0096 
0097 myFiles = cms.untracked.vstring()
0098 myFiles.extend([INPUTFILES[0][0].replace("\"","")])
0099 # Input source
0100 process.source = cms.Source("PoolSource",
0101                             fileNames = myFiles,
0102                             secondaryFileNames = cms.untracked.vstring()
0103                             )
0104 
0105 process.options = cms.untracked.PSet()
0106 
0107 # Additional output definition
0108 process.ALCARECOStreamPromptCalibProdSiStripGains = cms.OutputModule("PoolOutputModule",
0109                                                                      SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('pathALCARECOPromptCalibProdSiStripGains')),
0110                                                                      dataset = cms.untracked.PSet(dataTier = cms.untracked.string('ALCARECO'),
0111                                                                                                   filterName = cms.untracked.string('PromptCalibProdSiStripGains')),
0112                                                                      eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
0113                                                                      fileName = cms.untracked.string('PromptCalibProdSiStripGains_'+options.era+'.root'),
0114                                                                      outputCommands = cms.untracked.vstring('drop *', 
0115                                                                                                             'keep *_MEtoEDMConvertSiStripGains_*_*'
0116                                                                                                             )
0117                                                                      )
0118 
0119 # Other statements
0120 process.ALCARECOEventContent.outputCommands.extend(process.OutALCARECOPromptCalibProdSiStripGains_noDrop.outputCommands)
0121 from Configuration.AlCa.GlobalTag import GlobalTag
0122 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0123 
0124 # Path and EndPath definitions
0125 process.endjob_step = cms.EndPath(process.endOfProcess)
0126 process.ALCARECOStreamPromptCalibProdSiStripGainsOutPath = cms.EndPath(process.ALCARECOStreamPromptCalibProdSiStripGains)
0127 
0128 # Schedule definition
0129 process.schedule = cms.Schedule(process.pathALCARECOPromptCalibProdSiStripGains,process.endjob_step,process.ALCARECOStreamPromptCalibProdSiStripGainsOutPath)
0130 from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
0131 associatePatAlgosToolsTask(process)
0132 
0133 # Customisation from command line
0134 
0135 # Add early deletion of temporary data products to reduce peak memory need
0136 from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
0137 process = customiseEarlyDelete(process)
0138 # End adding early deletion
0139