ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
(Generate patch)

Comparing UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py (file contents):
Revision 1.1 by econte, Fri Nov 25 16:32:45 2011 UTC vs.
Revision 1.7 by econte, Thu Dec 8 10:43:30 2011 UTC

# Line 1 | Line 1
1   import FWCore.ParameterSet.Config as cms
2  
3 < process = cms.Process("Demo")
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 < process.TFileService = cms.Service("TFileService", fileName = cms.string("analyzerTree.root") )
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" )
# Line 15 | Line 31 | process.load( "Configuration.StandardSeq
31   process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff" )
32   process.GlobalTag.globaltag = "START44_V7::All"
33  
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 # )
34  
35   process.source = cms.Source( "PoolSource",
36      fileNames = cms.untracked.vstring(
# Line 46 | Line 54 | process.out = cms.OutputModule( "PoolOut
54   # ------------------------------------------------------------------------------
55   # 0) Change geometry
56   # ------------------------------------------------------------------------------
57 < #from CondCore.DBCommon.CondDBSetup_cfi import *
58 < #process.trackerAlignment = cms.ESSource("PoolDBESSource",
59 < #                  CondDBSetup,
60 < #                  timetype = cms.string('runnumber'),
61 < #                  toGet = cms.VPSet( cms.PSet(
62 < #                     record = cms.string('TrackerAlignmentRcd'),
63 < #                     tag = cms.string('Alignments')   )),
64 < #                  connect =
65 < #cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedTwist.db')
66 < #cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedSagitta.db')
67 <
68 < #                                        )
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")
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   # ------------------------------------------------------------------------------
# Line 79 | Line 111 | process.AlignmentTrackSelector.TwoBodyDe
111   # 2) Constructs transient tracks and trajectories from persistent tracks
112   # ------------------------------------------------------------------------------
113   from RecoTracker.TrackProducer.TrackRefitter_cfi import TrackRefitter
114 < process.Refitter = TrackRefitter.clone(
114 > process.GeomRefitter = TrackRefitter.clone(
115      src = "AlignmentTrackSelector",
116      TrajectoryInEvent = True )
117  
# Line 99 | Line 131 | process.TwoBodyDecayTrackFitter = KFFitt
131   # A-4) Refitter tracks without constraint
132   # ------------------------------------------------------------------------------
133   process.TrackRefitterWithoutConstraint = TrackRefitter.clone(
134 <    src = "AlignmentTrackSelector",
134 >    src = "GeomRefitter",
135      Fitter = cms.string('TwoBodyDecayTrackFitter'))
136  
137   # ------------------------------------------------------------------------------
138   # A-5) Fill Tree with refit tracks (without constraint)
139   # ------------------------------------------------------------------------------
140 < process.treeproducer1 = cms.EDAnalyzer('AlignmentTree',
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")
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.chi2Cut = 100
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 = "AlignmentTrackSelector",
168 >    src = "GeomRefitter",
169      srcConstr = "TwoBodyDecayConstraint",
170      Fitter = cms.string('TwoBodyDecayTrackFitter'),
171      constraint = "trackParameters",
# Line 135 | Line 174 | process.TrackRefitterTBDFullConstraint =
174   # ------------------------------------------------------------------------------
175   # B-6) Fill Tree with full TBD constraint
176   # ------------------------------------------------------------------------------
177 < process.treeproducer2 = cms.EDAnalyzer('AlignmentTree',
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")
186 >    algoName         = cms.string("FullTBD"),
187 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayConstraint'),
188 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayConstraint'),
189 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayConstraint')
190   )
191  
192   # ------------------------------------------------------------------------------
# Line 151 | Line 194 | process.treeproducer2 = cms.EDAnalyzer('
194   # ------------------------------------------------------------------------------
195   process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
196   process.TwoBodyDecayMomConstraint.isMC = True
197 < #process.TwoBodyDecayMomConstraint.chi2Cut = 100
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 = "AlignmentTrackSelector",
204 >    src = "GeomRefitter",
205      srcConstr = "TwoBodyDecayMomConstraint",
206      Fitter = cms.string('TwoBodyDecayTrackFitter'),
207      constraint = "momentum",
# Line 166 | Line 210 | process.TrackRefitterTBDMomConstraint =
210   # ------------------------------------------------------------------------------
211   # C-6) Fill Tree with mom TBD constraint
212   # ------------------------------------------------------------------------------
213 < process.treeproducer3 = cms.EDAnalyzer('AlignmentTree',
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")
222 >    algoName         = cms.string("MomTBD"),
223 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayMomConstraint'),
224 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayMomConstraint'),
225 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayMomConstraint')
226   )
227  
228   # ------------------------------------------------------------------------------
# Line 182 | Line 230 | process.treeproducer3 = cms.EDAnalyzer('
230   # ------------------------------------------------------------------------------
231   process.doConstraintKinFit = cms.EDProducer('ZmassConstraintsProd',
232      isMC             = cms.bool(True),
233 <    trackLabel       = cms.InputTag('AlignmentTrackSelector')
233 >    trackLabel       = cms.InputTag('GeomRefitter')
234   )
235  
236   # ------------------------------------------------------------------------------
237   # D-5) Refitter for KinFit
238   # ------------------------------------------------------------------------------
239   process.TrackRefitterKinFit = TrackRefitter.clone(
240 <    src = "AlignmentTrackSelector",
240 >    src = "GeomRefitter",
241      srcConstr = "doConstraintKinFit",
242      Fitter = cms.string('TwoBodyDecayTrackFitter'),
243      constraint = "momentum",
# Line 198 | Line 246 | process.TrackRefitterKinFit = TrackRefit
246   # ------------------------------------------------------------------------------
247   # D-6) Fill Tree with KinFit constraint
248   # ------------------------------------------------------------------------------
249 < process.treeproducer4 = cms.EDAnalyzer('AlignmentTree',
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")
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 constraint
265 > # E-4) Producer for TwoBodyDecay vertex constraints
266   # ------------------------------------------------------------------------------
267   process.load("RecoTracker.TrackProducer.TwoBodyDecayVertexConstraintProducer_cff")
268   process.TwoBodyDecayVertexConstraint.isMC = True
269 < #process.TwoBodyDecayVertexConstraint.chi2Cut = 100
269 > process.TwoBodyDecayVertexConstraint.src = "GeomRefitter"
270 > process.TwoBodyDecayVertexConstraint.chi2Cut = 10
271  
272   # ------------------------------------------------------------------------------
273 < # E-5) Producer for TwoBodyDecay vertex constraint
273 > # E-5) Track refitter with vertex constraints
274   # ------------------------------------------------------------------------------
275   process.TrackRefitterTBDVertexConstraint = TrackRefitter.clone(
276 <    src = "AlignmentTrackSelector",
276 >    src = "GeomRefitter",
277      srcConstr = "TwoBodyDecayVertexConstraint",
278      Fitter = cms.string('TwoBodyDecayTrackFitter'),
279      constraint = "vertex",
# Line 229 | Line 282 | process.TrackRefitterTBDVertexConstraint
282   # ------------------------------------------------------------------------------
283   # E-6) Fill Tree with vertex TBD constraint
284   # ------------------------------------------------------------------------------
285 < process.treeproducer5 = cms.EDAnalyzer('AlignmentTree',
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")
294 >    algoName         = cms.string("VtxTBD"),
295 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayVertexConstraint'),
296 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayVertexConstraint'),
297 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayVertexConstraint')
298   )
299  
300  
# Line 246 | Line 303 | process.treeproducer5 = cms.EDAnalyzer('
303  
304  
305   process.p = cms.Path( process.AlignmentTrackSelector *
306 <                      process.Refitter *
306 >                      process.GeomRefitter *
307                        process.TrackRefitterWithoutConstraint *
308 <                      process.treeproducer1 *
308 >                      process.treeWithoutConstraints *
309                        process.TwoBodyDecayConstraint *
310                        process.TrackRefitterTBDFullConstraint *
311 <                      process.treeproducer2 *
311 >                      process.treeTBDFullConstraints *
312                        process.TwoBodyDecayMomConstraint *
313                        process.TrackRefitterTBDMomConstraint *
314 <                      process.treeproducer3 *
314 >                      process.treeTBDMomConstraints *
315                        process.doConstraintKinFit *
316                        process.TrackRefitterKinFit *
317 <                      process.treeproducer4*
317 >                      process.treeKinFitConstraints*
318                        process.TwoBodyDecayVertexConstraint *
319                        process.TrackRefitterTBDVertexConstraint *
320 <                      process.treeproducer5)
320 >                      process.treeTBDVertexConstraints
321 >                      )
322  
323   process.outpath = cms.EndPath(process.out)
324 +
325 +
326 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines