ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
Revision: 1.4
Committed: Wed Nov 30 23:53:16 2011 UTC (13 years, 5 months ago) by jandrea
Content type: text/x-python
Branch: MAIN
Changes since 1.3: +23 -5 lines
Log Message:
ta mere ...

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=2
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("analyzerTree.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 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 isLaserRun = cms.bool(False),
174 isMC = cms.bool(True),
175 algoName = cms.string("FullTBD"),
176 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayConstraint'),
177 trkMomconstrcoll = cms.InputTag('TwoBodyDecayConstraint'),
178 trkFullconstrcoll = cms.InputTag('TwoBodyDecayConstraint')
179 )
180
181 # ------------------------------------------------------------------------------
182 # C-4) Producer for TwoBodyDecay momentum constraint
183 # ------------------------------------------------------------------------------
184 process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
185 process.TwoBodyDecayMomConstraint.isMC = True
186 process.TwoBodyDecayMomConstraint.src = "GeomRefitter"
187 process.TwoBodyDecayMomConstraint.chi2Cut = 10
188
189 # ------------------------------------------------------------------------------
190 # C-5) Refit the tracks with momentum constraint
191 # ------------------------------------------------------------------------------
192 process.TrackRefitterTBDMomConstraint = TrackRefitter.clone(
193 src = "GeomRefitter",
194 srcConstr = "TwoBodyDecayMomConstraint",
195 Fitter = cms.string('TwoBodyDecayTrackFitter'),
196 constraint = "momentum",
197 TrajectoryInEvent = True)
198
199 # ------------------------------------------------------------------------------
200 # C-6) Fill Tree with mom TBD constraint
201 # ------------------------------------------------------------------------------
202 process.treeTBDMomConstraints = cms.EDAnalyzer('AlignmentTree',
203 trackLabel = cms.InputTag('TrackRefitterTBDMomConstraint'),
204 tkTraj = cms.InputTag('TrackRefitterTBDMomConstraint'),
205 labelTrajToTrack = cms.InputTag('TrackRefitterTBDMomConstraint'),
206 siStripClusters = cms.InputTag('TrackRefitterTBDMomConstraint'),
207 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
208 isLaserRun = cms.bool(False),
209 isMC = cms.bool(True),
210 algoName = cms.string("MomTBD"),
211 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint'),
212 trkMomconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint'),
213 trkFullconstrcoll = cms.InputTag('TwoBodyDecayMomConstraint')
214 )
215
216 # ------------------------------------------------------------------------------
217 # D-4) Producer for KinFit
218 # ------------------------------------------------------------------------------
219 process.doConstraintKinFit = cms.EDProducer('ZmassConstraintsProd',
220 isMC = cms.bool(True),
221 trackLabel = cms.InputTag('GeomRefitter')
222 )
223
224 # ------------------------------------------------------------------------------
225 # D-5) Refitter for KinFit
226 # ------------------------------------------------------------------------------
227 process.TrackRefitterKinFit = TrackRefitter.clone(
228 src = "GeomRefitter",
229 srcConstr = "doConstraintKinFit",
230 Fitter = cms.string('TwoBodyDecayTrackFitter'),
231 constraint = "momentum",
232 TrajectoryInEvent = True)
233
234 # ------------------------------------------------------------------------------
235 # D-6) Fill Tree with KinFit constraint
236 # ------------------------------------------------------------------------------
237 process.treeKinFitConstraints = cms.EDAnalyzer('AlignmentTree',
238 trackLabel = cms.InputTag('TrackRefitterKinFit'),
239 tkTraj = cms.InputTag('TrackRefitterKinFit'),
240 labelTrajToTrack = cms.InputTag('TrackRefitterKinFit'),
241 siStripClusters = cms.InputTag('TrackRefitterKinFit'),
242 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
243 isLaserRun = cms.bool(False),
244 isMC = cms.bool(True),
245 algoName = cms.string("KinFit"),
246 trkVertexconstrcoll = cms.InputTag(''),
247 trkMomconstrcoll = cms.InputTag(''),
248 trkFullconstrcoll = cms.InputTag('')
249 )
250
251 # ------------------------------------------------------------------------------
252 # E-4) Producer for TwoBodyDecay vertex constraints
253 # ------------------------------------------------------------------------------
254 process.load("RecoTracker.TrackProducer.TwoBodyDecayVertexConstraintProducer_cff")
255 process.TwoBodyDecayVertexConstraint.isMC = True
256 process.TwoBodyDecayVertexConstraint.src = "GeomRefitter"
257 process.TwoBodyDecayVertexConstraint.chi2Cut = 10
258
259 # ------------------------------------------------------------------------------
260 # E-5) Track refitter with vertex constraints
261 # ------------------------------------------------------------------------------
262 process.TrackRefitterTBDVertexConstraint = TrackRefitter.clone(
263 src = "GeomRefitter",
264 srcConstr = "TwoBodyDecayVertexConstraint",
265 Fitter = cms.string('TwoBodyDecayTrackFitter'),
266 constraint = "vertex",
267 TrajectoryInEvent = True)
268
269 # ------------------------------------------------------------------------------
270 # E-6) Fill Tree with vertex TBD constraint
271 # ------------------------------------------------------------------------------
272 process.treeTBDVertexConstraints = cms.EDAnalyzer('AlignmentTree',
273 trackLabel = cms.InputTag('TrackRefitterTBDVertexConstraint'),
274 tkTraj = cms.InputTag('TrackRefitterTBDVertexConstraint'),
275 labelTrajToTrack = cms.InputTag('TrackRefitterTBDVertexConstraint'),
276 siStripClusters = cms.InputTag('TrackRefitterTBDVertexConstraint'),
277 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
278 isLaserRun = cms.bool(False),
279 isMC = cms.bool(True),
280 algoName = cms.string("VtxTBD"),
281 trkVertexconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint'),
282 trkMomconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint'),
283 trkFullconstrcoll = cms.InputTag('TwoBodyDecayVertexConstraint')
284 )
285
286
287
288
289
290
291 process.p = cms.Path( process.AlignmentTrackSelector *
292 process.GeomRefitter *
293 process.TrackRefitterWithoutConstraint *
294 process.treeWithoutConstraints *
295 process.TwoBodyDecayConstraint *
296 process.TrackRefitterTBDFullConstraint *
297 process.treeTBDFullConstraints *
298 process.TwoBodyDecayMomConstraint *
299 process.TrackRefitterTBDMomConstraint *
300 process.treeTBDMomConstraints *
301 process.doConstraintKinFit *
302 process.TrackRefitterKinFit *
303 process.treeKinFitConstraints*
304 process.TwoBodyDecayVertexConstraint *
305 process.TrackRefitterTBDVertexConstraint *
306 process.treeTBDVertexConstraints)
307
308 process.outpath = cms.EndPath(process.out)
309
310
311