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

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