CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
align_cfg.py
Go to the documentation of this file.
1 import os
2 import FWCore.ParameterSet.Config as cms
3 
4 alignmenttmp = os.environ["ALIGNMENT_ALIGNMENTTMP"].split("\n")
5 iteration = int(os.environ["ALIGNMENT_ITERATION"])
6 
7 globaltag = os.environ["ALIGNMENT_GLOBALTAG"]
8 inputdb = os.environ["ALIGNMENT_INPUTDB"]
9 trackerconnect = os.environ["ALIGNMENT_TRACKERCONNECT"]
10 trackeralignment = os.environ["ALIGNMENT_TRACKERALIGNMENT"]
11 trackerAPEconnect = os.environ["ALIGNMENT_TRACKERAPECONNECT"]
12 trackerAPE = os.environ["ALIGNMENT_TRACKERAPE"]
13 trackerBowsconnect = os.environ["ALIGNMENT_TRACKERBOWSCONNECT"]
14 trackerBows = os.environ["ALIGNMENT_TRACKERBOWS"]
15 gprcdconnect = os.environ["ALIGNMENT_GPRCDCONNECT"]
16 gprcd = os.environ["ALIGNMENT_GPRCD"]
17 
18 iscosmics = (os.environ["ALIGNMENT_ISCOSMICS"] == "True")
19 station123params = os.environ["ALIGNMENT_STATION123PARAMS"]
20 station4params = os.environ["ALIGNMENT_STATION4PARAMS"]
21 cscparams = os.environ["ALIGNMENT_CSCPARAMS"]
22 minTrackPt = float(os.environ["ALIGNMENT_MINTRACKPT"])
23 maxTrackPt = float(os.environ["ALIGNMENT_MAXTRACKPT"])
24 minTrackP = float(os.environ["ALIGNMENT_MINTRACKP"])
25 maxTrackP = float(os.environ["ALIGNMENT_MAXTRACKP"])
26 minTrackerHits = int(os.environ["ALIGNMENT_MINTRACKERHITS"])
27 maxTrackerRedChi2 = float(os.environ["ALIGNMENT_MAXTRACKERREDCHI2"])
28 allowTIDTEC = (os.environ["ALIGNMENT_ALLOWTIDTEC"] == "True")
29 twoBin = (os.environ["ALIGNMENT_TWOBIN"] == "True")
30 weightAlignment = (os.environ["ALIGNMENT_WEIGHTALIGNMENT"] == "True")
31 minAlignmentHits = int(os.environ["ALIGNMENT_MINALIGNMENTHITS"])
32 combineME11 = (os.environ["ALIGNMENT_COMBINEME11"] == "True")
33 maxResSlopeY = float(os.environ["ALIGNMENT_MAXRESSLOPEY"])
34 residualsModel = os.environ["ALIGNMENT_RESIDUALSMODEL"]
35 peakNSigma = float(os.environ["ALIGNMENT_PEAKNSIGMA"])
36 useResiduals = os.environ["ALIGNMENT_USERESIDUALS"]
37 
38 # optionally do selective DT or CSC alignment
39 doDT = True
40 doCSC = True
41 envDT = os.getenv("ALIGNMENT_DO_DT")
42 envCSC = os.getenv("ALIGNMENT_DO_CSC")
43 if envDT is not None and envCSC is not None:
44  if envDT=='True' and envCSC=='False':
45  doDT = True
46  doCSC = False
47  if envDT=='False' and envCSC=='True':
48  doDT = False
49  doCSC = True
50 
51 # optionally: create ntuples along with tmp files
52 createAlignNtuple = False
53 envNtuple = os.getenv("ALIGNMENT_CREATEALIGNNTUPLE")
54 if envNtuple is not None:
55  if envNtuple=='True': createAlignNtuple = True
56 
57 
58 process = cms.Process("ALIGN")
59 process.source = cms.Source("EmptySource")
60 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
61 
62 process.load("Alignment.MuonAlignmentAlgorithms.MuonAlignmentFromReference_cff")
63 process.looper.algoConfig.readTemporaryFiles = cms.vstring(*alignmenttmp)
64 process.looper.algoConfig.reportFileName = cms.string("MuonAlignmentFromReference_report.py")
65 
66 process.looper.ParameterBuilder.Selector.alignParams = cms.vstring("MuonDTChambers,%s,stations123" % station123params, "MuonDTChambers,%s,station4" % station4params, "MuonCSCChambers,%s" % cscparams)
67 process.looper.algoConfig.minTrackPt = minTrackPt
68 process.looper.algoConfig.maxTrackPt = maxTrackPt
69 process.looper.algoConfig.minTrackP = minTrackP
70 process.looper.algoConfig.maxTrackP = maxTrackP
71 process.looper.algoConfig.minTrackerHits = minTrackerHits
72 process.looper.algoConfig.maxTrackerRedChi2 = maxTrackerRedChi2
73 process.looper.algoConfig.allowTIDTEC = allowTIDTEC
74 process.looper.algoConfig.twoBin = twoBin
75 process.looper.algoConfig.weightAlignment = weightAlignment
76 process.looper.algoConfig.minAlignmentHits = minAlignmentHits
77 process.looper.algoConfig.combineME11 = combineME11
78 process.looper.algoConfig.maxResSlopeY = maxResSlopeY
79 process.looper.algoConfig.residualsModel = cms.string(residualsModel)
80 process.looper.algoConfig.peakNSigma = peakNSigma
81 process.looper.algoConfig.createNtuple = createAlignNtuple
82 process.looper.algoConfig.doDT = doDT
83 process.looper.algoConfig.doCSC = doCSC
84 process.looper.algoConfig.useResiduals = cms.string(useResiduals)
85 
86 
87 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
88 process.GlobalTag.globaltag = cms.string(globaltag)
89 process.looper.applyDbAlignment = True
90 
91 process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb)
92 process.MuonAlignmentFromReferenceInputDB.toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
93  cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCAlignmentRcd")))
94 
95 if trackerconnect != "":
97  process.TrackerAlignmentInputDB = cms.ESSource("PoolDBESSource",
98  CondDBSetup,
99  connect = cms.string(trackerconnect),
100  toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), tag = cms.string(trackeralignment))))
101  process.es_prefer_TrackerAlignmentInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentInputDB")
102 
103 if trackerAPEconnect != "":
105  process.TrackerAlignmentErrorInputDB = cms.ESSource("PoolDBESSource",
106  CondDBSetup,
107  connect = cms.string(trackerAPEconnect),
108  toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerAlignmentErrorExtendedRcd"), tag = cms.string(trackerAPE)))))
109  process.es_prefer_TrackerAlignmentErrorInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentErrorInputDB")
110 
111 if trackerBowsconnect != "":
113  process.TrackerSurfaceDeformationInputDB = cms.ESSource("PoolDBESSource",
114  CondDBSetup,
115  connect = cms.string(trackerBowsconnect),
116  toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerSurfaceDeformationRcd"), tag = cms.string(trackerBows)))))
117  process.es_prefer_TrackerSurfaceDeformationInputDB = cms.ESPrefer("PoolDBESSource", "TrackerSurfaceDeformationInputDB")
118 
119 if gprcdconnect != "":
121  process.GlobalPositionInputDB = cms.ESSource("PoolDBESSource",
122  CondDBSetup,
123  connect = cms.string(gprcdconnect),
124  toGet = cms.VPSet(cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string(gprcd))))
125  process.es_prefer_GlobalPositionInputDB = cms.ESPrefer("PoolDBESSource", "GlobalPositionInputDB")
126 
127 process.looper.saveToDB = True
128 process.looper.saveApeToDB = True
129 process.PoolDBOutputService.connect = cms.string("sqlite_file:MuonAlignmentFromReference_outputdb.db")
130 
131 process.TFileService = cms.Service("TFileService", fileName = cms.string("MuonAlignmentFromReference_plotting.root"))
double split
Definition: MVATrainer.cc:139