ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
Revision: 1.3
Committed: Wed Nov 30 18:17:10 2011 UTC (13 years, 5 months ago) by econte
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +44 -21 lines
Log Message:
scenarii alignments

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 )
141
142 # ------------------------------------------------------------------------------
143 # B-4) Producer for full TwoBodyDecay constraint
144 # ------------------------------------------------------------------------------
145 process.load("RecoTracker.TrackProducer.TwoBodyDecayConstraintProducer_cff")
146 process.TwoBodyDecayConstraint.src = "GeomRefitter"
147 process.TwoBodyDecayConstraint.chi2Cut = 10
148
149
150
151 # ------------------------------------------------------------------------------
152 # B-5) Refitter using the full TwoBodyDecay constraint
153 # ------------------------------------------------------------------------------
154 process.TrackRefitterTBDFullConstraint = TrackRefitter.clone(
155 src = "GeomRefitter",
156 srcConstr = "TwoBodyDecayConstraint",
157 Fitter = cms.string('TwoBodyDecayTrackFitter'),
158 constraint = "trackParameters",
159 TrajectoryInEvent = True)
160
161 # ------------------------------------------------------------------------------
162 # B-6) Fill Tree with full TBD constraint
163 # ------------------------------------------------------------------------------
164 process.treeTBDFullConstraints = cms.EDAnalyzer('AlignmentTree',
165 trackLabel = cms.InputTag('TrackRefitterTBDFullConstraint'),
166 tkTraj = cms.InputTag('TrackRefitterTBDFullConstraint'),
167 labelTrajToTrack = cms.InputTag('TrackRefitterTBDFullConstraint'),
168 siStripClusters = cms.InputTag('TrackRefitterTBDFullConstraint'),
169 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
170 isLaserRun = cms.bool(False),
171 isMC = cms.bool(True),
172 algoName = cms.string("FullTBD")
173 )
174
175 # ------------------------------------------------------------------------------
176 # C-4) Producer for TwoBodyDecay momentum constraint
177 # ------------------------------------------------------------------------------
178 process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
179 process.TwoBodyDecayMomConstraint.isMC = True
180 process.TwoBodyDecayMomConstraint.src = "GeomRefitter"
181 process.TwoBodyDecayMomConstraint.chi2Cut = 10
182
183 # ------------------------------------------------------------------------------
184 # C-5) Refit the tracks with momentum constraint
185 # ------------------------------------------------------------------------------
186 process.TrackRefitterTBDMomConstraint = TrackRefitter.clone(
187 src = "GeomRefitter",
188 srcConstr = "TwoBodyDecayMomConstraint",
189 Fitter = cms.string('TwoBodyDecayTrackFitter'),
190 constraint = "momentum",
191 TrajectoryInEvent = True)
192
193 # ------------------------------------------------------------------------------
194 # C-6) Fill Tree with mom TBD constraint
195 # ------------------------------------------------------------------------------
196 process.treeTBDMomConstraints = cms.EDAnalyzer('AlignmentTree',
197 trackLabel = cms.InputTag('TrackRefitterTBDMomConstraint'),
198 tkTraj = cms.InputTag('TrackRefitterTBDMomConstraint'),
199 labelTrajToTrack = cms.InputTag('TrackRefitterTBDMomConstraint'),
200 siStripClusters = cms.InputTag('TrackRefitterTBDMomConstraint'),
201 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
202 isLaserRun = cms.bool(False),
203 isMC = cms.bool(True),
204 algoName = cms.string("MomTBD")
205 )
206
207 # ------------------------------------------------------------------------------
208 # D-4) Producer for KinFit
209 # ------------------------------------------------------------------------------
210 process.doConstraintKinFit = cms.EDProducer('ZmassConstraintsProd',
211 isMC = cms.bool(True),
212 trackLabel = cms.InputTag('GeomRefitter')
213 )
214
215 # ------------------------------------------------------------------------------
216 # D-5) Refitter for KinFit
217 # ------------------------------------------------------------------------------
218 process.TrackRefitterKinFit = TrackRefitter.clone(
219 src = "GeomRefitter",
220 srcConstr = "doConstraintKinFit",
221 Fitter = cms.string('TwoBodyDecayTrackFitter'),
222 constraint = "momentum",
223 TrajectoryInEvent = True)
224
225 # ------------------------------------------------------------------------------
226 # D-6) Fill Tree with KinFit constraint
227 # ------------------------------------------------------------------------------
228 process.treeKinFitConstraints = cms.EDAnalyzer('AlignmentTree',
229 trackLabel = cms.InputTag('TrackRefitterKinFit'),
230 tkTraj = cms.InputTag('TrackRefitterKinFit'),
231 labelTrajToTrack = cms.InputTag('TrackRefitterKinFit'),
232 siStripClusters = cms.InputTag('TrackRefitterKinFit'),
233 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
234 isLaserRun = cms.bool(False),
235 isMC = cms.bool(True),
236 algoName = cms.string("KinFit")
237 )
238
239 # ------------------------------------------------------------------------------
240 # E-4) Producer for TwoBodyDecay vertex constraints
241 # ------------------------------------------------------------------------------
242 process.load("RecoTracker.TrackProducer.TwoBodyDecayVertexConstraintProducer_cff")
243 process.TwoBodyDecayVertexConstraint.isMC = True
244 process.TwoBodyDecayVertexConstraint.src = "GeomRefitter"
245 process.TwoBodyDecayVertexConstraint.chi2Cut = 10
246
247 # ------------------------------------------------------------------------------
248 # E-5) Track refitter with vertex constraints
249 # ------------------------------------------------------------------------------
250 process.TrackRefitterTBDVertexConstraint = TrackRefitter.clone(
251 src = "GeomRefitter",
252 srcConstr = "TwoBodyDecayVertexConstraint",
253 Fitter = cms.string('TwoBodyDecayTrackFitter'),
254 constraint = "vertex",
255 TrajectoryInEvent = True)
256
257 # ------------------------------------------------------------------------------
258 # E-6) Fill Tree with vertex TBD constraint
259 # ------------------------------------------------------------------------------
260 process.treeTBDVertexConstraints = cms.EDAnalyzer('AlignmentTree',
261 trackLabel = cms.InputTag('TrackRefitterTBDVertexConstraint'),
262 tkTraj = cms.InputTag('TrackRefitterTBDVertexConstraint'),
263 labelTrajToTrack = cms.InputTag('TrackRefitterTBDVertexConstraint'),
264 siStripClusters = cms.InputTag('TrackRefitterTBDVertexConstraint'),
265 primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
266 isLaserRun = cms.bool(False),
267 isMC = cms.bool(True),
268 algoName = cms.string("VtxTBD")
269 )
270
271
272
273
274
275
276 process.p = cms.Path( process.AlignmentTrackSelector *
277 process.GeomRefitter *
278 process.TrackRefitterWithoutConstraint *
279 process.treeWithoutConstraints *
280 process.TwoBodyDecayConstraint *
281 process.TrackRefitterTBDFullConstraint *
282 process.treeTBDFullConstraints *
283 process.TwoBodyDecayMomConstraint *
284 process.TrackRefitterTBDMomConstraint *
285 process.treeTBDMomConstraints *
286 process.doConstraintKinFit *
287 process.TrackRefitterKinFit *
288 process.treeKinFitConstraints*
289 process.TwoBodyDecayVertexConstraint *
290 process.TrackRefitterTBDVertexConstraint *
291 process.treeTBDVertexConstraints)
292
293 process.outpath = cms.EndPath(process.out)