Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:11

0001 import FWCore.ParameterSet.Config as cms
0002 #import FWCore.PythonUtilities.LumiList as LumiList
0003 
0004 from FWCore.ParameterSet.VarParsing import VarParsing
0005 
0006 import json
0007 import os
0008 
0009 ##Define process
0010 process = cms.Process("ValidationIntoNTuples")
0011 
0012 ##Argument parsing
0013 options = VarParsing()
0014 options.register("config", "", VarParsing.multiplicity.singleton, VarParsing.varType.string , "AllInOne config")
0015 
0016 options.parseArguments()
0017 
0018 ###Set validation mode
0019 #valiMode = "StandAlone"
0020 
0021 ##Read in AllInOne config in JSON format
0022 if options.config == "":
0023     config = {"validation": {},
0024               "alignments": {}}
0025 else:
0026     with open(options.config, "r") as configFile:
0027         config = json.load(configFile)
0028 
0029 #Global tag
0030 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0031 from Configuration.AlCa.GlobalTag import GlobalTag
0032 process.GlobalTag = GlobalTag(process.GlobalTag,config["alignments"]["globaltag"])
0033 
0034 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0035 
0036 process.load("CondCore.CondDB.CondDB_cfi")
0037 
0038 process.MessageLogger = cms.Service("MessageLogger",
0039     #destinations = cms.untracked.vstring('detailedInfo', 'cout')
0040     destinations = cms.untracked.vstring('warnings'),
0041     warnings = cms.untracked.PSet(
0042                        threshold  = cms.untracked.string('WARNING') 
0043         )
0044 ) 
0045 
0046 ##Load conditions if needed
0047 if "conditions" in config["alignments"]:
0048     from CalibTracker.Configuration.Common.PoolDBESSource_cfi import poolDBESSource
0049 
0050     for condition in config["alignments"]["conditions"]:
0051         setattr(
0052             process, 
0053             "conditionsIn{}".format(condition), 
0054             poolDBESSource.clone(
0055                 connect = cms.string(str(config["alignments"]["conditions"][condition]["connect"])),
0056                 toGet = cms.VPSet(
0057                     cms.PSet(
0058                         record = cms.string(str(condition)),
0059                         tag = cms.string(str(config["alignments"]["conditions"][condition]["tag"]))
0060                     )
0061                 )
0062             )
0063         )
0064 
0065         setattr(process, "prefer_conditionsIn{}".format(condition), cms.ESPrefer("PoolDBESSource", "conditionsIn{}".format(condition)))
0066 
0067 
0068 process.source = cms.Source("EmptySource",
0069     firstRun=cms.untracked.uint32(config["validation"]["IOV"])
0070     )
0071 
0072 process.maxEvents = cms.untracked.PSet(
0073     input = cms.untracked.int32(1)
0074 )
0075 print('Output file: '+config["output"]+'/Ntuples.root')
0076 
0077 from Alignment.OfflineValidation.trackerGeometryIntoNtuples_cfi import trackerGeometryIntoNtuples as _trackerGeometryIntoNtuples
0078 
0079 process.dump = _trackerGeometryIntoNtuples.clone(
0080     outputFile = str(config["output"]+'/Ntuples.root'),
0081     outputTreename = 'alignTree'
0082 )
0083 
0084 process.p = cms.Path(process.dump)  
0085 
0086