ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
Revision: 1.6
Committed: Wed Dec 7 18:44:38 2011 UTC (13 years, 5 months ago) by cgoetzma
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +2 -3 lines
Log Message:
chris mods

File Contents

# Content
1 import FWCore.ParameterSet.Config as cms
2
3 # IPHC variable for specifying geometry alignment scenario :
4 # 1 -> STARTUP
5 # 2 -> IDEAL
6 # 3 -> SAGITTA
7 # 4 -> TWIST
8 IPHC_GEOM=4
9
10 process = cms.Process("Demo")
11 process.load("FWCore.MessageService.MessageLogger_cfi")
12 process.MessageLogger.cerr.FwkReport.reportEvery = 50
13
14 #name of the output file containing the tree
15 process.TFileService = cms.Service("TFileService", fileName = cms.string("twist.root") )
16
17 process.load( "RecoTracker.Configuration.RecoTracker_cff" )
18 process.load( "Configuration.StandardSequences.Services_cff" )
19 process.load( "Configuration.StandardSequences.GeometryPilot2_cff" )
20 process.load( "Configuration.StandardSequences.MagneticField_38T_cff" )
21 process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff" )
22 process.GlobalTag.globaltag = "START44_V7::All"
23
24
25 process.source = cms.Source( "PoolSource",
26 fileNames = cms.untracked.vstring(
27 #"rfio:/castor/cern.ch/cms/store/relval/CMSSW_4_4_0_pre3/RelValZMM/GEN-SIM-RECO/START43_V4-v1/0001/805E5772-15A6-E011-9596-002618943800.root",
28 "file:/opt/sbg/data/data1/cms/cgoetzma/Thesis/data/CMSSW_4_4_2/reco/4618D130-7902-E111-9A07-0018F3D0961E.root",
29 "file:/opt/sbg/data/data1/cms/cgoetzma/Thesis/data/CMSSW_4_4_2/reco/8646C2B8-6605-E111-87E6-002618943879.root",
30 "file:/opt/sbg/data/data1/cms/cgoetzma/Thesis/data/CMSSW_4_4_2/reco/CC0BE8AF-7802-E111-8970-0018F3D0961E.root"
31 #"/castor/cern.ch/cms/store/relval/CMSSW_4_4_0_pre3/RelValZMM/GEN-SIM-RECO/START43_V4-v1/0000/E6064D98-01A4-E011-AAA0-002618943956.root",
32 #"rfio:/castor/cern.ch/cms/store/relval/CMSSW_4_4_0_pre3/RelValZMM/GEN-SIM-RECO/START43_V4-v1/0000/7C358E88-10A4-E011-BCDA-00304866C398.root",
33 #"rfio:/castor/cern.ch/cms/store/relval/CMSSW_4_4_0_pre3/RelValZMM/GEN-SIM-RECO/START43_V4-v1/0000/5AF156B6-FDA3-E011-BDB7-0026189438C1.root"
34 )
35 )
36
37 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
38
39 process.out = cms.OutputModule( "PoolOutputModule",
40 fileName = cms.untracked.string( "output.root" ),
41 outputCommands = cms.untracked.vstring("keep *Track*_*_*_*")
42 )
43
44 # ------------------------------------------------------------------------------
45 # 0) Change geometry
46 # ------------------------------------------------------------------------------
47 if IPHC_GEOM==1:
48 print "\x1b[31mIPHC config : STARTUP geometry !!!\x1b[0m"
49 pass
50 elif IPHC_GEOM==2:
51 print "\x1b[31mIPHC config : IDEAL geometry !!!\x1b[0m"
52 process.GlobalTag.toGet = cms.VPSet(
53 cms.PSet( record = cms.string( "TrackerAlignmentRcd" ),
54 tag = cms.string( "TrackerIdealGeometry210_mc" ),
55 connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) ),
56 cms.PSet( record = cms.string( "TrackerAlignmentErrorRcd" ),
57 tag = cms.string( "TrackerIdealGeometryErrors210_mc" ),
58 connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) )
59 )
60 elif IPHC_GEOM==3 or IPHC_GEOM==4:
61 if IPHC_GEOM==4:
62 print "\x1b[31mIPHC config : TWIST geometry !!!\x1b[0m"
63 IPHC_STRING = 'sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedTwist.db'
64 elif IPHC_GEOM==3:
65 print "\x1b[31mIPHC config : SAGITTA geometry !!!\x1b[0m"
66 IPHC_STRING = 'sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedSagitta.db'
67
68
69 from CondCore.DBCommon.CondDBSetup_cfi import *
70 process.trackerAlignment = cms.ESSource("PoolDBESSource",
71 CondDBSetup,
72 timetype = cms.string('runnumber'),
73 toGet = cms.VPSet( cms.PSet(
74 record = cms.string('TrackerAlignmentRcd'),
75 tag = cms.string('Alignments') )),
76 connect = cms.string(IPHC_STRING)
77 )
78
79 process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","trackerAlignment")
80
81 else:
82 print "\x1b[31mIPHC config : UNKNOWN geometry !!!\x1b[0m"
83 exit
84
85
86
87 # ------------------------------------------------------------------------------
88 # 1) Configure alignment track selector
89 # ------------------------------------------------------------------------------
90 process.load( "Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi" )
91 process.AlignmentTrackSelector.src = cms.InputTag( "generalTracks" ) # for RelValZMM
92 #process.AlignmentTrackSelector.src = cms.InputTag( "ALCARECOTkAlZMuMu" ) # for ALCARECO
93 process.AlignmentTrackSelector.filter = cms.bool( True )
94 process.AlignmentTrackSelector.applyBasicCuts = cms.bool( True )
95 process.AlignmentTrackSelector.applyNHighestPt = cms.bool( True )
96 process.AlignmentTrackSelector.TwoBodyDecaySelector.applyMassrangeFilter = cms.bool( True )
97 process.AlignmentTrackSelector.TwoBodyDecaySelector.minXMass = cms.double( 80. )
98 process.AlignmentTrackSelector.TwoBodyDecaySelector.maxXMass = cms.double( 100. )
99
100 # ------------------------------------------------------------------------------
101 # 2) Constructs transient tracks and trajectories from persistent tracks
102 # ------------------------------------------------------------------------------
103 from RecoTracker.TrackProducer.TrackRefitter_cfi import TrackRefitter
104 process.GeomRefitter = TrackRefitter.clone(
105 src = "AlignmentTrackSelector",
106 TrajectoryInEvent = True )
107
108 # ------------------------------------------------------------------------------
109 # 3) Initialize KFFittingSmoother without outlier rejection
110 # ------------------------------------------------------------------------------
111 from TrackingTools.TrackFitters.KFFittingSmootherESProducer_cfi import KFFittingSmoother
112 process.TwoBodyDecayTrackFitter = KFFittingSmoother.clone(
113 ComponentName = cms.string( "TwoBodyDecayTrackFitter" ),
114 Fitter = cms.string('RKFitter'),
115 Smoother = cms.string('RKSmoother'),
116 LogPixelProbabilityCut = cms.double(-15.0),
117 EstimateCut = cms.double(-1.0),
118 )
119
120 # ------------------------------------------------------------------------------
121 # A-4) Refitter tracks without constraint
122 # ------------------------------------------------------------------------------
123 process.TrackRefitterWithoutConstraint = TrackRefitter.clone(
124 src = "GeomRefitter",
125 Fitter = cms.string('TwoBodyDecayTrackFitter'))
126
127 # ------------------------------------------------------------------------------
128 # A-5) Fill Tree with refit tracks (without constraint)
129 # ------------------------------------------------------------------------------
130 process.treeWithoutConstraints = cms.EDAnalyzer('AlignmentTree',
131 trackLabel = cms.InputTag('TrackRefitterWithoutConstraint'),
132 tkTraj = cms.InputTag('TrackRefitterWithoutConstraint'),
133 labelTrajToTrack = cms.InputTag('TrackRefitterWithoutConstraint'),
134 siStripClusters = cms.InputTag('TrackRefitterWithoutConstraint'),
135 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
136 offlineBeamSpot = cms.InputTag('offlineBeamSpot'),
137 isLaserRun = cms.bool(False),
138 isMC = cms.bool(True),
139 algoName = cms.string("NoAlgo"),
140 trkVertexconstrcoll = cms.InputTag(''),
141 trkMomconstrcoll = cms.InputTag(''),
142 trkFullconstrcoll = cms.InputTag('')
143 )
144
145 # ------------------------------------------------------------------------------
146 # B-4) Producer for full TwoBodyDecay constraint
147 # ------------------------------------------------------------------------------
148 process.load("RecoTracker.TrackProducer.TwoBodyDecayConstraintProducer_cff")
149 process.TwoBodyDecayConstraint.src = "GeomRefitter"
150 process.TwoBodyDecayConstraint.chi2Cut = 10
151
152
153
154 # ------------------------------------------------------------------------------
155 # B-5) Refitter using the full TwoBodyDecay constraint
156 # ------------------------------------------------------------------------------
157 process.TrackRefitterTBDFullConstraint = TrackRefitter.clone(
158 src = "GeomRefitter",
159 srcConstr = "TwoBodyDecayConstraint",
160 Fitter = cms.string('TwoBodyDecayTrackFitter'),
161 constraint = "trackParameters",
162 TrajectoryInEvent = True)
163
164 # ------------------------------------------------------------------------------
165 # B-6) Fill Tree with full TBD constraint
166 # ------------------------------------------------------------------------------
167 process.treeTBDFullConstraints = cms.EDAnalyzer('AlignmentTree',
168 trackLabel = cms.InputTag('TrackRefitterTBDFullConstraint'),
169 tkTraj = cms.InputTag('TrackRefitterTBDFullConstraint'),
170 labelTrajToTrack = cms.InputTag('TrackRefitterTBDFullConstraint'),
171 siStripClusters = cms.InputTag('TrackRefitterTBDFullConstraint'),
172 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
173 offlineBeamSpot = cms.InputTag('offlineBeamSpot'),
174 isLaserRun = cms.bool(False),
175 isMC = cms.bool(True),
176 algoName = cms.string("FullTBD"),
177 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayConstraint'),
178 trkMomconstrcoll = cms.InputTag('TwoBodyDecayConstraint'),
179 trkFullconstrcoll = cms.InputTag('TwoBodyDecayConstraint')
180 )
181
182 # ------------------------------------------------------------------------------
183 # C-4) Producer for TwoBodyDecay momentum constraint
184 # ------------------------------------------------------------------------------
185 process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
186 process.TwoBodyDecayMomConstraint.isMC = True
187 process.TwoBodyDecayMomConstraint.src = "GeomRefitter"
188 process.TwoBodyDecayMomConstraint.chi2Cut = 10
189
190 # ------------------------------------------------------------------------------
191 # C-5) Refit the tracks with momentum constraint
192 # ------------------------------------------------------------------------------
193 process.TrackRefitterTBDMomConstraint = TrackRefitter.clone(
194 src = "GeomRefitter",
195 srcConstr = "TwoBodyDecayMomConstraint",
196 Fitter = cms.string('TwoBodyDecayTrackFitter'),
197 constraint = "momentum",
198 TrajectoryInEvent = True)
199
200 # ------------------------------------------------------------------------------
201 # C-6) Fill Tree with mom TBD constraint
202 # ------------------------------------------------------------------------------
203 process.treeTBDMomConstraints = cms.EDAnalyzer('AlignmentTree',
204 trackLabel = cms.InputTag('TrackRefitterTBDMomConstraint'),
205 tkTraj = cms.InputTag('TrackRefitterTBDMomConstraint'),
206 labelTrajToTrack = cms.InputTag('TrackRefitterTBDMomConstraint'),
207 siStripClusters = cms.InputTag('TrackRefitterTBDMomConstraint'),
208 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
209 offlineBeamSpot = cms.InputTag('offlineBeamSpot'),
210 isLaserRun = cms.bool(False),
211 isMC = cms.bool(True),
212 algoName = cms.string("MomTBD"),
213 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint'),
214 trkMomconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint'),
215 trkFullconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint')
216 )
217
218 # ------------------------------------------------------------------------------
219 # D-4) Producer for KinFit
220 # ------------------------------------------------------------------------------
221 process.doConstraintKinFit = cms.EDProducer('ZmassConstraintsProd',
222 isMC = cms.bool(True),
223 trackLabel = cms.InputTag('GeomRefitter')
224 )
225
226 # ------------------------------------------------------------------------------
227 # D-5) Refitter for KinFit
228 # ------------------------------------------------------------------------------
229 process.TrackRefitterKinFit = TrackRefitter.clone(
230 src = "GeomRefitter",
231 srcConstr = "doConstraintKinFit",
232 Fitter = cms.string('TwoBodyDecayTrackFitter'),
233 constraint = "momentum",
234 TrajectoryInEvent = True)
235
236 # ------------------------------------------------------------------------------
237 # D-6) Fill Tree with KinFit constraint
238 # ------------------------------------------------------------------------------
239 process.treeKinFitConstraints = cms.EDAnalyzer('AlignmentTree',
240 trackLabel = cms.InputTag('TrackRefitterKinFit'),
241 tkTraj = cms.InputTag('TrackRefitterKinFit'),
242 labelTrajToTrack = cms.InputTag('TrackRefitterKinFit'),
243 siStripClusters = cms.InputTag('TrackRefitterKinFit'),
244 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
245 offlineBeamSpot = cms.InputTag('offlineBeamSpot'),
246 isLaserRun = cms.bool(False),
247 isMC = cms.bool(True),
248 algoName = cms.string("KinFit"),
249 trkVertexconstrcoll = cms.InputTag(''),
250 trkMomconstrcoll = cms.InputTag(''),
251 trkFullconstrcoll = cms.InputTag('')
252 )
253
254 # ------------------------------------------------------------------------------
255 # E-4) Producer for TwoBodyDecay vertex constraints
256 # ------------------------------------------------------------------------------
257 process.load("RecoTracker.TrackProducer.TwoBodyDecayVertexConstraintProducer_cff")
258 process.TwoBodyDecayVertexConstraint.isMC = True
259 process.TwoBodyDecayVertexConstraint.src = "GeomRefitter"
260 process.TwoBodyDecayVertexConstraint.chi2Cut = 10
261
262 # ------------------------------------------------------------------------------
263 # E-5) Track refitter with vertex constraints
264 # ------------------------------------------------------------------------------
265 process.TrackRefitterTBDVertexConstraint = TrackRefitter.clone(
266 src = "GeomRefitter",
267 srcConstr = "TwoBodyDecayVertexConstraint",
268 Fitter = cms.string('TwoBodyDecayTrackFitter'),
269 constraint = "vertex",
270 TrajectoryInEvent = True)
271
272 # ------------------------------------------------------------------------------
273 # E-6) Fill Tree with vertex TBD constraint
274 # ------------------------------------------------------------------------------
275 process.treeTBDVertexConstraints = cms.EDAnalyzer('AlignmentTree',
276 trackLabel = cms.InputTag('TrackRefitterTBDVertexConstraint'),
277 tkTraj = cms.InputTag('TrackRefitterTBDVertexConstraint'),
278 labelTrajToTrack = cms.InputTag('TrackRefitterTBDVertexConstraint'),
279 siStripClusters = cms.InputTag('TrackRefitterTBDVertexConstraint'),
280 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
281 offlineBeamSpot = cms.InputTag('offlineBeamSpot'),
282 isLaserRun = cms.bool(False),
283 isMC = cms.bool(True),
284 algoName = cms.string("VtxTBD"),
285 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint'),
286 trkMomconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint'),
287 trkFullconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint')
288 )
289
290
291
292
293
294
295 process.p = cms.Path( process.AlignmentTrackSelector *
296 process.GeomRefitter *
297 process.TrackRefitterWithoutConstraint *
298 process.treeWithoutConstraints *
299 process.TwoBodyDecayConstraint *
300 process.TrackRefitterTBDFullConstraint *
301 process.treeTBDFullConstraints *
302 process.TwoBodyDecayMomConstraint *
303 process.TrackRefitterTBDMomConstraint *
304 process.treeTBDMomConstraints *
305 process.doConstraintKinFit *
306 process.TrackRefitterKinFit *
307 process.treeKinFitConstraints*
308 process.TwoBodyDecayVertexConstraint *
309 process.TrackRefitterTBDVertexConstraint *
310 process.treeTBDVertexConstraints
311 )
312
313 process.outpath = cms.EndPath(process.out)
314
315
316