CMS 3D CMS Logo

GCP_Ntuples_cfg.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 #import FWCore.PythonUtilities.LumiList as LumiList
3 
4 from FWCore.ParameterSet.VarParsing import VarParsing
5 
6 import json
7 import os
8 
9 
10 process = cms.Process("ValidationIntoNTuples")
11 
12 
13 options = VarParsing()
14 options.register("config", "", VarParsing.multiplicity.singleton, VarParsing.varType.string , "AllInOne config")
15 
16 options.parseArguments()
17 
18 
20 
21 
22 if options.config == "":
23  config = {"validation": {},
24  "alignments": {}}
25 else:
26  with open(options.config, "r") as configFile:
27  config = json.load(configFile)
28 
29 #Global tag
30 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
31 from Configuration.AlCa.GlobalTag import GlobalTag
32 process.GlobalTag = GlobalTag(process.GlobalTag,config["alignments"]["globaltag"])
33 
34 process.load("Configuration.Geometry.GeometryRecoDB_cff")
35 
36 process.load("CondCore.CondDB.CondDB_cfi")
37 
38 process.MessageLogger = cms.Service("MessageLogger",
39  #destinations = cms.untracked.vstring('detailedInfo', 'cout')
40  destinations = cms.untracked.vstring('warnings'),
41  warnings = cms.untracked.PSet(
42  threshold = cms.untracked.string('WARNING')
43  )
44 )
45 
46 
47 if "conditions" in config["alignments"]:
49 
50  for condition in config["alignments"]["conditions"]:
51  setattr(
52  process,
53  "conditionsIn{}".format(condition),
54  poolDBESSource.clone(
55  connect = cms.string(str(config["alignments"]["conditions"][condition]["connect"])),
56  toGet = cms.VPSet(
57  cms.PSet(
58  record = cms.string(str(condition)),
59  tag = cms.string(str(config["alignments"]["conditions"][condition]["tag"]))
60  )
61  )
62  )
63  )
64 
65  setattr(process, "prefer_conditionsIn{}".format(condition), cms.ESPrefer("PoolDBESSource", "conditionsIn{}".format(condition)))
66 
67 
68 process.source = cms.Source("EmptySource",
69  firstRun=cms.untracked.uint32(config["validation"]["IOV"])
70  )
71 
72 process.maxEvents = cms.untracked.PSet(
73  input = cms.untracked.int32(1)
74 )
75 print('Output file: '+config["output"]+'/Ntuples.root')
76 
77 from Alignment.OfflineValidation.trackerGeometryIntoNtuples_cfi import trackerGeometryIntoNtuples as _trackerGeometryIntoNtuples
78 
79 process.dump = _trackerGeometryIntoNtuples.clone(
80  outputFile = str(config["output"]+'/Ntuples.root'),
81  outputTreename = 'alignTree'
82 )
83 
84 process.p = cms.Path(process.dump)
85 
86 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)