ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
Revision: 1.7
Committed: Thu Dec 8 10:43:30 2011 UTC (13 years, 4 months ago) by econte
Content type: text/x-python
Branch: MAIN
CVS Tags: TBD2011, HEAD
Changes since 1.6: +12 -2 lines
Log Message:
auto outputname

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