ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
Revision: 1.1
Committed: Fri Nov 25 16:32:45 2011 UTC (13 years, 5 months ago) by econte
Content type: text/x-python
Branch: MAIN
Log Message:
new IPHC alignment

File Contents

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