CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DQM/EcalCommon/python/dqmpset.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 from types import *
00004 
00005 def dqmpset(d) :
00006     pset = dict()
00007     for key in d.iterkeys() :
00008         if isinstance(d[key], cms.PSet) :
00009             pset[key] = d[key]
00010         elif type(d[key]) is DictType :
00011             pset[key] = dqmpset(d[key])
00012         elif type(d[key]) is StringType :
00013             pset[key] = cms.untracked.string(d[key])
00014         elif type(d[key]) is IntType :
00015             pset[key] = cms.untracked.int32(d[key])
00016         elif type(d[key]) is FloatType :
00017             pset[key] = cms.untracked.double(d[key])
00018         elif type(d[key]) is BooleanType :
00019             pset[key] = cms.untracked.bool(d[key])
00020         elif type(d[key]) is ListType :
00021             if type(d[key][0]) is StringType :
00022                 pset[key] = cms.untracked.vstring(*(d[key]))
00023             elif type(d[key][0]) is IntType :
00024                 pset[key] = cms.untracked.vint32(*(d[key]))
00025             elif type(d[key][0]) is FloatType :
00026                 pset[key] = cms.untracked.vdouble(*(d[key]))
00027 
00028     return cms.untracked.PSet(**pset)
00029 
00030 def dqmpaths(prefix, dOfD) :
00031     pset = dict()
00032     for dKey in dOfD.iterkeys() :
00033         d = dOfD[dKey]
00034         psubset = dict()
00035         for key in d.iterkeys() :
00036             psubset[key] = cms.untracked.string(prefix + "/" + d[key])
00037 
00038         pset[dKey] = cms.untracked.PSet(**psubset)
00039 
00040     return cms.untracked.PSet(**pset)